1 /* Generated by Cython 0.29.24 */
2 
3 /* BEGIN: Cython Metadata
4 {
5     "distutils": {
6         "define_macros": [
7             [
8                 "CYTHON_CLINE_IN_TRACEBACK",
9                 0
10             ]
11         ],
12         "depends": [
13             "/usr/include/luajit-2.1/lauxlib.h",
14             "/usr/include/luajit-2.1/lua.h",
15             "/usr/include/luajit-2.1/lualib.h"
16         ],
17         "extra_objects": [
18             "-lluajit-5.1"
19         ],
20         "include_dirs": [
21             "/usr/include/luajit-2.1"
22         ],
23         "name": "lupa._lupa",
24         "sources": [
25             "/home/stefan/source/Python/lua/lupa-release/lupa/_lupa.pyx"
26         ]
27     },
28     "module_name": "lupa._lupa"
29 }
30 END: Cython Metadata */
31 
32 #ifndef PY_SSIZE_T_CLEAN
33 #define PY_SSIZE_T_CLEAN
34 #endif /* PY_SSIZE_T_CLEAN */
35 #include "Python.h"
36 #ifndef Py_PYTHON_H
37     #error Python headers needed to compile C extensions, please install development version of Python.
38 #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
39     #error Cython requires Python 2.6+ or Python 3.3+.
40 #else
41 #define CYTHON_ABI "0_29_24"
42 #define CYTHON_HEX_VERSION 0x001D18F0
43 #define CYTHON_FUTURE_DIVISION 1
44 #include <stddef.h>
45 #ifndef offsetof
46   #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
47 #endif
48 #if !defined(WIN32) && !defined(MS_WINDOWS)
49   #ifndef __stdcall
50     #define __stdcall
51   #endif
52   #ifndef __cdecl
53     #define __cdecl
54   #endif
55   #ifndef __fastcall
56     #define __fastcall
57   #endif
58 #endif
59 #ifndef DL_IMPORT
60   #define DL_IMPORT(t) t
61 #endif
62 #ifndef DL_EXPORT
63   #define DL_EXPORT(t) t
64 #endif
65 #define __PYX_COMMA ,
66 #ifndef HAVE_LONG_LONG
67   #if PY_VERSION_HEX >= 0x02070000
68     #define HAVE_LONG_LONG
69   #endif
70 #endif
71 #ifndef PY_LONG_LONG
72   #define PY_LONG_LONG LONG_LONG
73 #endif
74 #ifndef Py_HUGE_VAL
75   #define Py_HUGE_VAL HUGE_VAL
76 #endif
77 #ifdef PYPY_VERSION
78   #define CYTHON_COMPILING_IN_PYPY 1
79   #define CYTHON_COMPILING_IN_PYSTON 0
80   #define CYTHON_COMPILING_IN_CPYTHON 0
81   #undef CYTHON_USE_TYPE_SLOTS
82   #define CYTHON_USE_TYPE_SLOTS 0
83   #undef CYTHON_USE_PYTYPE_LOOKUP
84   #define CYTHON_USE_PYTYPE_LOOKUP 0
85   #if PY_VERSION_HEX < 0x03050000
86     #undef CYTHON_USE_ASYNC_SLOTS
87     #define CYTHON_USE_ASYNC_SLOTS 0
88   #elif !defined(CYTHON_USE_ASYNC_SLOTS)
89     #define CYTHON_USE_ASYNC_SLOTS 1
90   #endif
91   #undef CYTHON_USE_PYLIST_INTERNALS
92   #define CYTHON_USE_PYLIST_INTERNALS 0
93   #undef CYTHON_USE_UNICODE_INTERNALS
94   #define CYTHON_USE_UNICODE_INTERNALS 0
95   #undef CYTHON_USE_UNICODE_WRITER
96   #define CYTHON_USE_UNICODE_WRITER 0
97   #undef CYTHON_USE_PYLONG_INTERNALS
98   #define CYTHON_USE_PYLONG_INTERNALS 0
99   #undef CYTHON_AVOID_BORROWED_REFS
100   #define CYTHON_AVOID_BORROWED_REFS 1
101   #undef CYTHON_ASSUME_SAFE_MACROS
102   #define CYTHON_ASSUME_SAFE_MACROS 0
103   #undef CYTHON_UNPACK_METHODS
104   #define CYTHON_UNPACK_METHODS 0
105   #undef CYTHON_FAST_THREAD_STATE
106   #define CYTHON_FAST_THREAD_STATE 0
107   #undef CYTHON_FAST_PYCALL
108   #define CYTHON_FAST_PYCALL 0
109   #undef CYTHON_PEP489_MULTI_PHASE_INIT
110   #define CYTHON_PEP489_MULTI_PHASE_INIT 0
111   #undef CYTHON_USE_TP_FINALIZE
112   #define CYTHON_USE_TP_FINALIZE 0
113   #undef CYTHON_USE_DICT_VERSIONS
114   #define CYTHON_USE_DICT_VERSIONS 0
115   #undef CYTHON_USE_EXC_INFO_STACK
116   #define CYTHON_USE_EXC_INFO_STACK 0
117 #elif defined(PYSTON_VERSION)
118   #define CYTHON_COMPILING_IN_PYPY 0
119   #define CYTHON_COMPILING_IN_PYSTON 1
120   #define CYTHON_COMPILING_IN_CPYTHON 0
121   #ifndef CYTHON_USE_TYPE_SLOTS
122     #define CYTHON_USE_TYPE_SLOTS 1
123   #endif
124   #undef CYTHON_USE_PYTYPE_LOOKUP
125   #define CYTHON_USE_PYTYPE_LOOKUP 0
126   #undef CYTHON_USE_ASYNC_SLOTS
127   #define CYTHON_USE_ASYNC_SLOTS 0
128   #undef CYTHON_USE_PYLIST_INTERNALS
129   #define CYTHON_USE_PYLIST_INTERNALS 0
130   #ifndef CYTHON_USE_UNICODE_INTERNALS
131     #define CYTHON_USE_UNICODE_INTERNALS 1
132   #endif
133   #undef CYTHON_USE_UNICODE_WRITER
134   #define CYTHON_USE_UNICODE_WRITER 0
135   #undef CYTHON_USE_PYLONG_INTERNALS
136   #define CYTHON_USE_PYLONG_INTERNALS 0
137   #ifndef CYTHON_AVOID_BORROWED_REFS
138     #define CYTHON_AVOID_BORROWED_REFS 0
139   #endif
140   #ifndef CYTHON_ASSUME_SAFE_MACROS
141     #define CYTHON_ASSUME_SAFE_MACROS 1
142   #endif
143   #ifndef CYTHON_UNPACK_METHODS
144     #define CYTHON_UNPACK_METHODS 1
145   #endif
146   #undef CYTHON_FAST_THREAD_STATE
147   #define CYTHON_FAST_THREAD_STATE 0
148   #undef CYTHON_FAST_PYCALL
149   #define CYTHON_FAST_PYCALL 0
150   #undef CYTHON_PEP489_MULTI_PHASE_INIT
151   #define CYTHON_PEP489_MULTI_PHASE_INIT 0
152   #undef CYTHON_USE_TP_FINALIZE
153   #define CYTHON_USE_TP_FINALIZE 0
154   #undef CYTHON_USE_DICT_VERSIONS
155   #define CYTHON_USE_DICT_VERSIONS 0
156   #undef CYTHON_USE_EXC_INFO_STACK
157   #define CYTHON_USE_EXC_INFO_STACK 0
158 #else
159   #define CYTHON_COMPILING_IN_PYPY 0
160   #define CYTHON_COMPILING_IN_PYSTON 0
161   #define CYTHON_COMPILING_IN_CPYTHON 1
162   #ifndef CYTHON_USE_TYPE_SLOTS
163     #define CYTHON_USE_TYPE_SLOTS 1
164   #endif
165   #if PY_VERSION_HEX < 0x02070000
166     #undef CYTHON_USE_PYTYPE_LOOKUP
167     #define CYTHON_USE_PYTYPE_LOOKUP 0
168   #elif !defined(CYTHON_USE_PYTYPE_LOOKUP)
169     #define CYTHON_USE_PYTYPE_LOOKUP 1
170   #endif
171   #if PY_MAJOR_VERSION < 3
172     #undef CYTHON_USE_ASYNC_SLOTS
173     #define CYTHON_USE_ASYNC_SLOTS 0
174   #elif !defined(CYTHON_USE_ASYNC_SLOTS)
175     #define CYTHON_USE_ASYNC_SLOTS 1
176   #endif
177   #if PY_VERSION_HEX < 0x02070000
178     #undef CYTHON_USE_PYLONG_INTERNALS
179     #define CYTHON_USE_PYLONG_INTERNALS 0
180   #elif !defined(CYTHON_USE_PYLONG_INTERNALS)
181     #define CYTHON_USE_PYLONG_INTERNALS 1
182   #endif
183   #ifndef CYTHON_USE_PYLIST_INTERNALS
184     #define CYTHON_USE_PYLIST_INTERNALS 1
185   #endif
186   #ifndef CYTHON_USE_UNICODE_INTERNALS
187     #define CYTHON_USE_UNICODE_INTERNALS 1
188   #endif
189   #if PY_VERSION_HEX < 0x030300F0
190     #undef CYTHON_USE_UNICODE_WRITER
191     #define CYTHON_USE_UNICODE_WRITER 0
192   #elif !defined(CYTHON_USE_UNICODE_WRITER)
193     #define CYTHON_USE_UNICODE_WRITER 1
194   #endif
195   #ifndef CYTHON_AVOID_BORROWED_REFS
196     #define CYTHON_AVOID_BORROWED_REFS 0
197   #endif
198   #ifndef CYTHON_ASSUME_SAFE_MACROS
199     #define CYTHON_ASSUME_SAFE_MACROS 1
200   #endif
201   #ifndef CYTHON_UNPACK_METHODS
202     #define CYTHON_UNPACK_METHODS 1
203   #endif
204   #ifndef CYTHON_FAST_THREAD_STATE
205     #define CYTHON_FAST_THREAD_STATE 1
206   #endif
207   #ifndef CYTHON_FAST_PYCALL
208     #define CYTHON_FAST_PYCALL 1
209   #endif
210   #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
211     #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000)
212   #endif
213   #ifndef CYTHON_USE_TP_FINALIZE
214     #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
215   #endif
216   #ifndef CYTHON_USE_DICT_VERSIONS
217     #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1)
218   #endif
219   #ifndef CYTHON_USE_EXC_INFO_STACK
220     #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3)
221   #endif
222 #endif
223 #if !defined(CYTHON_FAST_PYCCALL)
224 #define CYTHON_FAST_PYCCALL  (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
225 #endif
226 #if CYTHON_USE_PYLONG_INTERNALS
227   #include "longintrepr.h"
228   #undef SHIFT
229   #undef BASE
230   #undef MASK
231   #ifdef SIZEOF_VOID_P
232     enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
233   #endif
234 #endif
235 #ifndef __has_attribute
236   #define __has_attribute(x) 0
237 #endif
238 #ifndef __has_cpp_attribute
239   #define __has_cpp_attribute(x) 0
240 #endif
241 #ifndef CYTHON_RESTRICT
242   #if defined(__GNUC__)
243     #define CYTHON_RESTRICT __restrict__
244   #elif defined(_MSC_VER) && _MSC_VER >= 1400
245     #define CYTHON_RESTRICT __restrict
246   #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
247     #define CYTHON_RESTRICT restrict
248   #else
249     #define CYTHON_RESTRICT
250   #endif
251 #endif
252 #ifndef CYTHON_UNUSED
253 # if defined(__GNUC__)
254 #   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
255 #     define CYTHON_UNUSED __attribute__ ((__unused__))
256 #   else
257 #     define CYTHON_UNUSED
258 #   endif
259 # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
260 #   define CYTHON_UNUSED __attribute__ ((__unused__))
261 # else
262 #   define CYTHON_UNUSED
263 # endif
264 #endif
265 #ifndef CYTHON_MAYBE_UNUSED_VAR
266 #  if defined(__cplusplus)
CYTHON_MAYBE_UNUSED_VAR(const T &)267      template<class T> void CYTHON_MAYBE_UNUSED_VAR( const T& ) { }
268 #  else
269 #    define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
270 #  endif
271 #endif
272 #ifndef CYTHON_NCP_UNUSED
273 # if CYTHON_COMPILING_IN_CPYTHON
274 #  define CYTHON_NCP_UNUSED
275 # else
276 #  define CYTHON_NCP_UNUSED CYTHON_UNUSED
277 # endif
278 #endif
279 #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
280 #ifdef _MSC_VER
281     #ifndef _MSC_STDINT_H_
282         #if _MSC_VER < 1300
283            typedef unsigned char     uint8_t;
284            typedef unsigned int      uint32_t;
285         #else
286            typedef unsigned __int8   uint8_t;
287            typedef unsigned __int32  uint32_t;
288         #endif
289     #endif
290 #else
291    #include <stdint.h>
292 #endif
293 #ifndef CYTHON_FALLTHROUGH
294   #if defined(__cplusplus) && __cplusplus >= 201103L
295     #if __has_cpp_attribute(fallthrough)
296       #define CYTHON_FALLTHROUGH [[fallthrough]]
297     #elif __has_cpp_attribute(clang::fallthrough)
298       #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
299     #elif __has_cpp_attribute(gnu::fallthrough)
300       #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
301     #endif
302   #endif
303   #ifndef CYTHON_FALLTHROUGH
304     #if __has_attribute(fallthrough)
305       #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
306     #else
307       #define CYTHON_FALLTHROUGH
308     #endif
309   #endif
310   #if defined(__clang__ ) && defined(__apple_build_version__)
311     #if __apple_build_version__ < 7000000
312       #undef  CYTHON_FALLTHROUGH
313       #define CYTHON_FALLTHROUGH
314     #endif
315   #endif
316 #endif
317 
318 #ifndef CYTHON_INLINE
319   #if defined(__clang__)
320     #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
321   #elif defined(__GNUC__)
322     #define CYTHON_INLINE __inline__
323   #elif defined(_MSC_VER)
324     #define CYTHON_INLINE __inline
325   #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
326     #define CYTHON_INLINE inline
327   #else
328     #define CYTHON_INLINE
329   #endif
330 #endif
331 
332 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
333   #define Py_OptimizeFlag 0
334 #endif
335 #define __PYX_BUILD_PY_SSIZE_T "n"
336 #define CYTHON_FORMAT_SSIZE_T "z"
337 #if PY_MAJOR_VERSION < 3
338   #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
339   #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
340           PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
341   #define __Pyx_DefaultClassType PyClass_Type
342 #else
343   #define __Pyx_BUILTIN_MODULE_NAME "builtins"
344 #if PY_VERSION_HEX >= 0x030800A4 && PY_VERSION_HEX < 0x030800B2
345   #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
346           PyCode_New(a, 0, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
347 #else
348   #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
349           PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
350 #endif
351   #define __Pyx_DefaultClassType PyType_Type
352 #endif
353 #ifndef Py_TPFLAGS_CHECKTYPES
354   #define Py_TPFLAGS_CHECKTYPES 0
355 #endif
356 #ifndef Py_TPFLAGS_HAVE_INDEX
357   #define Py_TPFLAGS_HAVE_INDEX 0
358 #endif
359 #ifndef Py_TPFLAGS_HAVE_NEWBUFFER
360   #define Py_TPFLAGS_HAVE_NEWBUFFER 0
361 #endif
362 #ifndef Py_TPFLAGS_HAVE_FINALIZE
363   #define Py_TPFLAGS_HAVE_FINALIZE 0
364 #endif
365 #ifndef METH_STACKLESS
366   #define METH_STACKLESS 0
367 #endif
368 #if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
369   #ifndef METH_FASTCALL
370      #define METH_FASTCALL 0x80
371   #endif
372   typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
373   typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
374                                                           Py_ssize_t nargs, PyObject *kwnames);
375 #else
376   #define __Pyx_PyCFunctionFast _PyCFunctionFast
377   #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
378 #endif
379 #if CYTHON_FAST_PYCCALL
380 #define __Pyx_PyFastCFunction_Check(func)\
381     ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)))))
382 #else
383 #define __Pyx_PyFastCFunction_Check(func) 0
384 #endif
385 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
386   #define PyObject_Malloc(s)   PyMem_Malloc(s)
387   #define PyObject_Free(p)     PyMem_Free(p)
388   #define PyObject_Realloc(p)  PyMem_Realloc(p)
389 #endif
390 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1
391   #define PyMem_RawMalloc(n)           PyMem_Malloc(n)
392   #define PyMem_RawRealloc(p, n)       PyMem_Realloc(p, n)
393   #define PyMem_RawFree(p)             PyMem_Free(p)
394 #endif
395 #if CYTHON_COMPILING_IN_PYSTON
396   #define __Pyx_PyCode_HasFreeVars(co)  PyCode_HasFreeVars(co)
397   #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
398 #else
399   #define __Pyx_PyCode_HasFreeVars(co)  (PyCode_GetNumFree(co) > 0)
400   #define __Pyx_PyFrame_SetLineNumber(frame, lineno)  (frame)->f_lineno = (lineno)
401 #endif
402 #if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000
403   #define __Pyx_PyThreadState_Current PyThreadState_GET()
404 #elif PY_VERSION_HEX >= 0x03060000
405   #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
406 #elif PY_VERSION_HEX >= 0x03000000
407   #define __Pyx_PyThreadState_Current PyThreadState_GET()
408 #else
409   #define __Pyx_PyThreadState_Current _PyThreadState_Current
410 #endif
411 #if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
412 #include "pythread.h"
413 #define Py_tss_NEEDS_INIT 0
414 typedef int Py_tss_t;
PyThread_tss_create(Py_tss_t * key)415 static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) {
416   *key = PyThread_create_key();
417   return 0;
418 }
PyThread_tss_alloc(void)419 static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) {
420   Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t));
421   *key = Py_tss_NEEDS_INIT;
422   return key;
423 }
PyThread_tss_free(Py_tss_t * key)424 static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) {
425   PyObject_Free(key);
426 }
PyThread_tss_is_created(Py_tss_t * key)427 static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) {
428   return *key != Py_tss_NEEDS_INIT;
429 }
PyThread_tss_delete(Py_tss_t * key)430 static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) {
431   PyThread_delete_key(*key);
432   *key = Py_tss_NEEDS_INIT;
433 }
PyThread_tss_set(Py_tss_t * key,void * value)434 static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) {
435   return PyThread_set_key_value(*key, value);
436 }
PyThread_tss_get(Py_tss_t * key)437 static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
438   return PyThread_get_key_value(*key);
439 }
440 #endif
441 #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
442 #define __Pyx_PyDict_NewPresized(n)  ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
443 #else
444 #define __Pyx_PyDict_NewPresized(n)  PyDict_New()
445 #endif
446 #if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
447   #define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
448   #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
449 #else
450   #define __Pyx_PyNumber_Divide(x,y)         PyNumber_Divide(x,y)
451   #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceDivide(x,y)
452 #endif
453 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS
454 #define __Pyx_PyDict_GetItemStr(dict, name)  _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
455 #else
456 #define __Pyx_PyDict_GetItemStr(dict, name)  PyDict_GetItem(dict, name)
457 #endif
458 #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
459   #define CYTHON_PEP393_ENABLED 1
460   #if defined(PyUnicode_IS_READY)
461   #define __Pyx_PyUnicode_READY(op)       (likely(PyUnicode_IS_READY(op)) ?\
462                                               0 : _PyUnicode_Ready((PyObject *)(op)))
463   #else
464   #define __Pyx_PyUnicode_READY(op)       (0)
465   #endif
466   #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_LENGTH(u)
467   #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
468   #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   PyUnicode_MAX_CHAR_VALUE(u)
469   #define __Pyx_PyUnicode_KIND(u)         PyUnicode_KIND(u)
470   #define __Pyx_PyUnicode_DATA(u)         PyUnicode_DATA(u)
471   #define __Pyx_PyUnicode_READ(k, d, i)   PyUnicode_READ(k, d, i)
472   #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  PyUnicode_WRITE(k, d, i, ch)
473   #if defined(PyUnicode_IS_READY) && defined(PyUnicode_GET_SIZE)
474   #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000
475   #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length))
476   #else
477   #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
478   #endif
479   #else
480   #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != PyUnicode_GET_LENGTH(u))
481   #endif
482 #else
483   #define CYTHON_PEP393_ENABLED 0
484   #define PyUnicode_1BYTE_KIND  1
485   #define PyUnicode_2BYTE_KIND  2
486   #define PyUnicode_4BYTE_KIND  4
487   #define __Pyx_PyUnicode_READY(op)       (0)
488   #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_SIZE(u)
489   #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
490   #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
491   #define __Pyx_PyUnicode_KIND(u)         (sizeof(Py_UNICODE))
492   #define __Pyx_PyUnicode_DATA(u)         ((void*)PyUnicode_AS_UNICODE(u))
493   #define __Pyx_PyUnicode_READ(k, d, i)   ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
494   #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
495   #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != PyUnicode_GET_SIZE(u))
496 #endif
497 #if CYTHON_COMPILING_IN_PYPY
498   #define __Pyx_PyUnicode_Concat(a, b)      PyNumber_Add(a, b)
499   #define __Pyx_PyUnicode_ConcatSafe(a, b)  PyNumber_Add(a, b)
500 #else
501   #define __Pyx_PyUnicode_Concat(a, b)      PyUnicode_Concat(a, b)
502   #define __Pyx_PyUnicode_ConcatSafe(a, b)  ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
503       PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
504 #endif
505 #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
506   #define PyUnicode_Contains(u, s)  PySequence_Contains(u, s)
507 #endif
508 #if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
509   #define PyByteArray_Check(obj)  PyObject_TypeCheck(obj, &PyByteArray_Type)
510 #endif
511 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
512   #define PyObject_Format(obj, fmt)  PyObject_CallMethod(obj, "__format__", "O", fmt)
513 #endif
514 #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))
515 #define __Pyx_PyUnicode_FormatSafe(a, b)  ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
516 #if PY_MAJOR_VERSION >= 3
517   #define __Pyx_PyString_Format(a, b)  PyUnicode_Format(a, b)
518 #else
519   #define __Pyx_PyString_Format(a, b)  PyString_Format(a, b)
520 #endif
521 #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
522   #define PyObject_ASCII(o)            PyObject_Repr(o)
523 #endif
524 #if PY_MAJOR_VERSION >= 3
525   #define PyBaseString_Type            PyUnicode_Type
526   #define PyStringObject               PyUnicodeObject
527   #define PyString_Type                PyUnicode_Type
528   #define PyString_Check               PyUnicode_Check
529   #define PyString_CheckExact          PyUnicode_CheckExact
530 #ifndef PyObject_Unicode
531   #define PyObject_Unicode             PyObject_Str
532 #endif
533 #endif
534 #if PY_MAJOR_VERSION >= 3
535   #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
536   #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
537 #else
538   #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
539   #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
540 #endif
541 #ifndef PySet_CheckExact
542   #define PySet_CheckExact(obj)        (Py_TYPE(obj) == &PySet_Type)
543 #endif
544 #if PY_VERSION_HEX >= 0x030900A4
545   #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt)
546   #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size)
547 #else
548   #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt)
549   #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size)
550 #endif
551 #if CYTHON_ASSUME_SAFE_MACROS
552   #define __Pyx_PySequence_SIZE(seq)  Py_SIZE(seq)
553 #else
554   #define __Pyx_PySequence_SIZE(seq)  PySequence_Size(seq)
555 #endif
556 #if PY_MAJOR_VERSION >= 3
557   #define PyIntObject                  PyLongObject
558   #define PyInt_Type                   PyLong_Type
559   #define PyInt_Check(op)              PyLong_Check(op)
560   #define PyInt_CheckExact(op)         PyLong_CheckExact(op)
561   #define PyInt_FromString             PyLong_FromString
562   #define PyInt_FromUnicode            PyLong_FromUnicode
563   #define PyInt_FromLong               PyLong_FromLong
564   #define PyInt_FromSize_t             PyLong_FromSize_t
565   #define PyInt_FromSsize_t            PyLong_FromSsize_t
566   #define PyInt_AsLong                 PyLong_AsLong
567   #define PyInt_AS_LONG                PyLong_AS_LONG
568   #define PyInt_AsSsize_t              PyLong_AsSsize_t
569   #define PyInt_AsUnsignedLongMask     PyLong_AsUnsignedLongMask
570   #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
571   #define PyNumber_Int                 PyNumber_Long
572 #endif
573 #if PY_MAJOR_VERSION >= 3
574   #define PyBoolObject                 PyLongObject
575 #endif
576 #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
577   #ifndef PyUnicode_InternFromString
578     #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
579   #endif
580 #endif
581 #if PY_VERSION_HEX < 0x030200A4
582   typedef long Py_hash_t;
583   #define __Pyx_PyInt_FromHash_t PyInt_FromLong
584   #define __Pyx_PyInt_AsHash_t   PyInt_AsLong
585 #else
586   #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
587   #define __Pyx_PyInt_AsHash_t   PyInt_AsSsize_t
588 #endif
589 #if PY_MAJOR_VERSION >= 3
590   #define __Pyx_PyMethod_New(func, self, klass) ((self) ? ((void)(klass), PyMethod_New(func, self)) : __Pyx_NewRef(func))
591 #else
592   #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
593 #endif
594 #if CYTHON_USE_ASYNC_SLOTS
595   #if PY_VERSION_HEX >= 0x030500B1
596     #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
597     #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
598   #else
599     #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
600   #endif
601 #else
602   #define __Pyx_PyType_AsAsync(obj) NULL
603 #endif
604 #ifndef __Pyx_PyAsyncMethodsStruct
605     typedef struct {
606         unaryfunc am_await;
607         unaryfunc am_aiter;
608         unaryfunc am_anext;
609     } __Pyx_PyAsyncMethodsStruct;
610 #endif
611 
612 #if defined(WIN32) || defined(MS_WINDOWS)
613   #define _USE_MATH_DEFINES
614 #endif
615 #include <math.h>
616 #ifdef NAN
617 #define __PYX_NAN() ((float) NAN)
618 #else
__PYX_NAN()619 static CYTHON_INLINE float __PYX_NAN() {
620   float value;
621   memset(&value, 0xFF, sizeof(value));
622   return value;
623 }
624 #endif
625 #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
626 #define __Pyx_truncl trunc
627 #else
628 #define __Pyx_truncl truncl
629 #endif
630 
631 #define __PYX_MARK_ERR_POS(f_index, lineno) \
632     { __pyx_filename = __pyx_f[f_index]; (void)__pyx_filename; __pyx_lineno = lineno; (void)__pyx_lineno; __pyx_clineno = __LINE__; (void)__pyx_clineno; }
633 #define __PYX_ERR(f_index, lineno, Ln_error) \
634     { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; }
635 
636 #ifndef __PYX_EXTERN_C
637   #ifdef __cplusplus
638     #define __PYX_EXTERN_C extern "C"
639   #else
640     #define __PYX_EXTERN_C extern
641   #endif
642 #endif
643 
644 #define __PYX_HAVE__lupa___lupa
645 #define __PYX_HAVE_API__lupa___lupa
646 /* Early includes */
647 #include <string.h>
648 #include "lua.h"
649 #include "lauxlib.h"
650 #include "lualib.h"
651 
652     #if LUA_VERSION_NUM >= 504
653     #define __lupa_lua_resume lua_resume
654     #else
__lupa_lua_resume(lua_State * L,lua_State * from,int nargs,int * nresults)655     LUA_API int __lupa_lua_resume (lua_State *L, lua_State *from, int nargs, int* nresults) {
656     #if LUA_VERSION_NUM >= 502
657         int status = lua_resume(L, from, nargs);
658     #else
659         int status = lua_resume(L, nargs);
660     #endif
661         *nresults = lua_gettop(L);
662         return status;
663     }
664     #endif
665 
666     #if LUA_VERSION_NUM >= 502
667     #define lua_objlen(L, i) lua_rawlen(L, (i))
668     #endif
669 
670     #if LUA_VERSION_NUM >= 504
671     #define read_lua_version(L)  ((int) lua_version(L))
672     #elif LUA_VERSION_NUM >= 502
673     #define read_lua_version(L)  ((int) *lua_version(L))
674     #elif LUA_VERSION_NUM >= 501
675     #define read_lua_version(L)  ((int) LUA_VERSION_NUM)
676     #else
677     #error Lupa requires at least Lua 5.1 or LuaJIT 2.x
678     #endif
679 
680 #include <stdio.h>
681 
682     #if PY_VERSION_HEX < 0x03040000 && defined(_MSC_VER)
683         #ifndef _MSC_STDINT_H_
684             #ifdef _WIN64 // [
685                typedef unsigned __int64  uintptr_t;
686             #else // _WIN64 ][
687                typedef _W64 unsigned int uintptr_t;
688             #endif // _WIN64 ]
689         #endif
690     #else
691         #include <stdint.h>
692     #endif
693 
694 
695     #define IS_PY2 (PY_MAJOR_VERSION == 2)
696 
697 #include "pythread.h"
698 #ifdef _OPENMP
699 #include <omp.h>
700 #endif /* _OPENMP */
701 
702 #if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
703 #define CYTHON_WITHOUT_ASSERTIONS
704 #endif
705 
706 typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
707                 const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
708 
709 #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
710 #define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
711 #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)
712 #define __PYX_DEFAULT_STRING_ENCODING ""
713 #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
714 #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
715 #define __Pyx_uchar_cast(c) ((unsigned char)c)
716 #define __Pyx_long_cast(x) ((long)x)
717 #define __Pyx_fits_Py_ssize_t(v, type, is_signed)  (\
718     (sizeof(type) < sizeof(Py_ssize_t))  ||\
719     (sizeof(type) > sizeof(Py_ssize_t) &&\
720           likely(v < (type)PY_SSIZE_T_MAX ||\
721                  v == (type)PY_SSIZE_T_MAX)  &&\
722           (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
723                                 v == (type)PY_SSIZE_T_MIN)))  ||\
724     (sizeof(type) == sizeof(Py_ssize_t) &&\
725           (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
726                                v == (type)PY_SSIZE_T_MAX)))  )
__Pyx_is_valid_index(Py_ssize_t i,Py_ssize_t limit)727 static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
728     return (size_t) i < (size_t) limit;
729 }
730 #if defined (__cplusplus) && __cplusplus >= 201103L
731     #include <cstdlib>
732     #define __Pyx_sst_abs(value) std::abs(value)
733 #elif SIZEOF_INT >= SIZEOF_SIZE_T
734     #define __Pyx_sst_abs(value) abs(value)
735 #elif SIZEOF_LONG >= SIZEOF_SIZE_T
736     #define __Pyx_sst_abs(value) labs(value)
737 #elif defined (_MSC_VER)
738     #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
739 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
740     #define __Pyx_sst_abs(value) llabs(value)
741 #elif defined (__GNUC__)
742     #define __Pyx_sst_abs(value) __builtin_llabs(value)
743 #else
744     #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
745 #endif
746 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
747 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
748 #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
749 #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
750 #define __Pyx_PyBytes_FromString        PyBytes_FromString
751 #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
752 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
753 #if PY_MAJOR_VERSION < 3
754     #define __Pyx_PyStr_FromString        __Pyx_PyBytes_FromString
755     #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
756 #else
757     #define __Pyx_PyStr_FromString        __Pyx_PyUnicode_FromString
758     #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
759 #endif
760 #define __Pyx_PyBytes_AsWritableString(s)     ((char*) PyBytes_AS_STRING(s))
761 #define __Pyx_PyBytes_AsWritableSString(s)    ((signed char*) PyBytes_AS_STRING(s))
762 #define __Pyx_PyBytes_AsWritableUString(s)    ((unsigned char*) PyBytes_AS_STRING(s))
763 #define __Pyx_PyBytes_AsString(s)     ((const char*) PyBytes_AS_STRING(s))
764 #define __Pyx_PyBytes_AsSString(s)    ((const signed char*) PyBytes_AS_STRING(s))
765 #define __Pyx_PyBytes_AsUString(s)    ((const unsigned char*) PyBytes_AS_STRING(s))
766 #define __Pyx_PyObject_AsWritableString(s)    ((char*) __Pyx_PyObject_AsString(s))
767 #define __Pyx_PyObject_AsWritableSString(s)    ((signed char*) __Pyx_PyObject_AsString(s))
768 #define __Pyx_PyObject_AsWritableUString(s)    ((unsigned char*) __Pyx_PyObject_AsString(s))
769 #define __Pyx_PyObject_AsSString(s)    ((const signed char*) __Pyx_PyObject_AsString(s))
770 #define __Pyx_PyObject_AsUString(s)    ((const unsigned char*) __Pyx_PyObject_AsString(s))
771 #define __Pyx_PyObject_FromCString(s)  __Pyx_PyObject_FromString((const char*)s)
772 #define __Pyx_PyBytes_FromCString(s)   __Pyx_PyBytes_FromString((const char*)s)
773 #define __Pyx_PyByteArray_FromCString(s)   __Pyx_PyByteArray_FromString((const char*)s)
774 #define __Pyx_PyStr_FromCString(s)     __Pyx_PyStr_FromString((const char*)s)
775 #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
__Pyx_Py_UNICODE_strlen(const Py_UNICODE * u)776 static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) {
777     const Py_UNICODE *u_end = u;
778     while (*u_end++) ;
779     return (size_t)(u_end - u - 1);
780 }
781 #define __Pyx_PyUnicode_FromUnicode(u)       PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
782 #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
783 #define __Pyx_PyUnicode_AsUnicode            PyUnicode_AsUnicode
784 #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
785 #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
786 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
787 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
788 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
789 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
790 #define __Pyx_PySequence_Tuple(obj)\
791     (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
792 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
793 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
794 #if CYTHON_ASSUME_SAFE_MACROS
795 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
796 #else
797 #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
798 #endif
799 #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
800 #if PY_MAJOR_VERSION >= 3
801 #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
802 #else
803 #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
804 #endif
805 #define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
806 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
807 static int __Pyx_sys_getdefaultencoding_not_ascii;
__Pyx_init_sys_getdefaultencoding_params(void)808 static int __Pyx_init_sys_getdefaultencoding_params(void) {
809     PyObject* sys;
810     PyObject* default_encoding = NULL;
811     PyObject* ascii_chars_u = NULL;
812     PyObject* ascii_chars_b = NULL;
813     const char* default_encoding_c;
814     sys = PyImport_ImportModule("sys");
815     if (!sys) goto bad;
816     default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
817     Py_DECREF(sys);
818     if (!default_encoding) goto bad;
819     default_encoding_c = PyBytes_AsString(default_encoding);
820     if (!default_encoding_c) goto bad;
821     if (strcmp(default_encoding_c, "ascii") == 0) {
822         __Pyx_sys_getdefaultencoding_not_ascii = 0;
823     } else {
824         char ascii_chars[128];
825         int c;
826         for (c = 0; c < 128; c++) {
827             ascii_chars[c] = c;
828         }
829         __Pyx_sys_getdefaultencoding_not_ascii = 1;
830         ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
831         if (!ascii_chars_u) goto bad;
832         ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
833         if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
834             PyErr_Format(
835                 PyExc_ValueError,
836                 "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
837                 default_encoding_c);
838             goto bad;
839         }
840         Py_DECREF(ascii_chars_u);
841         Py_DECREF(ascii_chars_b);
842     }
843     Py_DECREF(default_encoding);
844     return 0;
845 bad:
846     Py_XDECREF(default_encoding);
847     Py_XDECREF(ascii_chars_u);
848     Py_XDECREF(ascii_chars_b);
849     return -1;
850 }
851 #endif
852 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
853 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
854 #else
855 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
856 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
857 static char* __PYX_DEFAULT_STRING_ENCODING;
__Pyx_init_sys_getdefaultencoding_params(void)858 static int __Pyx_init_sys_getdefaultencoding_params(void) {
859     PyObject* sys;
860     PyObject* default_encoding = NULL;
861     char* default_encoding_c;
862     sys = PyImport_ImportModule("sys");
863     if (!sys) goto bad;
864     default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
865     Py_DECREF(sys);
866     if (!default_encoding) goto bad;
867     default_encoding_c = PyBytes_AsString(default_encoding);
868     if (!default_encoding_c) goto bad;
869     __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1);
870     if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
871     strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
872     Py_DECREF(default_encoding);
873     return 0;
874 bad:
875     Py_XDECREF(default_encoding);
876     return -1;
877 }
878 #endif
879 #endif
880 
881 
882 /* Test for GCC > 2.95 */
883 #if defined(__GNUC__)     && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
884   #define likely(x)   __builtin_expect(!!(x), 1)
885   #define unlikely(x) __builtin_expect(!!(x), 0)
886 #else /* !__GNUC__ or GCC < 2.95 */
887   #define likely(x)   (x)
888   #define unlikely(x) (x)
889 #endif /* __GNUC__ */
__Pyx_pretend_to_initialize(void * ptr)890 static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }
891 
892 static PyObject *__pyx_m = NULL;
893 static PyObject *__pyx_d;
894 static PyObject *__pyx_b;
895 static PyObject *__pyx_cython_runtime = NULL;
896 static PyObject *__pyx_empty_tuple;
897 static PyObject *__pyx_empty_bytes;
898 static PyObject *__pyx_empty_unicode;
899 static int __pyx_lineno;
900 static int __pyx_clineno = 0;
901 static const char * __pyx_cfilenm= __FILE__;
902 static const char *__pyx_filename;
903 
904 
905 static const char *__pyx_f[] = {
906   "lupa/_lupa.pyx",
907   "lupa/lock.pxi",
908   "stringsource",
909   "type.pxd",
910   "bool.pxd",
911   "complex.pxd",
912 };
913 /* NoFastGil.proto */
914 #define __Pyx_PyGILState_Ensure PyGILState_Ensure
915 #define __Pyx_PyGILState_Release PyGILState_Release
916 #define __Pyx_FastGIL_Remember()
917 #define __Pyx_FastGIL_Forget()
918 #define __Pyx_FastGilFuncInit()
919 
920 /* ForceInitThreads.proto */
921 #ifndef __PYX_FORCE_INIT_THREADS
922   #define __PYX_FORCE_INIT_THREADS 0
923 #endif
924 
925 
926 /*--- Type declarations ---*/
927 struct __pyx_obj_4lupa_5_lupa_FastRLock;
928 struct __pyx_obj_4lupa_5_lupa_LuaRuntime;
929 struct __pyx_obj_4lupa_5_lupa__LuaObject;
930 struct __pyx_obj_4lupa_5_lupa__LuaTable;
931 struct __pyx_obj_4lupa_5_lupa__LuaFunction;
932 struct __pyx_obj_4lupa_5_lupa__LuaCoroutineFunction;
933 struct __pyx_obj_4lupa_5_lupa__LuaThread;
934 struct __pyx_obj_4lupa_5_lupa__LuaIter;
935 struct __pyx_obj_4lupa_5_lupa__PyProtocolWrapper;
936 struct __pyx_obj_4lupa_5_lupa___pyx_scope_struct__unpacks_lua_table;
937 struct __pyx_obj_4lupa_5_lupa___pyx_scope_struct_1_unpacks_lua_table_method;
938 struct __pyx_t_4lupa_5_lupa_py_object;
939 struct __pyx_opt_args_4lupa_5_lupa_py_to_lua;
940 struct __pyx_opt_args_4lupa_5_lupa_push_lua_arguments;
941 
942 /* "lupa/_lupa.pyx":72
943  *     int IS_PY2
944  *
945  * cdef enum WrappedObjectFlags:             # <<<<<<<<<<<<<<
946  *     # flags that determine the behaviour of a wrapped object:
947  *     OBJ_AS_INDEX = 1 # prefers the getitem protocol (over getattr)
948  */
949 enum __pyx_t_4lupa_5_lupa_WrappedObjectFlags {
950   __pyx_e_4lupa_5_lupa_OBJ_AS_INDEX = 1,
951   __pyx_e_4lupa_5_lupa_OBJ_UNPACK_TUPLE = 2,
952   __pyx_e_4lupa_5_lupa_OBJ_ENUMERATOR = 4
953 };
954 
955 /* "lupa/_lupa.pyx":981
956  *
957  *
958  * cdef enum:             # <<<<<<<<<<<<<<
959  *     KEYS = 1
960  *     VALUES = 2
961  */
962 enum  {
963   __pyx_e_4lupa_5_lupa_KEYS = 1,
964   __pyx_e_4lupa_5_lupa_VALUES = 2,
965   __pyx_e_4lupa_5_lupa_ITEMS = 3
966 };
967 
968 /* "lupa/_lupa.pyx":78
969  *     OBJ_ENUMERATOR = 4 # iteration uses native enumerate() implementation
970  *
971  * cdef struct py_object:             # <<<<<<<<<<<<<<
972  *     PyObject* obj
973  *     PyObject* runtime
974  */
975 struct __pyx_t_4lupa_5_lupa_py_object {
976   PyObject *obj;
977   PyObject *runtime;
978   int type_flags;
979 };
980 
981 /* "lupa/_lupa.pyx":1185
982  *      return py_to_lua(runtime, L, o)
983  *
984  * cdef int py_to_lua(LuaRuntime runtime, lua_State *L, object o, bint wrap_none=False) except -1:             # <<<<<<<<<<<<<<
985  *     cdef int pushed_values_count = 0
986  *     cdef int type_flags = 0
987  */
988 struct __pyx_opt_args_4lupa_5_lupa_py_to_lua {
989   int __pyx_n;
990   int wrap_none;
991 };
992 
993 /* "lupa/_lupa.pyx":1362
994  *     return results
995  *
996  * cdef int push_lua_arguments(LuaRuntime runtime, lua_State *L,             # <<<<<<<<<<<<<<
997  *                             tuple args, bint first_may_be_nil=True) except -1:
998  *     cdef int i
999  */
1000 struct __pyx_opt_args_4lupa_5_lupa_push_lua_arguments {
1001   int __pyx_n;
1002   int first_may_be_nil;
1003 };
1004 
1005 /* "lupa/lock.pxi":5
1006  *
1007  *
1008  * cdef class FastRLock:             # <<<<<<<<<<<<<<
1009  *     """Fast, re-entrant locking.
1010  *
1011  */
1012 struct __pyx_obj_4lupa_5_lupa_FastRLock {
1013   PyObject_HEAD
1014   PyThread_type_lock _real_lock;
1015   long _owner;
1016   int _count;
1017   int _pending_requests;
1018   int _is_locked;
1019 };
1020 
1021 
1022 /* "lupa/_lupa.pyx":136
1023  *
1024  * @cython.no_gc_clear
1025  * cdef class LuaRuntime:             # <<<<<<<<<<<<<<
1026  *     """The main entry point to the Lua runtime.
1027  *
1028  */
1029 struct __pyx_obj_4lupa_5_lupa_LuaRuntime {
1030   PyObject_HEAD
1031   struct __pyx_vtabstruct_4lupa_5_lupa_LuaRuntime *__pyx_vtab;
1032   lua_State *_state;
1033   struct __pyx_obj_4lupa_5_lupa_FastRLock *_lock;
1034   PyObject *_pyrefs_in_lua;
1035   PyObject *_raised_exception;
1036   PyObject *_encoding;
1037   PyObject *_source_encoding;
1038   PyObject *_attribute_filter;
1039   PyObject *_attribute_getter;
1040   PyObject *_attribute_setter;
1041   int _unpack_returned_tuples;
1042 };
1043 
1044 
1045 /* "lupa/_lupa.pyx":549
1046  * @cython.no_gc_clear
1047  * @cython.freelist(16)
1048  * cdef class _LuaObject:             # <<<<<<<<<<<<<<
1049  *     """A wrapper around a Lua object such as a table or function.
1050  *     """
1051  */
1052 struct __pyx_obj_4lupa_5_lupa__LuaObject {
1053   PyObject_HEAD
1054   struct __pyx_vtabstruct_4lupa_5_lupa__LuaObject *__pyx_vtab;
1055   struct __pyx_obj_4lupa_5_lupa_LuaRuntime *_runtime;
1056   lua_State *_state;
1057   int _ref;
1058 };
1059 
1060 
1061 /* "lupa/_lupa.pyx":732
1062  * @cython.internal
1063  * @cython.no_gc_clear
1064  * cdef class _LuaTable(_LuaObject):             # <<<<<<<<<<<<<<
1065  *     def __iter__(self):
1066  *         return _LuaIter(self, KEYS)
1067  */
1068 struct __pyx_obj_4lupa_5_lupa__LuaTable {
1069   struct __pyx_obj_4lupa_5_lupa__LuaObject __pyx_base;
1070 };
1071 
1072 
1073 /* "lupa/_lupa.pyx":823
1074  * @cython.internal
1075  * @cython.no_gc_clear
1076  * cdef class _LuaFunction(_LuaObject):             # <<<<<<<<<<<<<<
1077  *     """A Lua function (which may become a coroutine).
1078  *     """
1079  */
1080 struct __pyx_obj_4lupa_5_lupa__LuaFunction {
1081   struct __pyx_obj_4lupa_5_lupa__LuaObject __pyx_base;
1082 };
1083 
1084 
1085 /* "lupa/_lupa.pyx":862
1086  * @cython.internal
1087  * @cython.no_gc_clear
1088  * cdef class _LuaCoroutineFunction(_LuaFunction):             # <<<<<<<<<<<<<<
1089  *     """A function that returns a new coroutine when called.
1090  *     """
1091  */
1092 struct __pyx_obj_4lupa_5_lupa__LuaCoroutineFunction {
1093   struct __pyx_obj_4lupa_5_lupa__LuaFunction __pyx_base;
1094 };
1095 
1096 
1097 /* "lupa/_lupa.pyx":877
1098  * @cython.internal
1099  * @cython.no_gc_clear   # FIXME: get rid if this
1100  * cdef class _LuaThread(_LuaObject):             # <<<<<<<<<<<<<<
1101  *     """A Lua thread (coroutine).
1102  *     """
1103  */
1104 struct __pyx_obj_4lupa_5_lupa__LuaThread {
1105   struct __pyx_obj_4lupa_5_lupa__LuaObject __pyx_base;
1106   lua_State *_co_state;
1107   PyObject *_arguments;
1108 };
1109 
1110 
1111 /* "lupa/_lupa.pyx":990
1112  * @cython.internal
1113  * @cython.no_gc_clear
1114  * cdef class _LuaIter:             # <<<<<<<<<<<<<<
1115  *     cdef LuaRuntime _runtime
1116  *     cdef _LuaObject _obj
1117  */
1118 struct __pyx_obj_4lupa_5_lupa__LuaIter {
1119   PyObject_HEAD
1120   struct __pyx_obj_4lupa_5_lupa_LuaRuntime *_runtime;
1121   struct __pyx_obj_4lupa_5_lupa__LuaObject *_obj;
1122   lua_State *_state;
1123   int _refiter;
1124   char _what;
1125 };
1126 
1127 
1128 /* "lupa/_lupa.pyx":1101
1129  * @cython.internal
1130  * @cython.freelist(8)
1131  * cdef class _PyProtocolWrapper:             # <<<<<<<<<<<<<<
1132  *     cdef object _obj
1133  *     cdef int _type_flags
1134  */
1135 struct __pyx_obj_4lupa_5_lupa__PyProtocolWrapper {
1136   PyObject_HEAD
1137   PyObject *_obj;
1138   int _type_flags;
1139 };
1140 
1141 
1142 /* "lupa/_lupa.pyx":462
1143  * # from Lua scripts
1144  *
1145  * def unpacks_lua_table(func):             # <<<<<<<<<<<<<<
1146  *     """
1147  *     A decorator to make the decorated function receive kwargs
1148  */
1149 struct __pyx_obj_4lupa_5_lupa___pyx_scope_struct__unpacks_lua_table {
1150   PyObject_HEAD
1151   PyObject *__pyx_v_func;
1152 };
1153 
1154 
1155 /* "lupa/_lupa.pyx":488
1156  *
1157  *
1158  * def unpacks_lua_table_method(meth):             # <<<<<<<<<<<<<<
1159  *     """
1160  *     This is :func:`unpacks_lua_table` for methods
1161  */
1162 struct __pyx_obj_4lupa_5_lupa___pyx_scope_struct_1_unpacks_lua_table_method {
1163   PyObject_HEAD
1164   PyObject *__pyx_v_meth;
1165 };
1166 
1167 
1168 
1169 /* "lupa/_lupa.pyx":136
1170  *
1171  * @cython.no_gc_clear
1172  * cdef class LuaRuntime:             # <<<<<<<<<<<<<<
1173  *     """The main entry point to the Lua runtime.
1174  *
1175  */
1176 
1177 struct __pyx_vtabstruct_4lupa_5_lupa_LuaRuntime {
1178   int (*reraise_on_exception)(struct __pyx_obj_4lupa_5_lupa_LuaRuntime *);
1179   int (*store_raised_exception)(struct __pyx_obj_4lupa_5_lupa_LuaRuntime *, lua_State *, PyObject *);
1180   int (*register_py_object)(struct __pyx_obj_4lupa_5_lupa_LuaRuntime *, PyObject *, PyObject *, PyObject *);
1181   int (*init_python_lib)(struct __pyx_obj_4lupa_5_lupa_LuaRuntime *, int, int);
1182 };
1183 static struct __pyx_vtabstruct_4lupa_5_lupa_LuaRuntime *__pyx_vtabptr_4lupa_5_lupa_LuaRuntime;
1184 static int __pyx_f_4lupa_5_lupa_10LuaRuntime_reraise_on_exception(struct __pyx_obj_4lupa_5_lupa_LuaRuntime *);
1185 static int __pyx_f_4lupa_5_lupa_10LuaRuntime_store_raised_exception(struct __pyx_obj_4lupa_5_lupa_LuaRuntime *, lua_State *, PyObject *);
1186 static int __pyx_f_4lupa_5_lupa_10LuaRuntime_register_py_object(struct __pyx_obj_4lupa_5_lupa_LuaRuntime *, PyObject *, PyObject *, PyObject *);
1187 static int __pyx_f_4lupa_5_lupa_10LuaRuntime_init_python_lib(struct __pyx_obj_4lupa_5_lupa_LuaRuntime *, int, int);
1188 
1189 
1190 /* "lupa/_lupa.pyx":549
1191  * @cython.no_gc_clear
1192  * @cython.freelist(16)
1193  * cdef class _LuaObject:             # <<<<<<<<<<<<<<
1194  *     """A wrapper around a Lua object such as a table or function.
1195  *     """
1196  */
1197 
1198 struct __pyx_vtabstruct_4lupa_5_lupa__LuaObject {
1199   int (*push_lua_object)(struct __pyx_obj_4lupa_5_lupa__LuaObject *);
1200   size_t (*_len)(struct __pyx_obj_4lupa_5_lupa__LuaObject *);
1201   PyObject *(*_getitem)(struct __pyx_obj_4lupa_5_lupa__LuaObject *, PyObject *, int);
1202 };
1203 static struct __pyx_vtabstruct_4lupa_5_lupa__LuaObject *__pyx_vtabptr_4lupa_5_lupa__LuaObject;
1204 static CYTHON_INLINE int __pyx_f_4lupa_5_lupa_10_LuaObject_push_lua_object(struct __pyx_obj_4lupa_5_lupa__LuaObject *);
1205 static size_t __pyx_f_4lupa_5_lupa_10_LuaObject__len(struct __pyx_obj_4lupa_5_lupa__LuaObject *);
1206 static PyObject *__pyx_f_4lupa_5_lupa_10_LuaObject__getitem(struct __pyx_obj_4lupa_5_lupa__LuaObject *, PyObject *, int);
1207 
1208 
1209 /* "lupa/_lupa.pyx":732
1210  * @cython.internal
1211  * @cython.no_gc_clear
1212  * cdef class _LuaTable(_LuaObject):             # <<<<<<<<<<<<<<
1213  *     def __iter__(self):
1214  *         return _LuaIter(self, KEYS)
1215  */
1216 
1217 struct __pyx_vtabstruct_4lupa_5_lupa__LuaTable {
1218   struct __pyx_vtabstruct_4lupa_5_lupa__LuaObject __pyx_base;
1219   int (*_setitem)(struct __pyx_obj_4lupa_5_lupa__LuaTable *, PyObject *, PyObject *);
1220   PyObject *(*_delitem)(struct __pyx_obj_4lupa_5_lupa__LuaTable *, PyObject *);
1221 };
1222 static struct __pyx_vtabstruct_4lupa_5_lupa__LuaTable *__pyx_vtabptr_4lupa_5_lupa__LuaTable;
1223 static int __pyx_f_4lupa_5_lupa_9_LuaTable__setitem(struct __pyx_obj_4lupa_5_lupa__LuaTable *, PyObject *, PyObject *);
1224 static PyObject *__pyx_f_4lupa_5_lupa_9_LuaTable__delitem(struct __pyx_obj_4lupa_5_lupa__LuaTable *, PyObject *);
1225 
1226 
1227 /* "lupa/_lupa.pyx":823
1228  * @cython.internal
1229  * @cython.no_gc_clear
1230  * cdef class _LuaFunction(_LuaObject):             # <<<<<<<<<<<<<<
1231  *     """A Lua function (which may become a coroutine).
1232  *     """
1233  */
1234 
1235 struct __pyx_vtabstruct_4lupa_5_lupa__LuaFunction {
1236   struct __pyx_vtabstruct_4lupa_5_lupa__LuaObject __pyx_base;
1237 };
1238 static struct __pyx_vtabstruct_4lupa_5_lupa__LuaFunction *__pyx_vtabptr_4lupa_5_lupa__LuaFunction;
1239 
1240 
1241 /* "lupa/_lupa.pyx":862
1242  * @cython.internal
1243  * @cython.no_gc_clear
1244  * cdef class _LuaCoroutineFunction(_LuaFunction):             # <<<<<<<<<<<<<<
1245  *     """A function that returns a new coroutine when called.
1246  *     """
1247  */
1248 
1249 struct __pyx_vtabstruct_4lupa_5_lupa__LuaCoroutineFunction {
1250   struct __pyx_vtabstruct_4lupa_5_lupa__LuaFunction __pyx_base;
1251 };
1252 static struct __pyx_vtabstruct_4lupa_5_lupa__LuaCoroutineFunction *__pyx_vtabptr_4lupa_5_lupa__LuaCoroutineFunction;
1253 
1254 
1255 /* "lupa/_lupa.pyx":877
1256  * @cython.internal
1257  * @cython.no_gc_clear   # FIXME: get rid if this
1258  * cdef class _LuaThread(_LuaObject):             # <<<<<<<<<<<<<<
1259  *     """A Lua thread (coroutine).
1260  *     """
1261  */
1262 
1263 struct __pyx_vtabstruct_4lupa_5_lupa__LuaThread {
1264   struct __pyx_vtabstruct_4lupa_5_lupa__LuaObject __pyx_base;
1265 };
1266 static struct __pyx_vtabstruct_4lupa_5_lupa__LuaThread *__pyx_vtabptr_4lupa_5_lupa__LuaThread;
1267 
1268 /* --- Runtime support code (head) --- */
1269 /* Refnanny.proto */
1270 #ifndef CYTHON_REFNANNY
1271   #define CYTHON_REFNANNY 0
1272 #endif
1273 #if CYTHON_REFNANNY
1274   typedef struct {
1275     void (*INCREF)(void*, PyObject*, int);
1276     void (*DECREF)(void*, PyObject*, int);
1277     void (*GOTREF)(void*, PyObject*, int);
1278     void (*GIVEREF)(void*, PyObject*, int);
1279     void* (*SetupContext)(const char*, int, const char*);
1280     void (*FinishContext)(void**);
1281   } __Pyx_RefNannyAPIStruct;
1282   static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
1283   static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
1284   #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
1285 #ifdef WITH_THREAD
1286   #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1287           if (acquire_gil) {\
1288               PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
1289               __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1290               PyGILState_Release(__pyx_gilstate_save);\
1291           } else {\
1292               __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1293           }
1294 #else
1295   #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1296           __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
1297 #endif
1298   #define __Pyx_RefNannyFinishContext()\
1299           __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
1300   #define __Pyx_INCREF(r)  __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1301   #define __Pyx_DECREF(r)  __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1302   #define __Pyx_GOTREF(r)  __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1303   #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1304   #define __Pyx_XINCREF(r)  do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
1305   #define __Pyx_XDECREF(r)  do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
1306   #define __Pyx_XGOTREF(r)  do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
1307   #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
1308 #else
1309   #define __Pyx_RefNannyDeclarations
1310   #define __Pyx_RefNannySetupContext(name, acquire_gil)
1311   #define __Pyx_RefNannyFinishContext()
1312   #define __Pyx_INCREF(r) Py_INCREF(r)
1313   #define __Pyx_DECREF(r) Py_DECREF(r)
1314   #define __Pyx_GOTREF(r)
1315   #define __Pyx_GIVEREF(r)
1316   #define __Pyx_XINCREF(r) Py_XINCREF(r)
1317   #define __Pyx_XDECREF(r) Py_XDECREF(r)
1318   #define __Pyx_XGOTREF(r)
1319   #define __Pyx_XGIVEREF(r)
1320 #endif
1321 #define __Pyx_XDECREF_SET(r, v) do {\
1322         PyObject *tmp = (PyObject *) r;\
1323         r = v; __Pyx_XDECREF(tmp);\
1324     } while (0)
1325 #define __Pyx_DECREF_SET(r, v) do {\
1326         PyObject *tmp = (PyObject *) r;\
1327         r = v; __Pyx_DECREF(tmp);\
1328     } while (0)
1329 #define __Pyx_CLEAR(r)    do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
1330 #define __Pyx_XCLEAR(r)   do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
1331 
1332 /* PyObjectGetAttrStr.proto */
1333 #if CYTHON_USE_TYPE_SLOTS
1334 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
1335 #else
1336 #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
1337 #endif
1338 
1339 /* GetBuiltinName.proto */
1340 static PyObject *__Pyx_GetBuiltinName(PyObject *name);
1341 
1342 /* RaiseArgTupleInvalid.proto */
1343 static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
1344     Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
1345 
1346 /* KeywordStringCheck.proto */
1347 static int __Pyx_CheckKeywordStrings(PyObject *kwdict, const char* function_name, int kw_allowed);
1348 
1349 /* RaiseDoubleKeywords.proto */
1350 static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
1351 
1352 /* ParseKeywords.proto */
1353 static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
1354     PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
1355     const char* function_name);
1356 
1357 /* PyObjectCall.proto */
1358 #if CYTHON_COMPILING_IN_CPYTHON
1359 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
1360 #else
1361 #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
1362 #endif
1363 
1364 /* PyThreadStateGet.proto */
1365 #if CYTHON_FAST_THREAD_STATE
1366 #define __Pyx_PyThreadState_declare  PyThreadState *__pyx_tstate;
1367 #define __Pyx_PyThreadState_assign  __pyx_tstate = __Pyx_PyThreadState_Current;
1368 #define __Pyx_PyErr_Occurred()  __pyx_tstate->curexc_type
1369 #else
1370 #define __Pyx_PyThreadState_declare
1371 #define __Pyx_PyThreadState_assign
1372 #define __Pyx_PyErr_Occurred()  PyErr_Occurred()
1373 #endif
1374 
1375 /* PyErrFetchRestore.proto */
1376 #if CYTHON_FAST_THREAD_STATE
1377 #define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
1378 #define __Pyx_ErrRestoreWithState(type, value, tb)  __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
1379 #define __Pyx_ErrFetchWithState(type, value, tb)    __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
1380 #define __Pyx_ErrRestore(type, value, tb)  __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
1381 #define __Pyx_ErrFetch(type, value, tb)    __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
1382 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1383 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1384 #if CYTHON_COMPILING_IN_CPYTHON
1385 #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
1386 #else
1387 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1388 #endif
1389 #else
1390 #define __Pyx_PyErr_Clear() PyErr_Clear()
1391 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1392 #define __Pyx_ErrRestoreWithState(type, value, tb)  PyErr_Restore(type, value, tb)
1393 #define __Pyx_ErrFetchWithState(type, value, tb)  PyErr_Fetch(type, value, tb)
1394 #define __Pyx_ErrRestoreInState(tstate, type, value, tb)  PyErr_Restore(type, value, tb)
1395 #define __Pyx_ErrFetchInState(tstate, type, value, tb)  PyErr_Fetch(type, value, tb)
1396 #define __Pyx_ErrRestore(type, value, tb)  PyErr_Restore(type, value, tb)
1397 #define __Pyx_ErrFetch(type, value, tb)  PyErr_Fetch(type, value, tb)
1398 #endif
1399 
1400 /* RaiseException.proto */
1401 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
1402 
1403 /* IncludeStringH.proto */
1404 #include <string.h>
1405 
1406 /* decode_c_string_utf16.proto */
__Pyx_PyUnicode_DecodeUTF16(const char * s,Py_ssize_t size,const char * errors)1407 static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16(const char *s, Py_ssize_t size, const char *errors) {
1408     int byteorder = 0;
1409     return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
1410 }
__Pyx_PyUnicode_DecodeUTF16LE(const char * s,Py_ssize_t size,const char * errors)1411 static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16LE(const char *s, Py_ssize_t size, const char *errors) {
1412     int byteorder = -1;
1413     return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
1414 }
__Pyx_PyUnicode_DecodeUTF16BE(const char * s,Py_ssize_t size,const char * errors)1415 static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16BE(const char *s, Py_ssize_t size, const char *errors) {
1416     int byteorder = 1;
1417     return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
1418 }
1419 
1420 /* decode_c_string.proto */
1421 static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
1422          const char* cstring, Py_ssize_t start, Py_ssize_t stop,
1423          const char* encoding, const char* errors,
1424          PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors));
1425 
1426 /* GetException.proto */
1427 #if CYTHON_FAST_THREAD_STATE
1428 #define __Pyx_GetException(type, value, tb)  __Pyx__GetException(__pyx_tstate, type, value, tb)
1429 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1430 #else
1431 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
1432 #endif
1433 
1434 /* SwapException.proto */
1435 #if CYTHON_FAST_THREAD_STATE
1436 #define __Pyx_ExceptionSwap(type, value, tb)  __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb)
1437 static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1438 #else
1439 static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb);
1440 #endif
1441 
1442 /* GetTopmostException.proto */
1443 #if CYTHON_USE_EXC_INFO_STACK
1444 static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
1445 #endif
1446 
1447 /* SaveResetException.proto */
1448 #if CYTHON_FAST_THREAD_STATE
1449 #define __Pyx_ExceptionSave(type, value, tb)  __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
1450 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1451 #define __Pyx_ExceptionReset(type, value, tb)  __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
1452 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1453 #else
1454 #define __Pyx_ExceptionSave(type, value, tb)   PyErr_GetExcInfo(type, value, tb)
1455 #define __Pyx_ExceptionReset(type, value, tb)  PyErr_SetExcInfo(type, value, tb)
1456 #endif
1457 
1458 /* PyDictVersioning.proto */
1459 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
1460 #define __PYX_DICT_VERSION_INIT  ((PY_UINT64_T) -1)
1461 #define __PYX_GET_DICT_VERSION(dict)  (((PyDictObject*)(dict))->ma_version_tag)
1462 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
1463     (version_var) = __PYX_GET_DICT_VERSION(dict);\
1464     (cache_var) = (value);
1465 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
1466     static PY_UINT64_T __pyx_dict_version = 0;\
1467     static PyObject *__pyx_dict_cached_value = NULL;\
1468     if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
1469         (VAR) = __pyx_dict_cached_value;\
1470     } else {\
1471         (VAR) = __pyx_dict_cached_value = (LOOKUP);\
1472         __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
1473     }\
1474 }
1475 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
1476 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
1477 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
1478 #else
1479 #define __PYX_GET_DICT_VERSION(dict)  (0)
1480 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
1481 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP)  (VAR) = (LOOKUP);
1482 #endif
1483 
1484 /* GetModuleGlobalName.proto */
1485 #if CYTHON_USE_DICT_VERSIONS
1486 #define __Pyx_GetModuleGlobalName(var, name)  {\
1487     static PY_UINT64_T __pyx_dict_version = 0;\
1488     static PyObject *__pyx_dict_cached_value = NULL;\
1489     (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\
1490         (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
1491         __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1492 }
1493 #define __Pyx_GetModuleGlobalNameUncached(var, name)  {\
1494     PY_UINT64_T __pyx_dict_version;\
1495     PyObject *__pyx_dict_cached_value;\
1496     (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1497 }
1498 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
1499 #else
1500 #define __Pyx_GetModuleGlobalName(var, name)  (var) = __Pyx__GetModuleGlobalName(name)
1501 #define __Pyx_GetModuleGlobalNameUncached(var, name)  (var) = __Pyx__GetModuleGlobalName(name)
1502 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
1503 #endif
1504 
1505 /* PyCFunctionFastCall.proto */
1506 #if CYTHON_FAST_PYCCALL
1507 static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
1508 #else
1509 #define __Pyx_PyCFunction_FastCall(func, args, nargs)  (assert(0), NULL)
1510 #endif
1511 
1512 /* PyFunctionFastCall.proto */
1513 #if CYTHON_FAST_PYCALL
1514 #define __Pyx_PyFunction_FastCall(func, args, nargs)\
1515     __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
1516 #if 1 || PY_VERSION_HEX < 0x030600B1
1517 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs);
1518 #else
1519 #define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
1520 #endif
1521 #define __Pyx_BUILD_ASSERT_EXPR(cond)\
1522     (sizeof(char [1 - 2*!(cond)]) - 1)
1523 #ifndef Py_MEMBER_SIZE
1524 #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
1525 #endif
1526   static size_t __pyx_pyframe_localsplus_offset = 0;
1527   #include "frameobject.h"
1528   #define __Pxy_PyFrame_Initialize_Offsets()\
1529     ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
1530      (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
1531   #define __Pyx_PyFrame_GetLocalsplus(frame)\
1532     (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
1533 #endif
1534 
1535 /* PyObjectCall2Args.proto */
1536 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2);
1537 
1538 /* PyObjectCallMethO.proto */
1539 #if CYTHON_COMPILING_IN_CPYTHON
1540 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
1541 #endif
1542 
1543 /* PyObjectCallOneArg.proto */
1544 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
1545 
1546 /* PyObjectCallNoArg.proto */
1547 #if CYTHON_COMPILING_IN_CPYTHON
1548 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
1549 #else
1550 #define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL)
1551 #endif
1552 
1553 /* CallableCheck.proto */
1554 #if CYTHON_USE_TYPE_SLOTS && PY_MAJOR_VERSION >= 3
1555 #define __Pyx_PyCallable_Check(obj)   (Py_TYPE(obj)->tp_call != NULL)
1556 #else
1557 #define __Pyx_PyCallable_Check(obj)   PyCallable_Check(obj)
1558 #endif
1559 
1560 /* RaiseTooManyValuesToUnpack.proto */
1561 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
1562 
1563 /* RaiseNeedMoreValuesToUnpack.proto */
1564 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
1565 
1566 /* IterFinish.proto */
1567 static CYTHON_INLINE int __Pyx_IterFinish(void);
1568 
1569 /* UnpackItemEndCheck.proto */
1570 static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected);
1571 
1572 /* PyErrExceptionMatches.proto */
1573 #if CYTHON_FAST_THREAD_STATE
1574 #define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
1575 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
1576 #else
1577 #define __Pyx_PyErr_ExceptionMatches(err)  PyErr_ExceptionMatches(err)
1578 #endif
1579 
1580 /* None.proto */
1581 static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname);
1582 
1583 /* None.proto */
1584 static CYTHON_INLINE long __Pyx_div_long(long, long);
1585 
1586 /* None.proto */
1587 static CYTHON_INLINE long __Pyx_mod_long(long, long);
1588 
1589 /* GetItemInt.proto */
1590 #define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1591     (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1592     __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
1593     (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
1594                __Pyx_GetItemInt_Generic(o, to_py_func(i))))
1595 #define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1596     (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1597     __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1598     (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
1599 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
1600                                                               int wraparound, int boundscheck);
1601 #define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1602     (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1603     __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1604     (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
1605 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
1606                                                               int wraparound, int boundscheck);
1607 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
1608 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
1609                                                      int is_list, int wraparound, int boundscheck);
1610 
1611 /* PyObjectGetMethod.proto */
1612 static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method);
1613 
1614 /* PyObjectCallMethod0.proto */
1615 static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name);
1616 
1617 /* RaiseNoneIterError.proto */
1618 static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);
1619 
1620 /* UnpackTupleError.proto */
1621 static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index);
1622 
1623 /* UnpackTuple2.proto */
1624 #define __Pyx_unpack_tuple2(tuple, value1, value2, is_tuple, has_known_size, decref_tuple)\
1625     (likely(is_tuple || PyTuple_Check(tuple)) ?\
1626         (likely(has_known_size || PyTuple_GET_SIZE(tuple) == 2) ?\
1627             __Pyx_unpack_tuple2_exact(tuple, value1, value2, decref_tuple) :\
1628             (__Pyx_UnpackTupleError(tuple, 2), -1)) :\
1629         __Pyx_unpack_tuple2_generic(tuple, value1, value2, has_known_size, decref_tuple))
1630 static CYTHON_INLINE int __Pyx_unpack_tuple2_exact(
1631     PyObject* tuple, PyObject** value1, PyObject** value2, int decref_tuple);
1632 static int __Pyx_unpack_tuple2_generic(
1633     PyObject* tuple, PyObject** value1, PyObject** value2, int has_known_size, int decref_tuple);
1634 
1635 /* dict_iter.proto */
1636 static CYTHON_INLINE PyObject* __Pyx_dict_iterator(PyObject* dict, int is_dict, PyObject* method_name,
1637                                                    Py_ssize_t* p_orig_length, int* p_is_dict);
1638 static CYTHON_INLINE int __Pyx_dict_iter_next(PyObject* dict_or_iter, Py_ssize_t orig_length, Py_ssize_t* ppos,
1639                                               PyObject** pkey, PyObject** pvalue, PyObject** pitem, int is_dict);
1640 
1641 /* ObjectGetItem.proto */
1642 #if CYTHON_USE_TYPE_SLOTS
1643 static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key);
1644 #else
1645 #define __Pyx_PyObject_GetItem(obj, key)  PyObject_GetItem(obj, key)
1646 #endif
1647 
1648 /* None.proto */
1649 static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname);
1650 
1651 /* FetchCommonType.proto */
1652 static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type);
1653 
1654 /* CythonFunctionShared.proto */
1655 #define __Pyx_CyFunction_USED 1
1656 #define __Pyx_CYFUNCTION_STATICMETHOD  0x01
1657 #define __Pyx_CYFUNCTION_CLASSMETHOD   0x02
1658 #define __Pyx_CYFUNCTION_CCLASS        0x04
1659 #define __Pyx_CyFunction_GetClosure(f)\
1660     (((__pyx_CyFunctionObject *) (f))->func_closure)
1661 #define __Pyx_CyFunction_GetClassObj(f)\
1662     (((__pyx_CyFunctionObject *) (f))->func_classobj)
1663 #define __Pyx_CyFunction_Defaults(type, f)\
1664     ((type *)(((__pyx_CyFunctionObject *) (f))->defaults))
1665 #define __Pyx_CyFunction_SetDefaultsGetter(f, g)\
1666     ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g)
1667 typedef struct {
1668     PyCFunctionObject func;
1669 #if PY_VERSION_HEX < 0x030500A0
1670     PyObject *func_weakreflist;
1671 #endif
1672     PyObject *func_dict;
1673     PyObject *func_name;
1674     PyObject *func_qualname;
1675     PyObject *func_doc;
1676     PyObject *func_globals;
1677     PyObject *func_code;
1678     PyObject *func_closure;
1679     PyObject *func_classobj;
1680     void *defaults;
1681     int defaults_pyobjects;
1682     size_t defaults_size;  // used by FusedFunction for copying defaults
1683     int flags;
1684     PyObject *defaults_tuple;
1685     PyObject *defaults_kwdict;
1686     PyObject *(*defaults_getter)(PyObject *);
1687     PyObject *func_annotations;
1688 } __pyx_CyFunctionObject;
1689 static PyTypeObject *__pyx_CyFunctionType = 0;
1690 #define __Pyx_CyFunction_Check(obj)  (__Pyx_TypeCheck(obj, __pyx_CyFunctionType))
1691 static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject* op, PyMethodDef *ml,
1692                                       int flags, PyObject* qualname,
1693                                       PyObject *self,
1694                                       PyObject *module, PyObject *globals,
1695                                       PyObject* code);
1696 static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m,
1697                                                          size_t size,
1698                                                          int pyobjects);
1699 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m,
1700                                                             PyObject *tuple);
1701 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m,
1702                                                              PyObject *dict);
1703 static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m,
1704                                                               PyObject *dict);
1705 static int __pyx_CyFunction_init(void);
1706 
1707 /* CythonFunction.proto */
1708 static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml,
1709                                       int flags, PyObject* qualname,
1710                                       PyObject *closure,
1711                                       PyObject *module, PyObject *globals,
1712                                       PyObject* code);
1713 
1714 /* ListCompAppend.proto */
1715 #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
__Pyx_ListComp_Append(PyObject * list,PyObject * x)1716 static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) {
1717     PyListObject* L = (PyListObject*) list;
1718     Py_ssize_t len = Py_SIZE(list);
1719     if (likely(L->allocated > len)) {
1720         Py_INCREF(x);
1721         PyList_SET_ITEM(list, len, x);
1722         __Pyx_SET_SIZE(list, len + 1);
1723         return 0;
1724     }
1725     return PyList_Append(list, x);
1726 }
1727 #else
1728 #define __Pyx_ListComp_Append(L,x) PyList_Append(L,x)
1729 #endif
1730 
1731 /* decode_c_bytes.proto */
1732 static CYTHON_INLINE PyObject* __Pyx_decode_c_bytes(
1733          const char* cstring, Py_ssize_t length, Py_ssize_t start, Py_ssize_t stop,
1734          const char* encoding, const char* errors,
1735          PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors));
1736 
1737 /* decode_bytes.proto */
__Pyx_decode_bytes(PyObject * string,Py_ssize_t start,Py_ssize_t stop,const char * encoding,const char * errors,PyObject * (* decode_func)(const char * s,Py_ssize_t size,const char * errors))1738 static CYTHON_INLINE PyObject* __Pyx_decode_bytes(
1739          PyObject* string, Py_ssize_t start, Py_ssize_t stop,
1740          const char* encoding, const char* errors,
1741          PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) {
1742     return __Pyx_decode_c_bytes(
1743         PyBytes_AS_STRING(string), PyBytes_GET_SIZE(string),
1744         start, stop, encoding, errors, decode_func);
1745 }
1746 
1747 /* WriteUnraisableException.proto */
1748 static void __Pyx_WriteUnraisable(const char *name, int clineno,
1749                                   int lineno, const char *filename,
1750                                   int full_traceback, int nogil);
1751 
1752 /* PyIntBinop.proto */
1753 #if !CYTHON_COMPILING_IN_PYPY
1754 static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
1755 #else
1756 #define __Pyx_PyInt_AddObjC(op1, op2, intval, inplace, zerodivision_check)\
1757     (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2))
1758 #endif
1759 
1760 /* unicode_tailmatch.proto */
1761 static int __Pyx_PyUnicode_Tailmatch(
1762     PyObject* s, PyObject* substr, Py_ssize_t start, Py_ssize_t end, int direction);
1763 
1764 /* bytes_tailmatch.proto */
1765 static int __Pyx_PyBytes_SingleTailmatch(PyObject* self, PyObject* arg,
1766                                          Py_ssize_t start, Py_ssize_t end, int direction);
1767 static int __Pyx_PyBytes_Tailmatch(PyObject* self, PyObject* substr,
1768                                    Py_ssize_t start, Py_ssize_t end, int direction);
1769 
1770 /* ArgTypeTest.proto */
1771 #define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\
1772     ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\
1773         __Pyx__ArgTypeTest(obj, type, name, exact))
1774 static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact);
1775 
1776 /* GetAttr.proto */
1777 static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *);
1778 
1779 /* HasAttr.proto */
1780 static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *);
1781 
1782 /* PyDictContains.proto */
__Pyx_PyDict_ContainsTF(PyObject * item,PyObject * dict,int eq)1783 static CYTHON_INLINE int __Pyx_PyDict_ContainsTF(PyObject* item, PyObject* dict, int eq) {
1784     int result = PyDict_Contains(dict, item);
1785     return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
1786 }
1787 
1788 /* ListAppend.proto */
1789 #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
__Pyx_PyList_Append(PyObject * list,PyObject * x)1790 static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
1791     PyListObject* L = (PyListObject*) list;
1792     Py_ssize_t len = Py_SIZE(list);
1793     if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) {
1794         Py_INCREF(x);
1795         PyList_SET_ITEM(list, len, x);
1796         __Pyx_SET_SIZE(list, len + 1);
1797         return 0;
1798     }
1799     return PyList_Append(list, x);
1800 }
1801 #else
1802 #define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
1803 #endif
1804 
1805 /* PyObjectCallMethod1.proto */
1806 static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg);
1807 
1808 /* append.proto */
1809 static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x);
1810 
1811 /* DictGetItem.proto */
1812 #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
1813 static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key);
1814 #define __Pyx_PyObject_Dict_GetItem(obj, name)\
1815     (likely(PyDict_CheckExact(obj)) ?\
1816      __Pyx_PyDict_GetItem(obj, name) : PyObject_GetItem(obj, name))
1817 #else
1818 #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
1819 #define __Pyx_PyObject_Dict_GetItem(obj, name)  PyObject_GetItem(obj, name)
1820 #endif
1821 
1822 /* pop.proto */
1823 static CYTHON_INLINE PyObject* __Pyx__PyObject_Pop(PyObject* L);
1824 #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
1825 static CYTHON_INLINE PyObject* __Pyx_PyList_Pop(PyObject* L);
1826 #define __Pyx_PyObject_Pop(L) (likely(PyList_CheckExact(L)) ?\
1827     __Pyx_PyList_Pop(L) : __Pyx__PyObject_Pop(L))
1828 #else
1829 #define __Pyx_PyList_Pop(L)  __Pyx__PyObject_Pop(L)
1830 #define __Pyx_PyObject_Pop(L)  __Pyx__PyObject_Pop(L)
1831 #endif
1832 
1833 /* UnpackUnboundCMethod.proto */
1834 typedef struct {
1835     PyObject *type;
1836     PyObject **method_name;
1837     PyCFunction func;
1838     PyObject *method;
1839     int flag;
1840 } __Pyx_CachedCFunction;
1841 
1842 /* CallUnboundCMethod0.proto */
1843 static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self);
1844 #if CYTHON_COMPILING_IN_CPYTHON
1845 #define __Pyx_CallUnboundCMethod0(cfunc, self)\
1846     (likely((cfunc)->func) ?\
1847         (likely((cfunc)->flag == METH_NOARGS) ?  (*((cfunc)->func))(self, NULL) :\
1848          (PY_VERSION_HEX >= 0x030600B1 && likely((cfunc)->flag == METH_FASTCALL) ?\
1849             (PY_VERSION_HEX >= 0x030700A0 ?\
1850                 (*(__Pyx_PyCFunctionFast)(void*)(PyCFunction)(cfunc)->func)(self, &__pyx_empty_tuple, 0) :\
1851                 (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)(cfunc)->func)(self, &__pyx_empty_tuple, 0, NULL)) :\
1852           (PY_VERSION_HEX >= 0x030700A0 && (cfunc)->flag == (METH_FASTCALL | METH_KEYWORDS) ?\
1853             (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)(cfunc)->func)(self, &__pyx_empty_tuple, 0, NULL) :\
1854             (likely((cfunc)->flag == (METH_VARARGS | METH_KEYWORDS)) ?  ((*(PyCFunctionWithKeywords)(void*)(PyCFunction)(cfunc)->func)(self, __pyx_empty_tuple, NULL)) :\
1855                ((cfunc)->flag == METH_VARARGS ?  (*((cfunc)->func))(self, __pyx_empty_tuple) :\
1856                __Pyx__CallUnboundCMethod0(cfunc, self)))))) :\
1857         __Pyx__CallUnboundCMethod0(cfunc, self))
1858 #else
1859 #define __Pyx_CallUnboundCMethod0(cfunc, self)  __Pyx__CallUnboundCMethod0(cfunc, self)
1860 #endif
1861 
1862 /* IterNext.proto */
1863 #define __Pyx_PyIter_Next(obj) __Pyx_PyIter_Next2(obj, NULL)
1864 static CYTHON_INLINE PyObject *__Pyx_PyIter_Next2(PyObject *, PyObject *);
1865 
1866 /* PyObject_GenericGetAttrNoDict.proto */
1867 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
1868 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name);
1869 #else
1870 #define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr
1871 #endif
1872 
1873 /* PyObject_GenericGetAttr.proto */
1874 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
1875 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name);
1876 #else
1877 #define __Pyx_PyObject_GenericGetAttr PyObject_GenericGetAttr
1878 #endif
1879 
1880 /* PyObjectGetAttrStrNoError.proto */
1881 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name);
1882 
1883 /* SetupReduce.proto */
1884 static int __Pyx_setup_reduce(PyObject* type_obj);
1885 
1886 /* SetVTable.proto */
1887 static int __Pyx_SetVtable(PyObject *dict, void *vtable);
1888 
1889 /* TypeImport.proto */
1890 #ifndef __PYX_HAVE_RT_ImportType_proto
1891 #define __PYX_HAVE_RT_ImportType_proto
1892 enum __Pyx_ImportType_CheckSize {
1893    __Pyx_ImportType_CheckSize_Error = 0,
1894    __Pyx_ImportType_CheckSize_Warn = 1,
1895    __Pyx_ImportType_CheckSize_Ignore = 2
1896 };
1897 static PyTypeObject *__Pyx_ImportType(PyObject* module, const char *module_name, const char *class_name, size_t size, enum __Pyx_ImportType_CheckSize check_size);
1898 #endif
1899 
1900 /* Import.proto */
1901 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
1902 
1903 /* ImportFrom.proto */
1904 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);
1905 
1906 /* CalculateMetaclass.proto */
1907 static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases);
1908 
1909 /* Py3ClassCreate.proto */
1910 static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, PyObject *qualname,
1911                                            PyObject *mkw, PyObject *modname, PyObject *doc);
1912 static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases, PyObject *dict,
1913                                       PyObject *mkw, int calculate_metaclass, int allow_py2_metaclass);
1914 
1915 /* CLineInTraceback.proto */
1916 #ifdef CYTHON_CLINE_IN_TRACEBACK
1917 #define __Pyx_CLineForTraceback(tstate, c_line)  (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
1918 #else
1919 static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
1920 #endif
1921 
1922 /* CodeObjectCache.proto */
1923 typedef struct {
1924     PyCodeObject* code_object;
1925     int code_line;
1926 } __Pyx_CodeObjectCacheEntry;
1927 struct __Pyx_CodeObjectCache {
1928     int count;
1929     int max_count;
1930     __Pyx_CodeObjectCacheEntry* entries;
1931 };
1932 static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
1933 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
1934 static PyCodeObject *__pyx_find_code_object(int code_line);
1935 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
1936 
1937 /* AddTraceback.proto */
1938 static void __Pyx_AddTraceback(const char *funcname, int c_line,
1939                                int py_line, const char *filename);
1940 
1941 /* GCCDiagnostics.proto */
1942 #if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
1943 #define __Pyx_HAS_GCC_DIAGNOSTIC
1944 #endif
1945 
1946 /* CIntToPy.proto */
1947 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
1948 
1949 /* CIntFromPy.proto */
1950 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
1951 
1952 /* CIntFromPy.proto */
1953 static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *);
1954 
1955 /* CIntToPy.proto */
1956 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
1957 
1958 /* CIntFromPy.proto */
1959 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
1960 
1961 /* FastTypeChecks.proto */
1962 #if CYTHON_COMPILING_IN_CPYTHON
1963 #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
1964 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
1965 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
1966 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
1967 #else
1968 #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
1969 #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
1970 #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
1971 #endif
1972 #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
1973 
1974 /* CheckBinaryVersion.proto */
1975 static int __Pyx_check_binary_version(void);
1976 
1977 /* InitStrings.proto */
1978 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
1979 
1980 static int __pyx_f_4lupa_5_lupa_10LuaRuntime_reraise_on_exception(struct __pyx_obj_4lupa_5_lupa_LuaRuntime *__pyx_v_self); /* proto*/
1981 static int __pyx_f_4lupa_5_lupa_10LuaRuntime_store_raised_exception(struct __pyx_obj_4lupa_5_lupa_LuaRuntime *__pyx_v_self, lua_State *__pyx_v_L, PyObject *__pyx_v_lua_error_msg); /* proto*/
1982 static int __pyx_f_4lupa_5_lupa_10LuaRuntime_register_py_object(struct __pyx_obj_4lupa_5_lupa_LuaRuntime *__pyx_v_self, PyObject *__pyx_v_cname, PyObject *__pyx_v_pyname, PyObject *__pyx_v_obj); /* proto*/
1983 static int __pyx_f_4lupa_5_lupa_10LuaRuntime_init_python_lib(struct __pyx_obj_4lupa_5_lupa_LuaRuntime *__pyx_v_self, int __pyx_v_register_eval, int __pyx_v_register_builtins); /* proto*/
1984 static CYTHON_INLINE int __pyx_f_4lupa_5_lupa_10_LuaObject_push_lua_object(struct __pyx_obj_4lupa_5_lupa__LuaObject *__pyx_v_self); /* proto*/
1985 static size_t __pyx_f_4lupa_5_lupa_10_LuaObject__len(struct __pyx_obj_4lupa_5_lupa__LuaObject *__pyx_v_self); /* proto*/
1986 static PyObject *__pyx_f_4lupa_5_lupa_10_LuaObject__getitem(struct __pyx_obj_4lupa_5_lupa__LuaObject *__pyx_v_self, PyObject *__pyx_v_name, int __pyx_v_is_attr_access); /* proto*/
1987 static int __pyx_f_4lupa_5_lupa_9_LuaTable__setitem(struct __pyx_obj_4lupa_5_lupa__LuaTable *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_value); /* proto*/
1988 static PyObject *__pyx_f_4lupa_5_lupa_9_LuaTable__delitem(struct __pyx_obj_4lupa_5_lupa__LuaTable *__pyx_v_self, PyObject *__pyx_v_name); /* proto*/
1989 
1990 /* Module declarations from 'cython' */
1991 
1992 /* Module declarations from 'libc.string' */
1993 
1994 /* Module declarations from 'lupa' */
1995 
1996 /* Module declarations from 'lupa.lua' */
1997 
1998 /* Module declarations from 'libc.stdio' */
1999 
2000 /* Module declarations from '__builtin__' */
2001 
2002 /* Module declarations from 'cpython.type' */
2003 static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;
2004 
2005 /* Module declarations from 'cpython.tuple' */
2006 
2007 /* Module declarations from 'cpython.float' */
2008 
2009 /* Module declarations from 'cpython.long' */
2010 
2011 /* Module declarations from 'cpython.version' */
2012 
2013 /* Module declarations from 'cpython.exc' */
2014 
2015 /* Module declarations from 'cpython.module' */
2016 
2017 /* Module declarations from 'cpython.mem' */
2018 
2019 /* Module declarations from 'cpython.list' */
2020 
2021 /* Module declarations from 'cpython.sequence' */
2022 
2023 /* Module declarations from 'cpython.mapping' */
2024 
2025 /* Module declarations from 'cpython.iterator' */
2026 
2027 /* Module declarations from 'cpython.number' */
2028 
2029 /* Module declarations from 'cpython.int' */
2030 
2031 /* Module declarations from '__builtin__' */
2032 
2033 /* Module declarations from 'cpython.bool' */
2034 static PyTypeObject *__pyx_ptype_7cpython_4bool_bool = 0;
2035 
2036 /* Module declarations from '__builtin__' */
2037 
2038 /* Module declarations from 'cpython.complex' */
2039 static PyTypeObject *__pyx_ptype_7cpython_7complex_complex = 0;
2040 
2041 /* Module declarations from 'cpython.string' */
2042 
2043 /* Module declarations from 'cpython.unicode' */
2044 
2045 /* Module declarations from 'cpython.dict' */
2046 
2047 /* Module declarations from 'cpython.instance' */
2048 
2049 /* Module declarations from 'cpython.function' */
2050 
2051 /* Module declarations from 'cpython.method' */
2052 
2053 /* Module declarations from 'cpython.weakref' */
2054 
2055 /* Module declarations from 'cpython.getargs' */
2056 
2057 /* Module declarations from 'cpython.pythread' */
2058 
2059 /* Module declarations from 'cpython.pystate' */
2060 
2061 /* Module declarations from 'cpython.cobject' */
2062 
2063 /* Module declarations from 'cpython.oldbuffer' */
2064 
2065 /* Module declarations from 'cpython.set' */
2066 
2067 /* Module declarations from 'cpython.buffer' */
2068 
2069 /* Module declarations from 'cpython.bytes' */
2070 
2071 /* Module declarations from 'cpython.pycapsule' */
2072 
2073 /* Module declarations from 'cpython' */
2074 
2075 /* Module declarations from 'cpython.object' */
2076 
2077 /* Module declarations from 'cpython.ref' */
2078 
2079 /* Module declarations from 'lupa._lupa' */
2080 static PyTypeObject *__pyx_ptype_4lupa_5_lupa_FastRLock = 0;
2081 static PyTypeObject *__pyx_ptype_4lupa_5_lupa_LuaRuntime = 0;
2082 static PyTypeObject *__pyx_ptype_4lupa_5_lupa__LuaObject = 0;
2083 static PyTypeObject *__pyx_ptype_4lupa_5_lupa__LuaTable = 0;
2084 static PyTypeObject *__pyx_ptype_4lupa_5_lupa__LuaFunction = 0;
2085 static PyTypeObject *__pyx_ptype_4lupa_5_lupa__LuaCoroutineFunction = 0;
2086 static PyTypeObject *__pyx_ptype_4lupa_5_lupa__LuaThread = 0;
2087 static PyTypeObject *__pyx_ptype_4lupa_5_lupa__LuaIter = 0;
2088 static PyTypeObject *__pyx_ptype_4lupa_5_lupa__PyProtocolWrapper = 0;
2089 static PyTypeObject *__pyx_ptype_4lupa_5_lupa___pyx_scope_struct__unpacks_lua_table = 0;
2090 static PyTypeObject *__pyx_ptype_4lupa_5_lupa___pyx_scope_struct_1_unpacks_lua_table_method = 0;
2091 static PyObject *__pyx_v_4lupa_5_lupa_exc_info = 0;
2092 static PyObject *__pyx_v_4lupa_5_lupa_Mapping = 0;
2093 static PyObject *__pyx_v_4lupa_5_lupa_wraps = 0;
2094 static PyObject *__pyx_v_4lupa_5_lupa_builtins = 0;
2095 static int __pyx_v_4lupa_5_lupa__LUA_VERSION;
2096 static luaL_Reg *__pyx_v_4lupa_5_lupa_py_object_lib;
2097 static luaL_Reg *__pyx_v_4lupa_5_lupa_py_lib;
2098 static CYTHON_INLINE int __pyx_f_4lupa_5_lupa_lock_lock(struct __pyx_obj_4lupa_5_lupa_FastRLock *, long, int); /*proto*/
2099 static int __pyx_f_4lupa_5_lupa__acquire_lock(struct __pyx_obj_4lupa_5_lupa_FastRLock *, long, int); /*proto*/
2100 static CYTHON_INLINE void __pyx_f_4lupa_5_lupa_unlock_lock(struct __pyx_obj_4lupa_5_lupa_FastRLock *); /*proto*/
2101 static PyObject *__pyx_f_4lupa_5_lupa__fix_args_kwargs(PyObject *); /*proto*/
2102 static CYTHON_INLINE int __pyx_f_4lupa_5_lupa_lock_runtime(struct __pyx_obj_4lupa_5_lupa_LuaRuntime *); /*proto*/
2103 static CYTHON_INLINE void __pyx_f_4lupa_5_lupa_unlock_runtime(struct __pyx_obj_4lupa_5_lupa_LuaRuntime *); /*proto*/
2104 static struct __pyx_obj_4lupa_5_lupa__LuaObject *__pyx_f_4lupa_5_lupa_new_lua_object(struct __pyx_obj_4lupa_5_lupa_LuaRuntime *, lua_State *, int); /*proto*/
2105 static void __pyx_f_4lupa_5_lupa_init_lua_object(struct __pyx_obj_4lupa_5_lupa__LuaObject *, struct __pyx_obj_4lupa_5_lupa_LuaRuntime *, lua_State *, int); /*proto*/
2106 static PyObject *__pyx_f_4lupa_5_lupa_lua_object_repr(lua_State *, PyObject *); /*proto*/
2107 static struct __pyx_obj_4lupa_5_lupa__LuaTable *__pyx_f_4lupa_5_lupa_new_lua_table(struct __pyx_obj_4lupa_5_lupa_LuaRuntime *, lua_State *, int); /*proto*/
2108 static struct __pyx_obj_4lupa_5_lupa__LuaFunction *__pyx_f_4lupa_5_lupa_new_lua_function(struct __pyx_obj_4lupa_5_lupa_LuaRuntime *, lua_State *, int); /*proto*/
2109 static struct __pyx_obj_4lupa_5_lupa__LuaCoroutineFunction *__pyx_f_4lupa_5_lupa_new_lua_coroutine_function(struct __pyx_obj_4lupa_5_lupa_LuaRuntime *, lua_State *, int); /*proto*/
2110 static struct __pyx_obj_4lupa_5_lupa__LuaThread *__pyx_f_4lupa_5_lupa_new_lua_thread(struct __pyx_obj_4lupa_5_lupa_LuaRuntime *, lua_State *, int); /*proto*/
2111 static struct __pyx_obj_4lupa_5_lupa__LuaObject *__pyx_f_4lupa_5_lupa_new_lua_thread_or_function(struct __pyx_obj_4lupa_5_lupa_LuaRuntime *, lua_State *, int); /*proto*/
2112 static PyObject *__pyx_f_4lupa_5_lupa_resume_lua_thread(struct __pyx_obj_4lupa_5_lupa__LuaThread *, PyObject *); /*proto*/
2113 static int __pyx_f_4lupa_5_lupa_py_asfunc_call(lua_State *); /*proto*/
2114 static struct __pyx_t_4lupa_5_lupa_py_object *__pyx_f_4lupa_5_lupa_unpack_wrapped_pyfunction(lua_State *, int); /*proto*/
2115 static PyObject *__pyx_f_4lupa_5_lupa_py_from_lua(struct __pyx_obj_4lupa_5_lupa_LuaRuntime *, lua_State *, int); /*proto*/
2116 static struct __pyx_t_4lupa_5_lupa_py_object *__pyx_f_4lupa_5_lupa_unpack_userdata(lua_State *, int); /*proto*/
2117 static int __pyx_f_4lupa_5_lupa_py_function_result_to_lua(struct __pyx_obj_4lupa_5_lupa_LuaRuntime *, lua_State *, PyObject *); /*proto*/
2118 static int __pyx_f_4lupa_5_lupa_py_to_lua(struct __pyx_obj_4lupa_5_lupa_LuaRuntime *, lua_State *, PyObject *, struct __pyx_opt_args_4lupa_5_lupa_py_to_lua *__pyx_optional_args); /*proto*/
2119 static int __pyx_f_4lupa_5_lupa_push_encoded_unicode_string(struct __pyx_obj_4lupa_5_lupa_LuaRuntime *, lua_State *, PyObject *); /*proto*/
2120 static int __pyx_f_4lupa_5_lupa_py_to_lua_custom(struct __pyx_obj_4lupa_5_lupa_LuaRuntime *, lua_State *, PyObject *, int); /*proto*/
2121 static CYTHON_INLINE int __pyx_f_4lupa_5_lupa__isascii(unsigned char *); /*proto*/
2122 static PyObject *__pyx_f_4lupa_5_lupa__asciiOrNone(PyObject *); /*proto*/
2123 static int __pyx_f_4lupa_5_lupa_raise_lua_error(struct __pyx_obj_4lupa_5_lupa_LuaRuntime *, lua_State *, int); /*proto*/
2124 static PyObject *__pyx_f_4lupa_5_lupa_build_lua_error_message(struct __pyx_obj_4lupa_5_lupa_LuaRuntime *, lua_State *, PyObject *, int); /*proto*/
2125 static PyObject *__pyx_f_4lupa_5_lupa_run_lua(struct __pyx_obj_4lupa_5_lupa_LuaRuntime *, PyObject *, PyObject *); /*proto*/
2126 static PyObject *__pyx_f_4lupa_5_lupa_call_lua(struct __pyx_obj_4lupa_5_lupa_LuaRuntime *, lua_State *, PyObject *); /*proto*/
2127 static PyObject *__pyx_f_4lupa_5_lupa_execute_lua_call(struct __pyx_obj_4lupa_5_lupa_LuaRuntime *, lua_State *, Py_ssize_t); /*proto*/
2128 static int __pyx_f_4lupa_5_lupa_push_lua_arguments(struct __pyx_obj_4lupa_5_lupa_LuaRuntime *, lua_State *, PyObject *, struct __pyx_opt_args_4lupa_5_lupa_push_lua_arguments *__pyx_optional_args); /*proto*/
2129 static CYTHON_INLINE PyObject *__pyx_f_4lupa_5_lupa_unpack_lua_results(struct __pyx_obj_4lupa_5_lupa_LuaRuntime *, lua_State *); /*proto*/
2130 static PyObject *__pyx_f_4lupa_5_lupa_unpack_multiple_lua_results(struct __pyx_obj_4lupa_5_lupa_LuaRuntime *, lua_State *, int); /*proto*/
2131 static int __pyx_f_4lupa_5_lupa_decref_with_gil(struct __pyx_t_4lupa_5_lupa_py_object *, lua_State *); /*proto*/
2132 static int __pyx_f_4lupa_5_lupa_py_object_gc(lua_State *); /*proto*/
2133 static int __pyx_f_4lupa_5_lupa_call_python(struct __pyx_obj_4lupa_5_lupa_LuaRuntime *, lua_State *, struct __pyx_t_4lupa_5_lupa_py_object *); /*proto*/
2134 static int __pyx_f_4lupa_5_lupa_py_call_with_gil(lua_State *, struct __pyx_t_4lupa_5_lupa_py_object *); /*proto*/
2135 static int __pyx_f_4lupa_5_lupa_py_object_call(lua_State *); /*proto*/
2136 static int __pyx_f_4lupa_5_lupa_py_str_with_gil(lua_State *, struct __pyx_t_4lupa_5_lupa_py_object *); /*proto*/
2137 static int __pyx_f_4lupa_5_lupa_py_object_str(lua_State *); /*proto*/
2138 static int __pyx_f_4lupa_5_lupa_getitem_for_lua(struct __pyx_obj_4lupa_5_lupa_LuaRuntime *, lua_State *, struct __pyx_t_4lupa_5_lupa_py_object *, int); /*proto*/
2139 static int __pyx_f_4lupa_5_lupa_setitem_for_lua(struct __pyx_obj_4lupa_5_lupa_LuaRuntime *, lua_State *, struct __pyx_t_4lupa_5_lupa_py_object *, int, int); /*proto*/
2140 static int __pyx_f_4lupa_5_lupa_getattr_for_lua(struct __pyx_obj_4lupa_5_lupa_LuaRuntime *, lua_State *, struct __pyx_t_4lupa_5_lupa_py_object *, int); /*proto*/
2141 static int __pyx_f_4lupa_5_lupa_setattr_for_lua(struct __pyx_obj_4lupa_5_lupa_LuaRuntime *, lua_State *, struct __pyx_t_4lupa_5_lupa_py_object *, int, int); /*proto*/
2142 static int __pyx_f_4lupa_5_lupa_py_object_getindex_with_gil(lua_State *, struct __pyx_t_4lupa_5_lupa_py_object *); /*proto*/
2143 static int __pyx_f_4lupa_5_lupa_py_object_getindex(lua_State *); /*proto*/
2144 static int __pyx_f_4lupa_5_lupa_py_object_setindex_with_gil(lua_State *, struct __pyx_t_4lupa_5_lupa_py_object *); /*proto*/
2145 static int __pyx_f_4lupa_5_lupa_py_object_setindex(lua_State *); /*proto*/
2146 static CYTHON_INLINE struct __pyx_t_4lupa_5_lupa_py_object *__pyx_f_4lupa_5_lupa_unpack_single_python_argument_or_jump(lua_State *); /*proto*/
2147 static struct __pyx_t_4lupa_5_lupa_py_object *__pyx_f_4lupa_5_lupa_unwrap_lua_object(lua_State *, int); /*proto*/
2148 static int __pyx_f_4lupa_5_lupa_py_wrap_object_protocol_with_gil(lua_State *, struct __pyx_t_4lupa_5_lupa_py_object *, int); /*proto*/
2149 static int __pyx_f_4lupa_5_lupa_py_wrap_object_protocol(lua_State *, int); /*proto*/
2150 static int __pyx_f_4lupa_5_lupa_py_as_attrgetter(lua_State *); /*proto*/
2151 static int __pyx_f_4lupa_5_lupa_py_as_itemgetter(lua_State *); /*proto*/
2152 static int __pyx_f_4lupa_5_lupa_py_as_function(lua_State *); /*proto*/
2153 static int __pyx_f_4lupa_5_lupa_py_iter(lua_State *); /*proto*/
2154 static int __pyx_f_4lupa_5_lupa_py_iterex(lua_State *); /*proto*/
2155 static int __pyx_f_4lupa_5_lupa_py_enumerate(lua_State *); /*proto*/
2156 static int __pyx_f_4lupa_5_lupa_py_enumerate_with_gil(lua_State *, struct __pyx_t_4lupa_5_lupa_py_object *, double); /*proto*/
2157 static int __pyx_f_4lupa_5_lupa_py_iter_with_gil(lua_State *, struct __pyx_t_4lupa_5_lupa_py_object *, int); /*proto*/
2158 static int __pyx_f_4lupa_5_lupa_py_push_iterator(struct __pyx_obj_4lupa_5_lupa_LuaRuntime *, lua_State *, PyObject *, int, lua_Number); /*proto*/
2159 static int __pyx_f_4lupa_5_lupa_py_iter_next(lua_State *); /*proto*/
2160 static int __pyx_f_4lupa_5_lupa_py_iter_next_with_gil(lua_State *, struct __pyx_t_4lupa_5_lupa_py_object *); /*proto*/
2161 static void __pyx_f_4lupa_5_lupa_luaL_setfuncs(lua_State *, luaL_Reg const *, int); /*proto*/
2162 static int __pyx_f_4lupa_5_lupa_libsize(luaL_Reg const *); /*proto*/
2163 static char const *__pyx_f_4lupa_5_lupa_luaL_findtable(lua_State *, int, char const *, int); /*proto*/
2164 static void __pyx_f_4lupa_5_lupa_luaL_pushmodule(lua_State *, char const *, int); /*proto*/
2165 static void __pyx_f_4lupa_5_lupa_luaL_openlib(lua_State *, char const *, luaL_Reg const *, int); /*proto*/
2166 #define __Pyx_MODULE_NAME "lupa._lupa"
2167 extern int __pyx_module_is_main_lupa___lupa;
2168 int __pyx_module_is_main_lupa___lupa = 0;
2169 
2170 /* Implementation of 'lupa._lupa' */
2171 static PyObject *__pyx_builtin_ImportError;
2172 static PyObject *__pyx_builtin_MemoryError;
2173 static PyObject *__pyx_builtin_RuntimeError;
2174 static PyObject *__pyx_builtin_TypeError;
2175 static PyObject *__pyx_builtin_ValueError;
2176 static PyObject *__pyx_builtin_eval;
2177 static PyObject *__pyx_builtin_range;
2178 static PyObject *__pyx_builtin_UnicodeDecodeError;
2179 static PyObject *__pyx_builtin_object;
2180 static PyObject *__pyx_builtin_AttributeError;
2181 static PyObject *__pyx_builtin_StopIteration;
2182 static PyObject *__pyx_builtin_BaseException;
2183 static PyObject *__pyx_builtin_enumerate;
2184 static PyObject *__pyx_builtin_KeyError;
2185 static const char __pyx_k_L[] = "L";
2186 static const char __pyx_k_i[] = "i";
2187 static const char __pyx_k_t[] = "t";
2188 static const char __pyx_k_v[] = "v";
2189 static const char __pyx_k_co[] = "co";
2190 static const char __pyx_k_tb[] = "tb";
2191 static const char __pyx_k__16[] = "__";
2192 static const char __pyx_k_all[] = "__all__";
2193 static const char __pyx_k_arg[] = "arg";
2194 static const char __pyx_k_doc[] = "__doc__";
2195 static const char __pyx_k_err[] = "err";
2196 static const char __pyx_k_key[] = "key";
2197 static const char __pyx_k_obj[] = "obj";
2198 static const char __pyx_k_pop[] = "pop";
2199 static const char __pyx_k_sys[] = "sys";
2200 static const char __pyx_k_args[] = "args";
2201 static const char __pyx_k_eval[] = "eval";
2202 static const char __pyx_k_exit[] = "__exit__";
2203 static const char __pyx_k_func[] = "func";
2204 static const char __pyx_k_keys[] = "keys";
2205 static const char __pyx_k_main[] = "__main__";
2206 static const char __pyx_k_meth[] = "meth";
2207 static const char __pyx_k_name[] = "__name__";
2208 static const char __pyx_k_none[] = "none";
2209 static const char __pyx_k_self[] = "self";
2210 static const char __pyx_k_send[] = "send";
2211 static const char __pyx_k_size[] = "size";
2212 static const char __pyx_k_test[] = "__test__";
2213 static const char __pyx_k_what[] = "what";
2214 static const char __pyx_k_wrap[] = "wrap";
2215 static const char __pyx_k_UTF_8[] = "UTF-8";
2216 static const char __pyx_k_enter[] = "__enter__";
2217 static const char __pyx_k_error[] = "error";
2218 static const char __pyx_k_items[] = "items";
2219 static const char __pyx_k_ltype[] = "ltype";
2220 static const char __pyx_k_range[] = "range";
2221 static const char __pyx_k_table[] = "table";
2222 static const char __pyx_k_value[] = "value";
2223 static const char __pyx_k_wraps[] = "wraps";
2224 static const char __pyx_k_append[] = "append";
2225 static const char __pyx_k_import[] = "__import__";
2226 static const char __pyx_k_kwargs[] = "kwargs";
2227 static const char __pyx_k_module[] = "__module__";
2228 static const char __pyx_k_name_2[] = "name";
2229 static const char __pyx_k_object[] = "object";
2230 static const char __pyx_k_oldtop[] = "oldtop";
2231 static const char __pyx_k_reduce[] = "__reduce__";
2232 static const char __pyx_k_return[] = "return ";
2233 static const char __pyx_k_status[] = "status";
2234 static const char __pyx_k_thread[] = "thread";
2235 static const char __pyx_k_values[] = "values";
2236 static const char __pyx_k_Mapping[] = "Mapping";
2237 static const char __pyx_k_Py_None[] = "Py_None";
2238 static const char __pyx_k_acquire[] = "acquire";
2239 static const char __pyx_k_builtin[] = "__builtin__";
2240 static const char __pyx_k_compile[] = "compile";
2241 static const char __pyx_k_delattr[] = "__delattr__";
2242 static const char __pyx_k_execute[] = "execute";
2243 static const char __pyx_k_getattr[] = "__getattr__";
2244 static const char __pyx_k_getitem[] = "__getitem__";
2245 static const char __pyx_k_globals[] = "globals";
2246 static const char __pyx_k_old_top[] = "old_top";
2247 static const char __pyx_k_prepare[] = "__prepare__";
2248 static const char __pyx_k_release[] = "release";
2249 static const char __pyx_k_require[] = "require";
2250 static const char __pyx_k_setattr[] = "__setattr__";
2251 static const char __pyx_k_wrapper[] = "wrapper";
2252 static const char __pyx_k_KeyError[] = "KeyError";
2253 static const char __pyx_k_LuaError[] = "LuaError";
2254 static const char __pyx_k_blocking[] = "blocking";
2255 static const char __pyx_k_builtins[] = "builtins";
2256 static const char __pyx_k_encoding[] = "encoding";
2257 static const char __pyx_k_exc_info[] = "exc_info";
2258 static const char __pyx_k_function[] = "function";
2259 static const char __pyx_k_getstate[] = "__getstate__";
2260 static const char __pyx_k_is_owned[] = "_is_owned";
2261 static const char __pyx_k_lua_code[] = "lua_code";
2262 static const char __pyx_k_lua_type[] = "lua_type";
2263 static const char __pyx_k_qualname[] = "__qualname__";
2264 static const char __pyx_k_setstate[] = "__setstate__";
2265 static const char __pyx_k_userdata[] = "userdata";
2266 static const char __pyx_k_FastRLock[] = "FastRLock";
2267 static const char __pyx_k_LuaIter_r[] = "LuaIter(%r)";
2268 static const char __pyx_k_TypeError[] = "TypeError";
2269 static const char __pyx_k_coroutine[] = "coroutine";
2270 static const char __pyx_k_enumerate[] = "enumerate";
2271 static const char __pyx_k_functools[] = "functools";
2272 static const char __pyx_k_iteritems[] = "iteritems";
2273 static const char __pyx_k_metaclass[] = "__metaclass__";
2274 static const char __pyx_k_pyx_state[] = "__pyx_state";
2275 static const char __pyx_k_reduce_ex[] = "__reduce_ex__";
2276 static const char __pyx_k_LuaRuntime[] = "LuaRuntime";
2277 static const char __pyx_k_ValueError[] = "ValueError";
2278 static const char __pyx_k_lua_object[] = "lua_object";
2279 static const char __pyx_k_lupa__lupa[] = "lupa._lupa";
2280 static const char __pyx_k_modulename[] = "modulename";
2281 static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__";
2282 static const char __pyx_k_table_from[] = "table_from";
2283 static const char __pyx_k_ImportError[] = "ImportError";
2284 static const char __pyx_k_LUA_VERSION[] = "LUA_VERSION";
2285 static const char __pyx_k_MemoryError[] = "MemoryError";
2286 static const char __pyx_k_collections[] = "collections";
2287 static const char __pyx_k_RuntimeError[] = "RuntimeError";
2288 static const char __pyx_k_stringsource[] = "stringsource";
2289 static const char __pyx_k_BaseException[] = "BaseException";
2290 static const char __pyx_k_LuaTable_keys[] = "_LuaTable.keys";
2291 static const char __pyx_k_StopIteration[] = "StopIteration";
2292 static const char __pyx_k_as_attrgetter[] = "as_attrgetter";
2293 static const char __pyx_k_as_itemgetter[] = "as_itemgetter";
2294 static const char __pyx_k_lua_type_name[] = "lua_type_name";
2295 static const char __pyx_k_lupa_lock_pxi[] = "lupa/lock.pxi";
2296 static const char __pyx_k_reduce_cython[] = "__reduce_cython__";
2297 static const char __pyx_k_register_eval[] = "register_eval";
2298 static const char __pyx_k_AttributeError[] = "AttributeError";
2299 static const char __pyx_k_LuaSyntaxError[] = "LuaSyntaxError";
2300 static const char __pyx_k_LuaTable_items[] = "_LuaTable.items";
2301 static const char __pyx_k_LuaThread_send[] = "_LuaThread.send";
2302 static const char __pyx_k_lost_reference[] = "lost reference";
2303 static const char __pyx_k_lupa__lupa_pyx[] = "lupa/_lupa.pyx";
2304 static const char __pyx_k_LuaRuntime_eval[] = "LuaRuntime.eval";
2305 static const char __pyx_k_LuaTable_values[] = "_LuaTable.values";
2306 static const char __pyx_k_collections_abc[] = "collections.abc";
2307 static const char __pyx_k_setstate_cython[] = "__setstate_cython__";
2308 static const char __pyx_k_source_encoding[] = "source_encoding";
2309 static const char __pyx_k_FastRLock___exit[] = "FastRLock.__exit__";
2310 static const char __pyx_k_LuaRuntime_table[] = "LuaRuntime.table";
2311 static const char __pyx_k_attribute_filter[] = "attribute_filter";
2312 static const char __pyx_k_FastRLock___enter[] = "FastRLock.__enter__";
2313 static const char __pyx_k_FastRLock_acquire[] = "FastRLock.acquire";
2314 static const char __pyx_k_FastRLock_release[] = "FastRLock.release";
2315 static const char __pyx_k_register_builtins[] = "register_builtins";
2316 static const char __pyx_k_unpacks_lua_table[] = "unpacks_lua_table";
2317 static const char __pyx_k_LuaRuntime_compile[] = "LuaRuntime.compile";
2318 static const char __pyx_k_LuaRuntime_execute[] = "LuaRuntime.execute";
2319 static const char __pyx_k_LuaRuntime_globals[] = "LuaRuntime.globals";
2320 static const char __pyx_k_LuaRuntime_require[] = "LuaRuntime.require";
2321 static const char __pyx_k_UnicodeDecodeError[] = "UnicodeDecodeError";
2322 static const char __pyx_k_attribute_handlers[] = "attribute_handlers";
2323 static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
2324 static const char __pyx_k_FastRLock__is_owned[] = "FastRLock._is_owned";
2325 static const char __pyx_k_globals_not_defined[] = "globals not defined";
2326 static const char __pyx_k_not_a_python_object[] = "not a python object";
2327 static const char __pyx_k_error_loading_code_s[] = "error loading code: %s";
2328 static const char __pyx_k_LuaFunction_coroutine[] = "_LuaFunction.coroutine";
2329 static const char __pyx_k_LuaRuntime_table_from[] = "LuaRuntime.table_from";
2330 static const char __pyx_k_expected_string_got_s[] = "expected string, got %s";
2331 static const char __pyx_k_require_is_not_defined[] = "require is not defined";
2332 static const char __pyx_k_unpack_returned_tuples[] = "unpack_returned_tuples";
2333 static const char __pyx_k_LuaIter___reduce_cython[] = "_LuaIter.__reduce_cython__";
2334 static const char __pyx_k_LuaTable___reduce_cython[] = "_LuaTable.__reduce_cython__";
2335 static const char __pyx_k_Syntax_error_in_Lua_code[] = "Syntax error in Lua code.\n    ";
2336 static const char __pyx_k_error_during_Python_call[] = "error during Python call";
2337 static const char __pyx_k_unpacks_lua_table_method[] = "unpacks_lua_table_method";
2338 static const char __pyx_k_FastRLock___reduce_cython[] = "FastRLock.__reduce_cython__";
2339 static const char __pyx_k_LuaIter___setstate_cython[] = "_LuaIter.__setstate_cython__";
2340 static const char __pyx_k_LuaObject___reduce_cython[] = "_LuaObject.__reduce_cython__";
2341 static const char __pyx_k_LuaThread___reduce_cython[] = "_LuaThread.__reduce_cython__";
2342 static const char __pyx_k_LuaRuntime___reduce_cython[] = "LuaRuntime.__reduce_cython__";
2343 static const char __pyx_k_LuaTable___setstate_cython[] = "_LuaTable.__setstate_cython__";
2344 static const char __pyx_k_error_creating_an_iterator[] = "error creating an iterator";
2345 static const char __pyx_k_failed_to_convert_s_object[] = "failed to convert %s object";
2346 static const char __pyx_k_FastRLock___setstate_cython[] = "FastRLock.__setstate_cython__";
2347 static const char __pyx_k_LuaFunction___reduce_cython[] = "_LuaFunction.__reduce_cython__";
2348 static const char __pyx_k_LuaObject___setstate_cython[] = "_LuaObject.__setstate_cython__";
2349 static const char __pyx_k_LuaThread___setstate_cython[] = "_LuaThread.__setstate_cython__";
2350 static const char __pyx_k_modulename_must_be_a_string[] = "modulename must be a string";
2351 static const char __pyx_k_LuaRuntime___setstate_cython[] = "LuaRuntime.__setstate_cython__";
2352 static const char __pyx_k_Lua_object_is_not_a_function[] = "Lua object is not a function";
2353 static const char __pyx_k_error_during_Python_str_call[] = "error during Python str() call";
2354 static const char __pyx_k_Failed_to_acquire_thread_lock[] = "Failed to acquire thread lock";
2355 static const char __pyx_k_LuaFunction___setstate_cython[] = "_LuaFunction.__setstate_cython__";
2356 static const char __pyx_k_A_fast_Python_wrapper_around_Lu[] = "\nA fast Python wrapper around Lua and LuaJIT2.\n";
2357 static const char __pyx_k_LuaCoroutineFunction___reduce_c[] = "_LuaCoroutineFunction.__reduce_cython__";
2358 static const char __pyx_k_LuaCoroutineFunction___setstate[] = "_LuaCoroutineFunction.__setstate_cython__";
2359 static const char __pyx_k_PyProtocolWrapper___reduce_cyth[] = "_PyProtocolWrapper.__reduce_cython__";
2360 static const char __pyx_k_PyProtocolWrapper___setstate_cy[] = "_PyProtocolWrapper.__setstate_cython__";
2361 static const char __pyx_k_cannot_release_un_acquired_lock[] = "cannot release un-acquired lock";
2362 static const char __pyx_k_error_creating_an_iterator_with[] = "error creating an iterator with enumerate()";
2363 static const char __pyx_k_function_if_type_jit_table_then[] = "(function ()     if type(jit) == 'table' then return jit.version else return _VERSION end end)()";
2364 static const char __pyx_k_iteration_is_only_supported_for[] = "iteration is only supported for tables";
2365 static const char __pyx_k_self__state_cannot_be_converted[] = "self._state cannot be converted to a Python object for pickling";
2366 static const char __pyx_k_unpacks_lua_table_method_locals[] = "unpacks_lua_table_method.<locals>.wrapper";
2367 static const char __pyx_k_Base_class_for_errors_in_the_Lua[] = "Base class for errors in the Lua runtime.\n    ";
2368 static const char __pyx_k_Failed_to_initialise_Lua_runtime[] = "Failed to initialise Lua runtime";
2369 static const char __pyx_k_Type_cannot_be_instantiated_from[] = "Type cannot be instantiated from Python";
2370 static const char __pyx_k_Type_cannot_be_instantiated_manu[] = "Type cannot be instantiated manually";
2371 static const char __pyx_k_attribute_filter_and_attribute_h[] = "attribute_filter and attribute_handlers are mutually exclusive";
2372 static const char __pyx_k_attribute_filter_must_be_callabl[] = "attribute_filter must be callable";
2373 static const char __pyx_k_attribute_handlers_must_be_a_seq[] = "attribute_handlers must be a sequence of two callables";
2374 static const char __pyx_k_byte_string_input_has_unknown_en[] = "byte string input has unknown encoding, only ASCII is allowed";
2375 static const char __pyx_k_can_t_send_non_None_value_to_a_j[] = "can't send non-None value to a just-started generator";
2376 static const char __pyx_k_cannot_iterate_over_non_table_fo[] = "cannot iterate over non-table (found %r)";
2377 static const char __pyx_k_cannot_mix_objects_from_differen[] = "cannot mix objects from different Lua runtimes";
2378 static const char __pyx_k_error_reading_Python_attribute_i[] = "error reading Python attribute/item";
2379 static const char __pyx_k_error_while_calling_next_iterato[] = "error while calling next(iterator)";
2380 static const char __pyx_k_error_while_cleaning_up_a_Python[] = "error while cleaning up a Python object";
2381 static const char __pyx_k_error_writing_Python_attribute_i[] = "error writing Python attribute/item";
2382 static const char __pyx_k_failed_to_convert_argument_at_in[] = "failed to convert argument at index %d";
2383 static const char __pyx_k_item_attribute_access_not_suppor[] = "item/attribute access not supported on functions";
2384 static const char __pyx_k_no_default___reduce___due_to_non[] = "no default __reduce__ due to non-trivial __cinit__";
2385 static const char __pyx_k_self__co_state_self__state_canno[] = "self._co_state,self._state cannot be converted to a Python object for pickling";
2386 static const char __pyx_k_unpacks_lua_table_locals_wrapper[] = "unpacks_lua_table.<locals>.wrapper";
2387 static PyObject *__pyx_n_s_AttributeError;
2388 static PyObject *__pyx_n_s_BaseException;
2389 static PyObject *__pyx_kp_s_Base_class_for_errors_in_the_Lua;
2390 static PyObject *__pyx_kp_s_Failed_to_acquire_thread_lock;
2391 static PyObject *__pyx_kp_s_Failed_to_initialise_Lua_runtime;
2392 static PyObject *__pyx_n_s_FastRLock;
2393 static PyObject *__pyx_n_s_FastRLock___enter;
2394 static PyObject *__pyx_n_s_FastRLock___exit;
2395 static PyObject *__pyx_n_s_FastRLock___reduce_cython;
2396 static PyObject *__pyx_n_s_FastRLock___setstate_cython;
2397 static PyObject *__pyx_n_s_FastRLock__is_owned;
2398 static PyObject *__pyx_n_s_FastRLock_acquire;
2399 static PyObject *__pyx_n_s_FastRLock_release;
2400 static PyObject *__pyx_n_s_ImportError;
2401 static PyObject *__pyx_n_s_KeyError;
2402 static PyObject *__pyx_n_s_L;
2403 static PyObject *__pyx_n_s_LUA_VERSION;
2404 static PyObject *__pyx_n_s_LuaCoroutineFunction___reduce_c;
2405 static PyObject *__pyx_n_s_LuaCoroutineFunction___setstate;
2406 static PyObject *__pyx_n_s_LuaError;
2407 static PyObject *__pyx_n_s_LuaFunction___reduce_cython;
2408 static PyObject *__pyx_n_s_LuaFunction___setstate_cython;
2409 static PyObject *__pyx_n_s_LuaFunction_coroutine;
2410 static PyObject *__pyx_n_s_LuaIter___reduce_cython;
2411 static PyObject *__pyx_n_s_LuaIter___setstate_cython;
2412 static PyObject *__pyx_kp_u_LuaIter_r;
2413 static PyObject *__pyx_n_s_LuaObject___reduce_cython;
2414 static PyObject *__pyx_n_s_LuaObject___setstate_cython;
2415 static PyObject *__pyx_n_s_LuaRuntime;
2416 static PyObject *__pyx_n_s_LuaRuntime___reduce_cython;
2417 static PyObject *__pyx_n_s_LuaRuntime___setstate_cython;
2418 static PyObject *__pyx_n_s_LuaRuntime_compile;
2419 static PyObject *__pyx_n_s_LuaRuntime_eval;
2420 static PyObject *__pyx_n_s_LuaRuntime_execute;
2421 static PyObject *__pyx_n_s_LuaRuntime_globals;
2422 static PyObject *__pyx_n_s_LuaRuntime_require;
2423 static PyObject *__pyx_n_s_LuaRuntime_table;
2424 static PyObject *__pyx_n_s_LuaRuntime_table_from;
2425 static PyObject *__pyx_n_s_LuaSyntaxError;
2426 static PyObject *__pyx_n_s_LuaTable___reduce_cython;
2427 static PyObject *__pyx_n_s_LuaTable___setstate_cython;
2428 static PyObject *__pyx_n_s_LuaTable_items;
2429 static PyObject *__pyx_n_s_LuaTable_keys;
2430 static PyObject *__pyx_n_s_LuaTable_values;
2431 static PyObject *__pyx_n_s_LuaThread___reduce_cython;
2432 static PyObject *__pyx_n_s_LuaThread___setstate_cython;
2433 static PyObject *__pyx_n_s_LuaThread_send;
2434 static PyObject *__pyx_kp_s_Lua_object_is_not_a_function;
2435 static PyObject *__pyx_n_s_Mapping;
2436 static PyObject *__pyx_n_s_MemoryError;
2437 static PyObject *__pyx_n_s_PyProtocolWrapper___reduce_cyth;
2438 static PyObject *__pyx_n_s_PyProtocolWrapper___setstate_cy;
2439 static PyObject *__pyx_n_b_Py_None;
2440 static PyObject *__pyx_n_s_RuntimeError;
2441 static PyObject *__pyx_n_s_StopIteration;
2442 static PyObject *__pyx_kp_s_Syntax_error_in_Lua_code;
2443 static PyObject *__pyx_n_s_TypeError;
2444 static PyObject *__pyx_kp_s_Type_cannot_be_instantiated_from;
2445 static PyObject *__pyx_kp_s_Type_cannot_be_instantiated_manu;
2446 static PyObject *__pyx_kp_b_UTF_8;
2447 static PyObject *__pyx_kp_s_UTF_8;
2448 static PyObject *__pyx_n_s_UnicodeDecodeError;
2449 static PyObject *__pyx_n_s_ValueError;
2450 static PyObject *__pyx_n_b__16;
2451 static PyObject *__pyx_n_u__16;
2452 static PyObject *__pyx_n_s_acquire;
2453 static PyObject *__pyx_n_s_all;
2454 static PyObject *__pyx_n_s_append;
2455 static PyObject *__pyx_n_s_arg;
2456 static PyObject *__pyx_n_s_args;
2457 static PyObject *__pyx_n_s_as_attrgetter;
2458 static PyObject *__pyx_n_s_as_itemgetter;
2459 static PyObject *__pyx_n_s_attribute_filter;
2460 static PyObject *__pyx_kp_s_attribute_filter_and_attribute_h;
2461 static PyObject *__pyx_kp_s_attribute_filter_must_be_callabl;
2462 static PyObject *__pyx_n_s_attribute_handlers;
2463 static PyObject *__pyx_kp_s_attribute_handlers_must_be_a_seq;
2464 static PyObject *__pyx_n_s_blocking;
2465 static PyObject *__pyx_n_s_builtin;
2466 static PyObject *__pyx_n_b_builtins;
2467 static PyObject *__pyx_n_s_builtins;
2468 static PyObject *__pyx_kp_s_byte_string_input_has_unknown_en;
2469 static PyObject *__pyx_kp_s_can_t_send_non_None_value_to_a_j;
2470 static PyObject *__pyx_kp_s_cannot_iterate_over_non_table_fo;
2471 static PyObject *__pyx_kp_s_cannot_mix_objects_from_differen;
2472 static PyObject *__pyx_kp_s_cannot_release_un_acquired_lock;
2473 static PyObject *__pyx_n_s_cline_in_traceback;
2474 static PyObject *__pyx_n_s_co;
2475 static PyObject *__pyx_n_s_collections;
2476 static PyObject *__pyx_n_s_collections_abc;
2477 static PyObject *__pyx_n_s_compile;
2478 static PyObject *__pyx_n_s_coroutine;
2479 static PyObject *__pyx_n_s_delattr;
2480 static PyObject *__pyx_n_s_doc;
2481 static PyObject *__pyx_n_s_encoding;
2482 static PyObject *__pyx_n_s_enter;
2483 static PyObject *__pyx_n_s_enumerate;
2484 static PyObject *__pyx_n_s_err;
2485 static PyObject *__pyx_n_s_error;
2486 static PyObject *__pyx_kp_b_error_creating_an_iterator;
2487 static PyObject *__pyx_kp_b_error_creating_an_iterator_with;
2488 static PyObject *__pyx_kp_b_error_during_Python_call;
2489 static PyObject *__pyx_kp_b_error_during_Python_str_call;
2490 static PyObject *__pyx_kp_u_error_loading_code_s;
2491 static PyObject *__pyx_kp_b_error_reading_Python_attribute_i;
2492 static PyObject *__pyx_kp_b_error_while_calling_next_iterato;
2493 static PyObject *__pyx_kp_b_error_while_cleaning_up_a_Python;
2494 static PyObject *__pyx_kp_b_error_writing_Python_attribute_i;
2495 static PyObject *__pyx_n_b_eval;
2496 static PyObject *__pyx_n_s_eval;
2497 static PyObject *__pyx_n_s_exc_info;
2498 static PyObject *__pyx_n_s_execute;
2499 static PyObject *__pyx_n_s_exit;
2500 static PyObject *__pyx_kp_s_expected_string_got_s;
2501 static PyObject *__pyx_kp_s_failed_to_convert_argument_at_in;
2502 static PyObject *__pyx_kp_s_failed_to_convert_s_object;
2503 static PyObject *__pyx_n_s_func;
2504 static PyObject *__pyx_n_s_function;
2505 static PyObject *__pyx_kp_s_function_if_type_jit_table_then;
2506 static PyObject *__pyx_n_s_functools;
2507 static PyObject *__pyx_n_s_getattr;
2508 static PyObject *__pyx_n_s_getitem;
2509 static PyObject *__pyx_n_s_getstate;
2510 static PyObject *__pyx_n_s_globals;
2511 static PyObject *__pyx_kp_s_globals_not_defined;
2512 static PyObject *__pyx_n_s_i;
2513 static PyObject *__pyx_n_s_import;
2514 static PyObject *__pyx_n_s_is_owned;
2515 static PyObject *__pyx_kp_s_item_attribute_access_not_suppor;
2516 static PyObject *__pyx_n_s_items;
2517 static PyObject *__pyx_kp_s_iteration_is_only_supported_for;
2518 static PyObject *__pyx_n_s_iteritems;
2519 static PyObject *__pyx_n_s_key;
2520 static PyObject *__pyx_n_s_keys;
2521 static PyObject *__pyx_n_s_kwargs;
2522 static PyObject *__pyx_kp_s_lost_reference;
2523 static PyObject *__pyx_n_s_ltype;
2524 static PyObject *__pyx_n_s_lua_code;
2525 static PyObject *__pyx_n_s_lua_object;
2526 static PyObject *__pyx_n_s_lua_type;
2527 static PyObject *__pyx_n_s_lua_type_name;
2528 static PyObject *__pyx_n_s_lupa__lupa;
2529 static PyObject *__pyx_kp_s_lupa__lupa_pyx;
2530 static PyObject *__pyx_kp_s_lupa_lock_pxi;
2531 static PyObject *__pyx_n_s_main;
2532 static PyObject *__pyx_n_s_metaclass;
2533 static PyObject *__pyx_n_s_meth;
2534 static PyObject *__pyx_n_s_module;
2535 static PyObject *__pyx_n_s_modulename;
2536 static PyObject *__pyx_kp_s_modulename_must_be_a_string;
2537 static PyObject *__pyx_n_s_name;
2538 static PyObject *__pyx_n_s_name_2;
2539 static PyObject *__pyx_kp_s_no_default___reduce___due_to_non;
2540 static PyObject *__pyx_n_b_none;
2541 static PyObject *__pyx_kp_s_not_a_python_object;
2542 static PyObject *__pyx_n_s_obj;
2543 static PyObject *__pyx_n_s_object;
2544 static PyObject *__pyx_n_s_old_top;
2545 static PyObject *__pyx_n_s_oldtop;
2546 static PyObject *__pyx_n_s_pop;
2547 static PyObject *__pyx_n_s_prepare;
2548 static PyObject *__pyx_n_s_pyx_state;
2549 static PyObject *__pyx_n_s_pyx_vtable;
2550 static PyObject *__pyx_n_s_qualname;
2551 static PyObject *__pyx_n_s_range;
2552 static PyObject *__pyx_n_s_reduce;
2553 static PyObject *__pyx_n_s_reduce_cython;
2554 static PyObject *__pyx_n_s_reduce_ex;
2555 static PyObject *__pyx_n_s_register_builtins;
2556 static PyObject *__pyx_n_s_register_eval;
2557 static PyObject *__pyx_n_s_release;
2558 static PyObject *__pyx_n_s_require;
2559 static PyObject *__pyx_kp_s_require_is_not_defined;
2560 static PyObject *__pyx_kp_b_return;
2561 static PyObject *__pyx_n_s_self;
2562 static PyObject *__pyx_kp_s_self__co_state_self__state_canno;
2563 static PyObject *__pyx_kp_s_self__state_cannot_be_converted;
2564 static PyObject *__pyx_n_s_send;
2565 static PyObject *__pyx_n_s_setattr;
2566 static PyObject *__pyx_n_s_setstate;
2567 static PyObject *__pyx_n_s_setstate_cython;
2568 static PyObject *__pyx_n_s_size;
2569 static PyObject *__pyx_n_s_source_encoding;
2570 static PyObject *__pyx_n_s_status;
2571 static PyObject *__pyx_kp_s_stringsource;
2572 static PyObject *__pyx_n_s_sys;
2573 static PyObject *__pyx_n_s_t;
2574 static PyObject *__pyx_n_s_table;
2575 static PyObject *__pyx_n_s_table_from;
2576 static PyObject *__pyx_n_s_tb;
2577 static PyObject *__pyx_n_s_test;
2578 static PyObject *__pyx_n_s_thread;
2579 static PyObject *__pyx_n_s_unpack_returned_tuples;
2580 static PyObject *__pyx_n_s_unpacks_lua_table;
2581 static PyObject *__pyx_n_s_unpacks_lua_table_locals_wrapper;
2582 static PyObject *__pyx_n_s_unpacks_lua_table_method;
2583 static PyObject *__pyx_n_s_unpacks_lua_table_method_locals;
2584 static PyObject *__pyx_n_s_userdata;
2585 static PyObject *__pyx_n_s_v;
2586 static PyObject *__pyx_n_s_value;
2587 static PyObject *__pyx_n_s_values;
2588 static PyObject *__pyx_n_s_what;
2589 static PyObject *__pyx_n_s_wrap;
2590 static PyObject *__pyx_n_s_wrapper;
2591 static PyObject *__pyx_n_s_wraps;
2592 static int __pyx_pf_4lupa_5_lupa_9FastRLock___cinit__(struct __pyx_obj_4lupa_5_lupa_FastRLock *__pyx_v_self); /* proto */
2593 static void __pyx_pf_4lupa_5_lupa_9FastRLock_2__dealloc__(struct __pyx_obj_4lupa_5_lupa_FastRLock *__pyx_v_self); /* proto */
2594 static PyObject *__pyx_pf_4lupa_5_lupa_9FastRLock_4acquire(struct __pyx_obj_4lupa_5_lupa_FastRLock *__pyx_v_self, int __pyx_v_blocking); /* proto */
2595 static PyObject *__pyx_pf_4lupa_5_lupa_9FastRLock_6release(struct __pyx_obj_4lupa_5_lupa_FastRLock *__pyx_v_self); /* proto */
2596 static PyObject *__pyx_pf_4lupa_5_lupa_9FastRLock_8__enter__(struct __pyx_obj_4lupa_5_lupa_FastRLock *__pyx_v_self); /* proto */
2597 static PyObject *__pyx_pf_4lupa_5_lupa_9FastRLock_10__exit__(struct __pyx_obj_4lupa_5_lupa_FastRLock *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_t, CYTHON_UNUSED PyObject *__pyx_v_v, CYTHON_UNUSED PyObject *__pyx_v_tb); /* proto */
2598 static PyObject *__pyx_pf_4lupa_5_lupa_9FastRLock_12_is_owned(struct __pyx_obj_4lupa_5_lupa_FastRLock *__pyx_v_self); /* proto */
2599 static PyObject *__pyx_pf_4lupa_5_lupa_9FastRLock_14__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_4lupa_5_lupa_FastRLock *__pyx_v_self); /* proto */
2600 static PyObject *__pyx_pf_4lupa_5_lupa_9FastRLock_16__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_4lupa_5_lupa_FastRLock *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
2601 static PyObject *__pyx_pf_4lupa_5_lupa_lua_type(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_obj); /* proto */
2602 static int __pyx_pf_4lupa_5_lupa_10LuaRuntime___cinit__(struct __pyx_obj_4lupa_5_lupa_LuaRuntime *__pyx_v_self, PyObject *__pyx_v_encoding, PyObject *__pyx_v_source_encoding, PyObject *__pyx_v_attribute_filter, PyObject *__pyx_v_attribute_handlers, int __pyx_v_register_eval, int __pyx_v_unpack_returned_tuples, int __pyx_v_register_builtins); /* proto */
2603 static void __pyx_pf_4lupa_5_lupa_10LuaRuntime_2__dealloc__(struct __pyx_obj_4lupa_5_lupa_LuaRuntime *__pyx_v_self); /* proto */
2604 static PyObject *__pyx_pf_4lupa_5_lupa_10LuaRuntime_11lua_version___get__(struct __pyx_obj_4lupa_5_lupa_LuaRuntime *__pyx_v_self); /* proto */
2605 static PyObject *__pyx_pf_4lupa_5_lupa_10LuaRuntime_18lua_implementation___get__(struct __pyx_obj_4lupa_5_lupa_LuaRuntime *__pyx_v_self); /* proto */
2606 static PyObject *__pyx_pf_4lupa_5_lupa_10LuaRuntime_4eval(struct __pyx_obj_4lupa_5_lupa_LuaRuntime *__pyx_v_self, PyObject *__pyx_v_lua_code, PyObject *__pyx_v_args); /* proto */
2607 static PyObject *__pyx_pf_4lupa_5_lupa_10LuaRuntime_6execute(struct __pyx_obj_4lupa_5_lupa_LuaRuntime *__pyx_v_self, PyObject *__pyx_v_lua_code, PyObject *__pyx_v_args); /* proto */
2608 static PyObject *__pyx_pf_4lupa_5_lupa_10LuaRuntime_8compile(struct __pyx_obj_4lupa_5_lupa_LuaRuntime *__pyx_v_self, PyObject *__pyx_v_lua_code); /* proto */
2609 static PyObject *__pyx_pf_4lupa_5_lupa_10LuaRuntime_10require(struct __pyx_obj_4lupa_5_lupa_LuaRuntime *__pyx_v_self, PyObject *__pyx_v_modulename); /* proto */
2610 static PyObject *__pyx_pf_4lupa_5_lupa_10LuaRuntime_12globals(struct __pyx_obj_4lupa_5_lupa_LuaRuntime *__pyx_v_self); /* proto */
2611 static PyObject *__pyx_pf_4lupa_5_lupa_10LuaRuntime_14table(struct __pyx_obj_4lupa_5_lupa_LuaRuntime *__pyx_v_self, PyObject *__pyx_v_items, PyObject *__pyx_v_kwargs); /* proto */
2612 static PyObject *__pyx_pf_4lupa_5_lupa_10LuaRuntime_16table_from(struct __pyx_obj_4lupa_5_lupa_LuaRuntime *__pyx_v_self, PyObject *__pyx_v_args); /* proto */
2613 static PyObject *__pyx_pf_4lupa_5_lupa_10LuaRuntime_18__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_4lupa_5_lupa_LuaRuntime *__pyx_v_self); /* proto */
2614 static PyObject *__pyx_pf_4lupa_5_lupa_10LuaRuntime_20__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_4lupa_5_lupa_LuaRuntime *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
2615 static PyObject *__pyx_pf_4lupa_5_lupa_17unpacks_lua_table_wrapper(PyObject *__pyx_self, PyObject *__pyx_v_args); /* proto */
2616 static PyObject *__pyx_pf_4lupa_5_lupa_2unpacks_lua_table(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_func); /* proto */
2617 static PyObject *__pyx_pf_4lupa_5_lupa_24unpacks_lua_table_method_wrapper(PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_args); /* proto */
2618 static PyObject *__pyx_pf_4lupa_5_lupa_4unpacks_lua_table_method(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_meth); /* proto */
2619 static int __pyx_pf_4lupa_5_lupa_10_LuaObject___init__(CYTHON_UNUSED struct __pyx_obj_4lupa_5_lupa__LuaObject *__pyx_v_self); /* proto */
2620 static void __pyx_pf_4lupa_5_lupa_10_LuaObject_2__dealloc__(struct __pyx_obj_4lupa_5_lupa__LuaObject *__pyx_v_self); /* proto */
2621 static PyObject *__pyx_pf_4lupa_5_lupa_10_LuaObject_4__call__(struct __pyx_obj_4lupa_5_lupa__LuaObject *__pyx_v_self, PyObject *__pyx_v_args); /* proto */
2622 static Py_ssize_t __pyx_pf_4lupa_5_lupa_10_LuaObject_6__len__(struct __pyx_obj_4lupa_5_lupa__LuaObject *__pyx_v_self); /* proto */
2623 static int __pyx_pf_4lupa_5_lupa_10_LuaObject_8__nonzero__(CYTHON_UNUSED struct __pyx_obj_4lupa_5_lupa__LuaObject *__pyx_v_self); /* proto */
2624 static PyObject *__pyx_pf_4lupa_5_lupa_10_LuaObject_10__iter__(CYTHON_UNUSED struct __pyx_obj_4lupa_5_lupa__LuaObject *__pyx_v_self); /* proto */
2625 static PyObject *__pyx_pf_4lupa_5_lupa_10_LuaObject_12__repr__(struct __pyx_obj_4lupa_5_lupa__LuaObject *__pyx_v_self); /* proto */
2626 static PyObject *__pyx_pf_4lupa_5_lupa_10_LuaObject_14__str__(struct __pyx_obj_4lupa_5_lupa__LuaObject *__pyx_v_self); /* proto */
2627 static PyObject *__pyx_pf_4lupa_5_lupa_10_LuaObject_16__getattr__(struct __pyx_obj_4lupa_5_lupa__LuaObject *__pyx_v_self, PyObject *__pyx_v_name); /* proto */
2628 static PyObject *__pyx_pf_4lupa_5_lupa_10_LuaObject_18__getitem__(struct __pyx_obj_4lupa_5_lupa__LuaObject *__pyx_v_self, PyObject *__pyx_v_index_or_name); /* proto */
2629 static PyObject *__pyx_pf_4lupa_5_lupa_10_LuaObject_20__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_4lupa_5_lupa__LuaObject *__pyx_v_self); /* proto */
2630 static PyObject *__pyx_pf_4lupa_5_lupa_10_LuaObject_22__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_4lupa_5_lupa__LuaObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
2631 static PyObject *__pyx_pf_4lupa_5_lupa_9_LuaTable___iter__(struct __pyx_obj_4lupa_5_lupa__LuaTable *__pyx_v_self); /* proto */
2632 static PyObject *__pyx_pf_4lupa_5_lupa_9_LuaTable_2keys(struct __pyx_obj_4lupa_5_lupa__LuaTable *__pyx_v_self); /* proto */
2633 static PyObject *__pyx_pf_4lupa_5_lupa_9_LuaTable_4values(struct __pyx_obj_4lupa_5_lupa__LuaTable *__pyx_v_self); /* proto */
2634 static PyObject *__pyx_pf_4lupa_5_lupa_9_LuaTable_6items(struct __pyx_obj_4lupa_5_lupa__LuaTable *__pyx_v_self); /* proto */
2635 static int __pyx_pf_4lupa_5_lupa_9_LuaTable_8__setattr__(struct __pyx_obj_4lupa_5_lupa__LuaTable *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_value); /* proto */
2636 static int __pyx_pf_4lupa_5_lupa_9_LuaTable_10__setitem__(struct __pyx_obj_4lupa_5_lupa__LuaTable *__pyx_v_self, PyObject *__pyx_v_index_or_name, PyObject *__pyx_v_value); /* proto */
2637 static int __pyx_pf_4lupa_5_lupa_9_LuaTable_12__delattr__(struct __pyx_obj_4lupa_5_lupa__LuaTable *__pyx_v_self, PyObject *__pyx_v_item); /* proto */
2638 static int __pyx_pf_4lupa_5_lupa_9_LuaTable_14__delitem__(struct __pyx_obj_4lupa_5_lupa__LuaTable *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
2639 static PyObject *__pyx_pf_4lupa_5_lupa_9_LuaTable_16__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_4lupa_5_lupa__LuaTable *__pyx_v_self); /* proto */
2640 static PyObject *__pyx_pf_4lupa_5_lupa_9_LuaTable_18__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_4lupa_5_lupa__LuaTable *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
2641 static PyObject *__pyx_pf_4lupa_5_lupa_12_LuaFunction_coroutine(struct __pyx_obj_4lupa_5_lupa__LuaFunction *__pyx_v_self, PyObject *__pyx_v_args); /* proto */
2642 static PyObject *__pyx_pf_4lupa_5_lupa_12_LuaFunction_2__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_4lupa_5_lupa__LuaFunction *__pyx_v_self); /* proto */
2643 static PyObject *__pyx_pf_4lupa_5_lupa_12_LuaFunction_4__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_4lupa_5_lupa__LuaFunction *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
2644 static PyObject *__pyx_pf_4lupa_5_lupa_21_LuaCoroutineFunction___call__(struct __pyx_obj_4lupa_5_lupa__LuaCoroutineFunction *__pyx_v_self, PyObject *__pyx_v_args); /* proto */
2645 static PyObject *__pyx_pf_4lupa_5_lupa_21_LuaCoroutineFunction_2__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_4lupa_5_lupa__LuaCoroutineFunction *__pyx_v_self); /* proto */
2646 static PyObject *__pyx_pf_4lupa_5_lupa_21_LuaCoroutineFunction_4__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_4lupa_5_lupa__LuaCoroutineFunction *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
2647 static PyObject *__pyx_pf_4lupa_5_lupa_10_LuaThread___iter__(struct __pyx_obj_4lupa_5_lupa__LuaThread *__pyx_v_self); /* proto */
2648 static PyObject *__pyx_pf_4lupa_5_lupa_10_LuaThread_2__next__(struct __pyx_obj_4lupa_5_lupa__LuaThread *__pyx_v_self); /* proto */
2649 static PyObject *__pyx_pf_4lupa_5_lupa_10_LuaThread_4send(struct __pyx_obj_4lupa_5_lupa__LuaThread *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
2650 static int __pyx_pf_4lupa_5_lupa_10_LuaThread_6__bool__(struct __pyx_obj_4lupa_5_lupa__LuaThread *__pyx_v_self); /* proto */
2651 static PyObject *__pyx_pf_4lupa_5_lupa_10_LuaThread_8__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_4lupa_5_lupa__LuaThread *__pyx_v_self); /* proto */
2652 static PyObject *__pyx_pf_4lupa_5_lupa_10_LuaThread_10__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_4lupa_5_lupa__LuaThread *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
2653 static int __pyx_pf_4lupa_5_lupa_8_LuaIter___cinit__(struct __pyx_obj_4lupa_5_lupa__LuaIter *__pyx_v_self, struct __pyx_obj_4lupa_5_lupa__LuaObject *__pyx_v_obj, int __pyx_v_what); /* proto */
2654 static void __pyx_pf_4lupa_5_lupa_8_LuaIter_2__dealloc__(struct __pyx_obj_4lupa_5_lupa__LuaIter *__pyx_v_self); /* proto */
2655 static PyObject *__pyx_pf_4lupa_5_lupa_8_LuaIter_4__repr__(struct __pyx_obj_4lupa_5_lupa__LuaIter *__pyx_v_self); /* proto */
2656 static PyObject *__pyx_pf_4lupa_5_lupa_8_LuaIter_6__iter__(struct __pyx_obj_4lupa_5_lupa__LuaIter *__pyx_v_self); /* proto */
2657 static PyObject *__pyx_pf_4lupa_5_lupa_8_LuaIter_8__next__(struct __pyx_obj_4lupa_5_lupa__LuaIter *__pyx_v_self); /* proto */
2658 static PyObject *__pyx_pf_4lupa_5_lupa_8_LuaIter_10__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_4lupa_5_lupa__LuaIter *__pyx_v_self); /* proto */
2659 static PyObject *__pyx_pf_4lupa_5_lupa_8_LuaIter_12__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_4lupa_5_lupa__LuaIter *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
2660 static int __pyx_pf_4lupa_5_lupa_18_PyProtocolWrapper___cinit__(struct __pyx_obj_4lupa_5_lupa__PyProtocolWrapper *__pyx_v_self); /* proto */
2661 static int __pyx_pf_4lupa_5_lupa_18_PyProtocolWrapper_2__init__(CYTHON_UNUSED struct __pyx_obj_4lupa_5_lupa__PyProtocolWrapper *__pyx_v_self); /* proto */
2662 static PyObject *__pyx_pf_4lupa_5_lupa_18_PyProtocolWrapper_4__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_4lupa_5_lupa__PyProtocolWrapper *__pyx_v_self); /* proto */
2663 static PyObject *__pyx_pf_4lupa_5_lupa_18_PyProtocolWrapper_6__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_4lupa_5_lupa__PyProtocolWrapper *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
2664 static PyObject *__pyx_pf_4lupa_5_lupa_6as_attrgetter(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_obj); /* proto */
2665 static PyObject *__pyx_pf_4lupa_5_lupa_8as_itemgetter(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_obj); /* proto */
2666 static PyObject *__pyx_tp_new_4lupa_5_lupa_FastRLock(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2667 static PyObject *__pyx_tp_new_4lupa_5_lupa_LuaRuntime(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2668 static PyObject *__pyx_tp_new_4lupa_5_lupa__LuaObject(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2669 static PyObject *__pyx_tp_new_4lupa_5_lupa__LuaTable(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2670 static PyObject *__pyx_tp_new_4lupa_5_lupa__LuaFunction(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2671 static PyObject *__pyx_tp_new_4lupa_5_lupa__LuaCoroutineFunction(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2672 static PyObject *__pyx_tp_new_4lupa_5_lupa__LuaThread(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2673 static PyObject *__pyx_tp_new_4lupa_5_lupa__LuaIter(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2674 static PyObject *__pyx_tp_new_4lupa_5_lupa__PyProtocolWrapper(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2675 static PyObject *__pyx_tp_new_4lupa_5_lupa___pyx_scope_struct__unpacks_lua_table(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2676 static PyObject *__pyx_tp_new_4lupa_5_lupa___pyx_scope_struct_1_unpacks_lua_table_method(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2677 static __Pyx_CachedCFunction __pyx_umethod_PyList_Type_pop = {0, &__pyx_n_s_pop, 0, 0, 0};
2678 static PyObject *__pyx_int_1;
2679 static PyObject *__pyx_tuple_;
2680 static PyObject *__pyx_tuple__2;
2681 static PyObject *__pyx_tuple__3;
2682 static PyObject *__pyx_tuple__4;
2683 static PyObject *__pyx_tuple__5;
2684 static PyObject *__pyx_tuple__6;
2685 static PyObject *__pyx_tuple__7;
2686 static PyObject *__pyx_tuple__8;
2687 static PyObject *__pyx_tuple__9;
2688 static PyObject *__pyx_tuple__10;
2689 static PyObject *__pyx_tuple__12;
2690 static PyObject *__pyx_tuple__14;
2691 static PyObject *__pyx_tuple__15;
2692 static PyObject *__pyx_tuple__17;
2693 static PyObject *__pyx_tuple__18;
2694 static PyObject *__pyx_tuple__19;
2695 static PyObject *__pyx_tuple__20;
2696 static PyObject *__pyx_tuple__21;
2697 static PyObject *__pyx_tuple__22;
2698 static PyObject *__pyx_tuple__23;
2699 static PyObject *__pyx_tuple__24;
2700 static PyObject *__pyx_tuple__25;
2701 static PyObject *__pyx_tuple__26;
2702 static PyObject *__pyx_tuple__27;
2703 static PyObject *__pyx_tuple__28;
2704 static PyObject *__pyx_tuple__29;
2705 static PyObject *__pyx_tuple__30;
2706 static PyObject *__pyx_tuple__31;
2707 static PyObject *__pyx_tuple__32;
2708 static PyObject *__pyx_tuple__33;
2709 static PyObject *__pyx_tuple__34;
2710 static PyObject *__pyx_tuple__35;
2711 static PyObject *__pyx_tuple__36;
2712 static PyObject *__pyx_tuple__38;
2713 static PyObject *__pyx_tuple__40;
2714 static PyObject *__pyx_tuple__42;
2715 static PyObject *__pyx_tuple__44;
2716 static PyObject *__pyx_tuple__46;
2717 static PyObject *__pyx_tuple__48;
2718 static PyObject *__pyx_tuple__50;
2719 static PyObject *__pyx_tuple__52;
2720 static PyObject *__pyx_tuple__54;
2721 static PyObject *__pyx_tuple__56;
2722 static PyObject *__pyx_tuple__58;
2723 static PyObject *__pyx_tuple__60;
2724 static PyObject *__pyx_tuple__62;
2725 static PyObject *__pyx_tuple__64;
2726 static PyObject *__pyx_tuple__66;
2727 static PyObject *__pyx_tuple__68;
2728 static PyObject *__pyx_tuple__70;
2729 static PyObject *__pyx_tuple__72;
2730 static PyObject *__pyx_tuple__74;
2731 static PyObject *__pyx_tuple__76;
2732 static PyObject *__pyx_tuple__78;
2733 static PyObject *__pyx_tuple__80;
2734 static PyObject *__pyx_tuple__82;
2735 static PyObject *__pyx_tuple__84;
2736 static PyObject *__pyx_tuple__86;
2737 static PyObject *__pyx_tuple__88;
2738 static PyObject *__pyx_tuple__90;
2739 static PyObject *__pyx_tuple__92;
2740 static PyObject *__pyx_tuple__94;
2741 static PyObject *__pyx_tuple__96;
2742 static PyObject *__pyx_tuple__98;
2743 static PyObject *__pyx_tuple__100;
2744 static PyObject *__pyx_tuple__102;
2745 static PyObject *__pyx_tuple__104;
2746 static PyObject *__pyx_tuple__106;
2747 static PyObject *__pyx_tuple__108;
2748 static PyObject *__pyx_tuple__110;
2749 static PyObject *__pyx_tuple__112;
2750 static PyObject *__pyx_tuple__114;
2751 static PyObject *__pyx_codeobj__11;
2752 static PyObject *__pyx_codeobj__13;
2753 static PyObject *__pyx_codeobj__37;
2754 static PyObject *__pyx_codeobj__39;
2755 static PyObject *__pyx_codeobj__41;
2756 static PyObject *__pyx_codeobj__43;
2757 static PyObject *__pyx_codeobj__45;
2758 static PyObject *__pyx_codeobj__47;
2759 static PyObject *__pyx_codeobj__49;
2760 static PyObject *__pyx_codeobj__51;
2761 static PyObject *__pyx_codeobj__53;
2762 static PyObject *__pyx_codeobj__55;
2763 static PyObject *__pyx_codeobj__57;
2764 static PyObject *__pyx_codeobj__59;
2765 static PyObject *__pyx_codeobj__61;
2766 static PyObject *__pyx_codeobj__63;
2767 static PyObject *__pyx_codeobj__65;
2768 static PyObject *__pyx_codeobj__67;
2769 static PyObject *__pyx_codeobj__69;
2770 static PyObject *__pyx_codeobj__71;
2771 static PyObject *__pyx_codeobj__73;
2772 static PyObject *__pyx_codeobj__75;
2773 static PyObject *__pyx_codeobj__77;
2774 static PyObject *__pyx_codeobj__79;
2775 static PyObject *__pyx_codeobj__81;
2776 static PyObject *__pyx_codeobj__83;
2777 static PyObject *__pyx_codeobj__85;
2778 static PyObject *__pyx_codeobj__87;
2779 static PyObject *__pyx_codeobj__89;
2780 static PyObject *__pyx_codeobj__91;
2781 static PyObject *__pyx_codeobj__93;
2782 static PyObject *__pyx_codeobj__95;
2783 static PyObject *__pyx_codeobj__97;
2784 static PyObject *__pyx_codeobj__99;
2785 static PyObject *__pyx_codeobj__101;
2786 static PyObject *__pyx_codeobj__103;
2787 static PyObject *__pyx_codeobj__105;
2788 static PyObject *__pyx_codeobj__107;
2789 static PyObject *__pyx_codeobj__109;
2790 static PyObject *__pyx_codeobj__111;
2791 static PyObject *__pyx_codeobj__113;
2792 static PyObject *__pyx_codeobj__115;
2793 /* Late includes */
2794 
2795 /* "lupa/lock.pxi":20
2796  *     cdef bint _is_locked        # whether the real lock is acquired
2797  *
2798  *     def __cinit__(self):             # <<<<<<<<<<<<<<
2799  *         self._owner = -1
2800  *         self._count = 0
2801  */
2802 
2803 /* Python wrapper */
2804 static int __pyx_pw_4lupa_5_lupa_9FastRLock_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_pw_4lupa_5_lupa_9FastRLock_1__cinit__(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)2805 static int __pyx_pw_4lupa_5_lupa_9FastRLock_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2806   int __pyx_r;
2807   __Pyx_RefNannyDeclarations
2808   __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
2809   if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
2810     __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
2811   if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;
2812   __pyx_r = __pyx_pf_4lupa_5_lupa_9FastRLock___cinit__(((struct __pyx_obj_4lupa_5_lupa_FastRLock *)__pyx_v_self));
2813 
2814   /* function exit code */
2815   __Pyx_RefNannyFinishContext();
2816   return __pyx_r;
2817 }
2818 
__pyx_pf_4lupa_5_lupa_9FastRLock___cinit__(struct __pyx_obj_4lupa_5_lupa_FastRLock * __pyx_v_self)2819 static int __pyx_pf_4lupa_5_lupa_9FastRLock___cinit__(struct __pyx_obj_4lupa_5_lupa_FastRLock *__pyx_v_self) {
2820   int __pyx_r;
2821   __Pyx_RefNannyDeclarations
2822   int __pyx_t_1;
2823   int __pyx_lineno = 0;
2824   const char *__pyx_filename = NULL;
2825   int __pyx_clineno = 0;
2826   __Pyx_RefNannySetupContext("__cinit__", 0);
2827 
2828   /* "lupa/lock.pxi":21
2829  *
2830  *     def __cinit__(self):
2831  *         self._owner = -1             # <<<<<<<<<<<<<<
2832  *         self._count = 0
2833  *         self._is_locked = False
2834  */
2835   __pyx_v_self->_owner = -1L;
2836 
2837   /* "lupa/lock.pxi":22
2838  *     def __cinit__(self):
2839  *         self._owner = -1
2840  *         self._count = 0             # <<<<<<<<<<<<<<
2841  *         self._is_locked = False
2842  *         self._pending_requests = 0
2843  */
2844   __pyx_v_self->_count = 0;
2845 
2846   /* "lupa/lock.pxi":23
2847  *         self._owner = -1
2848  *         self._count = 0
2849  *         self._is_locked = False             # <<<<<<<<<<<<<<
2850  *         self._pending_requests = 0
2851  *         self._real_lock = pythread.PyThread_allocate_lock()
2852  */
2853   __pyx_v_self->_is_locked = 0;
2854 
2855   /* "lupa/lock.pxi":24
2856  *         self._count = 0
2857  *         self._is_locked = False
2858  *         self._pending_requests = 0             # <<<<<<<<<<<<<<
2859  *         self._real_lock = pythread.PyThread_allocate_lock()
2860  *         if self._real_lock is NULL:
2861  */
2862   __pyx_v_self->_pending_requests = 0;
2863 
2864   /* "lupa/lock.pxi":25
2865  *         self._is_locked = False
2866  *         self._pending_requests = 0
2867  *         self._real_lock = pythread.PyThread_allocate_lock()             # <<<<<<<<<<<<<<
2868  *         if self._real_lock is NULL:
2869  *             raise MemoryError
2870  */
2871   __pyx_v_self->_real_lock = PyThread_allocate_lock();
2872 
2873   /* "lupa/lock.pxi":26
2874  *         self._pending_requests = 0
2875  *         self._real_lock = pythread.PyThread_allocate_lock()
2876  *         if self._real_lock is NULL:             # <<<<<<<<<<<<<<
2877  *             raise MemoryError
2878  *
2879  */
2880   __pyx_t_1 = ((__pyx_v_self->_real_lock == NULL) != 0);
2881   if (unlikely(__pyx_t_1)) {
2882 
2883     /* "lupa/lock.pxi":27
2884  *         self._real_lock = pythread.PyThread_allocate_lock()
2885  *         if self._real_lock is NULL:
2886  *             raise MemoryError             # <<<<<<<<<<<<<<
2887  *
2888  *     def __dealloc__(self):
2889  */
2890     PyErr_NoMemory(); __PYX_ERR(1, 27, __pyx_L1_error)
2891 
2892     /* "lupa/lock.pxi":26
2893  *         self._pending_requests = 0
2894  *         self._real_lock = pythread.PyThread_allocate_lock()
2895  *         if self._real_lock is NULL:             # <<<<<<<<<<<<<<
2896  *             raise MemoryError
2897  *
2898  */
2899   }
2900 
2901   /* "lupa/lock.pxi":20
2902  *     cdef bint _is_locked        # whether the real lock is acquired
2903  *
2904  *     def __cinit__(self):             # <<<<<<<<<<<<<<
2905  *         self._owner = -1
2906  *         self._count = 0
2907  */
2908 
2909   /* function exit code */
2910   __pyx_r = 0;
2911   goto __pyx_L0;
2912   __pyx_L1_error:;
2913   __Pyx_AddTraceback("lupa._lupa.FastRLock.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
2914   __pyx_r = -1;
2915   __pyx_L0:;
2916   __Pyx_RefNannyFinishContext();
2917   return __pyx_r;
2918 }
2919 
2920 /* "lupa/lock.pxi":29
2921  *             raise MemoryError
2922  *
2923  *     def __dealloc__(self):             # <<<<<<<<<<<<<<
2924  *         if self._real_lock is not NULL:
2925  *             pythread.PyThread_free_lock(self._real_lock)
2926  */
2927 
2928 /* Python wrapper */
2929 static void __pyx_pw_4lupa_5_lupa_9FastRLock_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_4lupa_5_lupa_9FastRLock_3__dealloc__(PyObject * __pyx_v_self)2930 static void __pyx_pw_4lupa_5_lupa_9FastRLock_3__dealloc__(PyObject *__pyx_v_self) {
2931   __Pyx_RefNannyDeclarations
2932   __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
2933   __pyx_pf_4lupa_5_lupa_9FastRLock_2__dealloc__(((struct __pyx_obj_4lupa_5_lupa_FastRLock *)__pyx_v_self));
2934 
2935   /* function exit code */
2936   __Pyx_RefNannyFinishContext();
2937 }
2938 
__pyx_pf_4lupa_5_lupa_9FastRLock_2__dealloc__(struct __pyx_obj_4lupa_5_lupa_FastRLock * __pyx_v_self)2939 static void __pyx_pf_4lupa_5_lupa_9FastRLock_2__dealloc__(struct __pyx_obj_4lupa_5_lupa_FastRLock *__pyx_v_self) {
2940   __Pyx_RefNannyDeclarations
2941   int __pyx_t_1;
2942   __Pyx_RefNannySetupContext("__dealloc__", 0);
2943 
2944   /* "lupa/lock.pxi":30
2945  *
2946  *     def __dealloc__(self):
2947  *         if self._real_lock is not NULL:             # <<<<<<<<<<<<<<
2948  *             pythread.PyThread_free_lock(self._real_lock)
2949  *             self._real_lock = NULL
2950  */
2951   __pyx_t_1 = ((__pyx_v_self->_real_lock != NULL) != 0);
2952   if (__pyx_t_1) {
2953 
2954     /* "lupa/lock.pxi":31
2955  *     def __dealloc__(self):
2956  *         if self._real_lock is not NULL:
2957  *             pythread.PyThread_free_lock(self._real_lock)             # <<<<<<<<<<<<<<
2958  *             self._real_lock = NULL
2959  *
2960  */
2961     PyThread_free_lock(__pyx_v_self->_real_lock);
2962 
2963     /* "lupa/lock.pxi":32
2964  *         if self._real_lock is not NULL:
2965  *             pythread.PyThread_free_lock(self._real_lock)
2966  *             self._real_lock = NULL             # <<<<<<<<<<<<<<
2967  *
2968  *     def acquire(self, bint blocking=True):
2969  */
2970     __pyx_v_self->_real_lock = NULL;
2971 
2972     /* "lupa/lock.pxi":30
2973  *
2974  *     def __dealloc__(self):
2975  *         if self._real_lock is not NULL:             # <<<<<<<<<<<<<<
2976  *             pythread.PyThread_free_lock(self._real_lock)
2977  *             self._real_lock = NULL
2978  */
2979   }
2980 
2981   /* "lupa/lock.pxi":29
2982  *             raise MemoryError
2983  *
2984  *     def __dealloc__(self):             # <<<<<<<<<<<<<<
2985  *         if self._real_lock is not NULL:
2986  *             pythread.PyThread_free_lock(self._real_lock)
2987  */
2988 
2989   /* function exit code */
2990   __Pyx_RefNannyFinishContext();
2991 }
2992 
2993 /* "lupa/lock.pxi":34
2994  *             self._real_lock = NULL
2995  *
2996  *     def acquire(self, bint blocking=True):             # <<<<<<<<<<<<<<
2997  *         return lock_lock(self, pythread.PyThread_get_thread_ident(), blocking)
2998  *
2999  */
3000 
3001 /* Python wrapper */
3002 static PyObject *__pyx_pw_4lupa_5_lupa_9FastRLock_5acquire(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
3003 static char __pyx_doc_4lupa_5_lupa_9FastRLock_4acquire[] = "FastRLock.acquire(self, bool blocking=True)";
3004 static PyMethodDef __pyx_mdef_4lupa_5_lupa_9FastRLock_5acquire = {"acquire", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lupa_5_lupa_9FastRLock_5acquire, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4lupa_5_lupa_9FastRLock_4acquire};
__pyx_pw_4lupa_5_lupa_9FastRLock_5acquire(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)3005 static PyObject *__pyx_pw_4lupa_5_lupa_9FastRLock_5acquire(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3006   int __pyx_v_blocking;
3007   int __pyx_lineno = 0;
3008   const char *__pyx_filename = NULL;
3009   int __pyx_clineno = 0;
3010   PyObject *__pyx_r = 0;
3011   __Pyx_RefNannyDeclarations
3012   __Pyx_RefNannySetupContext("acquire (wrapper)", 0);
3013   {
3014     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_blocking,0};
3015     PyObject* values[1] = {0};
3016     if (unlikely(__pyx_kwds)) {
3017       Py_ssize_t kw_args;
3018       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3019       switch (pos_args) {
3020         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3021         CYTHON_FALLTHROUGH;
3022         case  0: break;
3023         default: goto __pyx_L5_argtuple_error;
3024       }
3025       kw_args = PyDict_Size(__pyx_kwds);
3026       switch (pos_args) {
3027         case  0:
3028         if (kw_args > 0) {
3029           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_blocking);
3030           if (value) { values[0] = value; kw_args--; }
3031         }
3032       }
3033       if (unlikely(kw_args > 0)) {
3034         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "acquire") < 0)) __PYX_ERR(1, 34, __pyx_L3_error)
3035       }
3036     } else {
3037       switch (PyTuple_GET_SIZE(__pyx_args)) {
3038         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3039         CYTHON_FALLTHROUGH;
3040         case  0: break;
3041         default: goto __pyx_L5_argtuple_error;
3042       }
3043     }
3044     if (values[0]) {
3045       __pyx_v_blocking = __Pyx_PyObject_IsTrue(values[0]); if (unlikely((__pyx_v_blocking == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 34, __pyx_L3_error)
3046     } else {
3047       __pyx_v_blocking = ((int)1);
3048     }
3049   }
3050   goto __pyx_L4_argument_unpacking_done;
3051   __pyx_L5_argtuple_error:;
3052   __Pyx_RaiseArgtupleInvalid("acquire", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 34, __pyx_L3_error)
3053   __pyx_L3_error:;
3054   __Pyx_AddTraceback("lupa._lupa.FastRLock.acquire", __pyx_clineno, __pyx_lineno, __pyx_filename);
3055   __Pyx_RefNannyFinishContext();
3056   return NULL;
3057   __pyx_L4_argument_unpacking_done:;
3058   __pyx_r = __pyx_pf_4lupa_5_lupa_9FastRLock_4acquire(((struct __pyx_obj_4lupa_5_lupa_FastRLock *)__pyx_v_self), __pyx_v_blocking);
3059 
3060   /* function exit code */
3061   __Pyx_RefNannyFinishContext();
3062   return __pyx_r;
3063 }
3064 
__pyx_pf_4lupa_5_lupa_9FastRLock_4acquire(struct __pyx_obj_4lupa_5_lupa_FastRLock * __pyx_v_self,int __pyx_v_blocking)3065 static PyObject *__pyx_pf_4lupa_5_lupa_9FastRLock_4acquire(struct __pyx_obj_4lupa_5_lupa_FastRLock *__pyx_v_self, int __pyx_v_blocking) {
3066   PyObject *__pyx_r = NULL;
3067   __Pyx_RefNannyDeclarations
3068   PyObject *__pyx_t_1 = NULL;
3069   int __pyx_lineno = 0;
3070   const char *__pyx_filename = NULL;
3071   int __pyx_clineno = 0;
3072   __Pyx_RefNannySetupContext("acquire", 0);
3073 
3074   /* "lupa/lock.pxi":35
3075  *
3076  *     def acquire(self, bint blocking=True):
3077  *         return lock_lock(self, pythread.PyThread_get_thread_ident(), blocking)             # <<<<<<<<<<<<<<
3078  *
3079  *     def release(self):
3080  */
3081   __Pyx_XDECREF(__pyx_r);
3082   __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_f_4lupa_5_lupa_lock_lock(__pyx_v_self, PyThread_get_thread_ident(), __pyx_v_blocking)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 35, __pyx_L1_error)
3083   __Pyx_GOTREF(__pyx_t_1);
3084   __pyx_r = __pyx_t_1;
3085   __pyx_t_1 = 0;
3086   goto __pyx_L0;
3087 
3088   /* "lupa/lock.pxi":34
3089  *             self._real_lock = NULL
3090  *
3091  *     def acquire(self, bint blocking=True):             # <<<<<<<<<<<<<<
3092  *         return lock_lock(self, pythread.PyThread_get_thread_ident(), blocking)
3093  *
3094  */
3095 
3096   /* function exit code */
3097   __pyx_L1_error:;
3098   __Pyx_XDECREF(__pyx_t_1);
3099   __Pyx_AddTraceback("lupa._lupa.FastRLock.acquire", __pyx_clineno, __pyx_lineno, __pyx_filename);
3100   __pyx_r = NULL;
3101   __pyx_L0:;
3102   __Pyx_XGIVEREF(__pyx_r);
3103   __Pyx_RefNannyFinishContext();
3104   return __pyx_r;
3105 }
3106 
3107 /* "lupa/lock.pxi":37
3108  *         return lock_lock(self, pythread.PyThread_get_thread_ident(), blocking)
3109  *
3110  *     def release(self):             # <<<<<<<<<<<<<<
3111  *         if self._owner != pythread.PyThread_get_thread_ident():
3112  *             raise RuntimeError("cannot release un-acquired lock")
3113  */
3114 
3115 /* Python wrapper */
3116 static PyObject *__pyx_pw_4lupa_5_lupa_9FastRLock_7release(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
3117 static char __pyx_doc_4lupa_5_lupa_9FastRLock_6release[] = "FastRLock.release(self)";
3118 static PyMethodDef __pyx_mdef_4lupa_5_lupa_9FastRLock_7release = {"release", (PyCFunction)__pyx_pw_4lupa_5_lupa_9FastRLock_7release, METH_NOARGS, __pyx_doc_4lupa_5_lupa_9FastRLock_6release};
__pyx_pw_4lupa_5_lupa_9FastRLock_7release(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)3119 static PyObject *__pyx_pw_4lupa_5_lupa_9FastRLock_7release(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
3120   PyObject *__pyx_r = 0;
3121   __Pyx_RefNannyDeclarations
3122   __Pyx_RefNannySetupContext("release (wrapper)", 0);
3123   __pyx_r = __pyx_pf_4lupa_5_lupa_9FastRLock_6release(((struct __pyx_obj_4lupa_5_lupa_FastRLock *)__pyx_v_self));
3124 
3125   /* function exit code */
3126   __Pyx_RefNannyFinishContext();
3127   return __pyx_r;
3128 }
3129 
__pyx_pf_4lupa_5_lupa_9FastRLock_6release(struct __pyx_obj_4lupa_5_lupa_FastRLock * __pyx_v_self)3130 static PyObject *__pyx_pf_4lupa_5_lupa_9FastRLock_6release(struct __pyx_obj_4lupa_5_lupa_FastRLock *__pyx_v_self) {
3131   PyObject *__pyx_r = NULL;
3132   __Pyx_RefNannyDeclarations
3133   int __pyx_t_1;
3134   PyObject *__pyx_t_2 = NULL;
3135   int __pyx_lineno = 0;
3136   const char *__pyx_filename = NULL;
3137   int __pyx_clineno = 0;
3138   __Pyx_RefNannySetupContext("release", 0);
3139 
3140   /* "lupa/lock.pxi":38
3141  *
3142  *     def release(self):
3143  *         if self._owner != pythread.PyThread_get_thread_ident():             # <<<<<<<<<<<<<<
3144  *             raise RuntimeError("cannot release un-acquired lock")
3145  *         unlock_lock(self)
3146  */
3147   __pyx_t_1 = ((__pyx_v_self->_owner != PyThread_get_thread_ident()) != 0);
3148   if (unlikely(__pyx_t_1)) {
3149 
3150     /* "lupa/lock.pxi":39
3151  *     def release(self):
3152  *         if self._owner != pythread.PyThread_get_thread_ident():
3153  *             raise RuntimeError("cannot release un-acquired lock")             # <<<<<<<<<<<<<<
3154  *         unlock_lock(self)
3155  *
3156  */
3157     __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 39, __pyx_L1_error)
3158     __Pyx_GOTREF(__pyx_t_2);
3159     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
3160     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3161     __PYX_ERR(1, 39, __pyx_L1_error)
3162 
3163     /* "lupa/lock.pxi":38
3164  *
3165  *     def release(self):
3166  *         if self._owner != pythread.PyThread_get_thread_ident():             # <<<<<<<<<<<<<<
3167  *             raise RuntimeError("cannot release un-acquired lock")
3168  *         unlock_lock(self)
3169  */
3170   }
3171 
3172   /* "lupa/lock.pxi":40
3173  *         if self._owner != pythread.PyThread_get_thread_ident():
3174  *             raise RuntimeError("cannot release un-acquired lock")
3175  *         unlock_lock(self)             # <<<<<<<<<<<<<<
3176  *
3177  *     # compatibility with RLock
3178  */
3179   __pyx_f_4lupa_5_lupa_unlock_lock(__pyx_v_self);
3180 
3181   /* "lupa/lock.pxi":37
3182  *         return lock_lock(self, pythread.PyThread_get_thread_ident(), blocking)
3183  *
3184  *     def release(self):             # <<<<<<<<<<<<<<
3185  *         if self._owner != pythread.PyThread_get_thread_ident():
3186  *             raise RuntimeError("cannot release un-acquired lock")
3187  */
3188 
3189   /* function exit code */
3190   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3191   goto __pyx_L0;
3192   __pyx_L1_error:;
3193   __Pyx_XDECREF(__pyx_t_2);
3194   __Pyx_AddTraceback("lupa._lupa.FastRLock.release", __pyx_clineno, __pyx_lineno, __pyx_filename);
3195   __pyx_r = NULL;
3196   __pyx_L0:;
3197   __Pyx_XGIVEREF(__pyx_r);
3198   __Pyx_RefNannyFinishContext();
3199   return __pyx_r;
3200 }
3201 
3202 /* "lupa/lock.pxi":44
3203  *     # compatibility with RLock
3204  *
3205  *     def __enter__(self):             # <<<<<<<<<<<<<<
3206  *         # self.acquire()
3207  *         return lock_lock(self, pythread.PyThread_get_thread_ident(), True)
3208  */
3209 
3210 /* Python wrapper */
3211 static PyObject *__pyx_pw_4lupa_5_lupa_9FastRLock_9__enter__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
3212 static char __pyx_doc_4lupa_5_lupa_9FastRLock_8__enter__[] = "FastRLock.__enter__(self)";
3213 static PyMethodDef __pyx_mdef_4lupa_5_lupa_9FastRLock_9__enter__ = {"__enter__", (PyCFunction)__pyx_pw_4lupa_5_lupa_9FastRLock_9__enter__, METH_NOARGS, __pyx_doc_4lupa_5_lupa_9FastRLock_8__enter__};
__pyx_pw_4lupa_5_lupa_9FastRLock_9__enter__(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)3214 static PyObject *__pyx_pw_4lupa_5_lupa_9FastRLock_9__enter__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
3215   PyObject *__pyx_r = 0;
3216   __Pyx_RefNannyDeclarations
3217   __Pyx_RefNannySetupContext("__enter__ (wrapper)", 0);
3218   __pyx_r = __pyx_pf_4lupa_5_lupa_9FastRLock_8__enter__(((struct __pyx_obj_4lupa_5_lupa_FastRLock *)__pyx_v_self));
3219 
3220   /* function exit code */
3221   __Pyx_RefNannyFinishContext();
3222   return __pyx_r;
3223 }
3224 
__pyx_pf_4lupa_5_lupa_9FastRLock_8__enter__(struct __pyx_obj_4lupa_5_lupa_FastRLock * __pyx_v_self)3225 static PyObject *__pyx_pf_4lupa_5_lupa_9FastRLock_8__enter__(struct __pyx_obj_4lupa_5_lupa_FastRLock *__pyx_v_self) {
3226   PyObject *__pyx_r = NULL;
3227   __Pyx_RefNannyDeclarations
3228   PyObject *__pyx_t_1 = NULL;
3229   int __pyx_lineno = 0;
3230   const char *__pyx_filename = NULL;
3231   int __pyx_clineno = 0;
3232   __Pyx_RefNannySetupContext("__enter__", 0);
3233 
3234   /* "lupa/lock.pxi":46
3235  *     def __enter__(self):
3236  *         # self.acquire()
3237  *         return lock_lock(self, pythread.PyThread_get_thread_ident(), True)             # <<<<<<<<<<<<<<
3238  *
3239  *     def __exit__(self, t, v, tb):
3240  */
3241   __Pyx_XDECREF(__pyx_r);
3242   __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_f_4lupa_5_lupa_lock_lock(__pyx_v_self, PyThread_get_thread_ident(), 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 46, __pyx_L1_error)
3243   __Pyx_GOTREF(__pyx_t_1);
3244   __pyx_r = __pyx_t_1;
3245   __pyx_t_1 = 0;
3246   goto __pyx_L0;
3247 
3248   /* "lupa/lock.pxi":44
3249  *     # compatibility with RLock
3250  *
3251  *     def __enter__(self):             # <<<<<<<<<<<<<<
3252  *         # self.acquire()
3253  *         return lock_lock(self, pythread.PyThread_get_thread_ident(), True)
3254  */
3255 
3256   /* function exit code */
3257   __pyx_L1_error:;
3258   __Pyx_XDECREF(__pyx_t_1);
3259   __Pyx_AddTraceback("lupa._lupa.FastRLock.__enter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
3260   __pyx_r = NULL;
3261   __pyx_L0:;
3262   __Pyx_XGIVEREF(__pyx_r);
3263   __Pyx_RefNannyFinishContext();
3264   return __pyx_r;
3265 }
3266 
3267 /* "lupa/lock.pxi":48
3268  *         return lock_lock(self, pythread.PyThread_get_thread_ident(), True)
3269  *
3270  *     def __exit__(self, t, v, tb):             # <<<<<<<<<<<<<<
3271  *         # self.release()
3272  *         if self._owner != pythread.PyThread_get_thread_ident():
3273  */
3274 
3275 /* Python wrapper */
3276 static PyObject *__pyx_pw_4lupa_5_lupa_9FastRLock_11__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
3277 static char __pyx_doc_4lupa_5_lupa_9FastRLock_10__exit__[] = "FastRLock.__exit__(self, t, v, tb)";
3278 static PyMethodDef __pyx_mdef_4lupa_5_lupa_9FastRLock_11__exit__ = {"__exit__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lupa_5_lupa_9FastRLock_11__exit__, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4lupa_5_lupa_9FastRLock_10__exit__};
__pyx_pw_4lupa_5_lupa_9FastRLock_11__exit__(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)3279 static PyObject *__pyx_pw_4lupa_5_lupa_9FastRLock_11__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3280   CYTHON_UNUSED PyObject *__pyx_v_t = 0;
3281   CYTHON_UNUSED PyObject *__pyx_v_v = 0;
3282   CYTHON_UNUSED PyObject *__pyx_v_tb = 0;
3283   int __pyx_lineno = 0;
3284   const char *__pyx_filename = NULL;
3285   int __pyx_clineno = 0;
3286   PyObject *__pyx_r = 0;
3287   __Pyx_RefNannyDeclarations
3288   __Pyx_RefNannySetupContext("__exit__ (wrapper)", 0);
3289   {
3290     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_t,&__pyx_n_s_v,&__pyx_n_s_tb,0};
3291     PyObject* values[3] = {0,0,0};
3292     if (unlikely(__pyx_kwds)) {
3293       Py_ssize_t kw_args;
3294       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3295       switch (pos_args) {
3296         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3297         CYTHON_FALLTHROUGH;
3298         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3299         CYTHON_FALLTHROUGH;
3300         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3301         CYTHON_FALLTHROUGH;
3302         case  0: break;
3303         default: goto __pyx_L5_argtuple_error;
3304       }
3305       kw_args = PyDict_Size(__pyx_kwds);
3306       switch (pos_args) {
3307         case  0:
3308         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
3309         else goto __pyx_L5_argtuple_error;
3310         CYTHON_FALLTHROUGH;
3311         case  1:
3312         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v)) != 0)) kw_args--;
3313         else {
3314           __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, 1); __PYX_ERR(1, 48, __pyx_L3_error)
3315         }
3316         CYTHON_FALLTHROUGH;
3317         case  2:
3318         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tb)) != 0)) kw_args--;
3319         else {
3320           __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, 2); __PYX_ERR(1, 48, __pyx_L3_error)
3321         }
3322       }
3323       if (unlikely(kw_args > 0)) {
3324         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__exit__") < 0)) __PYX_ERR(1, 48, __pyx_L3_error)
3325       }
3326     } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
3327       goto __pyx_L5_argtuple_error;
3328     } else {
3329       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3330       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3331       values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3332     }
3333     __pyx_v_t = values[0];
3334     __pyx_v_v = values[1];
3335     __pyx_v_tb = values[2];
3336   }
3337   goto __pyx_L4_argument_unpacking_done;
3338   __pyx_L5_argtuple_error:;
3339   __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 48, __pyx_L3_error)
3340   __pyx_L3_error:;
3341   __Pyx_AddTraceback("lupa._lupa.FastRLock.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
3342   __Pyx_RefNannyFinishContext();
3343   return NULL;
3344   __pyx_L4_argument_unpacking_done:;
3345   __pyx_r = __pyx_pf_4lupa_5_lupa_9FastRLock_10__exit__(((struct __pyx_obj_4lupa_5_lupa_FastRLock *)__pyx_v_self), __pyx_v_t, __pyx_v_v, __pyx_v_tb);
3346 
3347   /* function exit code */
3348   __Pyx_RefNannyFinishContext();
3349   return __pyx_r;
3350 }
3351 
__pyx_pf_4lupa_5_lupa_9FastRLock_10__exit__(struct __pyx_obj_4lupa_5_lupa_FastRLock * __pyx_v_self,CYTHON_UNUSED PyObject * __pyx_v_t,CYTHON_UNUSED PyObject * __pyx_v_v,CYTHON_UNUSED PyObject * __pyx_v_tb)3352 static PyObject *__pyx_pf_4lupa_5_lupa_9FastRLock_10__exit__(struct __pyx_obj_4lupa_5_lupa_FastRLock *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_t, CYTHON_UNUSED PyObject *__pyx_v_v, CYTHON_UNUSED PyObject *__pyx_v_tb) {
3353   PyObject *__pyx_r = NULL;
3354   __Pyx_RefNannyDeclarations
3355   int __pyx_t_1;
3356   PyObject *__pyx_t_2 = NULL;
3357   int __pyx_lineno = 0;
3358   const char *__pyx_filename = NULL;
3359   int __pyx_clineno = 0;
3360   __Pyx_RefNannySetupContext("__exit__", 0);
3361 
3362   /* "lupa/lock.pxi":50
3363  *     def __exit__(self, t, v, tb):
3364  *         # self.release()
3365  *         if self._owner != pythread.PyThread_get_thread_ident():             # <<<<<<<<<<<<<<
3366  *             raise RuntimeError("cannot release un-acquired lock")
3367  *         unlock_lock(self)
3368  */
3369   __pyx_t_1 = ((__pyx_v_self->_owner != PyThread_get_thread_ident()) != 0);
3370   if (unlikely(__pyx_t_1)) {
3371 
3372     /* "lupa/lock.pxi":51
3373  *         # self.release()
3374  *         if self._owner != pythread.PyThread_get_thread_ident():
3375  *             raise RuntimeError("cannot release un-acquired lock")             # <<<<<<<<<<<<<<
3376  *         unlock_lock(self)
3377  *
3378  */
3379     __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 51, __pyx_L1_error)
3380     __Pyx_GOTREF(__pyx_t_2);
3381     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
3382     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3383     __PYX_ERR(1, 51, __pyx_L1_error)
3384 
3385     /* "lupa/lock.pxi":50
3386  *     def __exit__(self, t, v, tb):
3387  *         # self.release()
3388  *         if self._owner != pythread.PyThread_get_thread_ident():             # <<<<<<<<<<<<<<
3389  *             raise RuntimeError("cannot release un-acquired lock")
3390  *         unlock_lock(self)
3391  */
3392   }
3393 
3394   /* "lupa/lock.pxi":52
3395  *         if self._owner != pythread.PyThread_get_thread_ident():
3396  *             raise RuntimeError("cannot release un-acquired lock")
3397  *         unlock_lock(self)             # <<<<<<<<<<<<<<
3398  *
3399  *     def _is_owned(self):
3400  */
3401   __pyx_f_4lupa_5_lupa_unlock_lock(__pyx_v_self);
3402 
3403   /* "lupa/lock.pxi":48
3404  *         return lock_lock(self, pythread.PyThread_get_thread_ident(), True)
3405  *
3406  *     def __exit__(self, t, v, tb):             # <<<<<<<<<<<<<<
3407  *         # self.release()
3408  *         if self._owner != pythread.PyThread_get_thread_ident():
3409  */
3410 
3411   /* function exit code */
3412   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3413   goto __pyx_L0;
3414   __pyx_L1_error:;
3415   __Pyx_XDECREF(__pyx_t_2);
3416   __Pyx_AddTraceback("lupa._lupa.FastRLock.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
3417   __pyx_r = NULL;
3418   __pyx_L0:;
3419   __Pyx_XGIVEREF(__pyx_r);
3420   __Pyx_RefNannyFinishContext();
3421   return __pyx_r;
3422 }
3423 
3424 /* "lupa/lock.pxi":54
3425  *         unlock_lock(self)
3426  *
3427  *     def _is_owned(self):             # <<<<<<<<<<<<<<
3428  *         return self._owner == pythread.PyThread_get_thread_ident()
3429  *
3430  */
3431 
3432 /* Python wrapper */
3433 static PyObject *__pyx_pw_4lupa_5_lupa_9FastRLock_13_is_owned(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
3434 static char __pyx_doc_4lupa_5_lupa_9FastRLock_12_is_owned[] = "FastRLock._is_owned(self)";
3435 static PyMethodDef __pyx_mdef_4lupa_5_lupa_9FastRLock_13_is_owned = {"_is_owned", (PyCFunction)__pyx_pw_4lupa_5_lupa_9FastRLock_13_is_owned, METH_NOARGS, __pyx_doc_4lupa_5_lupa_9FastRLock_12_is_owned};
__pyx_pw_4lupa_5_lupa_9FastRLock_13_is_owned(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)3436 static PyObject *__pyx_pw_4lupa_5_lupa_9FastRLock_13_is_owned(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
3437   PyObject *__pyx_r = 0;
3438   __Pyx_RefNannyDeclarations
3439   __Pyx_RefNannySetupContext("_is_owned (wrapper)", 0);
3440   __pyx_r = __pyx_pf_4lupa_5_lupa_9FastRLock_12_is_owned(((struct __pyx_obj_4lupa_5_lupa_FastRLock *)__pyx_v_self));
3441 
3442   /* function exit code */
3443   __Pyx_RefNannyFinishContext();
3444   return __pyx_r;
3445 }
3446 
__pyx_pf_4lupa_5_lupa_9FastRLock_12_is_owned(struct __pyx_obj_4lupa_5_lupa_FastRLock * __pyx_v_self)3447 static PyObject *__pyx_pf_4lupa_5_lupa_9FastRLock_12_is_owned(struct __pyx_obj_4lupa_5_lupa_FastRLock *__pyx_v_self) {
3448   PyObject *__pyx_r = NULL;
3449   __Pyx_RefNannyDeclarations
3450   PyObject *__pyx_t_1 = NULL;
3451   int __pyx_lineno = 0;
3452   const char *__pyx_filename = NULL;
3453   int __pyx_clineno = 0;
3454   __Pyx_RefNannySetupContext("_is_owned", 0);
3455 
3456   /* "lupa/lock.pxi":55
3457  *
3458  *     def _is_owned(self):
3459  *         return self._owner == pythread.PyThread_get_thread_ident()             # <<<<<<<<<<<<<<
3460  *
3461  *
3462  */
3463   __Pyx_XDECREF(__pyx_r);
3464   __pyx_t_1 = __Pyx_PyBool_FromLong((__pyx_v_self->_owner == PyThread_get_thread_ident())); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 55, __pyx_L1_error)
3465   __Pyx_GOTREF(__pyx_t_1);
3466   __pyx_r = __pyx_t_1;
3467   __pyx_t_1 = 0;
3468   goto __pyx_L0;
3469 
3470   /* "lupa/lock.pxi":54
3471  *         unlock_lock(self)
3472  *
3473  *     def _is_owned(self):             # <<<<<<<<<<<<<<
3474  *         return self._owner == pythread.PyThread_get_thread_ident()
3475  *
3476  */
3477 
3478   /* function exit code */
3479   __pyx_L1_error:;
3480   __Pyx_XDECREF(__pyx_t_1);
3481   __Pyx_AddTraceback("lupa._lupa.FastRLock._is_owned", __pyx_clineno, __pyx_lineno, __pyx_filename);
3482   __pyx_r = NULL;
3483   __pyx_L0:;
3484   __Pyx_XGIVEREF(__pyx_r);
3485   __Pyx_RefNannyFinishContext();
3486   return __pyx_r;
3487 }
3488 
3489 /* "(tree fragment)":1
3490  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
3491  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
3492  * def __setstate_cython__(self, __pyx_state):
3493  */
3494 
3495 /* Python wrapper */
3496 static PyObject *__pyx_pw_4lupa_5_lupa_9FastRLock_15__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
3497 static char __pyx_doc_4lupa_5_lupa_9FastRLock_14__reduce_cython__[] = "FastRLock.__reduce_cython__(self)";
3498 static PyMethodDef __pyx_mdef_4lupa_5_lupa_9FastRLock_15__reduce_cython__ = {"__reduce_cython__", (PyCFunction)__pyx_pw_4lupa_5_lupa_9FastRLock_15__reduce_cython__, METH_NOARGS, __pyx_doc_4lupa_5_lupa_9FastRLock_14__reduce_cython__};
__pyx_pw_4lupa_5_lupa_9FastRLock_15__reduce_cython__(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)3499 static PyObject *__pyx_pw_4lupa_5_lupa_9FastRLock_15__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
3500   PyObject *__pyx_r = 0;
3501   __Pyx_RefNannyDeclarations
3502   __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
3503   __pyx_r = __pyx_pf_4lupa_5_lupa_9FastRLock_14__reduce_cython__(((struct __pyx_obj_4lupa_5_lupa_FastRLock *)__pyx_v_self));
3504 
3505   /* function exit code */
3506   __Pyx_RefNannyFinishContext();
3507   return __pyx_r;
3508 }
3509 
__pyx_pf_4lupa_5_lupa_9FastRLock_14__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_4lupa_5_lupa_FastRLock * __pyx_v_self)3510 static PyObject *__pyx_pf_4lupa_5_lupa_9FastRLock_14__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_4lupa_5_lupa_FastRLock *__pyx_v_self) {
3511   PyObject *__pyx_r = NULL;
3512   __Pyx_RefNannyDeclarations
3513   PyObject *__pyx_t_1 = NULL;
3514   int __pyx_lineno = 0;
3515   const char *__pyx_filename = NULL;
3516   int __pyx_clineno = 0;
3517   __Pyx_RefNannySetupContext("__reduce_cython__", 0);
3518 
3519   /* "(tree fragment)":2
3520  * def __reduce_cython__(self):
3521  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
3522  * def __setstate_cython__(self, __pyx_state):
3523  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
3524  */
3525   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error)
3526   __Pyx_GOTREF(__pyx_t_1);
3527   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
3528   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3529   __PYX_ERR(2, 2, __pyx_L1_error)
3530 
3531   /* "(tree fragment)":1
3532  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
3533  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
3534  * def __setstate_cython__(self, __pyx_state):
3535  */
3536 
3537   /* function exit code */
3538   __pyx_L1_error:;
3539   __Pyx_XDECREF(__pyx_t_1);
3540   __Pyx_AddTraceback("lupa._lupa.FastRLock.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
3541   __pyx_r = NULL;
3542   __Pyx_XGIVEREF(__pyx_r);
3543   __Pyx_RefNannyFinishContext();
3544   return __pyx_r;
3545 }
3546 
3547 /* "(tree fragment)":3
3548  * def __reduce_cython__(self):
3549  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
3550  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
3551  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
3552  */
3553 
3554 /* Python wrapper */
3555 static PyObject *__pyx_pw_4lupa_5_lupa_9FastRLock_17__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
3556 static char __pyx_doc_4lupa_5_lupa_9FastRLock_16__setstate_cython__[] = "FastRLock.__setstate_cython__(self, __pyx_state)";
3557 static PyMethodDef __pyx_mdef_4lupa_5_lupa_9FastRLock_17__setstate_cython__ = {"__setstate_cython__", (PyCFunction)__pyx_pw_4lupa_5_lupa_9FastRLock_17__setstate_cython__, METH_O, __pyx_doc_4lupa_5_lupa_9FastRLock_16__setstate_cython__};
__pyx_pw_4lupa_5_lupa_9FastRLock_17__setstate_cython__(PyObject * __pyx_v_self,PyObject * __pyx_v___pyx_state)3558 static PyObject *__pyx_pw_4lupa_5_lupa_9FastRLock_17__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
3559   PyObject *__pyx_r = 0;
3560   __Pyx_RefNannyDeclarations
3561   __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
3562   __pyx_r = __pyx_pf_4lupa_5_lupa_9FastRLock_16__setstate_cython__(((struct __pyx_obj_4lupa_5_lupa_FastRLock *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
3563 
3564   /* function exit code */
3565   __Pyx_RefNannyFinishContext();
3566   return __pyx_r;
3567 }
3568 
__pyx_pf_4lupa_5_lupa_9FastRLock_16__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_4lupa_5_lupa_FastRLock * __pyx_v_self,CYTHON_UNUSED PyObject * __pyx_v___pyx_state)3569 static PyObject *__pyx_pf_4lupa_5_lupa_9FastRLock_16__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_4lupa_5_lupa_FastRLock *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
3570   PyObject *__pyx_r = NULL;
3571   __Pyx_RefNannyDeclarations
3572   PyObject *__pyx_t_1 = NULL;
3573   int __pyx_lineno = 0;
3574   const char *__pyx_filename = NULL;
3575   int __pyx_clineno = 0;
3576   __Pyx_RefNannySetupContext("__setstate_cython__", 0);
3577 
3578   /* "(tree fragment)":4
3579  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
3580  * def __setstate_cython__(self, __pyx_state):
3581  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
3582  */
3583   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error)
3584   __Pyx_GOTREF(__pyx_t_1);
3585   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
3586   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3587   __PYX_ERR(2, 4, __pyx_L1_error)
3588 
3589   /* "(tree fragment)":3
3590  * def __reduce_cython__(self):
3591  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
3592  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
3593  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
3594  */
3595 
3596   /* function exit code */
3597   __pyx_L1_error:;
3598   __Pyx_XDECREF(__pyx_t_1);
3599   __Pyx_AddTraceback("lupa._lupa.FastRLock.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
3600   __pyx_r = NULL;
3601   __Pyx_XGIVEREF(__pyx_r);
3602   __Pyx_RefNannyFinishContext();
3603   return __pyx_r;
3604 }
3605 
3606 /* "lupa/lock.pxi":58
3607  *
3608  *
3609  * cdef inline bint lock_lock(FastRLock lock, long current_thread, bint blocking) nogil:             # <<<<<<<<<<<<<<
3610  *     # Note that this function *must* hold the GIL when being called.
3611  *     # We just use 'nogil' in the signature to make sure that no Python
3612  */
3613 
__pyx_f_4lupa_5_lupa_lock_lock(struct __pyx_obj_4lupa_5_lupa_FastRLock * __pyx_v_lock,long __pyx_v_current_thread,int __pyx_v_blocking)3614 static CYTHON_INLINE int __pyx_f_4lupa_5_lupa_lock_lock(struct __pyx_obj_4lupa_5_lupa_FastRLock *__pyx_v_lock, long __pyx_v_current_thread, int __pyx_v_blocking) {
3615   int __pyx_r;
3616   int __pyx_t_1;
3617   int __pyx_t_2;
3618 
3619   /* "lupa/lock.pxi":63
3620  *     # code execution slips in that might free the GIL
3621  *
3622  *     if lock._count:             # <<<<<<<<<<<<<<
3623  *         # locked! - by myself?
3624  *         if current_thread == lock._owner:
3625  */
3626   __pyx_t_1 = (__pyx_v_lock->_count != 0);
3627   if (__pyx_t_1) {
3628 
3629     /* "lupa/lock.pxi":65
3630  *     if lock._count:
3631  *         # locked! - by myself?
3632  *         if current_thread == lock._owner:             # <<<<<<<<<<<<<<
3633  *             lock._count += 1
3634  *             return 1
3635  */
3636     __pyx_t_1 = ((__pyx_v_current_thread == __pyx_v_lock->_owner) != 0);
3637     if (__pyx_t_1) {
3638 
3639       /* "lupa/lock.pxi":66
3640  *         # locked! - by myself?
3641  *         if current_thread == lock._owner:
3642  *             lock._count += 1             # <<<<<<<<<<<<<<
3643  *             return 1
3644  *     elif not lock._pending_requests:
3645  */
3646       __pyx_v_lock->_count = (__pyx_v_lock->_count + 1);
3647 
3648       /* "lupa/lock.pxi":67
3649  *         if current_thread == lock._owner:
3650  *             lock._count += 1
3651  *             return 1             # <<<<<<<<<<<<<<
3652  *     elif not lock._pending_requests:
3653  *         # not locked, not requested - go!
3654  */
3655       __pyx_r = 1;
3656       goto __pyx_L0;
3657 
3658       /* "lupa/lock.pxi":65
3659  *     if lock._count:
3660  *         # locked! - by myself?
3661  *         if current_thread == lock._owner:             # <<<<<<<<<<<<<<
3662  *             lock._count += 1
3663  *             return 1
3664  */
3665     }
3666 
3667     /* "lupa/lock.pxi":63
3668  *     # code execution slips in that might free the GIL
3669  *
3670  *     if lock._count:             # <<<<<<<<<<<<<<
3671  *         # locked! - by myself?
3672  *         if current_thread == lock._owner:
3673  */
3674     goto __pyx_L3;
3675   }
3676 
3677   /* "lupa/lock.pxi":68
3678  *             lock._count += 1
3679  *             return 1
3680  *     elif not lock._pending_requests:             # <<<<<<<<<<<<<<
3681  *         # not locked, not requested - go!
3682  *         lock._owner = current_thread
3683  */
3684   __pyx_t_1 = ((!(__pyx_v_lock->_pending_requests != 0)) != 0);
3685   if (__pyx_t_1) {
3686 
3687     /* "lupa/lock.pxi":70
3688  *     elif not lock._pending_requests:
3689  *         # not locked, not requested - go!
3690  *         lock._owner = current_thread             # <<<<<<<<<<<<<<
3691  *         lock._count = 1
3692  *         return 1
3693  */
3694     __pyx_v_lock->_owner = __pyx_v_current_thread;
3695 
3696     /* "lupa/lock.pxi":71
3697  *         # not locked, not requested - go!
3698  *         lock._owner = current_thread
3699  *         lock._count = 1             # <<<<<<<<<<<<<<
3700  *         return 1
3701  *     # need to get the real lock
3702  */
3703     __pyx_v_lock->_count = 1;
3704 
3705     /* "lupa/lock.pxi":72
3706  *         lock._owner = current_thread
3707  *         lock._count = 1
3708  *         return 1             # <<<<<<<<<<<<<<
3709  *     # need to get the real lock
3710  *     return _acquire_lock(
3711  */
3712     __pyx_r = 1;
3713     goto __pyx_L0;
3714 
3715     /* "lupa/lock.pxi":68
3716  *             lock._count += 1
3717  *             return 1
3718  *     elif not lock._pending_requests:             # <<<<<<<<<<<<<<
3719  *         # not locked, not requested - go!
3720  *         lock._owner = current_thread
3721  */
3722   }
3723   __pyx_L3:;
3724 
3725   /* "lupa/lock.pxi":76
3726  *     return _acquire_lock(
3727  *         lock, current_thread,
3728  *         pythread.WAIT_LOCK if blocking else pythread.NOWAIT_LOCK)             # <<<<<<<<<<<<<<
3729  *
3730  * cdef bint _acquire_lock(FastRLock lock, long current_thread, int wait) nogil:
3731  */
3732   if ((__pyx_v_blocking != 0)) {
3733     __pyx_t_2 = WAIT_LOCK;
3734   } else {
3735     __pyx_t_2 = NOWAIT_LOCK;
3736   }
3737 
3738   /* "lupa/lock.pxi":74
3739  *         return 1
3740  *     # need to get the real lock
3741  *     return _acquire_lock(             # <<<<<<<<<<<<<<
3742  *         lock, current_thread,
3743  *         pythread.WAIT_LOCK if blocking else pythread.NOWAIT_LOCK)
3744  */
3745   __pyx_r = __pyx_f_4lupa_5_lupa__acquire_lock(__pyx_v_lock, __pyx_v_current_thread, __pyx_t_2);
3746   goto __pyx_L0;
3747 
3748   /* "lupa/lock.pxi":58
3749  *
3750  *
3751  * cdef inline bint lock_lock(FastRLock lock, long current_thread, bint blocking) nogil:             # <<<<<<<<<<<<<<
3752  *     # Note that this function *must* hold the GIL when being called.
3753  *     # We just use 'nogil' in the signature to make sure that no Python
3754  */
3755 
3756   /* function exit code */
3757   __pyx_L0:;
3758   return __pyx_r;
3759 }
3760 
3761 /* "lupa/lock.pxi":78
3762  *         pythread.WAIT_LOCK if blocking else pythread.NOWAIT_LOCK)
3763  *
3764  * cdef bint _acquire_lock(FastRLock lock, long current_thread, int wait) nogil:             # <<<<<<<<<<<<<<
3765  *     # Note that this function *must* hold the GIL when being called.
3766  *     # We just use 'nogil' in the signature to make sure that no Python
3767  */
3768 
__pyx_f_4lupa_5_lupa__acquire_lock(struct __pyx_obj_4lupa_5_lupa_FastRLock * __pyx_v_lock,long __pyx_v_current_thread,int __pyx_v_wait)3769 static int __pyx_f_4lupa_5_lupa__acquire_lock(struct __pyx_obj_4lupa_5_lupa_FastRLock *__pyx_v_lock, long __pyx_v_current_thread, int __pyx_v_wait) {
3770   int __pyx_v_locked;
3771   int __pyx_r;
3772   int __pyx_t_1;
3773   int __pyx_t_2;
3774 
3775   /* "lupa/lock.pxi":83
3776  *     # code execution slips in that might free the GIL
3777  *
3778  *     if not lock._is_locked and not lock._pending_requests:             # <<<<<<<<<<<<<<
3779  *         # someone owns it but didn't acquire the real lock - do that
3780  *         # now and tell the owner to release it when done. Note that we
3781  */
3782   __pyx_t_2 = ((!(__pyx_v_lock->_is_locked != 0)) != 0);
3783   if (__pyx_t_2) {
3784   } else {
3785     __pyx_t_1 = __pyx_t_2;
3786     goto __pyx_L4_bool_binop_done;
3787   }
3788   __pyx_t_2 = ((!(__pyx_v_lock->_pending_requests != 0)) != 0);
3789   __pyx_t_1 = __pyx_t_2;
3790   __pyx_L4_bool_binop_done:;
3791   if (__pyx_t_1) {
3792 
3793     /* "lupa/lock.pxi":88
3794  *         # do not release the GIL here as we must absolutely be the one
3795  *         # who acquires the lock now.
3796  *         if not pythread.PyThread_acquire_lock(lock._real_lock, wait):             # <<<<<<<<<<<<<<
3797  *             return 0
3798  *         #assert not lock._is_locked
3799  */
3800     __pyx_t_1 = ((!(PyThread_acquire_lock(__pyx_v_lock->_real_lock, __pyx_v_wait) != 0)) != 0);
3801     if (__pyx_t_1) {
3802 
3803       /* "lupa/lock.pxi":89
3804  *         # who acquires the lock now.
3805  *         if not pythread.PyThread_acquire_lock(lock._real_lock, wait):
3806  *             return 0             # <<<<<<<<<<<<<<
3807  *         #assert not lock._is_locked
3808  *         lock._is_locked = True
3809  */
3810       __pyx_r = 0;
3811       goto __pyx_L0;
3812 
3813       /* "lupa/lock.pxi":88
3814  *         # do not release the GIL here as we must absolutely be the one
3815  *         # who acquires the lock now.
3816  *         if not pythread.PyThread_acquire_lock(lock._real_lock, wait):             # <<<<<<<<<<<<<<
3817  *             return 0
3818  *         #assert not lock._is_locked
3819  */
3820     }
3821 
3822     /* "lupa/lock.pxi":91
3823  *             return 0
3824  *         #assert not lock._is_locked
3825  *         lock._is_locked = True             # <<<<<<<<<<<<<<
3826  *     lock._pending_requests += 1
3827  *     with nogil:
3828  */
3829     __pyx_v_lock->_is_locked = 1;
3830 
3831     /* "lupa/lock.pxi":83
3832  *     # code execution slips in that might free the GIL
3833  *
3834  *     if not lock._is_locked and not lock._pending_requests:             # <<<<<<<<<<<<<<
3835  *         # someone owns it but didn't acquire the real lock - do that
3836  *         # now and tell the owner to release it when done. Note that we
3837  */
3838   }
3839 
3840   /* "lupa/lock.pxi":92
3841  *         #assert not lock._is_locked
3842  *         lock._is_locked = True
3843  *     lock._pending_requests += 1             # <<<<<<<<<<<<<<
3844  *     with nogil:
3845  *         # wait for the lock owning thread to release it
3846  */
3847   __pyx_v_lock->_pending_requests = (__pyx_v_lock->_pending_requests + 1);
3848 
3849   /* "lupa/lock.pxi":93
3850  *         lock._is_locked = True
3851  *     lock._pending_requests += 1
3852  *     with nogil:             # <<<<<<<<<<<<<<
3853  *         # wait for the lock owning thread to release it
3854  *         locked = pythread.PyThread_acquire_lock(lock._real_lock, wait)
3855  */
3856   {
3857       #ifdef WITH_THREAD
3858       PyThreadState *_save;
3859       Py_UNBLOCK_THREADS
3860       __Pyx_FastGIL_Remember();
3861       #endif
3862       /*try:*/ {
3863 
3864         /* "lupa/lock.pxi":95
3865  *     with nogil:
3866  *         # wait for the lock owning thread to release it
3867  *         locked = pythread.PyThread_acquire_lock(lock._real_lock, wait)             # <<<<<<<<<<<<<<
3868  *     lock._pending_requests -= 1
3869  *     #assert not lock._is_locked
3870  */
3871         __pyx_v_locked = PyThread_acquire_lock(__pyx_v_lock->_real_lock, __pyx_v_wait);
3872       }
3873 
3874       /* "lupa/lock.pxi":93
3875  *         lock._is_locked = True
3876  *     lock._pending_requests += 1
3877  *     with nogil:             # <<<<<<<<<<<<<<
3878  *         # wait for the lock owning thread to release it
3879  *         locked = pythread.PyThread_acquire_lock(lock._real_lock, wait)
3880  */
3881       /*finally:*/ {
3882         /*normal exit:*/{
3883           #ifdef WITH_THREAD
3884           __Pyx_FastGIL_Forget();
3885           Py_BLOCK_THREADS
3886           #endif
3887           goto __pyx_L9;
3888         }
3889         __pyx_L9:;
3890       }
3891   }
3892 
3893   /* "lupa/lock.pxi":96
3894  *         # wait for the lock owning thread to release it
3895  *         locked = pythread.PyThread_acquire_lock(lock._real_lock, wait)
3896  *     lock._pending_requests -= 1             # <<<<<<<<<<<<<<
3897  *     #assert not lock._is_locked
3898  *     #assert lock._count == 0
3899  */
3900   __pyx_v_lock->_pending_requests = (__pyx_v_lock->_pending_requests - 1);
3901 
3902   /* "lupa/lock.pxi":99
3903  *     #assert not lock._is_locked
3904  *     #assert lock._count == 0
3905  *     if not locked:             # <<<<<<<<<<<<<<
3906  *         return 0
3907  *     lock._is_locked = True
3908  */
3909   __pyx_t_1 = ((!(__pyx_v_locked != 0)) != 0);
3910   if (__pyx_t_1) {
3911 
3912     /* "lupa/lock.pxi":100
3913  *     #assert lock._count == 0
3914  *     if not locked:
3915  *         return 0             # <<<<<<<<<<<<<<
3916  *     lock._is_locked = True
3917  *     lock._owner = current_thread
3918  */
3919     __pyx_r = 0;
3920     goto __pyx_L0;
3921 
3922     /* "lupa/lock.pxi":99
3923  *     #assert not lock._is_locked
3924  *     #assert lock._count == 0
3925  *     if not locked:             # <<<<<<<<<<<<<<
3926  *         return 0
3927  *     lock._is_locked = True
3928  */
3929   }
3930 
3931   /* "lupa/lock.pxi":101
3932  *     if not locked:
3933  *         return 0
3934  *     lock._is_locked = True             # <<<<<<<<<<<<<<
3935  *     lock._owner = current_thread
3936  *     lock._count = 1
3937  */
3938   __pyx_v_lock->_is_locked = 1;
3939 
3940   /* "lupa/lock.pxi":102
3941  *         return 0
3942  *     lock._is_locked = True
3943  *     lock._owner = current_thread             # <<<<<<<<<<<<<<
3944  *     lock._count = 1
3945  *     return 1
3946  */
3947   __pyx_v_lock->_owner = __pyx_v_current_thread;
3948 
3949   /* "lupa/lock.pxi":103
3950  *     lock._is_locked = True
3951  *     lock._owner = current_thread
3952  *     lock._count = 1             # <<<<<<<<<<<<<<
3953  *     return 1
3954  *
3955  */
3956   __pyx_v_lock->_count = 1;
3957 
3958   /* "lupa/lock.pxi":104
3959  *     lock._owner = current_thread
3960  *     lock._count = 1
3961  *     return 1             # <<<<<<<<<<<<<<
3962  *
3963  * cdef inline void unlock_lock(FastRLock lock) nogil:
3964  */
3965   __pyx_r = 1;
3966   goto __pyx_L0;
3967 
3968   /* "lupa/lock.pxi":78
3969  *         pythread.WAIT_LOCK if blocking else pythread.NOWAIT_LOCK)
3970  *
3971  * cdef bint _acquire_lock(FastRLock lock, long current_thread, int wait) nogil:             # <<<<<<<<<<<<<<
3972  *     # Note that this function *must* hold the GIL when being called.
3973  *     # We just use 'nogil' in the signature to make sure that no Python
3974  */
3975 
3976   /* function exit code */
3977   __pyx_L0:;
3978   return __pyx_r;
3979 }
3980 
3981 /* "lupa/lock.pxi":106
3982  *     return 1
3983  *
3984  * cdef inline void unlock_lock(FastRLock lock) nogil:             # <<<<<<<<<<<<<<
3985  *     # Note that this function *must* hold the GIL when being called.
3986  *     # We just use 'nogil' in the signature to make sure that no Python
3987  */
3988 
__pyx_f_4lupa_5_lupa_unlock_lock(struct __pyx_obj_4lupa_5_lupa_FastRLock * __pyx_v_lock)3989 static CYTHON_INLINE void __pyx_f_4lupa_5_lupa_unlock_lock(struct __pyx_obj_4lupa_5_lupa_FastRLock *__pyx_v_lock) {
3990   int __pyx_t_1;
3991 
3992   /* "lupa/lock.pxi":113
3993  *     #assert lock._owner == pythread.PyThread_get_thread_ident()
3994  *     #assert lock._count > 0
3995  *     lock._count -= 1             # <<<<<<<<<<<<<<
3996  *     if lock._count == 0:
3997  *         lock._owner = -1
3998  */
3999   __pyx_v_lock->_count = (__pyx_v_lock->_count - 1);
4000 
4001   /* "lupa/lock.pxi":114
4002  *     #assert lock._count > 0
4003  *     lock._count -= 1
4004  *     if lock._count == 0:             # <<<<<<<<<<<<<<
4005  *         lock._owner = -1
4006  *         if lock._is_locked:
4007  */
4008   __pyx_t_1 = ((__pyx_v_lock->_count == 0) != 0);
4009   if (__pyx_t_1) {
4010 
4011     /* "lupa/lock.pxi":115
4012  *     lock._count -= 1
4013  *     if lock._count == 0:
4014  *         lock._owner = -1             # <<<<<<<<<<<<<<
4015  *         if lock._is_locked:
4016  *             pythread.PyThread_release_lock(lock._real_lock)
4017  */
4018     __pyx_v_lock->_owner = -1L;
4019 
4020     /* "lupa/lock.pxi":116
4021  *     if lock._count == 0:
4022  *         lock._owner = -1
4023  *         if lock._is_locked:             # <<<<<<<<<<<<<<
4024  *             pythread.PyThread_release_lock(lock._real_lock)
4025  *             lock._is_locked = False
4026  */
4027     __pyx_t_1 = (__pyx_v_lock->_is_locked != 0);
4028     if (__pyx_t_1) {
4029 
4030       /* "lupa/lock.pxi":117
4031  *         lock._owner = -1
4032  *         if lock._is_locked:
4033  *             pythread.PyThread_release_lock(lock._real_lock)             # <<<<<<<<<<<<<<
4034  *             lock._is_locked = False
4035  */
4036       PyThread_release_lock(__pyx_v_lock->_real_lock);
4037 
4038       /* "lupa/lock.pxi":118
4039  *         if lock._is_locked:
4040  *             pythread.PyThread_release_lock(lock._real_lock)
4041  *             lock._is_locked = False             # <<<<<<<<<<<<<<
4042  */
4043       __pyx_v_lock->_is_locked = 0;
4044 
4045       /* "lupa/lock.pxi":116
4046  *     if lock._count == 0:
4047  *         lock._owner = -1
4048  *         if lock._is_locked:             # <<<<<<<<<<<<<<
4049  *             pythread.PyThread_release_lock(lock._real_lock)
4050  *             lock._is_locked = False
4051  */
4052     }
4053 
4054     /* "lupa/lock.pxi":114
4055  *     #assert lock._count > 0
4056  *     lock._count -= 1
4057  *     if lock._count == 0:             # <<<<<<<<<<<<<<
4058  *         lock._owner = -1
4059  *         if lock._is_locked:
4060  */
4061   }
4062 
4063   /* "lupa/lock.pxi":106
4064  *     return 1
4065  *
4066  * cdef inline void unlock_lock(FastRLock lock) nogil:             # <<<<<<<<<<<<<<
4067  *     # Note that this function *must* hold the GIL when being called.
4068  *     # We just use 'nogil' in the signature to make sure that no Python
4069  */
4070 
4071   /* function exit code */
4072 }
4073 
4074 /* "lupa/_lupa.pyx":101
4075  *
4076  *
4077  * def lua_type(obj):             # <<<<<<<<<<<<<<
4078  *     """
4079  *     Return the Lua type name of a wrapped object as string, as provided
4080  */
4081 
4082 /* Python wrapper */
4083 static PyObject *__pyx_pw_4lupa_5_lupa_1lua_type(PyObject *__pyx_self, PyObject *__pyx_v_obj); /*proto*/
4084 static char __pyx_doc_4lupa_5_lupa_lua_type[] = "lua_type(obj)\n\n    Return the Lua type name of a wrapped object as string, as provided\n    by Lua's type() function.\n\n    For non-wrapper objects (i.e. normal Python objects), returns None.\n    ";
4085 static PyMethodDef __pyx_mdef_4lupa_5_lupa_1lua_type = {"lua_type", (PyCFunction)__pyx_pw_4lupa_5_lupa_1lua_type, METH_O, __pyx_doc_4lupa_5_lupa_lua_type};
__pyx_pw_4lupa_5_lupa_1lua_type(PyObject * __pyx_self,PyObject * __pyx_v_obj)4086 static PyObject *__pyx_pw_4lupa_5_lupa_1lua_type(PyObject *__pyx_self, PyObject *__pyx_v_obj) {
4087   PyObject *__pyx_r = 0;
4088   __Pyx_RefNannyDeclarations
4089   __Pyx_RefNannySetupContext("lua_type (wrapper)", 0);
4090   __pyx_r = __pyx_pf_4lupa_5_lupa_lua_type(__pyx_self, ((PyObject *)__pyx_v_obj));
4091 
4092   /* function exit code */
4093   __Pyx_RefNannyFinishContext();
4094   return __pyx_r;
4095 }
4096 
__pyx_pf_4lupa_5_lupa_lua_type(CYTHON_UNUSED PyObject * __pyx_self,PyObject * __pyx_v_obj)4097 static PyObject *__pyx_pf_4lupa_5_lupa_lua_type(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_obj) {
4098   struct __pyx_obj_4lupa_5_lupa__LuaObject *__pyx_v_lua_object = NULL;
4099   lua_State *__pyx_v_L;
4100   int __pyx_v_old_top;
4101   char const *__pyx_v_lua_type_name;
4102   int __pyx_v_ltype;
4103   PyObject *__pyx_r = NULL;
4104   __Pyx_RefNannyDeclarations
4105   int __pyx_t_1;
4106   int __pyx_t_2;
4107   PyObject *__pyx_t_3 = NULL;
4108   int __pyx_t_4;
4109   lua_State *__pyx_t_5;
4110   PyObject *__pyx_t_6 = NULL;
4111   int __pyx_t_7;
4112   char const *__pyx_t_8;
4113   PyObject *__pyx_t_9 = NULL;
4114   PyObject *__pyx_t_10 = NULL;
4115   PyObject *__pyx_t_11 = NULL;
4116   PyObject *__pyx_t_12 = NULL;
4117   PyObject *__pyx_t_13 = NULL;
4118   PyObject *__pyx_t_14 = NULL;
4119   int __pyx_lineno = 0;
4120   const char *__pyx_filename = NULL;
4121   int __pyx_clineno = 0;
4122   __Pyx_RefNannySetupContext("lua_type", 0);
4123 
4124   /* "lupa/_lupa.pyx":108
4125  *     For non-wrapper objects (i.e. normal Python objects), returns None.
4126  *     """
4127  *     if not isinstance(obj, _LuaObject):             # <<<<<<<<<<<<<<
4128  *         return None
4129  *     lua_object = <_LuaObject>obj
4130  */
4131   __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_obj, __pyx_ptype_4lupa_5_lupa__LuaObject);
4132   __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
4133   if (__pyx_t_2) {
4134 
4135     /* "lupa/_lupa.pyx":109
4136  *     """
4137  *     if not isinstance(obj, _LuaObject):
4138  *         return None             # <<<<<<<<<<<<<<
4139  *     lua_object = <_LuaObject>obj
4140  *     assert lua_object._runtime is not None
4141  */
4142     __Pyx_XDECREF(__pyx_r);
4143     __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4144     goto __pyx_L0;
4145 
4146     /* "lupa/_lupa.pyx":108
4147  *     For non-wrapper objects (i.e. normal Python objects), returns None.
4148  *     """
4149  *     if not isinstance(obj, _LuaObject):             # <<<<<<<<<<<<<<
4150  *         return None
4151  *     lua_object = <_LuaObject>obj
4152  */
4153   }
4154 
4155   /* "lupa/_lupa.pyx":110
4156  *     if not isinstance(obj, _LuaObject):
4157  *         return None
4158  *     lua_object = <_LuaObject>obj             # <<<<<<<<<<<<<<
4159  *     assert lua_object._runtime is not None
4160  *     lock_runtime(lua_object._runtime)
4161  */
4162   __pyx_t_3 = __pyx_v_obj;
4163   __Pyx_INCREF(__pyx_t_3);
4164   __pyx_v_lua_object = ((struct __pyx_obj_4lupa_5_lupa__LuaObject *)__pyx_t_3);
4165   __pyx_t_3 = 0;
4166 
4167   /* "lupa/_lupa.pyx":111
4168  *         return None
4169  *     lua_object = <_LuaObject>obj
4170  *     assert lua_object._runtime is not None             # <<<<<<<<<<<<<<
4171  *     lock_runtime(lua_object._runtime)
4172  *     L = lua_object._state
4173  */
4174   #ifndef CYTHON_WITHOUT_ASSERTIONS
4175   if (unlikely(!Py_OptimizeFlag)) {
4176     __pyx_t_2 = (((PyObject *)__pyx_v_lua_object->_runtime) != Py_None);
4177     if (unlikely(!(__pyx_t_2 != 0))) {
4178       PyErr_SetNone(PyExc_AssertionError);
4179       __PYX_ERR(0, 111, __pyx_L1_error)
4180     }
4181   }
4182   #endif
4183 
4184   /* "lupa/_lupa.pyx":112
4185  *     lua_object = <_LuaObject>obj
4186  *     assert lua_object._runtime is not None
4187  *     lock_runtime(lua_object._runtime)             # <<<<<<<<<<<<<<
4188  *     L = lua_object._state
4189  *     old_top = lua.lua_gettop(L)
4190  */
4191   __pyx_t_3 = ((PyObject *)__pyx_v_lua_object->_runtime);
4192   __Pyx_INCREF(__pyx_t_3);
4193   __pyx_t_4 = __pyx_f_4lupa_5_lupa_lock_runtime(((struct __pyx_obj_4lupa_5_lupa_LuaRuntime *)__pyx_t_3)); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 112, __pyx_L1_error)
4194   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4195 
4196   /* "lupa/_lupa.pyx":113
4197  *     assert lua_object._runtime is not None
4198  *     lock_runtime(lua_object._runtime)
4199  *     L = lua_object._state             # <<<<<<<<<<<<<<
4200  *     old_top = lua.lua_gettop(L)
4201  *     cdef const char* lua_type_name
4202  */
4203   __pyx_t_5 = __pyx_v_lua_object->_state;
4204   __pyx_v_L = __pyx_t_5;
4205 
4206   /* "lupa/_lupa.pyx":114
4207  *     lock_runtime(lua_object._runtime)
4208  *     L = lua_object._state
4209  *     old_top = lua.lua_gettop(L)             # <<<<<<<<<<<<<<
4210  *     cdef const char* lua_type_name
4211  *     try:
4212  */
4213   __pyx_v_old_top = lua_gettop(__pyx_v_L);
4214 
4215   /* "lupa/_lupa.pyx":116
4216  *     old_top = lua.lua_gettop(L)
4217  *     cdef const char* lua_type_name
4218  *     try:             # <<<<<<<<<<<<<<
4219  *         lua.lua_rawgeti(L, lua.LUA_REGISTRYINDEX, lua_object._ref)
4220  *         ltype = lua.lua_type(L, -1)
4221  */
4222   /*try:*/ {
4223 
4224     /* "lupa/_lupa.pyx":117
4225  *     cdef const char* lua_type_name
4226  *     try:
4227  *         lua.lua_rawgeti(L, lua.LUA_REGISTRYINDEX, lua_object._ref)             # <<<<<<<<<<<<<<
4228  *         ltype = lua.lua_type(L, -1)
4229  *         if ltype == lua.LUA_TTABLE:
4230  */
4231     lua_rawgeti(__pyx_v_L, LUA_REGISTRYINDEX, __pyx_v_lua_object->_ref);
4232 
4233     /* "lupa/_lupa.pyx":118
4234  *     try:
4235  *         lua.lua_rawgeti(L, lua.LUA_REGISTRYINDEX, lua_object._ref)
4236  *         ltype = lua.lua_type(L, -1)             # <<<<<<<<<<<<<<
4237  *         if ltype == lua.LUA_TTABLE:
4238  *             return 'table'
4239  */
4240     __pyx_v_ltype = lua_type(__pyx_v_L, -1);
4241 
4242     /* "lupa/_lupa.pyx":119
4243  *         lua.lua_rawgeti(L, lua.LUA_REGISTRYINDEX, lua_object._ref)
4244  *         ltype = lua.lua_type(L, -1)
4245  *         if ltype == lua.LUA_TTABLE:             # <<<<<<<<<<<<<<
4246  *             return 'table'
4247  *         elif ltype == lua.LUA_TFUNCTION:
4248  */
4249     switch (__pyx_v_ltype) {
4250       case LUA_TTABLE:
4251 
4252       /* "lupa/_lupa.pyx":120
4253  *         ltype = lua.lua_type(L, -1)
4254  *         if ltype == lua.LUA_TTABLE:
4255  *             return 'table'             # <<<<<<<<<<<<<<
4256  *         elif ltype == lua.LUA_TFUNCTION:
4257  *             return 'function'
4258  */
4259       __Pyx_XDECREF(__pyx_r);
4260       __Pyx_INCREF(__pyx_n_s_table);
4261       __pyx_r = __pyx_n_s_table;
4262       goto __pyx_L4_return;
4263 
4264       /* "lupa/_lupa.pyx":119
4265  *         lua.lua_rawgeti(L, lua.LUA_REGISTRYINDEX, lua_object._ref)
4266  *         ltype = lua.lua_type(L, -1)
4267  *         if ltype == lua.LUA_TTABLE:             # <<<<<<<<<<<<<<
4268  *             return 'table'
4269  *         elif ltype == lua.LUA_TFUNCTION:
4270  */
4271       break;
4272       case LUA_TFUNCTION:
4273 
4274       /* "lupa/_lupa.pyx":122
4275  *             return 'table'
4276  *         elif ltype == lua.LUA_TFUNCTION:
4277  *             return 'function'             # <<<<<<<<<<<<<<
4278  *         elif ltype == lua.LUA_TTHREAD:
4279  *             return 'thread'
4280  */
4281       __Pyx_XDECREF(__pyx_r);
4282       __Pyx_INCREF(__pyx_n_s_function);
4283       __pyx_r = __pyx_n_s_function;
4284       goto __pyx_L4_return;
4285 
4286       /* "lupa/_lupa.pyx":121
4287  *         if ltype == lua.LUA_TTABLE:
4288  *             return 'table'
4289  *         elif ltype == lua.LUA_TFUNCTION:             # <<<<<<<<<<<<<<
4290  *             return 'function'
4291  *         elif ltype == lua.LUA_TTHREAD:
4292  */
4293       break;
4294       case LUA_TTHREAD:
4295 
4296       /* "lupa/_lupa.pyx":124
4297  *             return 'function'
4298  *         elif ltype == lua.LUA_TTHREAD:
4299  *             return 'thread'             # <<<<<<<<<<<<<<
4300  *         elif ltype in (lua.LUA_TUSERDATA, lua.LUA_TLIGHTUSERDATA):
4301  *             return 'userdata'
4302  */
4303       __Pyx_XDECREF(__pyx_r);
4304       __Pyx_INCREF(__pyx_n_s_thread);
4305       __pyx_r = __pyx_n_s_thread;
4306       goto __pyx_L4_return;
4307 
4308       /* "lupa/_lupa.pyx":123
4309  *         elif ltype == lua.LUA_TFUNCTION:
4310  *             return 'function'
4311  *         elif ltype == lua.LUA_TTHREAD:             # <<<<<<<<<<<<<<
4312  *             return 'thread'
4313  *         elif ltype in (lua.LUA_TUSERDATA, lua.LUA_TLIGHTUSERDATA):
4314  */
4315       break;
4316       case LUA_TUSERDATA:
4317 
4318       /* "lupa/_lupa.pyx":125
4319  *         elif ltype == lua.LUA_TTHREAD:
4320  *             return 'thread'
4321  *         elif ltype in (lua.LUA_TUSERDATA, lua.LUA_TLIGHTUSERDATA):             # <<<<<<<<<<<<<<
4322  *             return 'userdata'
4323  *         else:
4324  */
4325       case LUA_TLIGHTUSERDATA:
4326 
4327       /* "lupa/_lupa.pyx":126
4328  *             return 'thread'
4329  *         elif ltype in (lua.LUA_TUSERDATA, lua.LUA_TLIGHTUSERDATA):
4330  *             return 'userdata'             # <<<<<<<<<<<<<<
4331  *         else:
4332  *             lua_type_name = lua.lua_typename(L, ltype)
4333  */
4334       __Pyx_XDECREF(__pyx_r);
4335       __Pyx_INCREF(__pyx_n_s_userdata);
4336       __pyx_r = __pyx_n_s_userdata;
4337       goto __pyx_L4_return;
4338 
4339       /* "lupa/_lupa.pyx":125
4340  *         elif ltype == lua.LUA_TTHREAD:
4341  *             return 'thread'
4342  *         elif ltype in (lua.LUA_TUSERDATA, lua.LUA_TLIGHTUSERDATA):             # <<<<<<<<<<<<<<
4343  *             return 'userdata'
4344  *         else:
4345  */
4346       break;
4347       default:
4348 
4349       /* "lupa/_lupa.pyx":128
4350  *             return 'userdata'
4351  *         else:
4352  *             lua_type_name = lua.lua_typename(L, ltype)             # <<<<<<<<<<<<<<
4353  *             return lua_type_name if IS_PY2 else lua_type_name.decode('ascii')
4354  *     finally:
4355  */
4356       __pyx_v_lua_type_name = lua_typename(__pyx_v_L, __pyx_v_ltype);
4357 
4358       /* "lupa/_lupa.pyx":129
4359  *         else:
4360  *             lua_type_name = lua.lua_typename(L, ltype)
4361  *             return lua_type_name if IS_PY2 else lua_type_name.decode('ascii')             # <<<<<<<<<<<<<<
4362  *     finally:
4363  *         lua.lua_settop(L, old_top)
4364  */
4365       __Pyx_XDECREF(__pyx_r);
4366       if ((IS_PY2 != 0)) {
4367         __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_v_lua_type_name); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 129, __pyx_L5_error)
4368         __Pyx_GOTREF(__pyx_t_6);
4369         __pyx_t_3 = __pyx_t_6;
4370         __pyx_t_6 = 0;
4371       } else {
4372         __pyx_t_6 = __Pyx_decode_c_string(__pyx_v_lua_type_name, 0, strlen(__pyx_v_lua_type_name), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 129, __pyx_L5_error)
4373         __Pyx_GOTREF(__pyx_t_6);
4374         __pyx_t_3 = __pyx_t_6;
4375         __pyx_t_6 = 0;
4376       }
4377       __pyx_r = __pyx_t_3;
4378       __pyx_t_3 = 0;
4379       goto __pyx_L4_return;
4380       break;
4381     }
4382   }
4383 
4384   /* "lupa/_lupa.pyx":131
4385  *             return lua_type_name if IS_PY2 else lua_type_name.decode('ascii')
4386  *     finally:
4387  *         lua.lua_settop(L, old_top)             # <<<<<<<<<<<<<<
4388  *         unlock_runtime(lua_object._runtime)
4389  *
4390  */
4391   /*finally:*/ {
4392     __pyx_L5_error:;
4393     /*exception exit:*/{
4394       __Pyx_PyThreadState_declare
4395       __Pyx_PyThreadState_assign
4396       __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0;
4397       __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
4398       __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
4399       if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14);
4400       if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11) < 0)) __Pyx_ErrFetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
4401       __Pyx_XGOTREF(__pyx_t_9);
4402       __Pyx_XGOTREF(__pyx_t_10);
4403       __Pyx_XGOTREF(__pyx_t_11);
4404       __Pyx_XGOTREF(__pyx_t_12);
4405       __Pyx_XGOTREF(__pyx_t_13);
4406       __Pyx_XGOTREF(__pyx_t_14);
4407       __pyx_t_4 = __pyx_lineno; __pyx_t_7 = __pyx_clineno; __pyx_t_8 = __pyx_filename;
4408       {
4409         lua_settop(__pyx_v_L, __pyx_v_old_top);
4410 
4411         /* "lupa/_lupa.pyx":132
4412  *     finally:
4413  *         lua.lua_settop(L, old_top)
4414  *         unlock_runtime(lua_object._runtime)             # <<<<<<<<<<<<<<
4415  *
4416  *
4417  */
4418         __pyx_t_3 = ((PyObject *)__pyx_v_lua_object->_runtime);
4419         __Pyx_INCREF(__pyx_t_3);
4420         __pyx_f_4lupa_5_lupa_unlock_runtime(((struct __pyx_obj_4lupa_5_lupa_LuaRuntime *)__pyx_t_3));
4421         __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4422       }
4423       if (PY_MAJOR_VERSION >= 3) {
4424         __Pyx_XGIVEREF(__pyx_t_12);
4425         __Pyx_XGIVEREF(__pyx_t_13);
4426         __Pyx_XGIVEREF(__pyx_t_14);
4427         __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_13, __pyx_t_14);
4428       }
4429       __Pyx_XGIVEREF(__pyx_t_9);
4430       __Pyx_XGIVEREF(__pyx_t_10);
4431       __Pyx_XGIVEREF(__pyx_t_11);
4432       __Pyx_ErrRestore(__pyx_t_9, __pyx_t_10, __pyx_t_11);
4433       __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0;
4434       __pyx_lineno = __pyx_t_4; __pyx_clineno = __pyx_t_7; __pyx_filename = __pyx_t_8;
4435       goto __pyx_L1_error;
4436     }
4437     __pyx_L4_return: {
4438       __pyx_t_14 = __pyx_r;
4439       __pyx_r = 0;
4440 
4441       /* "lupa/_lupa.pyx":131
4442  *             return lua_type_name if IS_PY2 else lua_type_name.decode('ascii')
4443  *     finally:
4444  *         lua.lua_settop(L, old_top)             # <<<<<<<<<<<<<<
4445  *         unlock_runtime(lua_object._runtime)
4446  *
4447  */
4448       lua_settop(__pyx_v_L, __pyx_v_old_top);
4449 
4450       /* "lupa/_lupa.pyx":132
4451  *     finally:
4452  *         lua.lua_settop(L, old_top)
4453  *         unlock_runtime(lua_object._runtime)             # <<<<<<<<<<<<<<
4454  *
4455  *
4456  */
4457       __pyx_t_3 = ((PyObject *)__pyx_v_lua_object->_runtime);
4458       __Pyx_INCREF(__pyx_t_3);
4459       __pyx_f_4lupa_5_lupa_unlock_runtime(((struct __pyx_obj_4lupa_5_lupa_LuaRuntime *)__pyx_t_3));
4460       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4461       __pyx_r = __pyx_t_14;
4462       __pyx_t_14 = 0;
4463       goto __pyx_L0;
4464     }
4465   }
4466 
4467   /* "lupa/_lupa.pyx":101
4468  *
4469  *
4470  * def lua_type(obj):             # <<<<<<<<<<<<<<
4471  *     """
4472  *     Return the Lua type name of a wrapped object as string, as provided
4473  */
4474 
4475   /* function exit code */
4476   __pyx_L1_error:;
4477   __Pyx_XDECREF(__pyx_t_3);
4478   __Pyx_XDECREF(__pyx_t_6);
4479   __Pyx_AddTraceback("lupa._lupa.lua_type", __pyx_clineno, __pyx_lineno, __pyx_filename);
4480   __pyx_r = NULL;
4481   __pyx_L0:;
4482   __Pyx_XDECREF((PyObject *)__pyx_v_lua_object);
4483   __Pyx_XGIVEREF(__pyx_r);
4484   __Pyx_RefNannyFinishContext();
4485   return __pyx_r;
4486 }
4487 
4488 /* "lupa/_lupa.pyx":213
4489  *     cdef bint _unpack_returned_tuples
4490  *
4491  *     def __cinit__(self, encoding='UTF-8', source_encoding=None,             # <<<<<<<<<<<<<<
4492  *                   attribute_filter=None, attribute_handlers=None,
4493  *                   bint register_eval=True, bint unpack_returned_tuples=False,
4494  */
4495 
4496 /* Python wrapper */
4497 static int __pyx_pw_4lupa_5_lupa_10LuaRuntime_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_pw_4lupa_5_lupa_10LuaRuntime_1__cinit__(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)4498 static int __pyx_pw_4lupa_5_lupa_10LuaRuntime_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4499   PyObject *__pyx_v_encoding = 0;
4500   PyObject *__pyx_v_source_encoding = 0;
4501   PyObject *__pyx_v_attribute_filter = 0;
4502   PyObject *__pyx_v_attribute_handlers = 0;
4503   int __pyx_v_register_eval;
4504   int __pyx_v_unpack_returned_tuples;
4505   int __pyx_v_register_builtins;
4506   int __pyx_lineno = 0;
4507   const char *__pyx_filename = NULL;
4508   int __pyx_clineno = 0;
4509   int __pyx_r;
4510   __Pyx_RefNannyDeclarations
4511   __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
4512   {
4513     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_encoding,&__pyx_n_s_source_encoding,&__pyx_n_s_attribute_filter,&__pyx_n_s_attribute_handlers,&__pyx_n_s_register_eval,&__pyx_n_s_unpack_returned_tuples,&__pyx_n_s_register_builtins,0};
4514     PyObject* values[7] = {0,0,0,0,0,0,0};
4515     values[0] = ((PyObject *)__pyx_kp_s_UTF_8);
4516     values[1] = ((PyObject *)Py_None);
4517 
4518     /* "lupa/_lupa.pyx":214
4519  *
4520  *     def __cinit__(self, encoding='UTF-8', source_encoding=None,
4521  *                   attribute_filter=None, attribute_handlers=None,             # <<<<<<<<<<<<<<
4522  *                   bint register_eval=True, bint unpack_returned_tuples=False,
4523  *                   bint register_builtins=True):
4524  */
4525     values[2] = ((PyObject *)Py_None);
4526     values[3] = ((PyObject *)Py_None);
4527     if (unlikely(__pyx_kwds)) {
4528       Py_ssize_t kw_args;
4529       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4530       switch (pos_args) {
4531         case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
4532         CYTHON_FALLTHROUGH;
4533         case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
4534         CYTHON_FALLTHROUGH;
4535         case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
4536         CYTHON_FALLTHROUGH;
4537         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
4538         CYTHON_FALLTHROUGH;
4539         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4540         CYTHON_FALLTHROUGH;
4541         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4542         CYTHON_FALLTHROUGH;
4543         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4544         CYTHON_FALLTHROUGH;
4545         case  0: break;
4546         default: goto __pyx_L5_argtuple_error;
4547       }
4548       kw_args = PyDict_Size(__pyx_kwds);
4549       switch (pos_args) {
4550         case  0:
4551         if (kw_args > 0) {
4552           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_encoding);
4553           if (value) { values[0] = value; kw_args--; }
4554         }
4555         CYTHON_FALLTHROUGH;
4556         case  1:
4557         if (kw_args > 0) {
4558           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_source_encoding);
4559           if (value) { values[1] = value; kw_args--; }
4560         }
4561         CYTHON_FALLTHROUGH;
4562         case  2:
4563         if (kw_args > 0) {
4564           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_attribute_filter);
4565           if (value) { values[2] = value; kw_args--; }
4566         }
4567         CYTHON_FALLTHROUGH;
4568         case  3:
4569         if (kw_args > 0) {
4570           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_attribute_handlers);
4571           if (value) { values[3] = value; kw_args--; }
4572         }
4573         CYTHON_FALLTHROUGH;
4574         case  4:
4575         if (kw_args > 0) {
4576           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_register_eval);
4577           if (value) { values[4] = value; kw_args--; }
4578         }
4579         CYTHON_FALLTHROUGH;
4580         case  5:
4581         if (kw_args > 0) {
4582           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_unpack_returned_tuples);
4583           if (value) { values[5] = value; kw_args--; }
4584         }
4585         CYTHON_FALLTHROUGH;
4586         case  6:
4587         if (kw_args > 0) {
4588           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_register_builtins);
4589           if (value) { values[6] = value; kw_args--; }
4590         }
4591       }
4592       if (unlikely(kw_args > 0)) {
4593         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(0, 213, __pyx_L3_error)
4594       }
4595     } else {
4596       switch (PyTuple_GET_SIZE(__pyx_args)) {
4597         case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
4598         CYTHON_FALLTHROUGH;
4599         case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
4600         CYTHON_FALLTHROUGH;
4601         case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
4602         CYTHON_FALLTHROUGH;
4603         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
4604         CYTHON_FALLTHROUGH;
4605         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4606         CYTHON_FALLTHROUGH;
4607         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4608         CYTHON_FALLTHROUGH;
4609         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4610         CYTHON_FALLTHROUGH;
4611         case  0: break;
4612         default: goto __pyx_L5_argtuple_error;
4613       }
4614     }
4615     __pyx_v_encoding = values[0];
4616     __pyx_v_source_encoding = values[1];
4617     __pyx_v_attribute_filter = values[2];
4618     __pyx_v_attribute_handlers = values[3];
4619     if (values[4]) {
4620       __pyx_v_register_eval = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_register_eval == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 215, __pyx_L3_error)
4621     } else {
4622 
4623       /* "lupa/_lupa.pyx":215
4624  *     def __cinit__(self, encoding='UTF-8', source_encoding=None,
4625  *                   attribute_filter=None, attribute_handlers=None,
4626  *                   bint register_eval=True, bint unpack_returned_tuples=False,             # <<<<<<<<<<<<<<
4627  *                   bint register_builtins=True):
4628  *         cdef lua_State* L = lua.luaL_newstate()
4629  */
4630       __pyx_v_register_eval = ((int)1);
4631     }
4632     if (values[5]) {
4633       __pyx_v_unpack_returned_tuples = __Pyx_PyObject_IsTrue(values[5]); if (unlikely((__pyx_v_unpack_returned_tuples == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 215, __pyx_L3_error)
4634     } else {
4635       __pyx_v_unpack_returned_tuples = ((int)0);
4636     }
4637     if (values[6]) {
4638       __pyx_v_register_builtins = __Pyx_PyObject_IsTrue(values[6]); if (unlikely((__pyx_v_register_builtins == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 216, __pyx_L3_error)
4639     } else {
4640 
4641       /* "lupa/_lupa.pyx":216
4642  *                   attribute_filter=None, attribute_handlers=None,
4643  *                   bint register_eval=True, bint unpack_returned_tuples=False,
4644  *                   bint register_builtins=True):             # <<<<<<<<<<<<<<
4645  *         cdef lua_State* L = lua.luaL_newstate()
4646  *         if L is NULL:
4647  */
4648       __pyx_v_register_builtins = ((int)1);
4649     }
4650   }
4651   goto __pyx_L4_argument_unpacking_done;
4652   __pyx_L5_argtuple_error:;
4653   __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 0, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 213, __pyx_L3_error)
4654   __pyx_L3_error:;
4655   __Pyx_AddTraceback("lupa._lupa.LuaRuntime.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
4656   __Pyx_RefNannyFinishContext();
4657   return -1;
4658   __pyx_L4_argument_unpacking_done:;
4659   __pyx_r = __pyx_pf_4lupa_5_lupa_10LuaRuntime___cinit__(((struct __pyx_obj_4lupa_5_lupa_LuaRuntime *)__pyx_v_self), __pyx_v_encoding, __pyx_v_source_encoding, __pyx_v_attribute_filter, __pyx_v_attribute_handlers, __pyx_v_register_eval, __pyx_v_unpack_returned_tuples, __pyx_v_register_builtins);
4660 
4661   /* "lupa/_lupa.pyx":213
4662  *     cdef bint _unpack_returned_tuples
4663  *
4664  *     def __cinit__(self, encoding='UTF-8', source_encoding=None,             # <<<<<<<<<<<<<<
4665  *                   attribute_filter=None, attribute_handlers=None,
4666  *                   bint register_eval=True, bint unpack_returned_tuples=False,
4667  */
4668 
4669   /* function exit code */
4670   __Pyx_RefNannyFinishContext();
4671   return __pyx_r;
4672 }
4673 
__pyx_pf_4lupa_5_lupa_10LuaRuntime___cinit__(struct __pyx_obj_4lupa_5_lupa_LuaRuntime * __pyx_v_self,PyObject * __pyx_v_encoding,PyObject * __pyx_v_source_encoding,PyObject * __pyx_v_attribute_filter,PyObject * __pyx_v_attribute_handlers,int __pyx_v_register_eval,int __pyx_v_unpack_returned_tuples,int __pyx_v_register_builtins)4674 static int __pyx_pf_4lupa_5_lupa_10LuaRuntime___cinit__(struct __pyx_obj_4lupa_5_lupa_LuaRuntime *__pyx_v_self, PyObject *__pyx_v_encoding, PyObject *__pyx_v_source_encoding, PyObject *__pyx_v_attribute_filter, PyObject *__pyx_v_attribute_handlers, int __pyx_v_register_eval, int __pyx_v_unpack_returned_tuples, int __pyx_v_register_builtins) {
4675   lua_State *__pyx_v_L;
4676   int __pyx_v_raise_error;
4677   PyObject *__pyx_v_getter = NULL;
4678   PyObject *__pyx_v_setter = NULL;
4679   int __pyx_r;
4680   __Pyx_RefNannyDeclarations
4681   int __pyx_t_1;
4682   PyObject *__pyx_t_2 = NULL;
4683   PyObject *__pyx_t_3 = NULL;
4684   PyObject *__pyx_t_4 = NULL;
4685   int __pyx_t_5;
4686   int __pyx_t_6;
4687   PyObject *__pyx_t_7 = NULL;
4688   PyObject *__pyx_t_8 = NULL;
4689   PyObject *__pyx_t_9 = NULL;
4690   PyObject *(*__pyx_t_10)(PyObject *);
4691   int __pyx_t_11;
4692   int __pyx_lineno = 0;
4693   const char *__pyx_filename = NULL;
4694   int __pyx_clineno = 0;
4695   __Pyx_RefNannySetupContext("__cinit__", 0);
4696 
4697   /* "lupa/_lupa.pyx":217
4698  *                   bint register_eval=True, bint unpack_returned_tuples=False,
4699  *                   bint register_builtins=True):
4700  *         cdef lua_State* L = lua.luaL_newstate()             # <<<<<<<<<<<<<<
4701  *         if L is NULL:
4702  *             raise LuaError("Failed to initialise Lua runtime")
4703  */
4704   __pyx_v_L = luaL_newstate();
4705 
4706   /* "lupa/_lupa.pyx":218
4707  *                   bint register_builtins=True):
4708  *         cdef lua_State* L = lua.luaL_newstate()
4709  *         if L is NULL:             # <<<<<<<<<<<<<<
4710  *             raise LuaError("Failed to initialise Lua runtime")
4711  *         self._state = L
4712  */
4713   __pyx_t_1 = ((__pyx_v_L == NULL) != 0);
4714   if (unlikely(__pyx_t_1)) {
4715 
4716     /* "lupa/_lupa.pyx":219
4717  *         cdef lua_State* L = lua.luaL_newstate()
4718  *         if L is NULL:
4719  *             raise LuaError("Failed to initialise Lua runtime")             # <<<<<<<<<<<<<<
4720  *         self._state = L
4721  *         self._lock = FastRLock()
4722  */
4723     __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_LuaError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 219, __pyx_L1_error)
4724     __Pyx_GOTREF(__pyx_t_3);
4725     __pyx_t_4 = NULL;
4726     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
4727       __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
4728       if (likely(__pyx_t_4)) {
4729         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
4730         __Pyx_INCREF(__pyx_t_4);
4731         __Pyx_INCREF(function);
4732         __Pyx_DECREF_SET(__pyx_t_3, function);
4733       }
4734     }
4735     __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_kp_s_Failed_to_initialise_Lua_runtime) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_s_Failed_to_initialise_Lua_runtime);
4736     __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
4737     if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 219, __pyx_L1_error)
4738     __Pyx_GOTREF(__pyx_t_2);
4739     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4740     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
4741     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4742     __PYX_ERR(0, 219, __pyx_L1_error)
4743 
4744     /* "lupa/_lupa.pyx":218
4745  *                   bint register_builtins=True):
4746  *         cdef lua_State* L = lua.luaL_newstate()
4747  *         if L is NULL:             # <<<<<<<<<<<<<<
4748  *             raise LuaError("Failed to initialise Lua runtime")
4749  *         self._state = L
4750  */
4751   }
4752 
4753   /* "lupa/_lupa.pyx":220
4754  *         if L is NULL:
4755  *             raise LuaError("Failed to initialise Lua runtime")
4756  *         self._state = L             # <<<<<<<<<<<<<<
4757  *         self._lock = FastRLock()
4758  *         self._pyrefs_in_lua = {}
4759  */
4760   __pyx_v_self->_state = __pyx_v_L;
4761 
4762   /* "lupa/_lupa.pyx":221
4763  *             raise LuaError("Failed to initialise Lua runtime")
4764  *         self._state = L
4765  *         self._lock = FastRLock()             # <<<<<<<<<<<<<<
4766  *         self._pyrefs_in_lua = {}
4767  *         self._encoding = _asciiOrNone(encoding)
4768  */
4769   __pyx_t_2 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_4lupa_5_lupa_FastRLock)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 221, __pyx_L1_error)
4770   __Pyx_GOTREF(__pyx_t_2);
4771   __Pyx_GIVEREF(__pyx_t_2);
4772   __Pyx_GOTREF(__pyx_v_self->_lock);
4773   __Pyx_DECREF(((PyObject *)__pyx_v_self->_lock));
4774   __pyx_v_self->_lock = ((struct __pyx_obj_4lupa_5_lupa_FastRLock *)__pyx_t_2);
4775   __pyx_t_2 = 0;
4776 
4777   /* "lupa/_lupa.pyx":222
4778  *         self._state = L
4779  *         self._lock = FastRLock()
4780  *         self._pyrefs_in_lua = {}             # <<<<<<<<<<<<<<
4781  *         self._encoding = _asciiOrNone(encoding)
4782  *         self._source_encoding = _asciiOrNone(source_encoding) or self._encoding or b'UTF-8'
4783  */
4784   __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 222, __pyx_L1_error)
4785   __Pyx_GOTREF(__pyx_t_2);
4786   __Pyx_GIVEREF(__pyx_t_2);
4787   __Pyx_GOTREF(__pyx_v_self->_pyrefs_in_lua);
4788   __Pyx_DECREF(__pyx_v_self->_pyrefs_in_lua);
4789   __pyx_v_self->_pyrefs_in_lua = ((PyObject*)__pyx_t_2);
4790   __pyx_t_2 = 0;
4791 
4792   /* "lupa/_lupa.pyx":223
4793  *         self._lock = FastRLock()
4794  *         self._pyrefs_in_lua = {}
4795  *         self._encoding = _asciiOrNone(encoding)             # <<<<<<<<<<<<<<
4796  *         self._source_encoding = _asciiOrNone(source_encoding) or self._encoding or b'UTF-8'
4797  *         if attribute_filter is not None and not callable(attribute_filter):
4798  */
4799   __pyx_t_2 = __pyx_f_4lupa_5_lupa__asciiOrNone(__pyx_v_encoding); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 223, __pyx_L1_error)
4800   __Pyx_GOTREF(__pyx_t_2);
4801   __Pyx_GIVEREF(__pyx_t_2);
4802   __Pyx_GOTREF(__pyx_v_self->_encoding);
4803   __Pyx_DECREF(__pyx_v_self->_encoding);
4804   __pyx_v_self->_encoding = ((PyObject*)__pyx_t_2);
4805   __pyx_t_2 = 0;
4806 
4807   /* "lupa/_lupa.pyx":224
4808  *         self._pyrefs_in_lua = {}
4809  *         self._encoding = _asciiOrNone(encoding)
4810  *         self._source_encoding = _asciiOrNone(source_encoding) or self._encoding or b'UTF-8'             # <<<<<<<<<<<<<<
4811  *         if attribute_filter is not None and not callable(attribute_filter):
4812  *             raise ValueError("attribute_filter must be callable")
4813  */
4814   __pyx_t_3 = __pyx_f_4lupa_5_lupa__asciiOrNone(__pyx_v_source_encoding); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 224, __pyx_L1_error)
4815   __Pyx_GOTREF(__pyx_t_3);
4816   __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 224, __pyx_L1_error)
4817   if (!__pyx_t_1) {
4818     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4819   } else {
4820     __Pyx_INCREF(__pyx_t_3);
4821     __pyx_t_2 = __pyx_t_3;
4822     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4823     goto __pyx_L4_bool_binop_done;
4824   }
4825   __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_self->_encoding); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 224, __pyx_L1_error)
4826   if (!__pyx_t_1) {
4827   } else {
4828     __Pyx_INCREF(__pyx_v_self->_encoding);
4829     __pyx_t_2 = __pyx_v_self->_encoding;
4830     goto __pyx_L4_bool_binop_done;
4831   }
4832   __Pyx_INCREF(__pyx_kp_b_UTF_8);
4833   __pyx_t_2 = __pyx_kp_b_UTF_8;
4834   __pyx_L4_bool_binop_done:;
4835   __Pyx_GIVEREF(__pyx_t_2);
4836   __Pyx_GOTREF(__pyx_v_self->_source_encoding);
4837   __Pyx_DECREF(__pyx_v_self->_source_encoding);
4838   __pyx_v_self->_source_encoding = ((PyObject*)__pyx_t_2);
4839   __pyx_t_2 = 0;
4840 
4841   /* "lupa/_lupa.pyx":225
4842  *         self._encoding = _asciiOrNone(encoding)
4843  *         self._source_encoding = _asciiOrNone(source_encoding) or self._encoding or b'UTF-8'
4844  *         if attribute_filter is not None and not callable(attribute_filter):             # <<<<<<<<<<<<<<
4845  *             raise ValueError("attribute_filter must be callable")
4846  *         self._attribute_filter = attribute_filter
4847  */
4848   __pyx_t_5 = (__pyx_v_attribute_filter != Py_None);
4849   __pyx_t_6 = (__pyx_t_5 != 0);
4850   if (__pyx_t_6) {
4851   } else {
4852     __pyx_t_1 = __pyx_t_6;
4853     goto __pyx_L8_bool_binop_done;
4854   }
4855   __pyx_t_6 = __Pyx_PyCallable_Check(__pyx_v_attribute_filter); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 225, __pyx_L1_error)
4856   __pyx_t_5 = ((!(__pyx_t_6 != 0)) != 0);
4857   __pyx_t_1 = __pyx_t_5;
4858   __pyx_L8_bool_binop_done:;
4859   if (unlikely(__pyx_t_1)) {
4860 
4861     /* "lupa/_lupa.pyx":226
4862  *         self._source_encoding = _asciiOrNone(source_encoding) or self._encoding or b'UTF-8'
4863  *         if attribute_filter is not None and not callable(attribute_filter):
4864  *             raise ValueError("attribute_filter must be callable")             # <<<<<<<<<<<<<<
4865  *         self._attribute_filter = attribute_filter
4866  *         self._unpack_returned_tuples = unpack_returned_tuples
4867  */
4868     __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 226, __pyx_L1_error)
4869     __Pyx_GOTREF(__pyx_t_2);
4870     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
4871     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4872     __PYX_ERR(0, 226, __pyx_L1_error)
4873 
4874     /* "lupa/_lupa.pyx":225
4875  *         self._encoding = _asciiOrNone(encoding)
4876  *         self._source_encoding = _asciiOrNone(source_encoding) or self._encoding or b'UTF-8'
4877  *         if attribute_filter is not None and not callable(attribute_filter):             # <<<<<<<<<<<<<<
4878  *             raise ValueError("attribute_filter must be callable")
4879  *         self._attribute_filter = attribute_filter
4880  */
4881   }
4882 
4883   /* "lupa/_lupa.pyx":227
4884  *         if attribute_filter is not None and not callable(attribute_filter):
4885  *             raise ValueError("attribute_filter must be callable")
4886  *         self._attribute_filter = attribute_filter             # <<<<<<<<<<<<<<
4887  *         self._unpack_returned_tuples = unpack_returned_tuples
4888  *
4889  */
4890   __Pyx_INCREF(__pyx_v_attribute_filter);
4891   __Pyx_GIVEREF(__pyx_v_attribute_filter);
4892   __Pyx_GOTREF(__pyx_v_self->_attribute_filter);
4893   __Pyx_DECREF(__pyx_v_self->_attribute_filter);
4894   __pyx_v_self->_attribute_filter = __pyx_v_attribute_filter;
4895 
4896   /* "lupa/_lupa.pyx":228
4897  *             raise ValueError("attribute_filter must be callable")
4898  *         self._attribute_filter = attribute_filter
4899  *         self._unpack_returned_tuples = unpack_returned_tuples             # <<<<<<<<<<<<<<
4900  *
4901  *         if attribute_handlers:
4902  */
4903   __pyx_v_self->_unpack_returned_tuples = __pyx_v_unpack_returned_tuples;
4904 
4905   /* "lupa/_lupa.pyx":230
4906  *         self._unpack_returned_tuples = unpack_returned_tuples
4907  *
4908  *         if attribute_handlers:             # <<<<<<<<<<<<<<
4909  *             raise_error = False
4910  *             try:
4911  */
4912   __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_attribute_handlers); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 230, __pyx_L1_error)
4913   if (__pyx_t_1) {
4914 
4915     /* "lupa/_lupa.pyx":231
4916  *
4917  *         if attribute_handlers:
4918  *             raise_error = False             # <<<<<<<<<<<<<<
4919  *             try:
4920  *                 getter, setter = attribute_handlers
4921  */
4922     __pyx_v_raise_error = 0;
4923 
4924     /* "lupa/_lupa.pyx":232
4925  *         if attribute_handlers:
4926  *             raise_error = False
4927  *             try:             # <<<<<<<<<<<<<<
4928  *                 getter, setter = attribute_handlers
4929  *             except (ValueError, TypeError):
4930  */
4931     {
4932       __Pyx_PyThreadState_declare
4933       __Pyx_PyThreadState_assign
4934       __Pyx_ExceptionSave(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
4935       __Pyx_XGOTREF(__pyx_t_7);
4936       __Pyx_XGOTREF(__pyx_t_8);
4937       __Pyx_XGOTREF(__pyx_t_9);
4938       /*try:*/ {
4939 
4940         /* "lupa/_lupa.pyx":233
4941  *             raise_error = False
4942  *             try:
4943  *                 getter, setter = attribute_handlers             # <<<<<<<<<<<<<<
4944  *             except (ValueError, TypeError):
4945  *                 raise_error = True
4946  */
4947         if ((likely(PyTuple_CheckExact(__pyx_v_attribute_handlers))) || (PyList_CheckExact(__pyx_v_attribute_handlers))) {
4948           PyObject* sequence = __pyx_v_attribute_handlers;
4949           Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
4950           if (unlikely(size != 2)) {
4951             if (size > 2) __Pyx_RaiseTooManyValuesError(2);
4952             else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
4953             __PYX_ERR(0, 233, __pyx_L11_error)
4954           }
4955           #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
4956           if (likely(PyTuple_CheckExact(sequence))) {
4957             __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
4958             __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1);
4959           } else {
4960             __pyx_t_2 = PyList_GET_ITEM(sequence, 0);
4961             __pyx_t_3 = PyList_GET_ITEM(sequence, 1);
4962           }
4963           __Pyx_INCREF(__pyx_t_2);
4964           __Pyx_INCREF(__pyx_t_3);
4965           #else
4966           __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 233, __pyx_L11_error)
4967           __Pyx_GOTREF(__pyx_t_2);
4968           __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 233, __pyx_L11_error)
4969           __Pyx_GOTREF(__pyx_t_3);
4970           #endif
4971         } else {
4972           Py_ssize_t index = -1;
4973           __pyx_t_4 = PyObject_GetIter(__pyx_v_attribute_handlers); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 233, __pyx_L11_error)
4974           __Pyx_GOTREF(__pyx_t_4);
4975           __pyx_t_10 = Py_TYPE(__pyx_t_4)->tp_iternext;
4976           index = 0; __pyx_t_2 = __pyx_t_10(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L17_unpacking_failed;
4977           __Pyx_GOTREF(__pyx_t_2);
4978           index = 1; __pyx_t_3 = __pyx_t_10(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L17_unpacking_failed;
4979           __Pyx_GOTREF(__pyx_t_3);
4980           if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_4), 2) < 0) __PYX_ERR(0, 233, __pyx_L11_error)
4981           __pyx_t_10 = NULL;
4982           __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4983           goto __pyx_L18_unpacking_done;
4984           __pyx_L17_unpacking_failed:;
4985           __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4986           __pyx_t_10 = NULL;
4987           if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
4988           __PYX_ERR(0, 233, __pyx_L11_error)
4989           __pyx_L18_unpacking_done:;
4990         }
4991         __pyx_v_getter = __pyx_t_2;
4992         __pyx_t_2 = 0;
4993         __pyx_v_setter = __pyx_t_3;
4994         __pyx_t_3 = 0;
4995 
4996         /* "lupa/_lupa.pyx":232
4997  *         if attribute_handlers:
4998  *             raise_error = False
4999  *             try:             # <<<<<<<<<<<<<<
5000  *                 getter, setter = attribute_handlers
5001  *             except (ValueError, TypeError):
5002  */
5003       }
5004 
5005       /* "lupa/_lupa.pyx":237
5006  *                 raise_error = True
5007  *             else:
5008  *                 if (getter is not None and not callable(getter) or             # <<<<<<<<<<<<<<
5009  *                         setter is not None and not callable(setter)):
5010  *                     raise_error = True
5011  */
5012       /*else:*/ {
5013         __pyx_t_5 = (__pyx_v_getter != Py_None);
5014         __pyx_t_6 = (__pyx_t_5 != 0);
5015         if (!__pyx_t_6) {
5016           goto __pyx_L21_next_or;
5017         } else {
5018         }
5019         __pyx_t_6 = __Pyx_PyCallable_Check(__pyx_v_getter); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 237, __pyx_L13_except_error)
5020         __pyx_t_5 = ((!(__pyx_t_6 != 0)) != 0);
5021         if (!__pyx_t_5) {
5022         } else {
5023           __pyx_t_1 = __pyx_t_5;
5024           goto __pyx_L20_bool_binop_done;
5025         }
5026         __pyx_L21_next_or:;
5027 
5028         /* "lupa/_lupa.pyx":238
5029  *             else:
5030  *                 if (getter is not None and not callable(getter) or
5031  *                         setter is not None and not callable(setter)):             # <<<<<<<<<<<<<<
5032  *                     raise_error = True
5033  *             if raise_error:
5034  */
5035         __pyx_t_5 = (__pyx_v_setter != Py_None);
5036         __pyx_t_6 = (__pyx_t_5 != 0);
5037         if (__pyx_t_6) {
5038         } else {
5039           __pyx_t_1 = __pyx_t_6;
5040           goto __pyx_L20_bool_binop_done;
5041         }
5042         __pyx_t_6 = __Pyx_PyCallable_Check(__pyx_v_setter); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 238, __pyx_L13_except_error)
5043         __pyx_t_5 = ((!(__pyx_t_6 != 0)) != 0);
5044         __pyx_t_1 = __pyx_t_5;
5045         __pyx_L20_bool_binop_done:;
5046 
5047         /* "lupa/_lupa.pyx":237
5048  *                 raise_error = True
5049  *             else:
5050  *                 if (getter is not None and not callable(getter) or             # <<<<<<<<<<<<<<
5051  *                         setter is not None and not callable(setter)):
5052  *                     raise_error = True
5053  */
5054         if (__pyx_t_1) {
5055 
5056           /* "lupa/_lupa.pyx":239
5057  *                 if (getter is not None and not callable(getter) or
5058  *                         setter is not None and not callable(setter)):
5059  *                     raise_error = True             # <<<<<<<<<<<<<<
5060  *             if raise_error:
5061  *                 raise ValueError("attribute_handlers must be a sequence of two callables")
5062  */
5063           __pyx_v_raise_error = 1;
5064 
5065           /* "lupa/_lupa.pyx":237
5066  *                 raise_error = True
5067  *             else:
5068  *                 if (getter is not None and not callable(getter) or             # <<<<<<<<<<<<<<
5069  *                         setter is not None and not callable(setter)):
5070  *                     raise_error = True
5071  */
5072         }
5073       }
5074       __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
5075       __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
5076       __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
5077       goto __pyx_L16_try_end;
5078       __pyx_L11_error:;
5079       __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
5080       __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
5081       __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
5082 
5083       /* "lupa/_lupa.pyx":234
5084  *             try:
5085  *                 getter, setter = attribute_handlers
5086  *             except (ValueError, TypeError):             # <<<<<<<<<<<<<<
5087  *                 raise_error = True
5088  *             else:
5089  */
5090       __pyx_t_11 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ValueError) || __Pyx_PyErr_ExceptionMatches(__pyx_builtin_TypeError);
5091       if (__pyx_t_11) {
5092         __Pyx_AddTraceback("lupa._lupa.LuaRuntime.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
5093         if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_2, &__pyx_t_4) < 0) __PYX_ERR(0, 234, __pyx_L13_except_error)
5094         __Pyx_GOTREF(__pyx_t_3);
5095         __Pyx_GOTREF(__pyx_t_2);
5096         __Pyx_GOTREF(__pyx_t_4);
5097 
5098         /* "lupa/_lupa.pyx":235
5099  *                 getter, setter = attribute_handlers
5100  *             except (ValueError, TypeError):
5101  *                 raise_error = True             # <<<<<<<<<<<<<<
5102  *             else:
5103  *                 if (getter is not None and not callable(getter) or
5104  */
5105         __pyx_v_raise_error = 1;
5106         __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
5107         __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
5108         __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
5109         goto __pyx_L12_exception_handled;
5110       }
5111       goto __pyx_L13_except_error;
5112       __pyx_L13_except_error:;
5113 
5114       /* "lupa/_lupa.pyx":232
5115  *         if attribute_handlers:
5116  *             raise_error = False
5117  *             try:             # <<<<<<<<<<<<<<
5118  *                 getter, setter = attribute_handlers
5119  *             except (ValueError, TypeError):
5120  */
5121       __Pyx_XGIVEREF(__pyx_t_7);
5122       __Pyx_XGIVEREF(__pyx_t_8);
5123       __Pyx_XGIVEREF(__pyx_t_9);
5124       __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
5125       goto __pyx_L1_error;
5126       __pyx_L12_exception_handled:;
5127       __Pyx_XGIVEREF(__pyx_t_7);
5128       __Pyx_XGIVEREF(__pyx_t_8);
5129       __Pyx_XGIVEREF(__pyx_t_9);
5130       __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
5131       __pyx_L16_try_end:;
5132     }
5133 
5134     /* "lupa/_lupa.pyx":240
5135  *                         setter is not None and not callable(setter)):
5136  *                     raise_error = True
5137  *             if raise_error:             # <<<<<<<<<<<<<<
5138  *                 raise ValueError("attribute_handlers must be a sequence of two callables")
5139  *             if attribute_filter and (getter is not None or setter is not None):
5140  */
5141     __pyx_t_1 = (__pyx_v_raise_error != 0);
5142     if (unlikely(__pyx_t_1)) {
5143 
5144       /* "lupa/_lupa.pyx":241
5145  *                     raise_error = True
5146  *             if raise_error:
5147  *                 raise ValueError("attribute_handlers must be a sequence of two callables")             # <<<<<<<<<<<<<<
5148  *             if attribute_filter and (getter is not None or setter is not None):
5149  *                 raise ValueError("attribute_filter and attribute_handlers are mutually exclusive")
5150  */
5151       __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 241, __pyx_L1_error)
5152       __Pyx_GOTREF(__pyx_t_4);
5153       __Pyx_Raise(__pyx_t_4, 0, 0, 0);
5154       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5155       __PYX_ERR(0, 241, __pyx_L1_error)
5156 
5157       /* "lupa/_lupa.pyx":240
5158  *                         setter is not None and not callable(setter)):
5159  *                     raise_error = True
5160  *             if raise_error:             # <<<<<<<<<<<<<<
5161  *                 raise ValueError("attribute_handlers must be a sequence of two callables")
5162  *             if attribute_filter and (getter is not None or setter is not None):
5163  */
5164     }
5165 
5166     /* "lupa/_lupa.pyx":242
5167  *             if raise_error:
5168  *                 raise ValueError("attribute_handlers must be a sequence of two callables")
5169  *             if attribute_filter and (getter is not None or setter is not None):             # <<<<<<<<<<<<<<
5170  *                 raise ValueError("attribute_filter and attribute_handlers are mutually exclusive")
5171  *             self._attribute_getter, self._attribute_setter = getter, setter
5172  */
5173     __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_attribute_filter); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 242, __pyx_L1_error)
5174     if (__pyx_t_5) {
5175     } else {
5176       __pyx_t_1 = __pyx_t_5;
5177       goto __pyx_L28_bool_binop_done;
5178     }
5179     if (unlikely(!__pyx_v_getter)) { __Pyx_RaiseUnboundLocalError("getter"); __PYX_ERR(0, 242, __pyx_L1_error) }
5180     __pyx_t_5 = (__pyx_v_getter != Py_None);
5181     __pyx_t_6 = (__pyx_t_5 != 0);
5182     if (!__pyx_t_6) {
5183     } else {
5184       __pyx_t_1 = __pyx_t_6;
5185       goto __pyx_L28_bool_binop_done;
5186     }
5187     if (unlikely(!__pyx_v_setter)) { __Pyx_RaiseUnboundLocalError("setter"); __PYX_ERR(0, 242, __pyx_L1_error) }
5188     __pyx_t_6 = (__pyx_v_setter != Py_None);
5189     __pyx_t_5 = (__pyx_t_6 != 0);
5190     __pyx_t_1 = __pyx_t_5;
5191     __pyx_L28_bool_binop_done:;
5192     if (unlikely(__pyx_t_1)) {
5193 
5194       /* "lupa/_lupa.pyx":243
5195  *                 raise ValueError("attribute_handlers must be a sequence of two callables")
5196  *             if attribute_filter and (getter is not None or setter is not None):
5197  *                 raise ValueError("attribute_filter and attribute_handlers are mutually exclusive")             # <<<<<<<<<<<<<<
5198  *             self._attribute_getter, self._attribute_setter = getter, setter
5199  *
5200  */
5201       __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 243, __pyx_L1_error)
5202       __Pyx_GOTREF(__pyx_t_4);
5203       __Pyx_Raise(__pyx_t_4, 0, 0, 0);
5204       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5205       __PYX_ERR(0, 243, __pyx_L1_error)
5206 
5207       /* "lupa/_lupa.pyx":242
5208  *             if raise_error:
5209  *                 raise ValueError("attribute_handlers must be a sequence of two callables")
5210  *             if attribute_filter and (getter is not None or setter is not None):             # <<<<<<<<<<<<<<
5211  *                 raise ValueError("attribute_filter and attribute_handlers are mutually exclusive")
5212  *             self._attribute_getter, self._attribute_setter = getter, setter
5213  */
5214     }
5215 
5216     /* "lupa/_lupa.pyx":244
5217  *             if attribute_filter and (getter is not None or setter is not None):
5218  *                 raise ValueError("attribute_filter and attribute_handlers are mutually exclusive")
5219  *             self._attribute_getter, self._attribute_setter = getter, setter             # <<<<<<<<<<<<<<
5220  *
5221  *         lua.luaL_openlibs(L)
5222  */
5223     if (unlikely(!__pyx_v_getter)) { __Pyx_RaiseUnboundLocalError("getter"); __PYX_ERR(0, 244, __pyx_L1_error) }
5224     __pyx_t_4 = __pyx_v_getter;
5225     __Pyx_INCREF(__pyx_t_4);
5226     if (unlikely(!__pyx_v_setter)) { __Pyx_RaiseUnboundLocalError("setter"); __PYX_ERR(0, 244, __pyx_L1_error) }
5227     __pyx_t_2 = __pyx_v_setter;
5228     __Pyx_INCREF(__pyx_t_2);
5229     __Pyx_GIVEREF(__pyx_t_4);
5230     __Pyx_GOTREF(__pyx_v_self->_attribute_getter);
5231     __Pyx_DECREF(__pyx_v_self->_attribute_getter);
5232     __pyx_v_self->_attribute_getter = __pyx_t_4;
5233     __pyx_t_4 = 0;
5234     __Pyx_GIVEREF(__pyx_t_2);
5235     __Pyx_GOTREF(__pyx_v_self->_attribute_setter);
5236     __Pyx_DECREF(__pyx_v_self->_attribute_setter);
5237     __pyx_v_self->_attribute_setter = __pyx_t_2;
5238     __pyx_t_2 = 0;
5239 
5240     /* "lupa/_lupa.pyx":230
5241  *         self._unpack_returned_tuples = unpack_returned_tuples
5242  *
5243  *         if attribute_handlers:             # <<<<<<<<<<<<<<
5244  *             raise_error = False
5245  *             try:
5246  */
5247   }
5248 
5249   /* "lupa/_lupa.pyx":246
5250  *             self._attribute_getter, self._attribute_setter = getter, setter
5251  *
5252  *         lua.luaL_openlibs(L)             # <<<<<<<<<<<<<<
5253  *         self.init_python_lib(register_eval, register_builtins)
5254  *         lua.lua_settop(L, 0)
5255  */
5256   luaL_openlibs(__pyx_v_L);
5257 
5258   /* "lupa/_lupa.pyx":247
5259  *
5260  *         lua.luaL_openlibs(L)
5261  *         self.init_python_lib(register_eval, register_builtins)             # <<<<<<<<<<<<<<
5262  *         lua.lua_settop(L, 0)
5263  *         lua.lua_atpanic(L, <lua.lua_CFunction>1)
5264  */
5265   __pyx_t_11 = __pyx_f_4lupa_5_lupa_10LuaRuntime_init_python_lib(__pyx_v_self, __pyx_v_register_eval, __pyx_v_register_builtins); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 247, __pyx_L1_error)
5266 
5267   /* "lupa/_lupa.pyx":248
5268  *         lua.luaL_openlibs(L)
5269  *         self.init_python_lib(register_eval, register_builtins)
5270  *         lua.lua_settop(L, 0)             # <<<<<<<<<<<<<<
5271  *         lua.lua_atpanic(L, <lua.lua_CFunction>1)
5272  *
5273  */
5274   lua_settop(__pyx_v_L, 0);
5275 
5276   /* "lupa/_lupa.pyx":249
5277  *         self.init_python_lib(register_eval, register_builtins)
5278  *         lua.lua_settop(L, 0)
5279  *         lua.lua_atpanic(L, <lua.lua_CFunction>1)             # <<<<<<<<<<<<<<
5280  *
5281  *     def __dealloc__(self):
5282  */
5283   (void)(lua_atpanic(__pyx_v_L, ((lua_CFunction)1)));
5284 
5285   /* "lupa/_lupa.pyx":213
5286  *     cdef bint _unpack_returned_tuples
5287  *
5288  *     def __cinit__(self, encoding='UTF-8', source_encoding=None,             # <<<<<<<<<<<<<<
5289  *                   attribute_filter=None, attribute_handlers=None,
5290  *                   bint register_eval=True, bint unpack_returned_tuples=False,
5291  */
5292 
5293   /* function exit code */
5294   __pyx_r = 0;
5295   goto __pyx_L0;
5296   __pyx_L1_error:;
5297   __Pyx_XDECREF(__pyx_t_2);
5298   __Pyx_XDECREF(__pyx_t_3);
5299   __Pyx_XDECREF(__pyx_t_4);
5300   __Pyx_AddTraceback("lupa._lupa.LuaRuntime.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
5301   __pyx_r = -1;
5302   __pyx_L0:;
5303   __Pyx_XDECREF(__pyx_v_getter);
5304   __Pyx_XDECREF(__pyx_v_setter);
5305   __Pyx_RefNannyFinishContext();
5306   return __pyx_r;
5307 }
5308 
5309 /* "lupa/_lupa.pyx":251
5310  *         lua.lua_atpanic(L, <lua.lua_CFunction>1)
5311  *
5312  *     def __dealloc__(self):             # <<<<<<<<<<<<<<
5313  *         if self._state is not NULL:
5314  *             lua.lua_close(self._state)
5315  */
5316 
5317 /* Python wrapper */
5318 static void __pyx_pw_4lupa_5_lupa_10LuaRuntime_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_4lupa_5_lupa_10LuaRuntime_3__dealloc__(PyObject * __pyx_v_self)5319 static void __pyx_pw_4lupa_5_lupa_10LuaRuntime_3__dealloc__(PyObject *__pyx_v_self) {
5320   __Pyx_RefNannyDeclarations
5321   __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
5322   __pyx_pf_4lupa_5_lupa_10LuaRuntime_2__dealloc__(((struct __pyx_obj_4lupa_5_lupa_LuaRuntime *)__pyx_v_self));
5323 
5324   /* function exit code */
5325   __Pyx_RefNannyFinishContext();
5326 }
5327 
__pyx_pf_4lupa_5_lupa_10LuaRuntime_2__dealloc__(struct __pyx_obj_4lupa_5_lupa_LuaRuntime * __pyx_v_self)5328 static void __pyx_pf_4lupa_5_lupa_10LuaRuntime_2__dealloc__(struct __pyx_obj_4lupa_5_lupa_LuaRuntime *__pyx_v_self) {
5329   __Pyx_RefNannyDeclarations
5330   int __pyx_t_1;
5331   __Pyx_RefNannySetupContext("__dealloc__", 0);
5332 
5333   /* "lupa/_lupa.pyx":252
5334  *
5335  *     def __dealloc__(self):
5336  *         if self._state is not NULL:             # <<<<<<<<<<<<<<
5337  *             lua.lua_close(self._state)
5338  *             self._state = NULL
5339  */
5340   __pyx_t_1 = ((__pyx_v_self->_state != NULL) != 0);
5341   if (__pyx_t_1) {
5342 
5343     /* "lupa/_lupa.pyx":253
5344  *     def __dealloc__(self):
5345  *         if self._state is not NULL:
5346  *             lua.lua_close(self._state)             # <<<<<<<<<<<<<<
5347  *             self._state = NULL
5348  *
5349  */
5350     lua_close(__pyx_v_self->_state);
5351 
5352     /* "lupa/_lupa.pyx":254
5353  *         if self._state is not NULL:
5354  *             lua.lua_close(self._state)
5355  *             self._state = NULL             # <<<<<<<<<<<<<<
5356  *
5357  *     @property
5358  */
5359     __pyx_v_self->_state = NULL;
5360 
5361     /* "lupa/_lupa.pyx":252
5362  *
5363  *     def __dealloc__(self):
5364  *         if self._state is not NULL:             # <<<<<<<<<<<<<<
5365  *             lua.lua_close(self._state)
5366  *             self._state = NULL
5367  */
5368   }
5369 
5370   /* "lupa/_lupa.pyx":251
5371  *         lua.lua_atpanic(L, <lua.lua_CFunction>1)
5372  *
5373  *     def __dealloc__(self):             # <<<<<<<<<<<<<<
5374  *         if self._state is not NULL:
5375  *             lua.lua_close(self._state)
5376  */
5377 
5378   /* function exit code */
5379   __Pyx_RefNannyFinishContext();
5380 }
5381 
5382 /* "lupa/_lupa.pyx":257
5383  *
5384  *     @property
5385  *     def lua_version(self):             # <<<<<<<<<<<<<<
5386  *         """
5387  *         The Lua runtime/language version as tuple, e.g. (5, 3) for Lua 5.3.
5388  */
5389 
5390 /* Python wrapper */
5391 static PyObject *__pyx_pw_4lupa_5_lupa_10LuaRuntime_11lua_version_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_4lupa_5_lupa_10LuaRuntime_11lua_version_1__get__(PyObject * __pyx_v_self)5392 static PyObject *__pyx_pw_4lupa_5_lupa_10LuaRuntime_11lua_version_1__get__(PyObject *__pyx_v_self) {
5393   PyObject *__pyx_r = 0;
5394   __Pyx_RefNannyDeclarations
5395   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
5396   __pyx_r = __pyx_pf_4lupa_5_lupa_10LuaRuntime_11lua_version___get__(((struct __pyx_obj_4lupa_5_lupa_LuaRuntime *)__pyx_v_self));
5397 
5398   /* function exit code */
5399   __Pyx_RefNannyFinishContext();
5400   return __pyx_r;
5401 }
5402 
__pyx_pf_4lupa_5_lupa_10LuaRuntime_11lua_version___get__(struct __pyx_obj_4lupa_5_lupa_LuaRuntime * __pyx_v_self)5403 static PyObject *__pyx_pf_4lupa_5_lupa_10LuaRuntime_11lua_version___get__(struct __pyx_obj_4lupa_5_lupa_LuaRuntime *__pyx_v_self) {
5404   int __pyx_v_version;
5405   PyObject *__pyx_r = NULL;
5406   __Pyx_RefNannyDeclarations
5407   PyObject *__pyx_t_1 = NULL;
5408   PyObject *__pyx_t_2 = NULL;
5409   PyObject *__pyx_t_3 = NULL;
5410   int __pyx_lineno = 0;
5411   const char *__pyx_filename = NULL;
5412   int __pyx_clineno = 0;
5413   __Pyx_RefNannySetupContext("__get__", 0);
5414 
5415   /* "lupa/_lupa.pyx":261
5416  *         The Lua runtime/language version as tuple, e.g. (5, 3) for Lua 5.3.
5417  *         """
5418  *         cdef int version = lua.read_lua_version(self._state)             # <<<<<<<<<<<<<<
5419  *         return (version // 100, version % 100)
5420  *
5421  */
5422   __pyx_v_version = read_lua_version(__pyx_v_self->_state);
5423 
5424   /* "lupa/_lupa.pyx":262
5425  *         """
5426  *         cdef int version = lua.read_lua_version(self._state)
5427  *         return (version // 100, version % 100)             # <<<<<<<<<<<<<<
5428  *
5429  *     @property
5430  */
5431   __Pyx_XDECREF(__pyx_r);
5432   __pyx_t_1 = __Pyx_PyInt_From_long(__Pyx_div_long(__pyx_v_version, 0x64)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 262, __pyx_L1_error)
5433   __Pyx_GOTREF(__pyx_t_1);
5434   __pyx_t_2 = __Pyx_PyInt_From_long(__Pyx_mod_long(__pyx_v_version, 0x64)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 262, __pyx_L1_error)
5435   __Pyx_GOTREF(__pyx_t_2);
5436   __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 262, __pyx_L1_error)
5437   __Pyx_GOTREF(__pyx_t_3);
5438   __Pyx_GIVEREF(__pyx_t_1);
5439   PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
5440   __Pyx_GIVEREF(__pyx_t_2);
5441   PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
5442   __pyx_t_1 = 0;
5443   __pyx_t_2 = 0;
5444   __pyx_r = __pyx_t_3;
5445   __pyx_t_3 = 0;
5446   goto __pyx_L0;
5447 
5448   /* "lupa/_lupa.pyx":257
5449  *
5450  *     @property
5451  *     def lua_version(self):             # <<<<<<<<<<<<<<
5452  *         """
5453  *         The Lua runtime/language version as tuple, e.g. (5, 3) for Lua 5.3.
5454  */
5455 
5456   /* function exit code */
5457   __pyx_L1_error:;
5458   __Pyx_XDECREF(__pyx_t_1);
5459   __Pyx_XDECREF(__pyx_t_2);
5460   __Pyx_XDECREF(__pyx_t_3);
5461   __Pyx_AddTraceback("lupa._lupa.LuaRuntime.lua_version.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
5462   __pyx_r = NULL;
5463   __pyx_L0:;
5464   __Pyx_XGIVEREF(__pyx_r);
5465   __Pyx_RefNannyFinishContext();
5466   return __pyx_r;
5467 }
5468 
5469 /* "lupa/_lupa.pyx":265
5470  *
5471  *     @property
5472  *     def lua_implementation(self):             # <<<<<<<<<<<<<<
5473  *         """
5474  *         The Lua implementation version string, e.g. "Lua 5.3" or "LuaJIT 2.0.1".
5475  */
5476 
5477 /* Python wrapper */
5478 static PyObject *__pyx_pw_4lupa_5_lupa_10LuaRuntime_18lua_implementation_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_4lupa_5_lupa_10LuaRuntime_18lua_implementation_1__get__(PyObject * __pyx_v_self)5479 static PyObject *__pyx_pw_4lupa_5_lupa_10LuaRuntime_18lua_implementation_1__get__(PyObject *__pyx_v_self) {
5480   PyObject *__pyx_r = 0;
5481   __Pyx_RefNannyDeclarations
5482   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
5483   __pyx_r = __pyx_pf_4lupa_5_lupa_10LuaRuntime_18lua_implementation___get__(((struct __pyx_obj_4lupa_5_lupa_LuaRuntime *)__pyx_v_self));
5484 
5485   /* function exit code */
5486   __Pyx_RefNannyFinishContext();
5487   return __pyx_r;
5488 }
5489 
__pyx_pf_4lupa_5_lupa_10LuaRuntime_18lua_implementation___get__(struct __pyx_obj_4lupa_5_lupa_LuaRuntime * __pyx_v_self)5490 static PyObject *__pyx_pf_4lupa_5_lupa_10LuaRuntime_18lua_implementation___get__(struct __pyx_obj_4lupa_5_lupa_LuaRuntime *__pyx_v_self) {
5491   PyObject *__pyx_r = NULL;
5492   __Pyx_RefNannyDeclarations
5493   PyObject *__pyx_t_1 = NULL;
5494   PyObject *__pyx_t_2 = NULL;
5495   PyObject *__pyx_t_3 = NULL;
5496   int __pyx_lineno = 0;
5497   const char *__pyx_filename = NULL;
5498   int __pyx_clineno = 0;
5499   __Pyx_RefNannySetupContext("__get__", 0);
5500 
5501   /* "lupa/_lupa.pyx":270
5502  *         May execute Lua code.
5503  *         """
5504  *         return self.eval(             # <<<<<<<<<<<<<<
5505  *             "(function () "
5506  *             "    if type(jit) == 'table' then return jit.version else return _VERSION end "
5507  */
5508   __Pyx_XDECREF(__pyx_r);
5509   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_eval); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 270, __pyx_L1_error)
5510   __Pyx_GOTREF(__pyx_t_2);
5511   __pyx_t_3 = NULL;
5512   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
5513     __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
5514     if (likely(__pyx_t_3)) {
5515       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
5516       __Pyx_INCREF(__pyx_t_3);
5517       __Pyx_INCREF(function);
5518       __Pyx_DECREF_SET(__pyx_t_2, function);
5519     }
5520   }
5521   __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_s_function_if_type_jit_table_then) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_s_function_if_type_jit_table_then);
5522   __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
5523   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 270, __pyx_L1_error)
5524   __Pyx_GOTREF(__pyx_t_1);
5525   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5526   __pyx_r = __pyx_t_1;
5527   __pyx_t_1 = 0;
5528   goto __pyx_L0;
5529 
5530   /* "lupa/_lupa.pyx":265
5531  *
5532  *     @property
5533  *     def lua_implementation(self):             # <<<<<<<<<<<<<<
5534  *         """
5535  *         The Lua implementation version string, e.g. "Lua 5.3" or "LuaJIT 2.0.1".
5536  */
5537 
5538   /* function exit code */
5539   __pyx_L1_error:;
5540   __Pyx_XDECREF(__pyx_t_1);
5541   __Pyx_XDECREF(__pyx_t_2);
5542   __Pyx_XDECREF(__pyx_t_3);
5543   __Pyx_AddTraceback("lupa._lupa.LuaRuntime.lua_implementation.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
5544   __pyx_r = NULL;
5545   __pyx_L0:;
5546   __Pyx_XGIVEREF(__pyx_r);
5547   __Pyx_RefNannyFinishContext();
5548   return __pyx_r;
5549 }
5550 
5551 /* "lupa/_lupa.pyx":277
5552  *
5553  *     @cython.final
5554  *     cdef int reraise_on_exception(self) except -1:             # <<<<<<<<<<<<<<
5555  *         if self._raised_exception is not None:
5556  *             exception = self._raised_exception
5557  */
5558 
__pyx_f_4lupa_5_lupa_10LuaRuntime_reraise_on_exception(struct __pyx_obj_4lupa_5_lupa_LuaRuntime * __pyx_v_self)5559 static int __pyx_f_4lupa_5_lupa_10LuaRuntime_reraise_on_exception(struct __pyx_obj_4lupa_5_lupa_LuaRuntime *__pyx_v_self) {
5560   PyObject *__pyx_v_exception = NULL;
5561   int __pyx_r;
5562   __Pyx_RefNannyDeclarations
5563   int __pyx_t_1;
5564   int __pyx_t_2;
5565   PyObject *__pyx_t_3 = NULL;
5566   PyObject *__pyx_t_4 = NULL;
5567   PyObject *__pyx_t_5 = NULL;
5568   int __pyx_lineno = 0;
5569   const char *__pyx_filename = NULL;
5570   int __pyx_clineno = 0;
5571   __Pyx_RefNannySetupContext("reraise_on_exception", 0);
5572 
5573   /* "lupa/_lupa.pyx":278
5574  *     @cython.final
5575  *     cdef int reraise_on_exception(self) except -1:
5576  *         if self._raised_exception is not None:             # <<<<<<<<<<<<<<
5577  *             exception = self._raised_exception
5578  *             self._raised_exception = None
5579  */
5580   __pyx_t_1 = (__pyx_v_self->_raised_exception != ((PyObject*)Py_None));
5581   __pyx_t_2 = (__pyx_t_1 != 0);
5582   if (unlikely(__pyx_t_2)) {
5583 
5584     /* "lupa/_lupa.pyx":279
5585  *     cdef int reraise_on_exception(self) except -1:
5586  *         if self._raised_exception is not None:
5587  *             exception = self._raised_exception             # <<<<<<<<<<<<<<
5588  *             self._raised_exception = None
5589  *             raise exception[0], exception[1], exception[2]
5590  */
5591     __pyx_t_3 = __pyx_v_self->_raised_exception;
5592     __Pyx_INCREF(__pyx_t_3);
5593     __pyx_v_exception = ((PyObject*)__pyx_t_3);
5594     __pyx_t_3 = 0;
5595 
5596     /* "lupa/_lupa.pyx":280
5597  *         if self._raised_exception is not None:
5598  *             exception = self._raised_exception
5599  *             self._raised_exception = None             # <<<<<<<<<<<<<<
5600  *             raise exception[0], exception[1], exception[2]
5601  *         return 0
5602  */
5603     __Pyx_INCREF(Py_None);
5604     __Pyx_GIVEREF(Py_None);
5605     __Pyx_GOTREF(__pyx_v_self->_raised_exception);
5606     __Pyx_DECREF(__pyx_v_self->_raised_exception);
5607     __pyx_v_self->_raised_exception = ((PyObject*)Py_None);
5608 
5609     /* "lupa/_lupa.pyx":281
5610  *             exception = self._raised_exception
5611  *             self._raised_exception = None
5612  *             raise exception[0], exception[1], exception[2]             # <<<<<<<<<<<<<<
5613  *         return 0
5614  *
5615  */
5616     if (unlikely(__pyx_v_exception == Py_None)) {
5617       PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
5618       __PYX_ERR(0, 281, __pyx_L1_error)
5619     }
5620     __pyx_t_3 = __Pyx_GetItemInt_Tuple(__pyx_v_exception, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 281, __pyx_L1_error)
5621     __Pyx_GOTREF(__pyx_t_3);
5622     if (unlikely(__pyx_v_exception == Py_None)) {
5623       PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
5624       __PYX_ERR(0, 281, __pyx_L1_error)
5625     }
5626     __pyx_t_4 = __Pyx_GetItemInt_Tuple(__pyx_v_exception, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 281, __pyx_L1_error)
5627     __Pyx_GOTREF(__pyx_t_4);
5628     if (unlikely(__pyx_v_exception == Py_None)) {
5629       PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
5630       __PYX_ERR(0, 281, __pyx_L1_error)
5631     }
5632     __pyx_t_5 = __Pyx_GetItemInt_Tuple(__pyx_v_exception, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 281, __pyx_L1_error)
5633     __Pyx_GOTREF(__pyx_t_5);
5634     __Pyx_Raise(__pyx_t_3, __pyx_t_4, __pyx_t_5, 0);
5635     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5636     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5637     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5638     __PYX_ERR(0, 281, __pyx_L1_error)
5639 
5640     /* "lupa/_lupa.pyx":278
5641  *     @cython.final
5642  *     cdef int reraise_on_exception(self) except -1:
5643  *         if self._raised_exception is not None:             # <<<<<<<<<<<<<<
5644  *             exception = self._raised_exception
5645  *             self._raised_exception = None
5646  */
5647   }
5648 
5649   /* "lupa/_lupa.pyx":282
5650  *             self._raised_exception = None
5651  *             raise exception[0], exception[1], exception[2]
5652  *         return 0             # <<<<<<<<<<<<<<
5653  *
5654  *     @cython.final
5655  */
5656   __pyx_r = 0;
5657   goto __pyx_L0;
5658 
5659   /* "lupa/_lupa.pyx":277
5660  *
5661  *     @cython.final
5662  *     cdef int reraise_on_exception(self) except -1:             # <<<<<<<<<<<<<<
5663  *         if self._raised_exception is not None:
5664  *             exception = self._raised_exception
5665  */
5666 
5667   /* function exit code */
5668   __pyx_L1_error:;
5669   __Pyx_XDECREF(__pyx_t_3);
5670   __Pyx_XDECREF(__pyx_t_4);
5671   __Pyx_XDECREF(__pyx_t_5);
5672   __Pyx_AddTraceback("lupa._lupa.LuaRuntime.reraise_on_exception", __pyx_clineno, __pyx_lineno, __pyx_filename);
5673   __pyx_r = -1;
5674   __pyx_L0:;
5675   __Pyx_XDECREF(__pyx_v_exception);
5676   __Pyx_RefNannyFinishContext();
5677   return __pyx_r;
5678 }
5679 
5680 /* "lupa/_lupa.pyx":285
5681  *
5682  *     @cython.final
5683  *     cdef int store_raised_exception(self, lua_State* L, bytes lua_error_msg) except -1:             # <<<<<<<<<<<<<<
5684  *         try:
5685  *             self._raised_exception = tuple(exc_info())
5686  */
5687 
__pyx_f_4lupa_5_lupa_10LuaRuntime_store_raised_exception(struct __pyx_obj_4lupa_5_lupa_LuaRuntime * __pyx_v_self,lua_State * __pyx_v_L,PyObject * __pyx_v_lua_error_msg)5688 static int __pyx_f_4lupa_5_lupa_10LuaRuntime_store_raised_exception(struct __pyx_obj_4lupa_5_lupa_LuaRuntime *__pyx_v_self, lua_State *__pyx_v_L, PyObject *__pyx_v_lua_error_msg) {
5689   int __pyx_r;
5690   __Pyx_RefNannyDeclarations
5691   PyObject *__pyx_t_1 = NULL;
5692   PyObject *__pyx_t_2 = NULL;
5693   PyObject *__pyx_t_3 = NULL;
5694   PyObject *__pyx_t_4 = NULL;
5695   PyObject *__pyx_t_5 = NULL;
5696   PyObject *__pyx_t_6 = NULL;
5697   int __pyx_t_7;
5698   char *__pyx_t_8;
5699   Py_ssize_t __pyx_t_9;
5700   int __pyx_lineno = 0;
5701   const char *__pyx_filename = NULL;
5702   int __pyx_clineno = 0;
5703   __Pyx_RefNannySetupContext("store_raised_exception", 0);
5704 
5705   /* "lupa/_lupa.pyx":286
5706  *     @cython.final
5707  *     cdef int store_raised_exception(self, lua_State* L, bytes lua_error_msg) except -1:
5708  *         try:             # <<<<<<<<<<<<<<
5709  *             self._raised_exception = tuple(exc_info())
5710  *             py_to_lua(self, L, self._raised_exception[1])
5711  */
5712   {
5713     __Pyx_PyThreadState_declare
5714     __Pyx_PyThreadState_assign
5715     __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
5716     __Pyx_XGOTREF(__pyx_t_1);
5717     __Pyx_XGOTREF(__pyx_t_2);
5718     __Pyx_XGOTREF(__pyx_t_3);
5719     /*try:*/ {
5720 
5721       /* "lupa/_lupa.pyx":287
5722  *     cdef int store_raised_exception(self, lua_State* L, bytes lua_error_msg) except -1:
5723  *         try:
5724  *             self._raised_exception = tuple(exc_info())             # <<<<<<<<<<<<<<
5725  *             py_to_lua(self, L, self._raised_exception[1])
5726  *         except:
5727  */
5728       __Pyx_INCREF(__pyx_v_4lupa_5_lupa_exc_info);
5729       __pyx_t_5 = __pyx_v_4lupa_5_lupa_exc_info; __pyx_t_6 = NULL;
5730       if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
5731         __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
5732         if (likely(__pyx_t_6)) {
5733           PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
5734           __Pyx_INCREF(__pyx_t_6);
5735           __Pyx_INCREF(function);
5736           __Pyx_DECREF_SET(__pyx_t_5, function);
5737         }
5738       }
5739       __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
5740       __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
5741       if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 287, __pyx_L3_error)
5742       __Pyx_GOTREF(__pyx_t_4);
5743       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5744       __pyx_t_5 = __Pyx_PySequence_Tuple(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 287, __pyx_L3_error)
5745       __Pyx_GOTREF(__pyx_t_5);
5746       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5747       __Pyx_GIVEREF(__pyx_t_5);
5748       __Pyx_GOTREF(__pyx_v_self->_raised_exception);
5749       __Pyx_DECREF(__pyx_v_self->_raised_exception);
5750       __pyx_v_self->_raised_exception = ((PyObject*)__pyx_t_5);
5751       __pyx_t_5 = 0;
5752 
5753       /* "lupa/_lupa.pyx":288
5754  *         try:
5755  *             self._raised_exception = tuple(exc_info())
5756  *             py_to_lua(self, L, self._raised_exception[1])             # <<<<<<<<<<<<<<
5757  *         except:
5758  *             lua.lua_pushlstring(L, lua_error_msg, len(lua_error_msg))
5759  */
5760       if (unlikely(__pyx_v_self->_raised_exception == Py_None)) {
5761         PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
5762         __PYX_ERR(0, 288, __pyx_L3_error)
5763       }
5764       __pyx_t_5 = __Pyx_GetItemInt_Tuple(__pyx_v_self->_raised_exception, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 288, __pyx_L3_error)
5765       __Pyx_GOTREF(__pyx_t_5);
5766       __pyx_t_7 = __pyx_f_4lupa_5_lupa_py_to_lua(__pyx_v_self, __pyx_v_L, __pyx_t_5, NULL); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 288, __pyx_L3_error)
5767       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5768 
5769       /* "lupa/_lupa.pyx":286
5770  *     @cython.final
5771  *     cdef int store_raised_exception(self, lua_State* L, bytes lua_error_msg) except -1:
5772  *         try:             # <<<<<<<<<<<<<<
5773  *             self._raised_exception = tuple(exc_info())
5774  *             py_to_lua(self, L, self._raised_exception[1])
5775  */
5776     }
5777     __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
5778     __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
5779     __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
5780     goto __pyx_L8_try_end;
5781     __pyx_L3_error:;
5782     __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
5783     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
5784     __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
5785 
5786     /* "lupa/_lupa.pyx":289
5787  *             self._raised_exception = tuple(exc_info())
5788  *             py_to_lua(self, L, self._raised_exception[1])
5789  *         except:             # <<<<<<<<<<<<<<
5790  *             lua.lua_pushlstring(L, lua_error_msg, len(lua_error_msg))
5791  *             raise
5792  */
5793     /*except:*/ {
5794       __Pyx_AddTraceback("lupa._lupa.LuaRuntime.store_raised_exception", __pyx_clineno, __pyx_lineno, __pyx_filename);
5795       if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_4, &__pyx_t_6) < 0) __PYX_ERR(0, 289, __pyx_L5_except_error)
5796       __Pyx_GOTREF(__pyx_t_5);
5797       __Pyx_GOTREF(__pyx_t_4);
5798       __Pyx_GOTREF(__pyx_t_6);
5799 
5800       /* "lupa/_lupa.pyx":290
5801  *             py_to_lua(self, L, self._raised_exception[1])
5802  *         except:
5803  *             lua.lua_pushlstring(L, lua_error_msg, len(lua_error_msg))             # <<<<<<<<<<<<<<
5804  *             raise
5805  *         return 0
5806  */
5807       if (unlikely(__pyx_v_lua_error_msg == Py_None)) {
5808         PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
5809         __PYX_ERR(0, 290, __pyx_L5_except_error)
5810       }
5811       __pyx_t_8 = __Pyx_PyBytes_AsWritableString(__pyx_v_lua_error_msg); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) __PYX_ERR(0, 290, __pyx_L5_except_error)
5812       if (unlikely(__pyx_v_lua_error_msg == Py_None)) {
5813         PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
5814         __PYX_ERR(0, 290, __pyx_L5_except_error)
5815       }
5816       __pyx_t_9 = PyBytes_GET_SIZE(__pyx_v_lua_error_msg); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(0, 290, __pyx_L5_except_error)
5817       lua_pushlstring(__pyx_v_L, __pyx_t_8, __pyx_t_9);
5818 
5819       /* "lupa/_lupa.pyx":291
5820  *         except:
5821  *             lua.lua_pushlstring(L, lua_error_msg, len(lua_error_msg))
5822  *             raise             # <<<<<<<<<<<<<<
5823  *         return 0
5824  *
5825  */
5826       __Pyx_GIVEREF(__pyx_t_5);
5827       __Pyx_GIVEREF(__pyx_t_4);
5828       __Pyx_XGIVEREF(__pyx_t_6);
5829       __Pyx_ErrRestoreWithState(__pyx_t_5, __pyx_t_4, __pyx_t_6);
5830       __pyx_t_5 = 0; __pyx_t_4 = 0; __pyx_t_6 = 0;
5831       __PYX_ERR(0, 291, __pyx_L5_except_error)
5832     }
5833     __pyx_L5_except_error:;
5834 
5835     /* "lupa/_lupa.pyx":286
5836  *     @cython.final
5837  *     cdef int store_raised_exception(self, lua_State* L, bytes lua_error_msg) except -1:
5838  *         try:             # <<<<<<<<<<<<<<
5839  *             self._raised_exception = tuple(exc_info())
5840  *             py_to_lua(self, L, self._raised_exception[1])
5841  */
5842     __Pyx_XGIVEREF(__pyx_t_1);
5843     __Pyx_XGIVEREF(__pyx_t_2);
5844     __Pyx_XGIVEREF(__pyx_t_3);
5845     __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
5846     goto __pyx_L1_error;
5847     __pyx_L8_try_end:;
5848   }
5849 
5850   /* "lupa/_lupa.pyx":292
5851  *             lua.lua_pushlstring(L, lua_error_msg, len(lua_error_msg))
5852  *             raise
5853  *         return 0             # <<<<<<<<<<<<<<
5854  *
5855  *     def eval(self, lua_code, *args):
5856  */
5857   __pyx_r = 0;
5858   goto __pyx_L0;
5859 
5860   /* "lupa/_lupa.pyx":285
5861  *
5862  *     @cython.final
5863  *     cdef int store_raised_exception(self, lua_State* L, bytes lua_error_msg) except -1:             # <<<<<<<<<<<<<<
5864  *         try:
5865  *             self._raised_exception = tuple(exc_info())
5866  */
5867 
5868   /* function exit code */
5869   __pyx_L1_error:;
5870   __Pyx_XDECREF(__pyx_t_4);
5871   __Pyx_XDECREF(__pyx_t_5);
5872   __Pyx_XDECREF(__pyx_t_6);
5873   __Pyx_AddTraceback("lupa._lupa.LuaRuntime.store_raised_exception", __pyx_clineno, __pyx_lineno, __pyx_filename);
5874   __pyx_r = -1;
5875   __pyx_L0:;
5876   __Pyx_RefNannyFinishContext();
5877   return __pyx_r;
5878 }
5879 
5880 /* "lupa/_lupa.pyx":294
5881  *         return 0
5882  *
5883  *     def eval(self, lua_code, *args):             # <<<<<<<<<<<<<<
5884  *         """Evaluate a Lua expression passed in a string.
5885  *         """
5886  */
5887 
5888 /* Python wrapper */
5889 static PyObject *__pyx_pw_4lupa_5_lupa_10LuaRuntime_5eval(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
5890 static char __pyx_doc_4lupa_5_lupa_10LuaRuntime_4eval[] = "LuaRuntime.eval(self, lua_code, *args)\nEvaluate a Lua expression passed in a string.\n        ";
5891 static PyMethodDef __pyx_mdef_4lupa_5_lupa_10LuaRuntime_5eval = {"eval", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lupa_5_lupa_10LuaRuntime_5eval, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4lupa_5_lupa_10LuaRuntime_4eval};
__pyx_pw_4lupa_5_lupa_10LuaRuntime_5eval(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)5892 static PyObject *__pyx_pw_4lupa_5_lupa_10LuaRuntime_5eval(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
5893   PyObject *__pyx_v_lua_code = 0;
5894   PyObject *__pyx_v_args = 0;
5895   int __pyx_lineno = 0;
5896   const char *__pyx_filename = NULL;
5897   int __pyx_clineno = 0;
5898   PyObject *__pyx_r = 0;
5899   __Pyx_RefNannyDeclarations
5900   __Pyx_RefNannySetupContext("eval (wrapper)", 0);
5901   if (PyTuple_GET_SIZE(__pyx_args) > 1) {
5902     __pyx_v_args = PyTuple_GetSlice(__pyx_args, 1, PyTuple_GET_SIZE(__pyx_args));
5903     if (unlikely(!__pyx_v_args)) {
5904       __Pyx_RefNannyFinishContext();
5905       return NULL;
5906     }
5907     __Pyx_GOTREF(__pyx_v_args);
5908   } else {
5909     __pyx_v_args = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple);
5910   }
5911   {
5912     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_lua_code,0};
5913     PyObject* values[1] = {0};
5914     if (unlikely(__pyx_kwds)) {
5915       Py_ssize_t kw_args;
5916       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
5917       switch (pos_args) {
5918         default:
5919         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5920         CYTHON_FALLTHROUGH;
5921         case  0: break;
5922       }
5923       kw_args = PyDict_Size(__pyx_kwds);
5924       switch (pos_args) {
5925         case  0:
5926         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lua_code)) != 0)) kw_args--;
5927         else goto __pyx_L5_argtuple_error;
5928       }
5929       if (unlikely(kw_args > 0)) {
5930         const Py_ssize_t used_pos_args = (pos_args < 1) ? pos_args : 1;
5931         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, used_pos_args, "eval") < 0)) __PYX_ERR(0, 294, __pyx_L3_error)
5932       }
5933     } else if (PyTuple_GET_SIZE(__pyx_args) < 1) {
5934       goto __pyx_L5_argtuple_error;
5935     } else {
5936       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5937     }
5938     __pyx_v_lua_code = values[0];
5939   }
5940   goto __pyx_L4_argument_unpacking_done;
5941   __pyx_L5_argtuple_error:;
5942   __Pyx_RaiseArgtupleInvalid("eval", 0, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 294, __pyx_L3_error)
5943   __pyx_L3_error:;
5944   __Pyx_DECREF(__pyx_v_args); __pyx_v_args = 0;
5945   __Pyx_AddTraceback("lupa._lupa.LuaRuntime.eval", __pyx_clineno, __pyx_lineno, __pyx_filename);
5946   __Pyx_RefNannyFinishContext();
5947   return NULL;
5948   __pyx_L4_argument_unpacking_done:;
5949   __pyx_r = __pyx_pf_4lupa_5_lupa_10LuaRuntime_4eval(((struct __pyx_obj_4lupa_5_lupa_LuaRuntime *)__pyx_v_self), __pyx_v_lua_code, __pyx_v_args);
5950 
5951   /* function exit code */
5952   __Pyx_XDECREF(__pyx_v_args);
5953   __Pyx_RefNannyFinishContext();
5954   return __pyx_r;
5955 }
5956 
__pyx_pf_4lupa_5_lupa_10LuaRuntime_4eval(struct __pyx_obj_4lupa_5_lupa_LuaRuntime * __pyx_v_self,PyObject * __pyx_v_lua_code,PyObject * __pyx_v_args)5957 static PyObject *__pyx_pf_4lupa_5_lupa_10LuaRuntime_4eval(struct __pyx_obj_4lupa_5_lupa_LuaRuntime *__pyx_v_self, PyObject *__pyx_v_lua_code, PyObject *__pyx_v_args) {
5958   PyObject *__pyx_r = NULL;
5959   __Pyx_RefNannyDeclarations
5960   int __pyx_t_1;
5961   int __pyx_t_2;
5962   char const *__pyx_t_3;
5963   PyObject *__pyx_t_4 = NULL;
5964   PyObject *__pyx_t_5 = NULL;
5965   int __pyx_lineno = 0;
5966   const char *__pyx_filename = NULL;
5967   int __pyx_clineno = 0;
5968   __Pyx_RefNannySetupContext("eval", 0);
5969   __Pyx_INCREF(__pyx_v_lua_code);
5970 
5971   /* "lupa/_lupa.pyx":297
5972  *         """Evaluate a Lua expression passed in a string.
5973  *         """
5974  *         assert self._state is not NULL             # <<<<<<<<<<<<<<
5975  *         if isinstance(lua_code, unicode):
5976  *             lua_code = (<unicode>lua_code).encode(self._source_encoding)
5977  */
5978   #ifndef CYTHON_WITHOUT_ASSERTIONS
5979   if (unlikely(!Py_OptimizeFlag)) {
5980     if (unlikely(!((__pyx_v_self->_state != NULL) != 0))) {
5981       PyErr_SetNone(PyExc_AssertionError);
5982       __PYX_ERR(0, 297, __pyx_L1_error)
5983     }
5984   }
5985   #endif
5986 
5987   /* "lupa/_lupa.pyx":298
5988  *         """
5989  *         assert self._state is not NULL
5990  *         if isinstance(lua_code, unicode):             # <<<<<<<<<<<<<<
5991  *             lua_code = (<unicode>lua_code).encode(self._source_encoding)
5992  *         return run_lua(self, b'return ' + lua_code, args)
5993  */
5994   __pyx_t_1 = PyUnicode_Check(__pyx_v_lua_code);
5995   __pyx_t_2 = (__pyx_t_1 != 0);
5996   if (__pyx_t_2) {
5997 
5998     /* "lupa/_lupa.pyx":299
5999  *         assert self._state is not NULL
6000  *         if isinstance(lua_code, unicode):
6001  *             lua_code = (<unicode>lua_code).encode(self._source_encoding)             # <<<<<<<<<<<<<<
6002  *         return run_lua(self, b'return ' + lua_code, args)
6003  *
6004  */
6005     if (unlikely(__pyx_v_lua_code == Py_None)) {
6006       PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode");
6007       __PYX_ERR(0, 299, __pyx_L1_error)
6008     }
6009     if (unlikely(__pyx_v_self->_source_encoding == Py_None)) {
6010       PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
6011       __PYX_ERR(0, 299, __pyx_L1_error)
6012     }
6013     __pyx_t_3 = __Pyx_PyBytes_AsString(__pyx_v_self->_source_encoding); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) __PYX_ERR(0, 299, __pyx_L1_error)
6014     __pyx_t_4 = PyUnicode_AsEncodedString(((PyObject*)__pyx_v_lua_code), __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 299, __pyx_L1_error)
6015     __Pyx_GOTREF(__pyx_t_4);
6016     __Pyx_DECREF_SET(__pyx_v_lua_code, __pyx_t_4);
6017     __pyx_t_4 = 0;
6018 
6019     /* "lupa/_lupa.pyx":298
6020  *         """
6021  *         assert self._state is not NULL
6022  *         if isinstance(lua_code, unicode):             # <<<<<<<<<<<<<<
6023  *             lua_code = (<unicode>lua_code).encode(self._source_encoding)
6024  *         return run_lua(self, b'return ' + lua_code, args)
6025  */
6026   }
6027 
6028   /* "lupa/_lupa.pyx":300
6029  *         if isinstance(lua_code, unicode):
6030  *             lua_code = (<unicode>lua_code).encode(self._source_encoding)
6031  *         return run_lua(self, b'return ' + lua_code, args)             # <<<<<<<<<<<<<<
6032  *
6033  *     def execute(self, lua_code, *args):
6034  */
6035   __Pyx_XDECREF(__pyx_r);
6036   __pyx_t_4 = PyNumber_Add(__pyx_kp_b_return, __pyx_v_lua_code); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 300, __pyx_L1_error)
6037   __Pyx_GOTREF(__pyx_t_4);
6038   if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(0, 300, __pyx_L1_error)
6039   __pyx_t_5 = __pyx_f_4lupa_5_lupa_run_lua(__pyx_v_self, ((PyObject*)__pyx_t_4), __pyx_v_args); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 300, __pyx_L1_error)
6040   __Pyx_GOTREF(__pyx_t_5);
6041   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6042   __pyx_r = __pyx_t_5;
6043   __pyx_t_5 = 0;
6044   goto __pyx_L0;
6045 
6046   /* "lupa/_lupa.pyx":294
6047  *         return 0
6048  *
6049  *     def eval(self, lua_code, *args):             # <<<<<<<<<<<<<<
6050  *         """Evaluate a Lua expression passed in a string.
6051  *         """
6052  */
6053 
6054   /* function exit code */
6055   __pyx_L1_error:;
6056   __Pyx_XDECREF(__pyx_t_4);
6057   __Pyx_XDECREF(__pyx_t_5);
6058   __Pyx_AddTraceback("lupa._lupa.LuaRuntime.eval", __pyx_clineno, __pyx_lineno, __pyx_filename);
6059   __pyx_r = NULL;
6060   __pyx_L0:;
6061   __Pyx_XDECREF(__pyx_v_lua_code);
6062   __Pyx_XGIVEREF(__pyx_r);
6063   __Pyx_RefNannyFinishContext();
6064   return __pyx_r;
6065 }
6066 
6067 /* "lupa/_lupa.pyx":302
6068  *         return run_lua(self, b'return ' + lua_code, args)
6069  *
6070  *     def execute(self, lua_code, *args):             # <<<<<<<<<<<<<<
6071  *         """Execute a Lua program passed in a string.
6072  *         """
6073  */
6074 
6075 /* Python wrapper */
6076 static PyObject *__pyx_pw_4lupa_5_lupa_10LuaRuntime_7execute(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
6077 static char __pyx_doc_4lupa_5_lupa_10LuaRuntime_6execute[] = "LuaRuntime.execute(self, lua_code, *args)\nExecute a Lua program passed in a string.\n        ";
6078 static PyMethodDef __pyx_mdef_4lupa_5_lupa_10LuaRuntime_7execute = {"execute", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lupa_5_lupa_10LuaRuntime_7execute, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4lupa_5_lupa_10LuaRuntime_6execute};
__pyx_pw_4lupa_5_lupa_10LuaRuntime_7execute(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)6079 static PyObject *__pyx_pw_4lupa_5_lupa_10LuaRuntime_7execute(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
6080   PyObject *__pyx_v_lua_code = 0;
6081   PyObject *__pyx_v_args = 0;
6082   int __pyx_lineno = 0;
6083   const char *__pyx_filename = NULL;
6084   int __pyx_clineno = 0;
6085   PyObject *__pyx_r = 0;
6086   __Pyx_RefNannyDeclarations
6087   __Pyx_RefNannySetupContext("execute (wrapper)", 0);
6088   if (PyTuple_GET_SIZE(__pyx_args) > 1) {
6089     __pyx_v_args = PyTuple_GetSlice(__pyx_args, 1, PyTuple_GET_SIZE(__pyx_args));
6090     if (unlikely(!__pyx_v_args)) {
6091       __Pyx_RefNannyFinishContext();
6092       return NULL;
6093     }
6094     __Pyx_GOTREF(__pyx_v_args);
6095   } else {
6096     __pyx_v_args = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple);
6097   }
6098   {
6099     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_lua_code,0};
6100     PyObject* values[1] = {0};
6101     if (unlikely(__pyx_kwds)) {
6102       Py_ssize_t kw_args;
6103       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
6104       switch (pos_args) {
6105         default:
6106         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6107         CYTHON_FALLTHROUGH;
6108         case  0: break;
6109       }
6110       kw_args = PyDict_Size(__pyx_kwds);
6111       switch (pos_args) {
6112         case  0:
6113         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lua_code)) != 0)) kw_args--;
6114         else goto __pyx_L5_argtuple_error;
6115       }
6116       if (unlikely(kw_args > 0)) {
6117         const Py_ssize_t used_pos_args = (pos_args < 1) ? pos_args : 1;
6118         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, used_pos_args, "execute") < 0)) __PYX_ERR(0, 302, __pyx_L3_error)
6119       }
6120     } else if (PyTuple_GET_SIZE(__pyx_args) < 1) {
6121       goto __pyx_L5_argtuple_error;
6122     } else {
6123       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6124     }
6125     __pyx_v_lua_code = values[0];
6126   }
6127   goto __pyx_L4_argument_unpacking_done;
6128   __pyx_L5_argtuple_error:;
6129   __Pyx_RaiseArgtupleInvalid("execute", 0, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 302, __pyx_L3_error)
6130   __pyx_L3_error:;
6131   __Pyx_DECREF(__pyx_v_args); __pyx_v_args = 0;
6132   __Pyx_AddTraceback("lupa._lupa.LuaRuntime.execute", __pyx_clineno, __pyx_lineno, __pyx_filename);
6133   __Pyx_RefNannyFinishContext();
6134   return NULL;
6135   __pyx_L4_argument_unpacking_done:;
6136   __pyx_r = __pyx_pf_4lupa_5_lupa_10LuaRuntime_6execute(((struct __pyx_obj_4lupa_5_lupa_LuaRuntime *)__pyx_v_self), __pyx_v_lua_code, __pyx_v_args);
6137 
6138   /* function exit code */
6139   __Pyx_XDECREF(__pyx_v_args);
6140   __Pyx_RefNannyFinishContext();
6141   return __pyx_r;
6142 }
6143 
__pyx_pf_4lupa_5_lupa_10LuaRuntime_6execute(struct __pyx_obj_4lupa_5_lupa_LuaRuntime * __pyx_v_self,PyObject * __pyx_v_lua_code,PyObject * __pyx_v_args)6144 static PyObject *__pyx_pf_4lupa_5_lupa_10LuaRuntime_6execute(struct __pyx_obj_4lupa_5_lupa_LuaRuntime *__pyx_v_self, PyObject *__pyx_v_lua_code, PyObject *__pyx_v_args) {
6145   PyObject *__pyx_r = NULL;
6146   __Pyx_RefNannyDeclarations
6147   int __pyx_t_1;
6148   int __pyx_t_2;
6149   char const *__pyx_t_3;
6150   PyObject *__pyx_t_4 = NULL;
6151   int __pyx_lineno = 0;
6152   const char *__pyx_filename = NULL;
6153   int __pyx_clineno = 0;
6154   __Pyx_RefNannySetupContext("execute", 0);
6155   __Pyx_INCREF(__pyx_v_lua_code);
6156 
6157   /* "lupa/_lupa.pyx":305
6158  *         """Execute a Lua program passed in a string.
6159  *         """
6160  *         assert self._state is not NULL             # <<<<<<<<<<<<<<
6161  *         if isinstance(lua_code, unicode):
6162  *             lua_code = (<unicode>lua_code).encode(self._source_encoding)
6163  */
6164   #ifndef CYTHON_WITHOUT_ASSERTIONS
6165   if (unlikely(!Py_OptimizeFlag)) {
6166     if (unlikely(!((__pyx_v_self->_state != NULL) != 0))) {
6167       PyErr_SetNone(PyExc_AssertionError);
6168       __PYX_ERR(0, 305, __pyx_L1_error)
6169     }
6170   }
6171   #endif
6172 
6173   /* "lupa/_lupa.pyx":306
6174  *         """
6175  *         assert self._state is not NULL
6176  *         if isinstance(lua_code, unicode):             # <<<<<<<<<<<<<<
6177  *             lua_code = (<unicode>lua_code).encode(self._source_encoding)
6178  *         return run_lua(self, lua_code, args)
6179  */
6180   __pyx_t_1 = PyUnicode_Check(__pyx_v_lua_code);
6181   __pyx_t_2 = (__pyx_t_1 != 0);
6182   if (__pyx_t_2) {
6183 
6184     /* "lupa/_lupa.pyx":307
6185  *         assert self._state is not NULL
6186  *         if isinstance(lua_code, unicode):
6187  *             lua_code = (<unicode>lua_code).encode(self._source_encoding)             # <<<<<<<<<<<<<<
6188  *         return run_lua(self, lua_code, args)
6189  *
6190  */
6191     if (unlikely(__pyx_v_lua_code == Py_None)) {
6192       PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode");
6193       __PYX_ERR(0, 307, __pyx_L1_error)
6194     }
6195     if (unlikely(__pyx_v_self->_source_encoding == Py_None)) {
6196       PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
6197       __PYX_ERR(0, 307, __pyx_L1_error)
6198     }
6199     __pyx_t_3 = __Pyx_PyBytes_AsString(__pyx_v_self->_source_encoding); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) __PYX_ERR(0, 307, __pyx_L1_error)
6200     __pyx_t_4 = PyUnicode_AsEncodedString(((PyObject*)__pyx_v_lua_code), __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 307, __pyx_L1_error)
6201     __Pyx_GOTREF(__pyx_t_4);
6202     __Pyx_DECREF_SET(__pyx_v_lua_code, __pyx_t_4);
6203     __pyx_t_4 = 0;
6204 
6205     /* "lupa/_lupa.pyx":306
6206  *         """
6207  *         assert self._state is not NULL
6208  *         if isinstance(lua_code, unicode):             # <<<<<<<<<<<<<<
6209  *             lua_code = (<unicode>lua_code).encode(self._source_encoding)
6210  *         return run_lua(self, lua_code, args)
6211  */
6212   }
6213 
6214   /* "lupa/_lupa.pyx":308
6215  *         if isinstance(lua_code, unicode):
6216  *             lua_code = (<unicode>lua_code).encode(self._source_encoding)
6217  *         return run_lua(self, lua_code, args)             # <<<<<<<<<<<<<<
6218  *
6219  *     def compile(self, lua_code):
6220  */
6221   __Pyx_XDECREF(__pyx_r);
6222   if (!(likely(PyBytes_CheckExact(__pyx_v_lua_code))||((__pyx_v_lua_code) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_v_lua_code)->tp_name), 0))) __PYX_ERR(0, 308, __pyx_L1_error)
6223   __pyx_t_4 = __pyx_f_4lupa_5_lupa_run_lua(__pyx_v_self, ((PyObject*)__pyx_v_lua_code), __pyx_v_args); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 308, __pyx_L1_error)
6224   __Pyx_GOTREF(__pyx_t_4);
6225   __pyx_r = __pyx_t_4;
6226   __pyx_t_4 = 0;
6227   goto __pyx_L0;
6228 
6229   /* "lupa/_lupa.pyx":302
6230  *         return run_lua(self, b'return ' + lua_code, args)
6231  *
6232  *     def execute(self, lua_code, *args):             # <<<<<<<<<<<<<<
6233  *         """Execute a Lua program passed in a string.
6234  *         """
6235  */
6236 
6237   /* function exit code */
6238   __pyx_L1_error:;
6239   __Pyx_XDECREF(__pyx_t_4);
6240   __Pyx_AddTraceback("lupa._lupa.LuaRuntime.execute", __pyx_clineno, __pyx_lineno, __pyx_filename);
6241   __pyx_r = NULL;
6242   __pyx_L0:;
6243   __Pyx_XDECREF(__pyx_v_lua_code);
6244   __Pyx_XGIVEREF(__pyx_r);
6245   __Pyx_RefNannyFinishContext();
6246   return __pyx_r;
6247 }
6248 
6249 /* "lupa/_lupa.pyx":310
6250  *         return run_lua(self, lua_code, args)
6251  *
6252  *     def compile(self, lua_code):             # <<<<<<<<<<<<<<
6253  *         """Compile a Lua program into a callable Lua function.
6254  *         """
6255  */
6256 
6257 /* Python wrapper */
6258 static PyObject *__pyx_pw_4lupa_5_lupa_10LuaRuntime_9compile(PyObject *__pyx_v_self, PyObject *__pyx_v_lua_code); /*proto*/
6259 static char __pyx_doc_4lupa_5_lupa_10LuaRuntime_8compile[] = "LuaRuntime.compile(self, lua_code)\nCompile a Lua program into a callable Lua function.\n        ";
6260 static PyMethodDef __pyx_mdef_4lupa_5_lupa_10LuaRuntime_9compile = {"compile", (PyCFunction)__pyx_pw_4lupa_5_lupa_10LuaRuntime_9compile, METH_O, __pyx_doc_4lupa_5_lupa_10LuaRuntime_8compile};
__pyx_pw_4lupa_5_lupa_10LuaRuntime_9compile(PyObject * __pyx_v_self,PyObject * __pyx_v_lua_code)6261 static PyObject *__pyx_pw_4lupa_5_lupa_10LuaRuntime_9compile(PyObject *__pyx_v_self, PyObject *__pyx_v_lua_code) {
6262   PyObject *__pyx_r = 0;
6263   __Pyx_RefNannyDeclarations
6264   __Pyx_RefNannySetupContext("compile (wrapper)", 0);
6265   __pyx_r = __pyx_pf_4lupa_5_lupa_10LuaRuntime_8compile(((struct __pyx_obj_4lupa_5_lupa_LuaRuntime *)__pyx_v_self), ((PyObject *)__pyx_v_lua_code));
6266 
6267   /* function exit code */
6268   __Pyx_RefNannyFinishContext();
6269   return __pyx_r;
6270 }
6271 
__pyx_pf_4lupa_5_lupa_10LuaRuntime_8compile(struct __pyx_obj_4lupa_5_lupa_LuaRuntime * __pyx_v_self,PyObject * __pyx_v_lua_code)6272 static PyObject *__pyx_pf_4lupa_5_lupa_10LuaRuntime_8compile(struct __pyx_obj_4lupa_5_lupa_LuaRuntime *__pyx_v_self, PyObject *__pyx_v_lua_code) {
6273   char const *__pyx_v_err;
6274   lua_State *__pyx_v_L;
6275   int __pyx_v_oldtop;
6276   size_t __pyx_v_size;
6277   int __pyx_v_status;
6278   PyObject *__pyx_v_error = NULL;
6279   PyObject *__pyx_r = NULL;
6280   __Pyx_RefNannyDeclarations
6281   int __pyx_t_1;
6282   int __pyx_t_2;
6283   char const *__pyx_t_3;
6284   PyObject *__pyx_t_4 = NULL;
6285   lua_State *__pyx_t_5;
6286   int __pyx_t_6;
6287   char *__pyx_t_7;
6288   Py_ssize_t __pyx_t_8;
6289   PyObject *__pyx_t_9 = NULL;
6290   PyObject *__pyx_t_10 = NULL;
6291   int __pyx_t_11;
6292   char const *__pyx_t_12;
6293   PyObject *__pyx_t_13 = NULL;
6294   PyObject *__pyx_t_14 = NULL;
6295   PyObject *__pyx_t_15 = NULL;
6296   PyObject *__pyx_t_16 = NULL;
6297   PyObject *__pyx_t_17 = NULL;
6298   PyObject *__pyx_t_18 = NULL;
6299   int __pyx_lineno = 0;
6300   const char *__pyx_filename = NULL;
6301   int __pyx_clineno = 0;
6302   __Pyx_RefNannySetupContext("compile", 0);
6303   __Pyx_INCREF(__pyx_v_lua_code);
6304 
6305   /* "lupa/_lupa.pyx":314
6306  *         """
6307  *         cdef const char *err
6308  *         if isinstance(lua_code, unicode):             # <<<<<<<<<<<<<<
6309  *             lua_code = (<unicode>lua_code).encode(self._source_encoding)
6310  *         L = self._state
6311  */
6312   __pyx_t_1 = PyUnicode_Check(__pyx_v_lua_code);
6313   __pyx_t_2 = (__pyx_t_1 != 0);
6314   if (__pyx_t_2) {
6315 
6316     /* "lupa/_lupa.pyx":315
6317  *         cdef const char *err
6318  *         if isinstance(lua_code, unicode):
6319  *             lua_code = (<unicode>lua_code).encode(self._source_encoding)             # <<<<<<<<<<<<<<
6320  *         L = self._state
6321  *         lock_runtime(self)
6322  */
6323     if (unlikely(__pyx_v_lua_code == Py_None)) {
6324       PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode");
6325       __PYX_ERR(0, 315, __pyx_L1_error)
6326     }
6327     if (unlikely(__pyx_v_self->_source_encoding == Py_None)) {
6328       PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
6329       __PYX_ERR(0, 315, __pyx_L1_error)
6330     }
6331     __pyx_t_3 = __Pyx_PyBytes_AsString(__pyx_v_self->_source_encoding); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) __PYX_ERR(0, 315, __pyx_L1_error)
6332     __pyx_t_4 = PyUnicode_AsEncodedString(((PyObject*)__pyx_v_lua_code), __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 315, __pyx_L1_error)
6333     __Pyx_GOTREF(__pyx_t_4);
6334     __Pyx_DECREF_SET(__pyx_v_lua_code, __pyx_t_4);
6335     __pyx_t_4 = 0;
6336 
6337     /* "lupa/_lupa.pyx":314
6338  *         """
6339  *         cdef const char *err
6340  *         if isinstance(lua_code, unicode):             # <<<<<<<<<<<<<<
6341  *             lua_code = (<unicode>lua_code).encode(self._source_encoding)
6342  *         L = self._state
6343  */
6344   }
6345 
6346   /* "lupa/_lupa.pyx":316
6347  *         if isinstance(lua_code, unicode):
6348  *             lua_code = (<unicode>lua_code).encode(self._source_encoding)
6349  *         L = self._state             # <<<<<<<<<<<<<<
6350  *         lock_runtime(self)
6351  *         oldtop = lua.lua_gettop(L)
6352  */
6353   __pyx_t_5 = __pyx_v_self->_state;
6354   __pyx_v_L = __pyx_t_5;
6355 
6356   /* "lupa/_lupa.pyx":317
6357  *             lua_code = (<unicode>lua_code).encode(self._source_encoding)
6358  *         L = self._state
6359  *         lock_runtime(self)             # <<<<<<<<<<<<<<
6360  *         oldtop = lua.lua_gettop(L)
6361  *         cdef size_t size
6362  */
6363   __pyx_t_6 = __pyx_f_4lupa_5_lupa_lock_runtime(__pyx_v_self); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 317, __pyx_L1_error)
6364 
6365   /* "lupa/_lupa.pyx":318
6366  *         L = self._state
6367  *         lock_runtime(self)
6368  *         oldtop = lua.lua_gettop(L)             # <<<<<<<<<<<<<<
6369  *         cdef size_t size
6370  *         try:
6371  */
6372   __pyx_v_oldtop = lua_gettop(__pyx_v_L);
6373 
6374   /* "lupa/_lupa.pyx":320
6375  *         oldtop = lua.lua_gettop(L)
6376  *         cdef size_t size
6377  *         try:             # <<<<<<<<<<<<<<
6378  *             status = lua.luaL_loadbuffer(L, lua_code, len(lua_code), b'<python>')
6379  *             if status == 0:
6380  */
6381   /*try:*/ {
6382 
6383     /* "lupa/_lupa.pyx":321
6384  *         cdef size_t size
6385  *         try:
6386  *             status = lua.luaL_loadbuffer(L, lua_code, len(lua_code), b'<python>')             # <<<<<<<<<<<<<<
6387  *             if status == 0:
6388  *                 return py_from_lua(self, L, -1)
6389  */
6390     __pyx_t_7 = __Pyx_PyObject_AsWritableString(__pyx_v_lua_code); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(0, 321, __pyx_L5_error)
6391     __pyx_t_8 = PyObject_Length(__pyx_v_lua_code); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(0, 321, __pyx_L5_error)
6392     __pyx_v_status = luaL_loadbuffer(__pyx_v_L, __pyx_t_7, __pyx_t_8, ((char *)"<python>"));
6393 
6394     /* "lupa/_lupa.pyx":322
6395  *         try:
6396  *             status = lua.luaL_loadbuffer(L, lua_code, len(lua_code), b'<python>')
6397  *             if status == 0:             # <<<<<<<<<<<<<<
6398  *                 return py_from_lua(self, L, -1)
6399  *             else:
6400  */
6401     __pyx_t_2 = ((__pyx_v_status == 0) != 0);
6402     if (likely(__pyx_t_2)) {
6403 
6404       /* "lupa/_lupa.pyx":323
6405  *             status = lua.luaL_loadbuffer(L, lua_code, len(lua_code), b'<python>')
6406  *             if status == 0:
6407  *                 return py_from_lua(self, L, -1)             # <<<<<<<<<<<<<<
6408  *             else:
6409  *                 err = lua.lua_tolstring(L, -1, &size)
6410  */
6411       __Pyx_XDECREF(__pyx_r);
6412       __pyx_t_4 = __pyx_f_4lupa_5_lupa_py_from_lua(__pyx_v_self, __pyx_v_L, -1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 323, __pyx_L5_error)
6413       __Pyx_GOTREF(__pyx_t_4);
6414       __pyx_r = __pyx_t_4;
6415       __pyx_t_4 = 0;
6416       goto __pyx_L4_return;
6417 
6418       /* "lupa/_lupa.pyx":322
6419  *         try:
6420  *             status = lua.luaL_loadbuffer(L, lua_code, len(lua_code), b'<python>')
6421  *             if status == 0:             # <<<<<<<<<<<<<<
6422  *                 return py_from_lua(self, L, -1)
6423  *             else:
6424  */
6425     }
6426 
6427     /* "lupa/_lupa.pyx":325
6428  *                 return py_from_lua(self, L, -1)
6429  *             else:
6430  *                 err = lua.lua_tolstring(L, -1, &size)             # <<<<<<<<<<<<<<
6431  *                 error = err[:size] if self._encoding is None else err[:size].decode(self._encoding)
6432  *                 raise LuaSyntaxError(error)
6433  */
6434     /*else*/ {
6435       __pyx_v_err = lua_tolstring(__pyx_v_L, -1, (&__pyx_v_size));
6436 
6437       /* "lupa/_lupa.pyx":326
6438  *             else:
6439  *                 err = lua.lua_tolstring(L, -1, &size)
6440  *                 error = err[:size] if self._encoding is None else err[:size].decode(self._encoding)             # <<<<<<<<<<<<<<
6441  *                 raise LuaSyntaxError(error)
6442  *         finally:
6443  */
6444       __pyx_t_2 = (__pyx_v_self->_encoding == ((PyObject*)Py_None));
6445       if ((__pyx_t_2 != 0)) {
6446         __pyx_t_9 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_err + 0, __pyx_v_size - 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 326, __pyx_L5_error)
6447         __Pyx_GOTREF(__pyx_t_9);
6448         __pyx_t_4 = __pyx_t_9;
6449         __pyx_t_9 = 0;
6450       } else {
6451         if (unlikely(__pyx_v_self->_encoding == Py_None)) {
6452           PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
6453           __PYX_ERR(0, 326, __pyx_L5_error)
6454         }
6455         __pyx_t_3 = __Pyx_PyBytes_AsString(__pyx_v_self->_encoding); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) __PYX_ERR(0, 326, __pyx_L5_error)
6456         __pyx_t_9 = __Pyx_decode_c_string(__pyx_v_err, 0, __pyx_v_size, __pyx_t_3, NULL, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 326, __pyx_L5_error)
6457         __Pyx_GOTREF(__pyx_t_9);
6458         __pyx_t_4 = __pyx_t_9;
6459         __pyx_t_9 = 0;
6460       }
6461       __pyx_v_error = __pyx_t_4;
6462       __pyx_t_4 = 0;
6463 
6464       /* "lupa/_lupa.pyx":327
6465  *                 err = lua.lua_tolstring(L, -1, &size)
6466  *                 error = err[:size] if self._encoding is None else err[:size].decode(self._encoding)
6467  *                 raise LuaSyntaxError(error)             # <<<<<<<<<<<<<<
6468  *         finally:
6469  *             lua.lua_settop(L, oldtop)
6470  */
6471       __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_LuaSyntaxError); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 327, __pyx_L5_error)
6472       __Pyx_GOTREF(__pyx_t_9);
6473       __pyx_t_10 = NULL;
6474       if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
6475         __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_9);
6476         if (likely(__pyx_t_10)) {
6477           PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
6478           __Pyx_INCREF(__pyx_t_10);
6479           __Pyx_INCREF(function);
6480           __Pyx_DECREF_SET(__pyx_t_9, function);
6481         }
6482       }
6483       __pyx_t_4 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_10, __pyx_v_error) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_v_error);
6484       __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
6485       if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 327, __pyx_L5_error)
6486       __Pyx_GOTREF(__pyx_t_4);
6487       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
6488       __Pyx_Raise(__pyx_t_4, 0, 0, 0);
6489       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6490       __PYX_ERR(0, 327, __pyx_L5_error)
6491     }
6492   }
6493 
6494   /* "lupa/_lupa.pyx":329
6495  *                 raise LuaSyntaxError(error)
6496  *         finally:
6497  *             lua.lua_settop(L, oldtop)             # <<<<<<<<<<<<<<
6498  *             unlock_runtime(self)
6499  *
6500  */
6501   /*finally:*/ {
6502     __pyx_L5_error:;
6503     /*exception exit:*/{
6504       __Pyx_PyThreadState_declare
6505       __Pyx_PyThreadState_assign
6506       __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0;
6507       __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
6508       __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
6509       __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
6510       if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_16, &__pyx_t_17, &__pyx_t_18);
6511       if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15) < 0)) __Pyx_ErrFetch(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15);
6512       __Pyx_XGOTREF(__pyx_t_13);
6513       __Pyx_XGOTREF(__pyx_t_14);
6514       __Pyx_XGOTREF(__pyx_t_15);
6515       __Pyx_XGOTREF(__pyx_t_16);
6516       __Pyx_XGOTREF(__pyx_t_17);
6517       __Pyx_XGOTREF(__pyx_t_18);
6518       __pyx_t_6 = __pyx_lineno; __pyx_t_11 = __pyx_clineno; __pyx_t_12 = __pyx_filename;
6519       {
6520         lua_settop(__pyx_v_L, __pyx_v_oldtop);
6521 
6522         /* "lupa/_lupa.pyx":330
6523  *         finally:
6524  *             lua.lua_settop(L, oldtop)
6525  *             unlock_runtime(self)             # <<<<<<<<<<<<<<
6526  *
6527  *     def require(self, modulename):
6528  */
6529         __pyx_f_4lupa_5_lupa_unlock_runtime(__pyx_v_self);
6530       }
6531       if (PY_MAJOR_VERSION >= 3) {
6532         __Pyx_XGIVEREF(__pyx_t_16);
6533         __Pyx_XGIVEREF(__pyx_t_17);
6534         __Pyx_XGIVEREF(__pyx_t_18);
6535         __Pyx_ExceptionReset(__pyx_t_16, __pyx_t_17, __pyx_t_18);
6536       }
6537       __Pyx_XGIVEREF(__pyx_t_13);
6538       __Pyx_XGIVEREF(__pyx_t_14);
6539       __Pyx_XGIVEREF(__pyx_t_15);
6540       __Pyx_ErrRestore(__pyx_t_13, __pyx_t_14, __pyx_t_15);
6541       __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0;
6542       __pyx_lineno = __pyx_t_6; __pyx_clineno = __pyx_t_11; __pyx_filename = __pyx_t_12;
6543       goto __pyx_L1_error;
6544     }
6545     __pyx_L4_return: {
6546       __pyx_t_18 = __pyx_r;
6547       __pyx_r = 0;
6548 
6549       /* "lupa/_lupa.pyx":329
6550  *                 raise LuaSyntaxError(error)
6551  *         finally:
6552  *             lua.lua_settop(L, oldtop)             # <<<<<<<<<<<<<<
6553  *             unlock_runtime(self)
6554  *
6555  */
6556       lua_settop(__pyx_v_L, __pyx_v_oldtop);
6557 
6558       /* "lupa/_lupa.pyx":330
6559  *         finally:
6560  *             lua.lua_settop(L, oldtop)
6561  *             unlock_runtime(self)             # <<<<<<<<<<<<<<
6562  *
6563  *     def require(self, modulename):
6564  */
6565       __pyx_f_4lupa_5_lupa_unlock_runtime(__pyx_v_self);
6566       __pyx_r = __pyx_t_18;
6567       __pyx_t_18 = 0;
6568       goto __pyx_L0;
6569     }
6570   }
6571 
6572   /* "lupa/_lupa.pyx":310
6573  *         return run_lua(self, lua_code, args)
6574  *
6575  *     def compile(self, lua_code):             # <<<<<<<<<<<<<<
6576  *         """Compile a Lua program into a callable Lua function.
6577  *         """
6578  */
6579 
6580   /* function exit code */
6581   __pyx_L1_error:;
6582   __Pyx_XDECREF(__pyx_t_4);
6583   __Pyx_XDECREF(__pyx_t_9);
6584   __Pyx_XDECREF(__pyx_t_10);
6585   __Pyx_AddTraceback("lupa._lupa.LuaRuntime.compile", __pyx_clineno, __pyx_lineno, __pyx_filename);
6586   __pyx_r = NULL;
6587   __pyx_L0:;
6588   __Pyx_XDECREF(__pyx_v_error);
6589   __Pyx_XDECREF(__pyx_v_lua_code);
6590   __Pyx_XGIVEREF(__pyx_r);
6591   __Pyx_RefNannyFinishContext();
6592   return __pyx_r;
6593 }
6594 
6595 /* "lupa/_lupa.pyx":332
6596  *             unlock_runtime(self)
6597  *
6598  *     def require(self, modulename):             # <<<<<<<<<<<<<<
6599  *         """Load a Lua library into the runtime.
6600  *         """
6601  */
6602 
6603 /* Python wrapper */
6604 static PyObject *__pyx_pw_4lupa_5_lupa_10LuaRuntime_11require(PyObject *__pyx_v_self, PyObject *__pyx_v_modulename); /*proto*/
6605 static char __pyx_doc_4lupa_5_lupa_10LuaRuntime_10require[] = "LuaRuntime.require(self, modulename)\nLoad a Lua library into the runtime.\n        ";
6606 static PyMethodDef __pyx_mdef_4lupa_5_lupa_10LuaRuntime_11require = {"require", (PyCFunction)__pyx_pw_4lupa_5_lupa_10LuaRuntime_11require, METH_O, __pyx_doc_4lupa_5_lupa_10LuaRuntime_10require};
__pyx_pw_4lupa_5_lupa_10LuaRuntime_11require(PyObject * __pyx_v_self,PyObject * __pyx_v_modulename)6607 static PyObject *__pyx_pw_4lupa_5_lupa_10LuaRuntime_11require(PyObject *__pyx_v_self, PyObject *__pyx_v_modulename) {
6608   PyObject *__pyx_r = 0;
6609   __Pyx_RefNannyDeclarations
6610   __Pyx_RefNannySetupContext("require (wrapper)", 0);
6611   __pyx_r = __pyx_pf_4lupa_5_lupa_10LuaRuntime_10require(((struct __pyx_obj_4lupa_5_lupa_LuaRuntime *)__pyx_v_self), ((PyObject *)__pyx_v_modulename));
6612 
6613   /* function exit code */
6614   __Pyx_RefNannyFinishContext();
6615   return __pyx_r;
6616 }
6617 
__pyx_pf_4lupa_5_lupa_10LuaRuntime_10require(struct __pyx_obj_4lupa_5_lupa_LuaRuntime * __pyx_v_self,PyObject * __pyx_v_modulename)6618 static PyObject *__pyx_pf_4lupa_5_lupa_10LuaRuntime_10require(struct __pyx_obj_4lupa_5_lupa_LuaRuntime *__pyx_v_self, PyObject *__pyx_v_modulename) {
6619   lua_State *__pyx_v_L;
6620   int __pyx_v_old_top;
6621   PyObject *__pyx_r = NULL;
6622   __Pyx_RefNannyDeclarations
6623   lua_State *__pyx_t_1;
6624   int __pyx_t_2;
6625   int __pyx_t_3;
6626   int __pyx_t_4;
6627   PyObject *__pyx_t_5 = NULL;
6628   int __pyx_t_6;
6629   PyObject *__pyx_t_7 = NULL;
6630   PyObject *__pyx_t_8 = NULL;
6631   int __pyx_t_9;
6632   char const *__pyx_t_10;
6633   PyObject *__pyx_t_11 = NULL;
6634   PyObject *__pyx_t_12 = NULL;
6635   PyObject *__pyx_t_13 = NULL;
6636   PyObject *__pyx_t_14 = NULL;
6637   PyObject *__pyx_t_15 = NULL;
6638   PyObject *__pyx_t_16 = NULL;
6639   int __pyx_lineno = 0;
6640   const char *__pyx_filename = NULL;
6641   int __pyx_clineno = 0;
6642   __Pyx_RefNannySetupContext("require", 0);
6643 
6644   /* "lupa/_lupa.pyx":335
6645  *         """Load a Lua library into the runtime.
6646  *         """
6647  *         assert self._state is not NULL             # <<<<<<<<<<<<<<
6648  *         cdef lua_State *L = self._state
6649  *         if not isinstance(modulename, (bytes, unicode)):
6650  */
6651   #ifndef CYTHON_WITHOUT_ASSERTIONS
6652   if (unlikely(!Py_OptimizeFlag)) {
6653     if (unlikely(!((__pyx_v_self->_state != NULL) != 0))) {
6654       PyErr_SetNone(PyExc_AssertionError);
6655       __PYX_ERR(0, 335, __pyx_L1_error)
6656     }
6657   }
6658   #endif
6659 
6660   /* "lupa/_lupa.pyx":336
6661  *         """
6662  *         assert self._state is not NULL
6663  *         cdef lua_State *L = self._state             # <<<<<<<<<<<<<<
6664  *         if not isinstance(modulename, (bytes, unicode)):
6665  *             raise TypeError("modulename must be a string")
6666  */
6667   __pyx_t_1 = __pyx_v_self->_state;
6668   __pyx_v_L = __pyx_t_1;
6669 
6670   /* "lupa/_lupa.pyx":337
6671  *         assert self._state is not NULL
6672  *         cdef lua_State *L = self._state
6673  *         if not isinstance(modulename, (bytes, unicode)):             # <<<<<<<<<<<<<<
6674  *             raise TypeError("modulename must be a string")
6675  *         lock_runtime(self)
6676  */
6677   __pyx_t_3 = PyBytes_Check(__pyx_v_modulename);
6678   __pyx_t_4 = (__pyx_t_3 != 0);
6679   if (!__pyx_t_4) {
6680   } else {
6681     __pyx_t_2 = __pyx_t_4;
6682     goto __pyx_L4_bool_binop_done;
6683   }
6684   __pyx_t_4 = PyUnicode_Check(__pyx_v_modulename);
6685   __pyx_t_3 = (__pyx_t_4 != 0);
6686   __pyx_t_2 = __pyx_t_3;
6687   __pyx_L4_bool_binop_done:;
6688   __pyx_t_3 = ((!(__pyx_t_2 != 0)) != 0);
6689   if (unlikely(__pyx_t_3)) {
6690 
6691     /* "lupa/_lupa.pyx":338
6692  *         cdef lua_State *L = self._state
6693  *         if not isinstance(modulename, (bytes, unicode)):
6694  *             raise TypeError("modulename must be a string")             # <<<<<<<<<<<<<<
6695  *         lock_runtime(self)
6696  *         old_top = lua.lua_gettop(L)
6697  */
6698     __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 338, __pyx_L1_error)
6699     __Pyx_GOTREF(__pyx_t_5);
6700     __Pyx_Raise(__pyx_t_5, 0, 0, 0);
6701     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6702     __PYX_ERR(0, 338, __pyx_L1_error)
6703 
6704     /* "lupa/_lupa.pyx":337
6705  *         assert self._state is not NULL
6706  *         cdef lua_State *L = self._state
6707  *         if not isinstance(modulename, (bytes, unicode)):             # <<<<<<<<<<<<<<
6708  *             raise TypeError("modulename must be a string")
6709  *         lock_runtime(self)
6710  */
6711   }
6712 
6713   /* "lupa/_lupa.pyx":339
6714  *         if not isinstance(modulename, (bytes, unicode)):
6715  *             raise TypeError("modulename must be a string")
6716  *         lock_runtime(self)             # <<<<<<<<<<<<<<
6717  *         old_top = lua.lua_gettop(L)
6718  *         try:
6719  */
6720   __pyx_t_6 = __pyx_f_4lupa_5_lupa_lock_runtime(__pyx_v_self); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 339, __pyx_L1_error)
6721 
6722   /* "lupa/_lupa.pyx":340
6723  *             raise TypeError("modulename must be a string")
6724  *         lock_runtime(self)
6725  *         old_top = lua.lua_gettop(L)             # <<<<<<<<<<<<<<
6726  *         try:
6727  *             lua.lua_getglobal(L, 'require')
6728  */
6729   __pyx_v_old_top = lua_gettop(__pyx_v_L);
6730 
6731   /* "lupa/_lupa.pyx":341
6732  *         lock_runtime(self)
6733  *         old_top = lua.lua_gettop(L)
6734  *         try:             # <<<<<<<<<<<<<<
6735  *             lua.lua_getglobal(L, 'require')
6736  *             if lua.lua_isnil(L, -1):
6737  */
6738   /*try:*/ {
6739 
6740     /* "lupa/_lupa.pyx":342
6741  *         old_top = lua.lua_gettop(L)
6742  *         try:
6743  *             lua.lua_getglobal(L, 'require')             # <<<<<<<<<<<<<<
6744  *             if lua.lua_isnil(L, -1):
6745  *                 raise LuaError("require is not defined")
6746  */
6747     lua_getglobal(__pyx_v_L, ((char *)"require"));
6748 
6749     /* "lupa/_lupa.pyx":343
6750  *         try:
6751  *             lua.lua_getglobal(L, 'require')
6752  *             if lua.lua_isnil(L, -1):             # <<<<<<<<<<<<<<
6753  *                 raise LuaError("require is not defined")
6754  *             return call_lua(self, L, (modulename,))
6755  */
6756     __pyx_t_3 = (lua_isnil(__pyx_v_L, -1) != 0);
6757     if (unlikely(__pyx_t_3)) {
6758 
6759       /* "lupa/_lupa.pyx":344
6760  *             lua.lua_getglobal(L, 'require')
6761  *             if lua.lua_isnil(L, -1):
6762  *                 raise LuaError("require is not defined")             # <<<<<<<<<<<<<<
6763  *             return call_lua(self, L, (modulename,))
6764  *         finally:
6765  */
6766       __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_LuaError); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 344, __pyx_L7_error)
6767       __Pyx_GOTREF(__pyx_t_7);
6768       __pyx_t_8 = NULL;
6769       if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
6770         __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
6771         if (likely(__pyx_t_8)) {
6772           PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
6773           __Pyx_INCREF(__pyx_t_8);
6774           __Pyx_INCREF(function);
6775           __Pyx_DECREF_SET(__pyx_t_7, function);
6776         }
6777       }
6778       __pyx_t_5 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_kp_s_require_is_not_defined) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_kp_s_require_is_not_defined);
6779       __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
6780       if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 344, __pyx_L7_error)
6781       __Pyx_GOTREF(__pyx_t_5);
6782       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
6783       __Pyx_Raise(__pyx_t_5, 0, 0, 0);
6784       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6785       __PYX_ERR(0, 344, __pyx_L7_error)
6786 
6787       /* "lupa/_lupa.pyx":343
6788  *         try:
6789  *             lua.lua_getglobal(L, 'require')
6790  *             if lua.lua_isnil(L, -1):             # <<<<<<<<<<<<<<
6791  *                 raise LuaError("require is not defined")
6792  *             return call_lua(self, L, (modulename,))
6793  */
6794     }
6795 
6796     /* "lupa/_lupa.pyx":345
6797  *             if lua.lua_isnil(L, -1):
6798  *                 raise LuaError("require is not defined")
6799  *             return call_lua(self, L, (modulename,))             # <<<<<<<<<<<<<<
6800  *         finally:
6801  *             lua.lua_settop(L, old_top)
6802  */
6803     __Pyx_XDECREF(__pyx_r);
6804     __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 345, __pyx_L7_error)
6805     __Pyx_GOTREF(__pyx_t_5);
6806     __Pyx_INCREF(__pyx_v_modulename);
6807     __Pyx_GIVEREF(__pyx_v_modulename);
6808     PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_modulename);
6809     __pyx_t_7 = __pyx_f_4lupa_5_lupa_call_lua(__pyx_v_self, __pyx_v_L, ((PyObject*)__pyx_t_5)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 345, __pyx_L7_error)
6810     __Pyx_GOTREF(__pyx_t_7);
6811     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6812     __pyx_r = __pyx_t_7;
6813     __pyx_t_7 = 0;
6814     goto __pyx_L6_return;
6815   }
6816 
6817   /* "lupa/_lupa.pyx":347
6818  *             return call_lua(self, L, (modulename,))
6819  *         finally:
6820  *             lua.lua_settop(L, old_top)             # <<<<<<<<<<<<<<
6821  *             unlock_runtime(self)
6822  *
6823  */
6824   /*finally:*/ {
6825     __pyx_L7_error:;
6826     /*exception exit:*/{
6827       __Pyx_PyThreadState_declare
6828       __Pyx_PyThreadState_assign
6829       __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0;
6830       __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
6831       __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
6832       __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
6833       if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_14, &__pyx_t_15, &__pyx_t_16);
6834       if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13) < 0)) __Pyx_ErrFetch(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
6835       __Pyx_XGOTREF(__pyx_t_11);
6836       __Pyx_XGOTREF(__pyx_t_12);
6837       __Pyx_XGOTREF(__pyx_t_13);
6838       __Pyx_XGOTREF(__pyx_t_14);
6839       __Pyx_XGOTREF(__pyx_t_15);
6840       __Pyx_XGOTREF(__pyx_t_16);
6841       __pyx_t_6 = __pyx_lineno; __pyx_t_9 = __pyx_clineno; __pyx_t_10 = __pyx_filename;
6842       {
6843         lua_settop(__pyx_v_L, __pyx_v_old_top);
6844 
6845         /* "lupa/_lupa.pyx":348
6846  *         finally:
6847  *             lua.lua_settop(L, old_top)
6848  *             unlock_runtime(self)             # <<<<<<<<<<<<<<
6849  *
6850  *     def globals(self):
6851  */
6852         __pyx_f_4lupa_5_lupa_unlock_runtime(__pyx_v_self);
6853       }
6854       if (PY_MAJOR_VERSION >= 3) {
6855         __Pyx_XGIVEREF(__pyx_t_14);
6856         __Pyx_XGIVEREF(__pyx_t_15);
6857         __Pyx_XGIVEREF(__pyx_t_16);
6858         __Pyx_ExceptionReset(__pyx_t_14, __pyx_t_15, __pyx_t_16);
6859       }
6860       __Pyx_XGIVEREF(__pyx_t_11);
6861       __Pyx_XGIVEREF(__pyx_t_12);
6862       __Pyx_XGIVEREF(__pyx_t_13);
6863       __Pyx_ErrRestore(__pyx_t_11, __pyx_t_12, __pyx_t_13);
6864       __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0;
6865       __pyx_lineno = __pyx_t_6; __pyx_clineno = __pyx_t_9; __pyx_filename = __pyx_t_10;
6866       goto __pyx_L1_error;
6867     }
6868     __pyx_L6_return: {
6869       __pyx_t_16 = __pyx_r;
6870       __pyx_r = 0;
6871 
6872       /* "lupa/_lupa.pyx":347
6873  *             return call_lua(self, L, (modulename,))
6874  *         finally:
6875  *             lua.lua_settop(L, old_top)             # <<<<<<<<<<<<<<
6876  *             unlock_runtime(self)
6877  *
6878  */
6879       lua_settop(__pyx_v_L, __pyx_v_old_top);
6880 
6881       /* "lupa/_lupa.pyx":348
6882  *         finally:
6883  *             lua.lua_settop(L, old_top)
6884  *             unlock_runtime(self)             # <<<<<<<<<<<<<<
6885  *
6886  *     def globals(self):
6887  */
6888       __pyx_f_4lupa_5_lupa_unlock_runtime(__pyx_v_self);
6889       __pyx_r = __pyx_t_16;
6890       __pyx_t_16 = 0;
6891       goto __pyx_L0;
6892     }
6893   }
6894 
6895   /* "lupa/_lupa.pyx":332
6896  *             unlock_runtime(self)
6897  *
6898  *     def require(self, modulename):             # <<<<<<<<<<<<<<
6899  *         """Load a Lua library into the runtime.
6900  *         """
6901  */
6902 
6903   /* function exit code */
6904   __pyx_L1_error:;
6905   __Pyx_XDECREF(__pyx_t_5);
6906   __Pyx_XDECREF(__pyx_t_7);
6907   __Pyx_XDECREF(__pyx_t_8);
6908   __Pyx_AddTraceback("lupa._lupa.LuaRuntime.require", __pyx_clineno, __pyx_lineno, __pyx_filename);
6909   __pyx_r = NULL;
6910   __pyx_L0:;
6911   __Pyx_XGIVEREF(__pyx_r);
6912   __Pyx_RefNannyFinishContext();
6913   return __pyx_r;
6914 }
6915 
6916 /* "lupa/_lupa.pyx":350
6917  *             unlock_runtime(self)
6918  *
6919  *     def globals(self):             # <<<<<<<<<<<<<<
6920  *         """Return the globals defined in this Lua runtime as a Lua
6921  *         table.
6922  */
6923 
6924 /* Python wrapper */
6925 static PyObject *__pyx_pw_4lupa_5_lupa_10LuaRuntime_13globals(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
6926 static char __pyx_doc_4lupa_5_lupa_10LuaRuntime_12globals[] = "LuaRuntime.globals(self)\nReturn the globals defined in this Lua runtime as a Lua\n        table.\n        ";
6927 static PyMethodDef __pyx_mdef_4lupa_5_lupa_10LuaRuntime_13globals = {"globals", (PyCFunction)__pyx_pw_4lupa_5_lupa_10LuaRuntime_13globals, METH_NOARGS, __pyx_doc_4lupa_5_lupa_10LuaRuntime_12globals};
__pyx_pw_4lupa_5_lupa_10LuaRuntime_13globals(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)6928 static PyObject *__pyx_pw_4lupa_5_lupa_10LuaRuntime_13globals(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
6929   PyObject *__pyx_r = 0;
6930   __Pyx_RefNannyDeclarations
6931   __Pyx_RefNannySetupContext("globals (wrapper)", 0);
6932   __pyx_r = __pyx_pf_4lupa_5_lupa_10LuaRuntime_12globals(((struct __pyx_obj_4lupa_5_lupa_LuaRuntime *)__pyx_v_self));
6933 
6934   /* function exit code */
6935   __Pyx_RefNannyFinishContext();
6936   return __pyx_r;
6937 }
6938 
__pyx_pf_4lupa_5_lupa_10LuaRuntime_12globals(struct __pyx_obj_4lupa_5_lupa_LuaRuntime * __pyx_v_self)6939 static PyObject *__pyx_pf_4lupa_5_lupa_10LuaRuntime_12globals(struct __pyx_obj_4lupa_5_lupa_LuaRuntime *__pyx_v_self) {
6940   lua_State *__pyx_v_L;
6941   int __pyx_v_old_top;
6942   PyObject *__pyx_r = NULL;
6943   __Pyx_RefNannyDeclarations
6944   lua_State *__pyx_t_1;
6945   int __pyx_t_2;
6946   int __pyx_t_3;
6947   PyObject *__pyx_t_4 = NULL;
6948   PyObject *__pyx_t_5 = NULL;
6949   PyObject *__pyx_t_6 = NULL;
6950   int __pyx_t_7;
6951   char const *__pyx_t_8;
6952   PyObject *__pyx_t_9 = NULL;
6953   PyObject *__pyx_t_10 = NULL;
6954   PyObject *__pyx_t_11 = NULL;
6955   PyObject *__pyx_t_12 = NULL;
6956   PyObject *__pyx_t_13 = NULL;
6957   PyObject *__pyx_t_14 = NULL;
6958   int __pyx_lineno = 0;
6959   const char *__pyx_filename = NULL;
6960   int __pyx_clineno = 0;
6961   __Pyx_RefNannySetupContext("globals", 0);
6962 
6963   /* "lupa/_lupa.pyx":354
6964  *         table.
6965  *         """
6966  *         assert self._state is not NULL             # <<<<<<<<<<<<<<
6967  *         cdef lua_State *L = self._state
6968  *         lock_runtime(self)
6969  */
6970   #ifndef CYTHON_WITHOUT_ASSERTIONS
6971   if (unlikely(!Py_OptimizeFlag)) {
6972     if (unlikely(!((__pyx_v_self->_state != NULL) != 0))) {
6973       PyErr_SetNone(PyExc_AssertionError);
6974       __PYX_ERR(0, 354, __pyx_L1_error)
6975     }
6976   }
6977   #endif
6978 
6979   /* "lupa/_lupa.pyx":355
6980  *         """
6981  *         assert self._state is not NULL
6982  *         cdef lua_State *L = self._state             # <<<<<<<<<<<<<<
6983  *         lock_runtime(self)
6984  *         old_top = lua.lua_gettop(L)
6985  */
6986   __pyx_t_1 = __pyx_v_self->_state;
6987   __pyx_v_L = __pyx_t_1;
6988 
6989   /* "lupa/_lupa.pyx":356
6990  *         assert self._state is not NULL
6991  *         cdef lua_State *L = self._state
6992  *         lock_runtime(self)             # <<<<<<<<<<<<<<
6993  *         old_top = lua.lua_gettop(L)
6994  *         try:
6995  */
6996   __pyx_t_2 = __pyx_f_4lupa_5_lupa_lock_runtime(__pyx_v_self); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 356, __pyx_L1_error)
6997 
6998   /* "lupa/_lupa.pyx":357
6999  *         cdef lua_State *L = self._state
7000  *         lock_runtime(self)
7001  *         old_top = lua.lua_gettop(L)             # <<<<<<<<<<<<<<
7002  *         try:
7003  *             lua.lua_getglobal(L, '_G')
7004  */
7005   __pyx_v_old_top = lua_gettop(__pyx_v_L);
7006 
7007   /* "lupa/_lupa.pyx":358
7008  *         lock_runtime(self)
7009  *         old_top = lua.lua_gettop(L)
7010  *         try:             # <<<<<<<<<<<<<<
7011  *             lua.lua_getglobal(L, '_G')
7012  *             if lua.lua_isnil(L, -1):
7013  */
7014   /*try:*/ {
7015 
7016     /* "lupa/_lupa.pyx":359
7017  *         old_top = lua.lua_gettop(L)
7018  *         try:
7019  *             lua.lua_getglobal(L, '_G')             # <<<<<<<<<<<<<<
7020  *             if lua.lua_isnil(L, -1):
7021  *                 raise LuaError("globals not defined")
7022  */
7023     lua_getglobal(__pyx_v_L, ((char *)"_G"));
7024 
7025     /* "lupa/_lupa.pyx":360
7026  *         try:
7027  *             lua.lua_getglobal(L, '_G')
7028  *             if lua.lua_isnil(L, -1):             # <<<<<<<<<<<<<<
7029  *                 raise LuaError("globals not defined")
7030  *             return py_from_lua(self, L, -1)
7031  */
7032     __pyx_t_3 = (lua_isnil(__pyx_v_L, -1) != 0);
7033     if (unlikely(__pyx_t_3)) {
7034 
7035       /* "lupa/_lupa.pyx":361
7036  *             lua.lua_getglobal(L, '_G')
7037  *             if lua.lua_isnil(L, -1):
7038  *                 raise LuaError("globals not defined")             # <<<<<<<<<<<<<<
7039  *             return py_from_lua(self, L, -1)
7040  *         finally:
7041  */
7042       __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_LuaError); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 361, __pyx_L4_error)
7043       __Pyx_GOTREF(__pyx_t_5);
7044       __pyx_t_6 = NULL;
7045       if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
7046         __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
7047         if (likely(__pyx_t_6)) {
7048           PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
7049           __Pyx_INCREF(__pyx_t_6);
7050           __Pyx_INCREF(function);
7051           __Pyx_DECREF_SET(__pyx_t_5, function);
7052         }
7053       }
7054       __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_kp_s_globals_not_defined) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_kp_s_globals_not_defined);
7055       __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
7056       if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 361, __pyx_L4_error)
7057       __Pyx_GOTREF(__pyx_t_4);
7058       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7059       __Pyx_Raise(__pyx_t_4, 0, 0, 0);
7060       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7061       __PYX_ERR(0, 361, __pyx_L4_error)
7062 
7063       /* "lupa/_lupa.pyx":360
7064  *         try:
7065  *             lua.lua_getglobal(L, '_G')
7066  *             if lua.lua_isnil(L, -1):             # <<<<<<<<<<<<<<
7067  *                 raise LuaError("globals not defined")
7068  *             return py_from_lua(self, L, -1)
7069  */
7070     }
7071 
7072     /* "lupa/_lupa.pyx":362
7073  *             if lua.lua_isnil(L, -1):
7074  *                 raise LuaError("globals not defined")
7075  *             return py_from_lua(self, L, -1)             # <<<<<<<<<<<<<<
7076  *         finally:
7077  *             lua.lua_settop(L, old_top)
7078  */
7079     __Pyx_XDECREF(__pyx_r);
7080     __pyx_t_4 = __pyx_f_4lupa_5_lupa_py_from_lua(__pyx_v_self, __pyx_v_L, -1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 362, __pyx_L4_error)
7081     __Pyx_GOTREF(__pyx_t_4);
7082     __pyx_r = __pyx_t_4;
7083     __pyx_t_4 = 0;
7084     goto __pyx_L3_return;
7085   }
7086 
7087   /* "lupa/_lupa.pyx":364
7088  *             return py_from_lua(self, L, -1)
7089  *         finally:
7090  *             lua.lua_settop(L, old_top)             # <<<<<<<<<<<<<<
7091  *             unlock_runtime(self)
7092  *
7093  */
7094   /*finally:*/ {
7095     __pyx_L4_error:;
7096     /*exception exit:*/{
7097       __Pyx_PyThreadState_declare
7098       __Pyx_PyThreadState_assign
7099       __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0;
7100       __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
7101       __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
7102       __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
7103       if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14);
7104       if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11) < 0)) __Pyx_ErrFetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
7105       __Pyx_XGOTREF(__pyx_t_9);
7106       __Pyx_XGOTREF(__pyx_t_10);
7107       __Pyx_XGOTREF(__pyx_t_11);
7108       __Pyx_XGOTREF(__pyx_t_12);
7109       __Pyx_XGOTREF(__pyx_t_13);
7110       __Pyx_XGOTREF(__pyx_t_14);
7111       __pyx_t_2 = __pyx_lineno; __pyx_t_7 = __pyx_clineno; __pyx_t_8 = __pyx_filename;
7112       {
7113         lua_settop(__pyx_v_L, __pyx_v_old_top);
7114 
7115         /* "lupa/_lupa.pyx":365
7116  *         finally:
7117  *             lua.lua_settop(L, old_top)
7118  *             unlock_runtime(self)             # <<<<<<<<<<<<<<
7119  *
7120  *     def table(self, *items, **kwargs):
7121  */
7122         __pyx_f_4lupa_5_lupa_unlock_runtime(__pyx_v_self);
7123       }
7124       if (PY_MAJOR_VERSION >= 3) {
7125         __Pyx_XGIVEREF(__pyx_t_12);
7126         __Pyx_XGIVEREF(__pyx_t_13);
7127         __Pyx_XGIVEREF(__pyx_t_14);
7128         __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_13, __pyx_t_14);
7129       }
7130       __Pyx_XGIVEREF(__pyx_t_9);
7131       __Pyx_XGIVEREF(__pyx_t_10);
7132       __Pyx_XGIVEREF(__pyx_t_11);
7133       __Pyx_ErrRestore(__pyx_t_9, __pyx_t_10, __pyx_t_11);
7134       __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0;
7135       __pyx_lineno = __pyx_t_2; __pyx_clineno = __pyx_t_7; __pyx_filename = __pyx_t_8;
7136       goto __pyx_L1_error;
7137     }
7138     __pyx_L3_return: {
7139       __pyx_t_14 = __pyx_r;
7140       __pyx_r = 0;
7141 
7142       /* "lupa/_lupa.pyx":364
7143  *             return py_from_lua(self, L, -1)
7144  *         finally:
7145  *             lua.lua_settop(L, old_top)             # <<<<<<<<<<<<<<
7146  *             unlock_runtime(self)
7147  *
7148  */
7149       lua_settop(__pyx_v_L, __pyx_v_old_top);
7150 
7151       /* "lupa/_lupa.pyx":365
7152  *         finally:
7153  *             lua.lua_settop(L, old_top)
7154  *             unlock_runtime(self)             # <<<<<<<<<<<<<<
7155  *
7156  *     def table(self, *items, **kwargs):
7157  */
7158       __pyx_f_4lupa_5_lupa_unlock_runtime(__pyx_v_self);
7159       __pyx_r = __pyx_t_14;
7160       __pyx_t_14 = 0;
7161       goto __pyx_L0;
7162     }
7163   }
7164 
7165   /* "lupa/_lupa.pyx":350
7166  *             unlock_runtime(self)
7167  *
7168  *     def globals(self):             # <<<<<<<<<<<<<<
7169  *         """Return the globals defined in this Lua runtime as a Lua
7170  *         table.
7171  */
7172 
7173   /* function exit code */
7174   __pyx_L1_error:;
7175   __Pyx_XDECREF(__pyx_t_4);
7176   __Pyx_XDECREF(__pyx_t_5);
7177   __Pyx_XDECREF(__pyx_t_6);
7178   __Pyx_AddTraceback("lupa._lupa.LuaRuntime.globals", __pyx_clineno, __pyx_lineno, __pyx_filename);
7179   __pyx_r = NULL;
7180   __pyx_L0:;
7181   __Pyx_XGIVEREF(__pyx_r);
7182   __Pyx_RefNannyFinishContext();
7183   return __pyx_r;
7184 }
7185 
7186 /* "lupa/_lupa.pyx":367
7187  *             unlock_runtime(self)
7188  *
7189  *     def table(self, *items, **kwargs):             # <<<<<<<<<<<<<<
7190  *         """Create a new table with the provided items.  Positional
7191  *         arguments are placed in the table in order, keyword arguments
7192  */
7193 
7194 /* Python wrapper */
7195 static PyObject *__pyx_pw_4lupa_5_lupa_10LuaRuntime_15table(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
7196 static char __pyx_doc_4lupa_5_lupa_10LuaRuntime_14table[] = "LuaRuntime.table(self, *items, **kwargs)\nCreate a new table with the provided items.  Positional\n        arguments are placed in the table in order, keyword arguments\n        are set as key-value pairs.\n        ";
7197 static PyMethodDef __pyx_mdef_4lupa_5_lupa_10LuaRuntime_15table = {"table", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lupa_5_lupa_10LuaRuntime_15table, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4lupa_5_lupa_10LuaRuntime_14table};
__pyx_pw_4lupa_5_lupa_10LuaRuntime_15table(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)7198 static PyObject *__pyx_pw_4lupa_5_lupa_10LuaRuntime_15table(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
7199   PyObject *__pyx_v_items = 0;
7200   PyObject *__pyx_v_kwargs = 0;
7201   PyObject *__pyx_r = 0;
7202   __Pyx_RefNannyDeclarations
7203   __Pyx_RefNannySetupContext("table (wrapper)", 0);
7204   if (unlikely(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "table", 1))) return NULL;
7205   __pyx_v_kwargs = (__pyx_kwds) ? PyDict_Copy(__pyx_kwds) : PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL;
7206   __Pyx_GOTREF(__pyx_v_kwargs);
7207   __Pyx_INCREF(__pyx_args);
7208   __pyx_v_items = __pyx_args;
7209   __pyx_r = __pyx_pf_4lupa_5_lupa_10LuaRuntime_14table(((struct __pyx_obj_4lupa_5_lupa_LuaRuntime *)__pyx_v_self), __pyx_v_items, __pyx_v_kwargs);
7210 
7211   /* function exit code */
7212   __Pyx_XDECREF(__pyx_v_items);
7213   __Pyx_XDECREF(__pyx_v_kwargs);
7214   __Pyx_RefNannyFinishContext();
7215   return __pyx_r;
7216 }
7217 
__pyx_pf_4lupa_5_lupa_10LuaRuntime_14table(struct __pyx_obj_4lupa_5_lupa_LuaRuntime * __pyx_v_self,PyObject * __pyx_v_items,PyObject * __pyx_v_kwargs)7218 static PyObject *__pyx_pf_4lupa_5_lupa_10LuaRuntime_14table(struct __pyx_obj_4lupa_5_lupa_LuaRuntime *__pyx_v_self, PyObject *__pyx_v_items, PyObject *__pyx_v_kwargs) {
7219   PyObject *__pyx_r = NULL;
7220   __Pyx_RefNannyDeclarations
7221   PyObject *__pyx_t_1 = NULL;
7222   PyObject *__pyx_t_2 = NULL;
7223   PyObject *__pyx_t_3 = NULL;
7224   int __pyx_t_4;
7225   PyObject *__pyx_t_5 = NULL;
7226   int __pyx_lineno = 0;
7227   const char *__pyx_filename = NULL;
7228   int __pyx_clineno = 0;
7229   __Pyx_RefNannySetupContext("table", 0);
7230 
7231   /* "lupa/_lupa.pyx":372
7232  *         are set as key-value pairs.
7233  *         """
7234  *         return self.table_from(items, kwargs)             # <<<<<<<<<<<<<<
7235  *
7236  *     def table_from(self, *args):
7237  */
7238   __Pyx_XDECREF(__pyx_r);
7239   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_table_from); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 372, __pyx_L1_error)
7240   __Pyx_GOTREF(__pyx_t_2);
7241   __pyx_t_3 = NULL;
7242   __pyx_t_4 = 0;
7243   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
7244     __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
7245     if (likely(__pyx_t_3)) {
7246       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
7247       __Pyx_INCREF(__pyx_t_3);
7248       __Pyx_INCREF(function);
7249       __Pyx_DECREF_SET(__pyx_t_2, function);
7250       __pyx_t_4 = 1;
7251     }
7252   }
7253   #if CYTHON_FAST_PYCALL
7254   if (PyFunction_Check(__pyx_t_2)) {
7255     PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_items, __pyx_v_kwargs};
7256     __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, 372, __pyx_L1_error)
7257     __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
7258     __Pyx_GOTREF(__pyx_t_1);
7259   } else
7260   #endif
7261   #if CYTHON_FAST_PYCCALL
7262   if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
7263     PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_items, __pyx_v_kwargs};
7264     __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, 372, __pyx_L1_error)
7265     __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
7266     __Pyx_GOTREF(__pyx_t_1);
7267   } else
7268   #endif
7269   {
7270     __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 372, __pyx_L1_error)
7271     __Pyx_GOTREF(__pyx_t_5);
7272     if (__pyx_t_3) {
7273       __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
7274     }
7275     __Pyx_INCREF(__pyx_v_items);
7276     __Pyx_GIVEREF(__pyx_v_items);
7277     PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_items);
7278     __Pyx_INCREF(__pyx_v_kwargs);
7279     __Pyx_GIVEREF(__pyx_v_kwargs);
7280     PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_kwargs);
7281     __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 372, __pyx_L1_error)
7282     __Pyx_GOTREF(__pyx_t_1);
7283     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7284   }
7285   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7286   __pyx_r = __pyx_t_1;
7287   __pyx_t_1 = 0;
7288   goto __pyx_L0;
7289 
7290   /* "lupa/_lupa.pyx":367
7291  *             unlock_runtime(self)
7292  *
7293  *     def table(self, *items, **kwargs):             # <<<<<<<<<<<<<<
7294  *         """Create a new table with the provided items.  Positional
7295  *         arguments are placed in the table in order, keyword arguments
7296  */
7297 
7298   /* function exit code */
7299   __pyx_L1_error:;
7300   __Pyx_XDECREF(__pyx_t_1);
7301   __Pyx_XDECREF(__pyx_t_2);
7302   __Pyx_XDECREF(__pyx_t_3);
7303   __Pyx_XDECREF(__pyx_t_5);
7304   __Pyx_AddTraceback("lupa._lupa.LuaRuntime.table", __pyx_clineno, __pyx_lineno, __pyx_filename);
7305   __pyx_r = NULL;
7306   __pyx_L0:;
7307   __Pyx_XGIVEREF(__pyx_r);
7308   __Pyx_RefNannyFinishContext();
7309   return __pyx_r;
7310 }
7311 
7312 /* "lupa/_lupa.pyx":374
7313  *         return self.table_from(items, kwargs)
7314  *
7315  *     def table_from(self, *args):             # <<<<<<<<<<<<<<
7316  *         """Create a new table from Python mapping or iterable.
7317  *
7318  */
7319 
7320 /* Python wrapper */
7321 static PyObject *__pyx_pw_4lupa_5_lupa_10LuaRuntime_17table_from(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
7322 static char __pyx_doc_4lupa_5_lupa_10LuaRuntime_16table_from[] = "LuaRuntime.table_from(self, *args)\nCreate a new table from Python mapping or iterable.\n\n        table_from() accepts either a dict/mapping or an iterable with items.\n        Items from dicts are set as key-value pairs; items from iterables\n        are placed in the table in order.\n\n        Nested mappings / iterables are passed to Lua as userdata\n        (wrapped Python objects); they are not converted to Lua tables.\n        ";
7323 static PyMethodDef __pyx_mdef_4lupa_5_lupa_10LuaRuntime_17table_from = {"table_from", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lupa_5_lupa_10LuaRuntime_17table_from, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4lupa_5_lupa_10LuaRuntime_16table_from};
__pyx_pw_4lupa_5_lupa_10LuaRuntime_17table_from(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)7324 static PyObject *__pyx_pw_4lupa_5_lupa_10LuaRuntime_17table_from(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
7325   PyObject *__pyx_v_args = 0;
7326   PyObject *__pyx_r = 0;
7327   __Pyx_RefNannyDeclarations
7328   __Pyx_RefNannySetupContext("table_from (wrapper)", 0);
7329   if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "table_from", 0))) return NULL;
7330   __Pyx_INCREF(__pyx_args);
7331   __pyx_v_args = __pyx_args;
7332   __pyx_r = __pyx_pf_4lupa_5_lupa_10LuaRuntime_16table_from(((struct __pyx_obj_4lupa_5_lupa_LuaRuntime *)__pyx_v_self), __pyx_v_args);
7333 
7334   /* function exit code */
7335   __Pyx_XDECREF(__pyx_v_args);
7336   __Pyx_RefNannyFinishContext();
7337   return __pyx_r;
7338 }
7339 
__pyx_pf_4lupa_5_lupa_10LuaRuntime_16table_from(struct __pyx_obj_4lupa_5_lupa_LuaRuntime * __pyx_v_self,PyObject * __pyx_v_args)7340 static PyObject *__pyx_pf_4lupa_5_lupa_10LuaRuntime_16table_from(struct __pyx_obj_4lupa_5_lupa_LuaRuntime *__pyx_v_self, PyObject *__pyx_v_args) {
7341   lua_State *__pyx_v_L;
7342   int __pyx_v_i;
7343   int __pyx_v_old_top;
7344   PyObject *__pyx_v_obj = NULL;
7345   PyObject *__pyx_v_key = NULL;
7346   PyObject *__pyx_v_value = NULL;
7347   PyObject *__pyx_v_arg = NULL;
7348   PyObject *__pyx_r = NULL;
7349   __Pyx_RefNannyDeclarations
7350   lua_State *__pyx_t_1;
7351   int __pyx_t_2;
7352   PyObject *__pyx_t_3 = NULL;
7353   Py_ssize_t __pyx_t_4;
7354   PyObject *__pyx_t_5 = NULL;
7355   int __pyx_t_6;
7356   int __pyx_t_7;
7357   Py_ssize_t __pyx_t_8;
7358   Py_ssize_t __pyx_t_9;
7359   PyObject *__pyx_t_10 = NULL;
7360   PyObject *__pyx_t_11 = NULL;
7361   int __pyx_t_12;
7362   PyObject *(*__pyx_t_13)(PyObject *);
7363   char const *__pyx_t_14;
7364   PyObject *__pyx_t_15 = NULL;
7365   PyObject *__pyx_t_16 = NULL;
7366   PyObject *__pyx_t_17 = NULL;
7367   PyObject *__pyx_t_18 = NULL;
7368   PyObject *__pyx_t_19 = NULL;
7369   PyObject *__pyx_t_20 = NULL;
7370   int __pyx_lineno = 0;
7371   const char *__pyx_filename = NULL;
7372   int __pyx_clineno = 0;
7373   __Pyx_RefNannySetupContext("table_from", 0);
7374 
7375   /* "lupa/_lupa.pyx":384
7376  *         (wrapped Python objects); they are not converted to Lua tables.
7377  *         """
7378  *         assert self._state is not NULL             # <<<<<<<<<<<<<<
7379  *         cdef lua_State *L = self._state
7380  *         cdef int i = 1
7381  */
7382   #ifndef CYTHON_WITHOUT_ASSERTIONS
7383   if (unlikely(!Py_OptimizeFlag)) {
7384     if (unlikely(!((__pyx_v_self->_state != NULL) != 0))) {
7385       PyErr_SetNone(PyExc_AssertionError);
7386       __PYX_ERR(0, 384, __pyx_L1_error)
7387     }
7388   }
7389   #endif
7390 
7391   /* "lupa/_lupa.pyx":385
7392  *         """
7393  *         assert self._state is not NULL
7394  *         cdef lua_State *L = self._state             # <<<<<<<<<<<<<<
7395  *         cdef int i = 1
7396  *         lock_runtime(self)
7397  */
7398   __pyx_t_1 = __pyx_v_self->_state;
7399   __pyx_v_L = __pyx_t_1;
7400 
7401   /* "lupa/_lupa.pyx":386
7402  *         assert self._state is not NULL
7403  *         cdef lua_State *L = self._state
7404  *         cdef int i = 1             # <<<<<<<<<<<<<<
7405  *         lock_runtime(self)
7406  *         old_top = lua.lua_gettop(L)
7407  */
7408   __pyx_v_i = 1;
7409 
7410   /* "lupa/_lupa.pyx":387
7411  *         cdef lua_State *L = self._state
7412  *         cdef int i = 1
7413  *         lock_runtime(self)             # <<<<<<<<<<<<<<
7414  *         old_top = lua.lua_gettop(L)
7415  *         try:
7416  */
7417   __pyx_t_2 = __pyx_f_4lupa_5_lupa_lock_runtime(__pyx_v_self); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 387, __pyx_L1_error)
7418 
7419   /* "lupa/_lupa.pyx":388
7420  *         cdef int i = 1
7421  *         lock_runtime(self)
7422  *         old_top = lua.lua_gettop(L)             # <<<<<<<<<<<<<<
7423  *         try:
7424  *             lua.lua_newtable(L)
7425  */
7426   __pyx_v_old_top = lua_gettop(__pyx_v_L);
7427 
7428   /* "lupa/_lupa.pyx":389
7429  *         lock_runtime(self)
7430  *         old_top = lua.lua_gettop(L)
7431  *         try:             # <<<<<<<<<<<<<<
7432  *             lua.lua_newtable(L)
7433  *             # FIXME: how to check for failure?
7434  */
7435   /*try:*/ {
7436 
7437     /* "lupa/_lupa.pyx":390
7438  *         old_top = lua.lua_gettop(L)
7439  *         try:
7440  *             lua.lua_newtable(L)             # <<<<<<<<<<<<<<
7441  *             # FIXME: how to check for failure?
7442  *             for obj in args:
7443  */
7444     lua_newtable(__pyx_v_L);
7445 
7446     /* "lupa/_lupa.pyx":392
7447  *             lua.lua_newtable(L)
7448  *             # FIXME: how to check for failure?
7449  *             for obj in args:             # <<<<<<<<<<<<<<
7450  *                 if isinstance(obj, dict):
7451  *                     for key, value in obj.iteritems():
7452  */
7453     __pyx_t_3 = __pyx_v_args; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0;
7454     for (;;) {
7455       if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
7456       #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
7457       __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_5); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 392, __pyx_L4_error)
7458       #else
7459       __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 392, __pyx_L4_error)
7460       __Pyx_GOTREF(__pyx_t_5);
7461       #endif
7462       __Pyx_XDECREF_SET(__pyx_v_obj, __pyx_t_5);
7463       __pyx_t_5 = 0;
7464 
7465       /* "lupa/_lupa.pyx":393
7466  *             # FIXME: how to check for failure?
7467  *             for obj in args:
7468  *                 if isinstance(obj, dict):             # <<<<<<<<<<<<<<
7469  *                     for key, value in obj.iteritems():
7470  *                         py_to_lua(self, L, key)
7471  */
7472       __pyx_t_6 = PyDict_Check(__pyx_v_obj);
7473       __pyx_t_7 = (__pyx_t_6 != 0);
7474       if (__pyx_t_7) {
7475 
7476         /* "lupa/_lupa.pyx":394
7477  *             for obj in args:
7478  *                 if isinstance(obj, dict):
7479  *                     for key, value in obj.iteritems():             # <<<<<<<<<<<<<<
7480  *                         py_to_lua(self, L, key)
7481  *                         py_to_lua(self, L, value)
7482  */
7483         __pyx_t_8 = 0;
7484         if (unlikely(__pyx_v_obj == Py_None)) {
7485           PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "iteritems");
7486           __PYX_ERR(0, 394, __pyx_L4_error)
7487         }
7488         __pyx_t_10 = __Pyx_dict_iterator(__pyx_v_obj, 0, __pyx_n_s_iteritems, (&__pyx_t_9), (&__pyx_t_2)); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 394, __pyx_L4_error)
7489         __Pyx_GOTREF(__pyx_t_10);
7490         __Pyx_XDECREF(__pyx_t_5);
7491         __pyx_t_5 = __pyx_t_10;
7492         __pyx_t_10 = 0;
7493         while (1) {
7494           __pyx_t_12 = __Pyx_dict_iter_next(__pyx_t_5, __pyx_t_9, &__pyx_t_8, &__pyx_t_10, &__pyx_t_11, NULL, __pyx_t_2);
7495           if (unlikely(__pyx_t_12 == 0)) break;
7496           if (unlikely(__pyx_t_12 == -1)) __PYX_ERR(0, 394, __pyx_L4_error)
7497           __Pyx_GOTREF(__pyx_t_10);
7498           __Pyx_GOTREF(__pyx_t_11);
7499           __Pyx_XDECREF_SET(__pyx_v_key, __pyx_t_10);
7500           __pyx_t_10 = 0;
7501           __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_11);
7502           __pyx_t_11 = 0;
7503 
7504           /* "lupa/_lupa.pyx":395
7505  *                 if isinstance(obj, dict):
7506  *                     for key, value in obj.iteritems():
7507  *                         py_to_lua(self, L, key)             # <<<<<<<<<<<<<<
7508  *                         py_to_lua(self, L, value)
7509  *                         lua.lua_rawset(L, -3)
7510  */
7511           __pyx_t_12 = __pyx_f_4lupa_5_lupa_py_to_lua(__pyx_v_self, __pyx_v_L, __pyx_v_key, NULL); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 395, __pyx_L4_error)
7512 
7513           /* "lupa/_lupa.pyx":396
7514  *                     for key, value in obj.iteritems():
7515  *                         py_to_lua(self, L, key)
7516  *                         py_to_lua(self, L, value)             # <<<<<<<<<<<<<<
7517  *                         lua.lua_rawset(L, -3)
7518  *
7519  */
7520           __pyx_t_12 = __pyx_f_4lupa_5_lupa_py_to_lua(__pyx_v_self, __pyx_v_L, __pyx_v_value, NULL); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 396, __pyx_L4_error)
7521 
7522           /* "lupa/_lupa.pyx":397
7523  *                         py_to_lua(self, L, key)
7524  *                         py_to_lua(self, L, value)
7525  *                         lua.lua_rawset(L, -3)             # <<<<<<<<<<<<<<
7526  *
7527  *                 elif isinstance(obj, _LuaTable):
7528  */
7529           lua_rawset(__pyx_v_L, -3);
7530         }
7531         __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7532 
7533         /* "lupa/_lupa.pyx":393
7534  *             # FIXME: how to check for failure?
7535  *             for obj in args:
7536  *                 if isinstance(obj, dict):             # <<<<<<<<<<<<<<
7537  *                     for key, value in obj.iteritems():
7538  *                         py_to_lua(self, L, key)
7539  */
7540         goto __pyx_L8;
7541       }
7542 
7543       /* "lupa/_lupa.pyx":399
7544  *                         lua.lua_rawset(L, -3)
7545  *
7546  *                 elif isinstance(obj, _LuaTable):             # <<<<<<<<<<<<<<
7547  *                     # Stack:                            # tbl
7548  *                     (<_LuaObject>obj).push_lua_object() # tbl, obj
7549  */
7550       __pyx_t_7 = __Pyx_TypeCheck(__pyx_v_obj, __pyx_ptype_4lupa_5_lupa__LuaTable);
7551       __pyx_t_6 = (__pyx_t_7 != 0);
7552       if (__pyx_t_6) {
7553 
7554         /* "lupa/_lupa.pyx":401
7555  *                 elif isinstance(obj, _LuaTable):
7556  *                     # Stack:                            # tbl
7557  *                     (<_LuaObject>obj).push_lua_object() # tbl, obj             # <<<<<<<<<<<<<<
7558  *                     lua.lua_pushnil(L)                  # tbl, obj, nil       // iterate over obj (-2)
7559  *                     while lua.lua_next(L, -2):          # tbl, obj, k, v
7560  */
7561         __pyx_t_2 = __pyx_f_4lupa_5_lupa_10_LuaObject_push_lua_object(((struct __pyx_obj_4lupa_5_lupa__LuaObject *)__pyx_v_obj)); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 401, __pyx_L4_error)
7562 
7563         /* "lupa/_lupa.pyx":402
7564  *                     # Stack:                            # tbl
7565  *                     (<_LuaObject>obj).push_lua_object() # tbl, obj
7566  *                     lua.lua_pushnil(L)                  # tbl, obj, nil       // iterate over obj (-2)             # <<<<<<<<<<<<<<
7567  *                     while lua.lua_next(L, -2):          # tbl, obj, k, v
7568  *                         lua.lua_pushvalue(L, -2)        # tbl, obj, k, v, k   // copy key (because
7569  */
7570         lua_pushnil(__pyx_v_L);
7571 
7572         /* "lupa/_lupa.pyx":403
7573  *                     (<_LuaObject>obj).push_lua_object() # tbl, obj
7574  *                     lua.lua_pushnil(L)                  # tbl, obj, nil       // iterate over obj (-2)
7575  *                     while lua.lua_next(L, -2):          # tbl, obj, k, v             # <<<<<<<<<<<<<<
7576  *                         lua.lua_pushvalue(L, -2)        # tbl, obj, k, v, k   // copy key (because
7577  *                         lua.lua_insert(L, -2)           # tbl, obj, k, k, v   // lua_next needs a key for iteration)
7578  */
7579         while (1) {
7580           __pyx_t_6 = (lua_next(__pyx_v_L, -2) != 0);
7581           if (!__pyx_t_6) break;
7582 
7583           /* "lupa/_lupa.pyx":404
7584  *                     lua.lua_pushnil(L)                  # tbl, obj, nil       // iterate over obj (-2)
7585  *                     while lua.lua_next(L, -2):          # tbl, obj, k, v
7586  *                         lua.lua_pushvalue(L, -2)        # tbl, obj, k, v, k   // copy key (because             # <<<<<<<<<<<<<<
7587  *                         lua.lua_insert(L, -2)           # tbl, obj, k, k, v   // lua_next needs a key for iteration)
7588  *                         lua.lua_settable(L, -5)         # tbl, obj, k         // tbl[k] = v
7589  */
7590           lua_pushvalue(__pyx_v_L, -2);
7591 
7592           /* "lupa/_lupa.pyx":405
7593  *                     while lua.lua_next(L, -2):          # tbl, obj, k, v
7594  *                         lua.lua_pushvalue(L, -2)        # tbl, obj, k, v, k   // copy key (because
7595  *                         lua.lua_insert(L, -2)           # tbl, obj, k, k, v   // lua_next needs a key for iteration)             # <<<<<<<<<<<<<<
7596  *                         lua.lua_settable(L, -5)         # tbl, obj, k         // tbl[k] = v
7597  *                     lua.lua_pop(L, 1)                   # tbl                 // remove obj from stack
7598  */
7599           lua_insert(__pyx_v_L, -2);
7600 
7601           /* "lupa/_lupa.pyx":406
7602  *                         lua.lua_pushvalue(L, -2)        # tbl, obj, k, v, k   // copy key (because
7603  *                         lua.lua_insert(L, -2)           # tbl, obj, k, k, v   // lua_next needs a key for iteration)
7604  *                         lua.lua_settable(L, -5)         # tbl, obj, k         // tbl[k] = v             # <<<<<<<<<<<<<<
7605  *                     lua.lua_pop(L, 1)                   # tbl                 // remove obj from stack
7606  *
7607  */
7608           lua_settable(__pyx_v_L, -5);
7609         }
7610 
7611         /* "lupa/_lupa.pyx":407
7612  *                         lua.lua_insert(L, -2)           # tbl, obj, k, k, v   // lua_next needs a key for iteration)
7613  *                         lua.lua_settable(L, -5)         # tbl, obj, k         // tbl[k] = v
7614  *                     lua.lua_pop(L, 1)                   # tbl                 // remove obj from stack             # <<<<<<<<<<<<<<
7615  *
7616  *                 elif isinstance(obj, Mapping):
7617  */
7618         lua_pop(__pyx_v_L, 1);
7619 
7620         /* "lupa/_lupa.pyx":399
7621  *                         lua.lua_rawset(L, -3)
7622  *
7623  *                 elif isinstance(obj, _LuaTable):             # <<<<<<<<<<<<<<
7624  *                     # Stack:                            # tbl
7625  *                     (<_LuaObject>obj).push_lua_object() # tbl, obj
7626  */
7627         goto __pyx_L8;
7628       }
7629 
7630       /* "lupa/_lupa.pyx":409
7631  *                     lua.lua_pop(L, 1)                   # tbl                 // remove obj from stack
7632  *
7633  *                 elif isinstance(obj, Mapping):             # <<<<<<<<<<<<<<
7634  *                     for key in obj:
7635  *                         value = obj[key]
7636  */
7637       __pyx_t_5 = __pyx_v_4lupa_5_lupa_Mapping;
7638       __Pyx_INCREF(__pyx_t_5);
7639       __pyx_t_6 = PyObject_IsInstance(__pyx_v_obj, __pyx_t_5); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 409, __pyx_L4_error)
7640       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7641       __pyx_t_7 = (__pyx_t_6 != 0);
7642       if (__pyx_t_7) {
7643 
7644         /* "lupa/_lupa.pyx":410
7645  *
7646  *                 elif isinstance(obj, Mapping):
7647  *                     for key in obj:             # <<<<<<<<<<<<<<
7648  *                         value = obj[key]
7649  *                         py_to_lua(self, L, key)
7650  */
7651         if (likely(PyList_CheckExact(__pyx_v_obj)) || PyTuple_CheckExact(__pyx_v_obj)) {
7652           __pyx_t_5 = __pyx_v_obj; __Pyx_INCREF(__pyx_t_5); __pyx_t_9 = 0;
7653           __pyx_t_13 = NULL;
7654         } else {
7655           __pyx_t_9 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_v_obj); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 410, __pyx_L4_error)
7656           __Pyx_GOTREF(__pyx_t_5);
7657           __pyx_t_13 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 410, __pyx_L4_error)
7658         }
7659         for (;;) {
7660           if (likely(!__pyx_t_13)) {
7661             if (likely(PyList_CheckExact(__pyx_t_5))) {
7662               if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_5)) break;
7663               #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
7664               __pyx_t_11 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_9); __Pyx_INCREF(__pyx_t_11); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 410, __pyx_L4_error)
7665               #else
7666               __pyx_t_11 = PySequence_ITEM(__pyx_t_5, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 410, __pyx_L4_error)
7667               __Pyx_GOTREF(__pyx_t_11);
7668               #endif
7669             } else {
7670               if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
7671               #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
7672               __pyx_t_11 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_9); __Pyx_INCREF(__pyx_t_11); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 410, __pyx_L4_error)
7673               #else
7674               __pyx_t_11 = PySequence_ITEM(__pyx_t_5, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 410, __pyx_L4_error)
7675               __Pyx_GOTREF(__pyx_t_11);
7676               #endif
7677             }
7678           } else {
7679             __pyx_t_11 = __pyx_t_13(__pyx_t_5);
7680             if (unlikely(!__pyx_t_11)) {
7681               PyObject* exc_type = PyErr_Occurred();
7682               if (exc_type) {
7683                 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
7684                 else __PYX_ERR(0, 410, __pyx_L4_error)
7685               }
7686               break;
7687             }
7688             __Pyx_GOTREF(__pyx_t_11);
7689           }
7690           __Pyx_XDECREF_SET(__pyx_v_key, __pyx_t_11);
7691           __pyx_t_11 = 0;
7692 
7693           /* "lupa/_lupa.pyx":411
7694  *                 elif isinstance(obj, Mapping):
7695  *                     for key in obj:
7696  *                         value = obj[key]             # <<<<<<<<<<<<<<
7697  *                         py_to_lua(self, L, key)
7698  *                         py_to_lua(self, L, value)
7699  */
7700           __pyx_t_11 = __Pyx_PyObject_GetItem(__pyx_v_obj, __pyx_v_key); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 411, __pyx_L4_error)
7701           __Pyx_GOTREF(__pyx_t_11);
7702           __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_11);
7703           __pyx_t_11 = 0;
7704 
7705           /* "lupa/_lupa.pyx":412
7706  *                     for key in obj:
7707  *                         value = obj[key]
7708  *                         py_to_lua(self, L, key)             # <<<<<<<<<<<<<<
7709  *                         py_to_lua(self, L, value)
7710  *                         lua.lua_rawset(L, -3)
7711  */
7712           __pyx_t_2 = __pyx_f_4lupa_5_lupa_py_to_lua(__pyx_v_self, __pyx_v_L, __pyx_v_key, NULL); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 412, __pyx_L4_error)
7713 
7714           /* "lupa/_lupa.pyx":413
7715  *                         value = obj[key]
7716  *                         py_to_lua(self, L, key)
7717  *                         py_to_lua(self, L, value)             # <<<<<<<<<<<<<<
7718  *                         lua.lua_rawset(L, -3)
7719  *                 else:
7720  */
7721           __pyx_t_2 = __pyx_f_4lupa_5_lupa_py_to_lua(__pyx_v_self, __pyx_v_L, __pyx_v_value, NULL); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 413, __pyx_L4_error)
7722 
7723           /* "lupa/_lupa.pyx":414
7724  *                         py_to_lua(self, L, key)
7725  *                         py_to_lua(self, L, value)
7726  *                         lua.lua_rawset(L, -3)             # <<<<<<<<<<<<<<
7727  *                 else:
7728  *                     for arg in obj:
7729  */
7730           lua_rawset(__pyx_v_L, -3);
7731 
7732           /* "lupa/_lupa.pyx":410
7733  *
7734  *                 elif isinstance(obj, Mapping):
7735  *                     for key in obj:             # <<<<<<<<<<<<<<
7736  *                         value = obj[key]
7737  *                         py_to_lua(self, L, key)
7738  */
7739         }
7740         __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7741 
7742         /* "lupa/_lupa.pyx":409
7743  *                     lua.lua_pop(L, 1)                   # tbl                 // remove obj from stack
7744  *
7745  *                 elif isinstance(obj, Mapping):             # <<<<<<<<<<<<<<
7746  *                     for key in obj:
7747  *                         value = obj[key]
7748  */
7749         goto __pyx_L8;
7750       }
7751 
7752       /* "lupa/_lupa.pyx":416
7753  *                         lua.lua_rawset(L, -3)
7754  *                 else:
7755  *                     for arg in obj:             # <<<<<<<<<<<<<<
7756  *                         py_to_lua(self, L, arg)
7757  *                         lua.lua_rawseti(L, -2, i)
7758  */
7759       /*else*/ {
7760         if (likely(PyList_CheckExact(__pyx_v_obj)) || PyTuple_CheckExact(__pyx_v_obj)) {
7761           __pyx_t_5 = __pyx_v_obj; __Pyx_INCREF(__pyx_t_5); __pyx_t_9 = 0;
7762           __pyx_t_13 = NULL;
7763         } else {
7764           __pyx_t_9 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_v_obj); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 416, __pyx_L4_error)
7765           __Pyx_GOTREF(__pyx_t_5);
7766           __pyx_t_13 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 416, __pyx_L4_error)
7767         }
7768         for (;;) {
7769           if (likely(!__pyx_t_13)) {
7770             if (likely(PyList_CheckExact(__pyx_t_5))) {
7771               if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_5)) break;
7772               #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
7773               __pyx_t_11 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_9); __Pyx_INCREF(__pyx_t_11); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 416, __pyx_L4_error)
7774               #else
7775               __pyx_t_11 = PySequence_ITEM(__pyx_t_5, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 416, __pyx_L4_error)
7776               __Pyx_GOTREF(__pyx_t_11);
7777               #endif
7778             } else {
7779               if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
7780               #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
7781               __pyx_t_11 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_9); __Pyx_INCREF(__pyx_t_11); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 416, __pyx_L4_error)
7782               #else
7783               __pyx_t_11 = PySequence_ITEM(__pyx_t_5, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 416, __pyx_L4_error)
7784               __Pyx_GOTREF(__pyx_t_11);
7785               #endif
7786             }
7787           } else {
7788             __pyx_t_11 = __pyx_t_13(__pyx_t_5);
7789             if (unlikely(!__pyx_t_11)) {
7790               PyObject* exc_type = PyErr_Occurred();
7791               if (exc_type) {
7792                 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
7793                 else __PYX_ERR(0, 416, __pyx_L4_error)
7794               }
7795               break;
7796             }
7797             __Pyx_GOTREF(__pyx_t_11);
7798           }
7799           __Pyx_XDECREF_SET(__pyx_v_arg, __pyx_t_11);
7800           __pyx_t_11 = 0;
7801 
7802           /* "lupa/_lupa.pyx":417
7803  *                 else:
7804  *                     for arg in obj:
7805  *                         py_to_lua(self, L, arg)             # <<<<<<<<<<<<<<
7806  *                         lua.lua_rawseti(L, -2, i)
7807  *                         i += 1
7808  */
7809           __pyx_t_2 = __pyx_f_4lupa_5_lupa_py_to_lua(__pyx_v_self, __pyx_v_L, __pyx_v_arg, NULL); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 417, __pyx_L4_error)
7810 
7811           /* "lupa/_lupa.pyx":418
7812  *                     for arg in obj:
7813  *                         py_to_lua(self, L, arg)
7814  *                         lua.lua_rawseti(L, -2, i)             # <<<<<<<<<<<<<<
7815  *                         i += 1
7816  *             return py_from_lua(self, L, -1)
7817  */
7818           lua_rawseti(__pyx_v_L, -2, __pyx_v_i);
7819 
7820           /* "lupa/_lupa.pyx":419
7821  *                         py_to_lua(self, L, arg)
7822  *                         lua.lua_rawseti(L, -2, i)
7823  *                         i += 1             # <<<<<<<<<<<<<<
7824  *             return py_from_lua(self, L, -1)
7825  *         finally:
7826  */
7827           __pyx_v_i = (__pyx_v_i + 1);
7828 
7829           /* "lupa/_lupa.pyx":416
7830  *                         lua.lua_rawset(L, -3)
7831  *                 else:
7832  *                     for arg in obj:             # <<<<<<<<<<<<<<
7833  *                         py_to_lua(self, L, arg)
7834  *                         lua.lua_rawseti(L, -2, i)
7835  */
7836         }
7837         __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7838       }
7839       __pyx_L8:;
7840 
7841       /* "lupa/_lupa.pyx":392
7842  *             lua.lua_newtable(L)
7843  *             # FIXME: how to check for failure?
7844  *             for obj in args:             # <<<<<<<<<<<<<<
7845  *                 if isinstance(obj, dict):
7846  *                     for key, value in obj.iteritems():
7847  */
7848     }
7849     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7850 
7851     /* "lupa/_lupa.pyx":420
7852  *                         lua.lua_rawseti(L, -2, i)
7853  *                         i += 1
7854  *             return py_from_lua(self, L, -1)             # <<<<<<<<<<<<<<
7855  *         finally:
7856  *             lua.lua_settop(L, old_top)
7857  */
7858     __Pyx_XDECREF(__pyx_r);
7859     __pyx_t_3 = __pyx_f_4lupa_5_lupa_py_from_lua(__pyx_v_self, __pyx_v_L, -1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 420, __pyx_L4_error)
7860     __Pyx_GOTREF(__pyx_t_3);
7861     __pyx_r = __pyx_t_3;
7862     __pyx_t_3 = 0;
7863     goto __pyx_L3_return;
7864   }
7865 
7866   /* "lupa/_lupa.pyx":422
7867  *             return py_from_lua(self, L, -1)
7868  *         finally:
7869  *             lua.lua_settop(L, old_top)             # <<<<<<<<<<<<<<
7870  *             unlock_runtime(self)
7871  *
7872  */
7873   /*finally:*/ {
7874     __pyx_L4_error:;
7875     /*exception exit:*/{
7876       __Pyx_PyThreadState_declare
7877       __Pyx_PyThreadState_assign
7878       __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0;
7879       __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
7880       __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
7881       __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
7882       __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
7883       if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_18, &__pyx_t_19, &__pyx_t_20);
7884       if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_15, &__pyx_t_16, &__pyx_t_17) < 0)) __Pyx_ErrFetch(&__pyx_t_15, &__pyx_t_16, &__pyx_t_17);
7885       __Pyx_XGOTREF(__pyx_t_15);
7886       __Pyx_XGOTREF(__pyx_t_16);
7887       __Pyx_XGOTREF(__pyx_t_17);
7888       __Pyx_XGOTREF(__pyx_t_18);
7889       __Pyx_XGOTREF(__pyx_t_19);
7890       __Pyx_XGOTREF(__pyx_t_20);
7891       __pyx_t_2 = __pyx_lineno; __pyx_t_12 = __pyx_clineno; __pyx_t_14 = __pyx_filename;
7892       {
7893         lua_settop(__pyx_v_L, __pyx_v_old_top);
7894 
7895         /* "lupa/_lupa.pyx":423
7896  *         finally:
7897  *             lua.lua_settop(L, old_top)
7898  *             unlock_runtime(self)             # <<<<<<<<<<<<<<
7899  *
7900  *     @cython.final
7901  */
7902         __pyx_f_4lupa_5_lupa_unlock_runtime(__pyx_v_self);
7903       }
7904       if (PY_MAJOR_VERSION >= 3) {
7905         __Pyx_XGIVEREF(__pyx_t_18);
7906         __Pyx_XGIVEREF(__pyx_t_19);
7907         __Pyx_XGIVEREF(__pyx_t_20);
7908         __Pyx_ExceptionReset(__pyx_t_18, __pyx_t_19, __pyx_t_20);
7909       }
7910       __Pyx_XGIVEREF(__pyx_t_15);
7911       __Pyx_XGIVEREF(__pyx_t_16);
7912       __Pyx_XGIVEREF(__pyx_t_17);
7913       __Pyx_ErrRestore(__pyx_t_15, __pyx_t_16, __pyx_t_17);
7914       __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0;
7915       __pyx_lineno = __pyx_t_2; __pyx_clineno = __pyx_t_12; __pyx_filename = __pyx_t_14;
7916       goto __pyx_L1_error;
7917     }
7918     __pyx_L3_return: {
7919       __pyx_t_20 = __pyx_r;
7920       __pyx_r = 0;
7921 
7922       /* "lupa/_lupa.pyx":422
7923  *             return py_from_lua(self, L, -1)
7924  *         finally:
7925  *             lua.lua_settop(L, old_top)             # <<<<<<<<<<<<<<
7926  *             unlock_runtime(self)
7927  *
7928  */
7929       lua_settop(__pyx_v_L, __pyx_v_old_top);
7930 
7931       /* "lupa/_lupa.pyx":423
7932  *         finally:
7933  *             lua.lua_settop(L, old_top)
7934  *             unlock_runtime(self)             # <<<<<<<<<<<<<<
7935  *
7936  *     @cython.final
7937  */
7938       __pyx_f_4lupa_5_lupa_unlock_runtime(__pyx_v_self);
7939       __pyx_r = __pyx_t_20;
7940       __pyx_t_20 = 0;
7941       goto __pyx_L0;
7942     }
7943   }
7944 
7945   /* "lupa/_lupa.pyx":374
7946  *         return self.table_from(items, kwargs)
7947  *
7948  *     def table_from(self, *args):             # <<<<<<<<<<<<<<
7949  *         """Create a new table from Python mapping or iterable.
7950  *
7951  */
7952 
7953   /* function exit code */
7954   __pyx_L1_error:;
7955   __Pyx_XDECREF(__pyx_t_3);
7956   __Pyx_XDECREF(__pyx_t_5);
7957   __Pyx_XDECREF(__pyx_t_10);
7958   __Pyx_XDECREF(__pyx_t_11);
7959   __Pyx_AddTraceback("lupa._lupa.LuaRuntime.table_from", __pyx_clineno, __pyx_lineno, __pyx_filename);
7960   __pyx_r = NULL;
7961   __pyx_L0:;
7962   __Pyx_XDECREF(__pyx_v_obj);
7963   __Pyx_XDECREF(__pyx_v_key);
7964   __Pyx_XDECREF(__pyx_v_value);
7965   __Pyx_XDECREF(__pyx_v_arg);
7966   __Pyx_XGIVEREF(__pyx_r);
7967   __Pyx_RefNannyFinishContext();
7968   return __pyx_r;
7969 }
7970 
7971 /* "lupa/_lupa.pyx":426
7972  *
7973  *     @cython.final
7974  *     cdef int register_py_object(self, bytes cname, bytes pyname, object obj) except -1:             # <<<<<<<<<<<<<<
7975  *         cdef lua_State *L = self._state
7976  *         lua.lua_pushlstring(L, cname, len(cname))
7977  */
7978 
__pyx_f_4lupa_5_lupa_10LuaRuntime_register_py_object(struct __pyx_obj_4lupa_5_lupa_LuaRuntime * __pyx_v_self,PyObject * __pyx_v_cname,PyObject * __pyx_v_pyname,PyObject * __pyx_v_obj)7979 static int __pyx_f_4lupa_5_lupa_10LuaRuntime_register_py_object(struct __pyx_obj_4lupa_5_lupa_LuaRuntime *__pyx_v_self, PyObject *__pyx_v_cname, PyObject *__pyx_v_pyname, PyObject *__pyx_v_obj) {
7980   lua_State *__pyx_v_L;
7981   int __pyx_r;
7982   __Pyx_RefNannyDeclarations
7983   lua_State *__pyx_t_1;
7984   char *__pyx_t_2;
7985   Py_ssize_t __pyx_t_3;
7986   int __pyx_t_4;
7987   PyObject *__pyx_t_5 = NULL;
7988   PyObject *__pyx_t_6 = NULL;
7989   PyObject *__pyx_t_7 = NULL;
7990   PyObject *__pyx_t_8 = NULL;
7991   int __pyx_lineno = 0;
7992   const char *__pyx_filename = NULL;
7993   int __pyx_clineno = 0;
7994   __Pyx_RefNannySetupContext("register_py_object", 0);
7995 
7996   /* "lupa/_lupa.pyx":427
7997  *     @cython.final
7998  *     cdef int register_py_object(self, bytes cname, bytes pyname, object obj) except -1:
7999  *         cdef lua_State *L = self._state             # <<<<<<<<<<<<<<
8000  *         lua.lua_pushlstring(L, cname, len(cname))
8001  *         if not py_to_lua_custom(self, L, obj, 0):
8002  */
8003   __pyx_t_1 = __pyx_v_self->_state;
8004   __pyx_v_L = __pyx_t_1;
8005 
8006   /* "lupa/_lupa.pyx":428
8007  *     cdef int register_py_object(self, bytes cname, bytes pyname, object obj) except -1:
8008  *         cdef lua_State *L = self._state
8009  *         lua.lua_pushlstring(L, cname, len(cname))             # <<<<<<<<<<<<<<
8010  *         if not py_to_lua_custom(self, L, obj, 0):
8011  *             lua.lua_pop(L, 1)
8012  */
8013   if (unlikely(__pyx_v_cname == Py_None)) {
8014     PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
8015     __PYX_ERR(0, 428, __pyx_L1_error)
8016   }
8017   __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_cname); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 428, __pyx_L1_error)
8018   if (unlikely(__pyx_v_cname == Py_None)) {
8019     PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
8020     __PYX_ERR(0, 428, __pyx_L1_error)
8021   }
8022   __pyx_t_3 = PyBytes_GET_SIZE(__pyx_v_cname); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 428, __pyx_L1_error)
8023   lua_pushlstring(__pyx_v_L, __pyx_t_2, __pyx_t_3);
8024 
8025   /* "lupa/_lupa.pyx":429
8026  *         cdef lua_State *L = self._state
8027  *         lua.lua_pushlstring(L, cname, len(cname))
8028  *         if not py_to_lua_custom(self, L, obj, 0):             # <<<<<<<<<<<<<<
8029  *             lua.lua_pop(L, 1)
8030  *             raise LuaError("failed to convert %s object" % pyname)
8031  */
8032   __pyx_t_4 = ((!(__pyx_f_4lupa_5_lupa_py_to_lua_custom(__pyx_v_self, __pyx_v_L, __pyx_v_obj, 0) != 0)) != 0);
8033   if (unlikely(__pyx_t_4)) {
8034 
8035     /* "lupa/_lupa.pyx":430
8036  *         lua.lua_pushlstring(L, cname, len(cname))
8037  *         if not py_to_lua_custom(self, L, obj, 0):
8038  *             lua.lua_pop(L, 1)             # <<<<<<<<<<<<<<
8039  *             raise LuaError("failed to convert %s object" % pyname)
8040  *         lua.lua_pushlstring(L, pyname, len(pyname))
8041  */
8042     lua_pop(__pyx_v_L, 1);
8043 
8044     /* "lupa/_lupa.pyx":431
8045  *         if not py_to_lua_custom(self, L, obj, 0):
8046  *             lua.lua_pop(L, 1)
8047  *             raise LuaError("failed to convert %s object" % pyname)             # <<<<<<<<<<<<<<
8048  *         lua.lua_pushlstring(L, pyname, len(pyname))
8049  *         lua.lua_pushvalue(L, -2)
8050  */
8051     __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_LuaError); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 431, __pyx_L1_error)
8052     __Pyx_GOTREF(__pyx_t_6);
8053     __pyx_t_7 = __Pyx_PyString_Format(__pyx_kp_s_failed_to_convert_s_object, __pyx_v_pyname); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 431, __pyx_L1_error)
8054     __Pyx_GOTREF(__pyx_t_7);
8055     __pyx_t_8 = NULL;
8056     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
8057       __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_6);
8058       if (likely(__pyx_t_8)) {
8059         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
8060         __Pyx_INCREF(__pyx_t_8);
8061         __Pyx_INCREF(function);
8062         __Pyx_DECREF_SET(__pyx_t_6, function);
8063       }
8064     }
8065     __pyx_t_5 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_8, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_7);
8066     __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
8067     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
8068     if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 431, __pyx_L1_error)
8069     __Pyx_GOTREF(__pyx_t_5);
8070     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
8071     __Pyx_Raise(__pyx_t_5, 0, 0, 0);
8072     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8073     __PYX_ERR(0, 431, __pyx_L1_error)
8074 
8075     /* "lupa/_lupa.pyx":429
8076  *         cdef lua_State *L = self._state
8077  *         lua.lua_pushlstring(L, cname, len(cname))
8078  *         if not py_to_lua_custom(self, L, obj, 0):             # <<<<<<<<<<<<<<
8079  *             lua.lua_pop(L, 1)
8080  *             raise LuaError("failed to convert %s object" % pyname)
8081  */
8082   }
8083 
8084   /* "lupa/_lupa.pyx":432
8085  *             lua.lua_pop(L, 1)
8086  *             raise LuaError("failed to convert %s object" % pyname)
8087  *         lua.lua_pushlstring(L, pyname, len(pyname))             # <<<<<<<<<<<<<<
8088  *         lua.lua_pushvalue(L, -2)
8089  *         lua.lua_rawset(L, -5)
8090  */
8091   if (unlikely(__pyx_v_pyname == Py_None)) {
8092     PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
8093     __PYX_ERR(0, 432, __pyx_L1_error)
8094   }
8095   __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_pyname); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 432, __pyx_L1_error)
8096   if (unlikely(__pyx_v_pyname == Py_None)) {
8097     PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
8098     __PYX_ERR(0, 432, __pyx_L1_error)
8099   }
8100   __pyx_t_3 = PyBytes_GET_SIZE(__pyx_v_pyname); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 432, __pyx_L1_error)
8101   lua_pushlstring(__pyx_v_L, __pyx_t_2, __pyx_t_3);
8102 
8103   /* "lupa/_lupa.pyx":433
8104  *             raise LuaError("failed to convert %s object" % pyname)
8105  *         lua.lua_pushlstring(L, pyname, len(pyname))
8106  *         lua.lua_pushvalue(L, -2)             # <<<<<<<<<<<<<<
8107  *         lua.lua_rawset(L, -5)
8108  *         lua.lua_rawset(L, lua.LUA_REGISTRYINDEX)
8109  */
8110   lua_pushvalue(__pyx_v_L, -2);
8111 
8112   /* "lupa/_lupa.pyx":434
8113  *         lua.lua_pushlstring(L, pyname, len(pyname))
8114  *         lua.lua_pushvalue(L, -2)
8115  *         lua.lua_rawset(L, -5)             # <<<<<<<<<<<<<<
8116  *         lua.lua_rawset(L, lua.LUA_REGISTRYINDEX)
8117  *         return 0
8118  */
8119   lua_rawset(__pyx_v_L, -5);
8120 
8121   /* "lupa/_lupa.pyx":435
8122  *         lua.lua_pushvalue(L, -2)
8123  *         lua.lua_rawset(L, -5)
8124  *         lua.lua_rawset(L, lua.LUA_REGISTRYINDEX)             # <<<<<<<<<<<<<<
8125  *         return 0
8126  *
8127  */
8128   lua_rawset(__pyx_v_L, LUA_REGISTRYINDEX);
8129 
8130   /* "lupa/_lupa.pyx":436
8131  *         lua.lua_rawset(L, -5)
8132  *         lua.lua_rawset(L, lua.LUA_REGISTRYINDEX)
8133  *         return 0             # <<<<<<<<<<<<<<
8134  *
8135  *     @cython.final
8136  */
8137   __pyx_r = 0;
8138   goto __pyx_L0;
8139 
8140   /* "lupa/_lupa.pyx":426
8141  *
8142  *     @cython.final
8143  *     cdef int register_py_object(self, bytes cname, bytes pyname, object obj) except -1:             # <<<<<<<<<<<<<<
8144  *         cdef lua_State *L = self._state
8145  *         lua.lua_pushlstring(L, cname, len(cname))
8146  */
8147 
8148   /* function exit code */
8149   __pyx_L1_error:;
8150   __Pyx_XDECREF(__pyx_t_5);
8151   __Pyx_XDECREF(__pyx_t_6);
8152   __Pyx_XDECREF(__pyx_t_7);
8153   __Pyx_XDECREF(__pyx_t_8);
8154   __Pyx_AddTraceback("lupa._lupa.LuaRuntime.register_py_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
8155   __pyx_r = -1;
8156   __pyx_L0:;
8157   __Pyx_RefNannyFinishContext();
8158   return __pyx_r;
8159 }
8160 
8161 /* "lupa/_lupa.pyx":439
8162  *
8163  *     @cython.final
8164  *     cdef int init_python_lib(self, bint register_eval, bint register_builtins) except -1:             # <<<<<<<<<<<<<<
8165  *         cdef lua_State *L = self._state
8166  *
8167  */
8168 
__pyx_f_4lupa_5_lupa_10LuaRuntime_init_python_lib(struct __pyx_obj_4lupa_5_lupa_LuaRuntime * __pyx_v_self,int __pyx_v_register_eval,int __pyx_v_register_builtins)8169 static int __pyx_f_4lupa_5_lupa_10LuaRuntime_init_python_lib(struct __pyx_obj_4lupa_5_lupa_LuaRuntime *__pyx_v_self, int __pyx_v_register_eval, int __pyx_v_register_builtins) {
8170   lua_State *__pyx_v_L;
8171   int __pyx_r;
8172   __Pyx_RefNannyDeclarations
8173   lua_State *__pyx_t_1;
8174   int __pyx_t_2;
8175   int __pyx_t_3;
8176   PyObject *__pyx_t_4 = NULL;
8177   int __pyx_lineno = 0;
8178   const char *__pyx_filename = NULL;
8179   int __pyx_clineno = 0;
8180   __Pyx_RefNannySetupContext("init_python_lib", 0);
8181 
8182   /* "lupa/_lupa.pyx":440
8183  *     @cython.final
8184  *     cdef int init_python_lib(self, bint register_eval, bint register_builtins) except -1:
8185  *         cdef lua_State *L = self._state             # <<<<<<<<<<<<<<
8186  *
8187  *         # create 'python' lib and register our own object metatable
8188  */
8189   __pyx_t_1 = __pyx_v_self->_state;
8190   __pyx_v_L = __pyx_t_1;
8191 
8192   /* "lupa/_lupa.pyx":443
8193  *
8194  *         # create 'python' lib and register our own object metatable
8195  *         luaL_openlib(L, "python", py_lib, 0)             # <<<<<<<<<<<<<<
8196  *         lua.luaL_newmetatable(L, POBJECT)
8197  *         luaL_openlib(L, NULL, py_object_lib, 0)
8198  */
8199   __pyx_f_4lupa_5_lupa_luaL_openlib(__pyx_v_L, ((char const *)"python"), __pyx_v_4lupa_5_lupa_py_lib, 0);
8200 
8201   /* "lupa/_lupa.pyx":444
8202  *         # create 'python' lib and register our own object metatable
8203  *         luaL_openlib(L, "python", py_lib, 0)
8204  *         lua.luaL_newmetatable(L, POBJECT)             # <<<<<<<<<<<<<<
8205  *         luaL_openlib(L, NULL, py_object_lib, 0)
8206  *         lua.lua_pop(L, 1)
8207  */
8208   (void)(luaL_newmetatable(__pyx_v_L, ((char *)"POBJECT")));
8209 
8210   /* "lupa/_lupa.pyx":445
8211  *         luaL_openlib(L, "python", py_lib, 0)
8212  *         lua.luaL_newmetatable(L, POBJECT)
8213  *         luaL_openlib(L, NULL, py_object_lib, 0)             # <<<<<<<<<<<<<<
8214  *         lua.lua_pop(L, 1)
8215  *
8216  */
8217   __pyx_f_4lupa_5_lupa_luaL_openlib(__pyx_v_L, NULL, __pyx_v_4lupa_5_lupa_py_object_lib, 0);
8218 
8219   /* "lupa/_lupa.pyx":446
8220  *         lua.luaL_newmetatable(L, POBJECT)
8221  *         luaL_openlib(L, NULL, py_object_lib, 0)
8222  *         lua.lua_pop(L, 1)             # <<<<<<<<<<<<<<
8223  *
8224  *         # register global names in the module
8225  */
8226   lua_pop(__pyx_v_L, 1);
8227 
8228   /* "lupa/_lupa.pyx":449
8229  *
8230  *         # register global names in the module
8231  *         self.register_py_object(b'Py_None',  b'none', None)             # <<<<<<<<<<<<<<
8232  *         if register_eval:
8233  *             self.register_py_object(b'eval',     b'eval', eval)
8234  */
8235   __pyx_t_2 = __pyx_f_4lupa_5_lupa_10LuaRuntime_register_py_object(__pyx_v_self, __pyx_n_b_Py_None, __pyx_n_b_none, Py_None); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 449, __pyx_L1_error)
8236 
8237   /* "lupa/_lupa.pyx":450
8238  *         # register global names in the module
8239  *         self.register_py_object(b'Py_None',  b'none', None)
8240  *         if register_eval:             # <<<<<<<<<<<<<<
8241  *             self.register_py_object(b'eval',     b'eval', eval)
8242  *         if register_builtins:
8243  */
8244   __pyx_t_3 = (__pyx_v_register_eval != 0);
8245   if (__pyx_t_3) {
8246 
8247     /* "lupa/_lupa.pyx":451
8248  *         self.register_py_object(b'Py_None',  b'none', None)
8249  *         if register_eval:
8250  *             self.register_py_object(b'eval',     b'eval', eval)             # <<<<<<<<<<<<<<
8251  *         if register_builtins:
8252  *             self.register_py_object(b'builtins', b'builtins', builtins)
8253  */
8254     __pyx_t_2 = __pyx_f_4lupa_5_lupa_10LuaRuntime_register_py_object(__pyx_v_self, __pyx_n_b_eval, __pyx_n_b_eval, __pyx_builtin_eval); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 451, __pyx_L1_error)
8255 
8256     /* "lupa/_lupa.pyx":450
8257  *         # register global names in the module
8258  *         self.register_py_object(b'Py_None',  b'none', None)
8259  *         if register_eval:             # <<<<<<<<<<<<<<
8260  *             self.register_py_object(b'eval',     b'eval', eval)
8261  *         if register_builtins:
8262  */
8263   }
8264 
8265   /* "lupa/_lupa.pyx":452
8266  *         if register_eval:
8267  *             self.register_py_object(b'eval',     b'eval', eval)
8268  *         if register_builtins:             # <<<<<<<<<<<<<<
8269  *             self.register_py_object(b'builtins', b'builtins', builtins)
8270  *
8271  */
8272   __pyx_t_3 = (__pyx_v_register_builtins != 0);
8273   if (__pyx_t_3) {
8274 
8275     /* "lupa/_lupa.pyx":453
8276  *             self.register_py_object(b'eval',     b'eval', eval)
8277  *         if register_builtins:
8278  *             self.register_py_object(b'builtins', b'builtins', builtins)             # <<<<<<<<<<<<<<
8279  *
8280  *         return 0  # nothing left to return on the stack
8281  */
8282     __pyx_t_4 = __pyx_v_4lupa_5_lupa_builtins;
8283     __Pyx_INCREF(__pyx_t_4);
8284     __pyx_t_2 = __pyx_f_4lupa_5_lupa_10LuaRuntime_register_py_object(__pyx_v_self, __pyx_n_b_builtins, __pyx_n_b_builtins, __pyx_t_4); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 453, __pyx_L1_error)
8285     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8286 
8287     /* "lupa/_lupa.pyx":452
8288  *         if register_eval:
8289  *             self.register_py_object(b'eval',     b'eval', eval)
8290  *         if register_builtins:             # <<<<<<<<<<<<<<
8291  *             self.register_py_object(b'builtins', b'builtins', builtins)
8292  *
8293  */
8294   }
8295 
8296   /* "lupa/_lupa.pyx":455
8297  *             self.register_py_object(b'builtins', b'builtins', builtins)
8298  *
8299  *         return 0  # nothing left to return on the stack             # <<<<<<<<<<<<<<
8300  *
8301  *
8302  */
8303   __pyx_r = 0;
8304   goto __pyx_L0;
8305 
8306   /* "lupa/_lupa.pyx":439
8307  *
8308  *     @cython.final
8309  *     cdef int init_python_lib(self, bint register_eval, bint register_builtins) except -1:             # <<<<<<<<<<<<<<
8310  *         cdef lua_State *L = self._state
8311  *
8312  */
8313 
8314   /* function exit code */
8315   __pyx_L1_error:;
8316   __Pyx_XDECREF(__pyx_t_4);
8317   __Pyx_AddTraceback("lupa._lupa.LuaRuntime.init_python_lib", __pyx_clineno, __pyx_lineno, __pyx_filename);
8318   __pyx_r = -1;
8319   __pyx_L0:;
8320   __Pyx_RefNannyFinishContext();
8321   return __pyx_r;
8322 }
8323 
8324 /* "(tree fragment)":1
8325  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
8326  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
8327  * def __setstate_cython__(self, __pyx_state):
8328  */
8329 
8330 /* Python wrapper */
8331 static PyObject *__pyx_pw_4lupa_5_lupa_10LuaRuntime_19__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
8332 static char __pyx_doc_4lupa_5_lupa_10LuaRuntime_18__reduce_cython__[] = "LuaRuntime.__reduce_cython__(self)";
8333 static PyMethodDef __pyx_mdef_4lupa_5_lupa_10LuaRuntime_19__reduce_cython__ = {"__reduce_cython__", (PyCFunction)__pyx_pw_4lupa_5_lupa_10LuaRuntime_19__reduce_cython__, METH_NOARGS, __pyx_doc_4lupa_5_lupa_10LuaRuntime_18__reduce_cython__};
__pyx_pw_4lupa_5_lupa_10LuaRuntime_19__reduce_cython__(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)8334 static PyObject *__pyx_pw_4lupa_5_lupa_10LuaRuntime_19__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
8335   PyObject *__pyx_r = 0;
8336   __Pyx_RefNannyDeclarations
8337   __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
8338   __pyx_r = __pyx_pf_4lupa_5_lupa_10LuaRuntime_18__reduce_cython__(((struct __pyx_obj_4lupa_5_lupa_LuaRuntime *)__pyx_v_self));
8339 
8340   /* function exit code */
8341   __Pyx_RefNannyFinishContext();
8342   return __pyx_r;
8343 }
8344 
__pyx_pf_4lupa_5_lupa_10LuaRuntime_18__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_4lupa_5_lupa_LuaRuntime * __pyx_v_self)8345 static PyObject *__pyx_pf_4lupa_5_lupa_10LuaRuntime_18__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_4lupa_5_lupa_LuaRuntime *__pyx_v_self) {
8346   PyObject *__pyx_r = NULL;
8347   __Pyx_RefNannyDeclarations
8348   PyObject *__pyx_t_1 = NULL;
8349   int __pyx_lineno = 0;
8350   const char *__pyx_filename = NULL;
8351   int __pyx_clineno = 0;
8352   __Pyx_RefNannySetupContext("__reduce_cython__", 0);
8353 
8354   /* "(tree fragment)":2
8355  * def __reduce_cython__(self):
8356  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
8357  * def __setstate_cython__(self, __pyx_state):
8358  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
8359  */
8360   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error)
8361   __Pyx_GOTREF(__pyx_t_1);
8362   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
8363   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8364   __PYX_ERR(2, 2, __pyx_L1_error)
8365 
8366   /* "(tree fragment)":1
8367  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
8368  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
8369  * def __setstate_cython__(self, __pyx_state):
8370  */
8371 
8372   /* function exit code */
8373   __pyx_L1_error:;
8374   __Pyx_XDECREF(__pyx_t_1);
8375   __Pyx_AddTraceback("lupa._lupa.LuaRuntime.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8376   __pyx_r = NULL;
8377   __Pyx_XGIVEREF(__pyx_r);
8378   __Pyx_RefNannyFinishContext();
8379   return __pyx_r;
8380 }
8381 
8382 /* "(tree fragment)":3
8383  * def __reduce_cython__(self):
8384  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
8385  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
8386  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
8387  */
8388 
8389 /* Python wrapper */
8390 static PyObject *__pyx_pw_4lupa_5_lupa_10LuaRuntime_21__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
8391 static char __pyx_doc_4lupa_5_lupa_10LuaRuntime_20__setstate_cython__[] = "LuaRuntime.__setstate_cython__(self, __pyx_state)";
8392 static PyMethodDef __pyx_mdef_4lupa_5_lupa_10LuaRuntime_21__setstate_cython__ = {"__setstate_cython__", (PyCFunction)__pyx_pw_4lupa_5_lupa_10LuaRuntime_21__setstate_cython__, METH_O, __pyx_doc_4lupa_5_lupa_10LuaRuntime_20__setstate_cython__};
__pyx_pw_4lupa_5_lupa_10LuaRuntime_21__setstate_cython__(PyObject * __pyx_v_self,PyObject * __pyx_v___pyx_state)8393 static PyObject *__pyx_pw_4lupa_5_lupa_10LuaRuntime_21__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
8394   PyObject *__pyx_r = 0;
8395   __Pyx_RefNannyDeclarations
8396   __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
8397   __pyx_r = __pyx_pf_4lupa_5_lupa_10LuaRuntime_20__setstate_cython__(((struct __pyx_obj_4lupa_5_lupa_LuaRuntime *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
8398 
8399   /* function exit code */
8400   __Pyx_RefNannyFinishContext();
8401   return __pyx_r;
8402 }
8403 
__pyx_pf_4lupa_5_lupa_10LuaRuntime_20__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_4lupa_5_lupa_LuaRuntime * __pyx_v_self,CYTHON_UNUSED PyObject * __pyx_v___pyx_state)8404 static PyObject *__pyx_pf_4lupa_5_lupa_10LuaRuntime_20__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_4lupa_5_lupa_LuaRuntime *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
8405   PyObject *__pyx_r = NULL;
8406   __Pyx_RefNannyDeclarations
8407   PyObject *__pyx_t_1 = NULL;
8408   int __pyx_lineno = 0;
8409   const char *__pyx_filename = NULL;
8410   int __pyx_clineno = 0;
8411   __Pyx_RefNannySetupContext("__setstate_cython__", 0);
8412 
8413   /* "(tree fragment)":4
8414  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
8415  * def __setstate_cython__(self, __pyx_state):
8416  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
8417  */
8418   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error)
8419   __Pyx_GOTREF(__pyx_t_1);
8420   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
8421   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8422   __PYX_ERR(2, 4, __pyx_L1_error)
8423 
8424   /* "(tree fragment)":3
8425  * def __reduce_cython__(self):
8426  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
8427  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
8428  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
8429  */
8430 
8431   /* function exit code */
8432   __pyx_L1_error:;
8433   __Pyx_XDECREF(__pyx_t_1);
8434   __Pyx_AddTraceback("lupa._lupa.LuaRuntime.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8435   __pyx_r = NULL;
8436   __Pyx_XGIVEREF(__pyx_r);
8437   __Pyx_RefNannyFinishContext();
8438   return __pyx_r;
8439 }
8440 
8441 /* "lupa/_lupa.pyx":462
8442  * # from Lua scripts
8443  *
8444  * def unpacks_lua_table(func):             # <<<<<<<<<<<<<<
8445  *     """
8446  *     A decorator to make the decorated function receive kwargs
8447  */
8448 
8449 /* Python wrapper */
8450 static PyObject *__pyx_pw_4lupa_5_lupa_3unpacks_lua_table(PyObject *__pyx_self, PyObject *__pyx_v_func); /*proto*/
8451 static char __pyx_doc_4lupa_5_lupa_2unpacks_lua_table[] = "unpacks_lua_table(func)\n\n    A decorator to make the decorated function receive kwargs\n    when it is called from Lua with a single Lua table argument.\n\n    Python functions wrapped in this decorator can be called from Lua code\n    as ``func(foo, bar)``, ``func{foo=foo, bar=bar}`` and ``func{foo, bar=bar}``.\n\n    See also: http://lua-users.org/wiki/NamedParameters\n\n    WARNING: avoid using this decorator for functions where the\n    first argument can be a Lua table.\n\n    WARNING: be careful with ``nil`` values.  Depending on the context,\n    passing ``nil`` as a parameter can mean either \"omit a parameter\"\n    or \"pass None\".  This even depends on the Lua version.  It is\n    possible to use ``python.none`` instead of ``nil`` to pass None values\n    robustly.\n    ";
8452 static PyMethodDef __pyx_mdef_4lupa_5_lupa_3unpacks_lua_table = {"unpacks_lua_table", (PyCFunction)__pyx_pw_4lupa_5_lupa_3unpacks_lua_table, METH_O, __pyx_doc_4lupa_5_lupa_2unpacks_lua_table};
__pyx_pw_4lupa_5_lupa_3unpacks_lua_table(PyObject * __pyx_self,PyObject * __pyx_v_func)8453 static PyObject *__pyx_pw_4lupa_5_lupa_3unpacks_lua_table(PyObject *__pyx_self, PyObject *__pyx_v_func) {
8454   PyObject *__pyx_r = 0;
8455   __Pyx_RefNannyDeclarations
8456   __Pyx_RefNannySetupContext("unpacks_lua_table (wrapper)", 0);
8457   __pyx_r = __pyx_pf_4lupa_5_lupa_2unpacks_lua_table(__pyx_self, ((PyObject *)__pyx_v_func));
8458 
8459   /* function exit code */
8460   __Pyx_RefNannyFinishContext();
8461   return __pyx_r;
8462 }
8463 
8464 /* "lupa/_lupa.pyx":482
8465  *     """
8466  *     @wraps(func)
8467  *     def wrapper(*args):             # <<<<<<<<<<<<<<
8468  *         args, kwargs = _fix_args_kwargs(args)
8469  *         return func(*args, **kwargs)
8470  */
8471 
8472 /* Python wrapper */
8473 static PyObject *__pyx_pw_4lupa_5_lupa_17unpacks_lua_table_1wrapper(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
8474 static PyMethodDef __pyx_mdef_4lupa_5_lupa_17unpacks_lua_table_1wrapper = {"wrapper", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lupa_5_lupa_17unpacks_lua_table_1wrapper, METH_VARARGS|METH_KEYWORDS, 0};
__pyx_pw_4lupa_5_lupa_17unpacks_lua_table_1wrapper(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)8475 static PyObject *__pyx_pw_4lupa_5_lupa_17unpacks_lua_table_1wrapper(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
8476   PyObject *__pyx_v_args = 0;
8477   PyObject *__pyx_r = 0;
8478   __Pyx_RefNannyDeclarations
8479   __Pyx_RefNannySetupContext("wrapper (wrapper)", 0);
8480   if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "wrapper", 0))) return NULL;
8481   __Pyx_INCREF(__pyx_args);
8482   __pyx_v_args = __pyx_args;
8483   __pyx_r = __pyx_pf_4lupa_5_lupa_17unpacks_lua_table_wrapper(__pyx_self, __pyx_v_args);
8484 
8485   /* function exit code */
8486   __Pyx_XDECREF(__pyx_v_args);
8487   __Pyx_RefNannyFinishContext();
8488   return __pyx_r;
8489 }
8490 
__pyx_pf_4lupa_5_lupa_17unpacks_lua_table_wrapper(PyObject * __pyx_self,PyObject * __pyx_v_args)8491 static PyObject *__pyx_pf_4lupa_5_lupa_17unpacks_lua_table_wrapper(PyObject *__pyx_self, PyObject *__pyx_v_args) {
8492   struct __pyx_obj_4lupa_5_lupa___pyx_scope_struct__unpacks_lua_table *__pyx_cur_scope;
8493   struct __pyx_obj_4lupa_5_lupa___pyx_scope_struct__unpacks_lua_table *__pyx_outer_scope;
8494   PyObject *__pyx_v_kwargs = NULL;
8495   PyObject *__pyx_r = NULL;
8496   __Pyx_RefNannyDeclarations
8497   PyObject *__pyx_t_1 = NULL;
8498   PyObject *__pyx_t_2 = NULL;
8499   PyObject *__pyx_t_3 = NULL;
8500   int __pyx_lineno = 0;
8501   const char *__pyx_filename = NULL;
8502   int __pyx_clineno = 0;
8503   __Pyx_RefNannySetupContext("wrapper", 0);
8504   __pyx_outer_scope = (struct __pyx_obj_4lupa_5_lupa___pyx_scope_struct__unpacks_lua_table *) __Pyx_CyFunction_GetClosure(__pyx_self);
8505   __pyx_cur_scope = __pyx_outer_scope;
8506   __Pyx_INCREF(__pyx_v_args);
8507 
8508   /* "lupa/_lupa.pyx":483
8509  *     @wraps(func)
8510  *     def wrapper(*args):
8511  *         args, kwargs = _fix_args_kwargs(args)             # <<<<<<<<<<<<<<
8512  *         return func(*args, **kwargs)
8513  *     return wrapper
8514  */
8515   if (!(likely(PyTuple_CheckExact(__pyx_v_args))||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v_args)->tp_name), 0))) __PYX_ERR(0, 483, __pyx_L1_error)
8516   __pyx_t_1 = __pyx_f_4lupa_5_lupa__fix_args_kwargs(((PyObject*)__pyx_v_args)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 483, __pyx_L1_error)
8517   __Pyx_GOTREF(__pyx_t_1);
8518   if (likely(__pyx_t_1 != Py_None)) {
8519     PyObject* sequence = __pyx_t_1;
8520     Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
8521     if (unlikely(size != 2)) {
8522       if (size > 2) __Pyx_RaiseTooManyValuesError(2);
8523       else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
8524       __PYX_ERR(0, 483, __pyx_L1_error)
8525     }
8526     #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
8527     __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
8528     __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1);
8529     __Pyx_INCREF(__pyx_t_2);
8530     __Pyx_INCREF(__pyx_t_3);
8531     #else
8532     __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 483, __pyx_L1_error)
8533     __Pyx_GOTREF(__pyx_t_2);
8534     __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 483, __pyx_L1_error)
8535     __Pyx_GOTREF(__pyx_t_3);
8536     #endif
8537     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8538   } else {
8539     __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 483, __pyx_L1_error)
8540   }
8541   __Pyx_DECREF_SET(__pyx_v_args, __pyx_t_2);
8542   __pyx_t_2 = 0;
8543   __pyx_v_kwargs = __pyx_t_3;
8544   __pyx_t_3 = 0;
8545 
8546   /* "lupa/_lupa.pyx":484
8547  *     def wrapper(*args):
8548  *         args, kwargs = _fix_args_kwargs(args)
8549  *         return func(*args, **kwargs)             # <<<<<<<<<<<<<<
8550  *     return wrapper
8551  *
8552  */
8553   __Pyx_XDECREF(__pyx_r);
8554   if (unlikely(!__pyx_cur_scope->__pyx_v_func)) { __Pyx_RaiseClosureNameError("func"); __PYX_ERR(0, 484, __pyx_L1_error) }
8555   __pyx_t_1 = __Pyx_PySequence_Tuple(__pyx_v_args); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 484, __pyx_L1_error)
8556   __Pyx_GOTREF(__pyx_t_1);
8557   if (unlikely(__pyx_v_kwargs == Py_None)) {
8558     PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
8559     __PYX_ERR(0, 484, __pyx_L1_error)
8560   }
8561   if (likely(PyDict_CheckExact(__pyx_v_kwargs))) {
8562     __pyx_t_3 = PyDict_Copy(__pyx_v_kwargs); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 484, __pyx_L1_error)
8563     __Pyx_GOTREF(__pyx_t_3);
8564   } else {
8565     __pyx_t_3 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_kwargs, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 484, __pyx_L1_error)
8566     __Pyx_GOTREF(__pyx_t_3);
8567   }
8568   __pyx_t_2 = __Pyx_PyObject_Call(__pyx_cur_scope->__pyx_v_func, __pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 484, __pyx_L1_error)
8569   __Pyx_GOTREF(__pyx_t_2);
8570   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8571   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8572   __pyx_r = __pyx_t_2;
8573   __pyx_t_2 = 0;
8574   goto __pyx_L0;
8575 
8576   /* "lupa/_lupa.pyx":482
8577  *     """
8578  *     @wraps(func)
8579  *     def wrapper(*args):             # <<<<<<<<<<<<<<
8580  *         args, kwargs = _fix_args_kwargs(args)
8581  *         return func(*args, **kwargs)
8582  */
8583 
8584   /* function exit code */
8585   __pyx_L1_error:;
8586   __Pyx_XDECREF(__pyx_t_1);
8587   __Pyx_XDECREF(__pyx_t_2);
8588   __Pyx_XDECREF(__pyx_t_3);
8589   __Pyx_AddTraceback("lupa._lupa.unpacks_lua_table.wrapper", __pyx_clineno, __pyx_lineno, __pyx_filename);
8590   __pyx_r = NULL;
8591   __pyx_L0:;
8592   __Pyx_XDECREF(__pyx_v_args);
8593   __Pyx_XDECREF(__pyx_v_kwargs);
8594   __Pyx_XGIVEREF(__pyx_r);
8595   __Pyx_RefNannyFinishContext();
8596   return __pyx_r;
8597 }
8598 
8599 /* "lupa/_lupa.pyx":462
8600  * # from Lua scripts
8601  *
8602  * def unpacks_lua_table(func):             # <<<<<<<<<<<<<<
8603  *     """
8604  *     A decorator to make the decorated function receive kwargs
8605  */
8606 
__pyx_pf_4lupa_5_lupa_2unpacks_lua_table(CYTHON_UNUSED PyObject * __pyx_self,PyObject * __pyx_v_func)8607 static PyObject *__pyx_pf_4lupa_5_lupa_2unpacks_lua_table(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_func) {
8608   struct __pyx_obj_4lupa_5_lupa___pyx_scope_struct__unpacks_lua_table *__pyx_cur_scope;
8609   PyObject *__pyx_v_wrapper = 0;
8610   PyObject *__pyx_r = NULL;
8611   __Pyx_RefNannyDeclarations
8612   PyObject *__pyx_t_1 = NULL;
8613   PyObject *__pyx_t_2 = NULL;
8614   PyObject *__pyx_t_3 = NULL;
8615   PyObject *__pyx_t_4 = NULL;
8616   int __pyx_lineno = 0;
8617   const char *__pyx_filename = NULL;
8618   int __pyx_clineno = 0;
8619   __Pyx_RefNannySetupContext("unpacks_lua_table", 0);
8620   __pyx_cur_scope = (struct __pyx_obj_4lupa_5_lupa___pyx_scope_struct__unpacks_lua_table *)__pyx_tp_new_4lupa_5_lupa___pyx_scope_struct__unpacks_lua_table(__pyx_ptype_4lupa_5_lupa___pyx_scope_struct__unpacks_lua_table, __pyx_empty_tuple, NULL);
8621   if (unlikely(!__pyx_cur_scope)) {
8622     __pyx_cur_scope = ((struct __pyx_obj_4lupa_5_lupa___pyx_scope_struct__unpacks_lua_table *)Py_None);
8623     __Pyx_INCREF(Py_None);
8624     __PYX_ERR(0, 462, __pyx_L1_error)
8625   } else {
8626     __Pyx_GOTREF(__pyx_cur_scope);
8627   }
8628   __pyx_cur_scope->__pyx_v_func = __pyx_v_func;
8629   __Pyx_INCREF(__pyx_cur_scope->__pyx_v_func);
8630   __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_func);
8631 
8632   /* "lupa/_lupa.pyx":481
8633  *     robustly.
8634  *     """
8635  *     @wraps(func)             # <<<<<<<<<<<<<<
8636  *     def wrapper(*args):
8637  *         args, kwargs = _fix_args_kwargs(args)
8638  */
8639   __Pyx_INCREF(__pyx_v_4lupa_5_lupa_wraps);
8640   __pyx_t_3 = __pyx_v_4lupa_5_lupa_wraps; __pyx_t_4 = NULL;
8641   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
8642     __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
8643     if (likely(__pyx_t_4)) {
8644       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
8645       __Pyx_INCREF(__pyx_t_4);
8646       __Pyx_INCREF(function);
8647       __Pyx_DECREF_SET(__pyx_t_3, function);
8648     }
8649   }
8650   __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_cur_scope->__pyx_v_func) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_cur_scope->__pyx_v_func);
8651   __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
8652   if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 481, __pyx_L1_error)
8653   __Pyx_GOTREF(__pyx_t_2);
8654   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8655 
8656   /* "lupa/_lupa.pyx":482
8657  *     """
8658  *     @wraps(func)
8659  *     def wrapper(*args):             # <<<<<<<<<<<<<<
8660  *         args, kwargs = _fix_args_kwargs(args)
8661  *         return func(*args, **kwargs)
8662  */
8663   __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4lupa_5_lupa_17unpacks_lua_table_1wrapper, 0, __pyx_n_s_unpacks_lua_table_locals_wrapper, ((PyObject*)__pyx_cur_scope), __pyx_n_s_lupa__lupa, __pyx_d, ((PyObject *)__pyx_codeobj__11)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 482, __pyx_L1_error)
8664   __Pyx_GOTREF(__pyx_t_3);
8665   __pyx_t_4 = NULL;
8666   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
8667     __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
8668     if (likely(__pyx_t_4)) {
8669       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
8670       __Pyx_INCREF(__pyx_t_4);
8671       __Pyx_INCREF(function);
8672       __Pyx_DECREF_SET(__pyx_t_2, function);
8673     }
8674   }
8675   __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
8676   __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
8677   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8678   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 481, __pyx_L1_error)
8679   __Pyx_GOTREF(__pyx_t_1);
8680   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8681   __pyx_v_wrapper = __pyx_t_1;
8682   __pyx_t_1 = 0;
8683 
8684   /* "lupa/_lupa.pyx":485
8685  *         args, kwargs = _fix_args_kwargs(args)
8686  *         return func(*args, **kwargs)
8687  *     return wrapper             # <<<<<<<<<<<<<<
8688  *
8689  *
8690  */
8691   __Pyx_XDECREF(__pyx_r);
8692   __Pyx_INCREF(__pyx_v_wrapper);
8693   __pyx_r = __pyx_v_wrapper;
8694   goto __pyx_L0;
8695 
8696   /* "lupa/_lupa.pyx":462
8697  * # from Lua scripts
8698  *
8699  * def unpacks_lua_table(func):             # <<<<<<<<<<<<<<
8700  *     """
8701  *     A decorator to make the decorated function receive kwargs
8702  */
8703 
8704   /* function exit code */
8705   __pyx_L1_error:;
8706   __Pyx_XDECREF(__pyx_t_1);
8707   __Pyx_XDECREF(__pyx_t_2);
8708   __Pyx_XDECREF(__pyx_t_3);
8709   __Pyx_XDECREF(__pyx_t_4);
8710   __Pyx_AddTraceback("lupa._lupa.unpacks_lua_table", __pyx_clineno, __pyx_lineno, __pyx_filename);
8711   __pyx_r = NULL;
8712   __pyx_L0:;
8713   __Pyx_XDECREF(__pyx_v_wrapper);
8714   __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
8715   __Pyx_XGIVEREF(__pyx_r);
8716   __Pyx_RefNannyFinishContext();
8717   return __pyx_r;
8718 }
8719 
8720 /* "lupa/_lupa.pyx":488
8721  *
8722  *
8723  * def unpacks_lua_table_method(meth):             # <<<<<<<<<<<<<<
8724  *     """
8725  *     This is :func:`unpacks_lua_table` for methods
8726  */
8727 
8728 /* Python wrapper */
8729 static PyObject *__pyx_pw_4lupa_5_lupa_5unpacks_lua_table_method(PyObject *__pyx_self, PyObject *__pyx_v_meth); /*proto*/
8730 static char __pyx_doc_4lupa_5_lupa_4unpacks_lua_table_method[] = "unpacks_lua_table_method(meth)\n\n    This is :func:`unpacks_lua_table` for methods\n    (i.e. it knows about the 'self' argument).\n    ";
8731 static PyMethodDef __pyx_mdef_4lupa_5_lupa_5unpacks_lua_table_method = {"unpacks_lua_table_method", (PyCFunction)__pyx_pw_4lupa_5_lupa_5unpacks_lua_table_method, METH_O, __pyx_doc_4lupa_5_lupa_4unpacks_lua_table_method};
__pyx_pw_4lupa_5_lupa_5unpacks_lua_table_method(PyObject * __pyx_self,PyObject * __pyx_v_meth)8732 static PyObject *__pyx_pw_4lupa_5_lupa_5unpacks_lua_table_method(PyObject *__pyx_self, PyObject *__pyx_v_meth) {
8733   PyObject *__pyx_r = 0;
8734   __Pyx_RefNannyDeclarations
8735   __Pyx_RefNannySetupContext("unpacks_lua_table_method (wrapper)", 0);
8736   __pyx_r = __pyx_pf_4lupa_5_lupa_4unpacks_lua_table_method(__pyx_self, ((PyObject *)__pyx_v_meth));
8737 
8738   /* function exit code */
8739   __Pyx_RefNannyFinishContext();
8740   return __pyx_r;
8741 }
8742 
8743 /* "lupa/_lupa.pyx":494
8744  *     """
8745  *     @wraps(meth)
8746  *     def wrapper(self, *args):             # <<<<<<<<<<<<<<
8747  *         args, kwargs = _fix_args_kwargs(args)
8748  *         return meth(self, *args, **kwargs)
8749  */
8750 
8751 /* Python wrapper */
8752 static PyObject *__pyx_pw_4lupa_5_lupa_24unpacks_lua_table_method_1wrapper(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
8753 static PyMethodDef __pyx_mdef_4lupa_5_lupa_24unpacks_lua_table_method_1wrapper = {"wrapper", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lupa_5_lupa_24unpacks_lua_table_method_1wrapper, METH_VARARGS|METH_KEYWORDS, 0};
__pyx_pw_4lupa_5_lupa_24unpacks_lua_table_method_1wrapper(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)8754 static PyObject *__pyx_pw_4lupa_5_lupa_24unpacks_lua_table_method_1wrapper(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
8755   PyObject *__pyx_v_self = 0;
8756   PyObject *__pyx_v_args = 0;
8757   int __pyx_lineno = 0;
8758   const char *__pyx_filename = NULL;
8759   int __pyx_clineno = 0;
8760   PyObject *__pyx_r = 0;
8761   __Pyx_RefNannyDeclarations
8762   __Pyx_RefNannySetupContext("wrapper (wrapper)", 0);
8763   if (PyTuple_GET_SIZE(__pyx_args) > 1) {
8764     __pyx_v_args = PyTuple_GetSlice(__pyx_args, 1, PyTuple_GET_SIZE(__pyx_args));
8765     if (unlikely(!__pyx_v_args)) {
8766       __Pyx_RefNannyFinishContext();
8767       return NULL;
8768     }
8769     __Pyx_GOTREF(__pyx_v_args);
8770   } else {
8771     __pyx_v_args = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple);
8772   }
8773   {
8774     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,0};
8775     PyObject* values[1] = {0};
8776     if (unlikely(__pyx_kwds)) {
8777       Py_ssize_t kw_args;
8778       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
8779       switch (pos_args) {
8780         default:
8781         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8782         CYTHON_FALLTHROUGH;
8783         case  0: break;
8784       }
8785       kw_args = PyDict_Size(__pyx_kwds);
8786       switch (pos_args) {
8787         case  0:
8788         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
8789         else goto __pyx_L5_argtuple_error;
8790       }
8791       if (unlikely(kw_args > 0)) {
8792         const Py_ssize_t used_pos_args = (pos_args < 1) ? pos_args : 1;
8793         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, used_pos_args, "wrapper") < 0)) __PYX_ERR(0, 494, __pyx_L3_error)
8794       }
8795     } else if (PyTuple_GET_SIZE(__pyx_args) < 1) {
8796       goto __pyx_L5_argtuple_error;
8797     } else {
8798       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8799     }
8800     __pyx_v_self = values[0];
8801   }
8802   goto __pyx_L4_argument_unpacking_done;
8803   __pyx_L5_argtuple_error:;
8804   __Pyx_RaiseArgtupleInvalid("wrapper", 0, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 494, __pyx_L3_error)
8805   __pyx_L3_error:;
8806   __Pyx_DECREF(__pyx_v_args); __pyx_v_args = 0;
8807   __Pyx_AddTraceback("lupa._lupa.unpacks_lua_table_method.wrapper", __pyx_clineno, __pyx_lineno, __pyx_filename);
8808   __Pyx_RefNannyFinishContext();
8809   return NULL;
8810   __pyx_L4_argument_unpacking_done:;
8811   __pyx_r = __pyx_pf_4lupa_5_lupa_24unpacks_lua_table_method_wrapper(__pyx_self, __pyx_v_self, __pyx_v_args);
8812 
8813   /* function exit code */
8814   __Pyx_XDECREF(__pyx_v_args);
8815   __Pyx_RefNannyFinishContext();
8816   return __pyx_r;
8817 }
8818 
__pyx_pf_4lupa_5_lupa_24unpacks_lua_table_method_wrapper(PyObject * __pyx_self,PyObject * __pyx_v_self,PyObject * __pyx_v_args)8819 static PyObject *__pyx_pf_4lupa_5_lupa_24unpacks_lua_table_method_wrapper(PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_args) {
8820   struct __pyx_obj_4lupa_5_lupa___pyx_scope_struct_1_unpacks_lua_table_method *__pyx_cur_scope;
8821   struct __pyx_obj_4lupa_5_lupa___pyx_scope_struct_1_unpacks_lua_table_method *__pyx_outer_scope;
8822   PyObject *__pyx_v_kwargs = NULL;
8823   PyObject *__pyx_r = NULL;
8824   __Pyx_RefNannyDeclarations
8825   PyObject *__pyx_t_1 = NULL;
8826   PyObject *__pyx_t_2 = NULL;
8827   PyObject *__pyx_t_3 = NULL;
8828   int __pyx_lineno = 0;
8829   const char *__pyx_filename = NULL;
8830   int __pyx_clineno = 0;
8831   __Pyx_RefNannySetupContext("wrapper", 0);
8832   __pyx_outer_scope = (struct __pyx_obj_4lupa_5_lupa___pyx_scope_struct_1_unpacks_lua_table_method *) __Pyx_CyFunction_GetClosure(__pyx_self);
8833   __pyx_cur_scope = __pyx_outer_scope;
8834   __Pyx_INCREF(__pyx_v_args);
8835 
8836   /* "lupa/_lupa.pyx":495
8837  *     @wraps(meth)
8838  *     def wrapper(self, *args):
8839  *         args, kwargs = _fix_args_kwargs(args)             # <<<<<<<<<<<<<<
8840  *         return meth(self, *args, **kwargs)
8841  *     return wrapper
8842  */
8843   if (!(likely(PyTuple_CheckExact(__pyx_v_args))||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v_args)->tp_name), 0))) __PYX_ERR(0, 495, __pyx_L1_error)
8844   __pyx_t_1 = __pyx_f_4lupa_5_lupa__fix_args_kwargs(((PyObject*)__pyx_v_args)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 495, __pyx_L1_error)
8845   __Pyx_GOTREF(__pyx_t_1);
8846   if (likely(__pyx_t_1 != Py_None)) {
8847     PyObject* sequence = __pyx_t_1;
8848     Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
8849     if (unlikely(size != 2)) {
8850       if (size > 2) __Pyx_RaiseTooManyValuesError(2);
8851       else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
8852       __PYX_ERR(0, 495, __pyx_L1_error)
8853     }
8854     #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
8855     __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
8856     __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1);
8857     __Pyx_INCREF(__pyx_t_2);
8858     __Pyx_INCREF(__pyx_t_3);
8859     #else
8860     __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 495, __pyx_L1_error)
8861     __Pyx_GOTREF(__pyx_t_2);
8862     __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 495, __pyx_L1_error)
8863     __Pyx_GOTREF(__pyx_t_3);
8864     #endif
8865     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8866   } else {
8867     __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 495, __pyx_L1_error)
8868   }
8869   __Pyx_DECREF_SET(__pyx_v_args, __pyx_t_2);
8870   __pyx_t_2 = 0;
8871   __pyx_v_kwargs = __pyx_t_3;
8872   __pyx_t_3 = 0;
8873 
8874   /* "lupa/_lupa.pyx":496
8875  *     def wrapper(self, *args):
8876  *         args, kwargs = _fix_args_kwargs(args)
8877  *         return meth(self, *args, **kwargs)             # <<<<<<<<<<<<<<
8878  *     return wrapper
8879  *
8880  */
8881   __Pyx_XDECREF(__pyx_r);
8882   if (unlikely(!__pyx_cur_scope->__pyx_v_meth)) { __Pyx_RaiseClosureNameError("meth"); __PYX_ERR(0, 496, __pyx_L1_error) }
8883   __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 496, __pyx_L1_error)
8884   __Pyx_GOTREF(__pyx_t_1);
8885   __Pyx_INCREF(__pyx_v_self);
8886   __Pyx_GIVEREF(__pyx_v_self);
8887   PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self);
8888   __pyx_t_3 = __Pyx_PySequence_Tuple(__pyx_v_args); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 496, __pyx_L1_error)
8889   __Pyx_GOTREF(__pyx_t_3);
8890   __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 496, __pyx_L1_error)
8891   __Pyx_GOTREF(__pyx_t_2);
8892   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8893   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8894   if (unlikely(__pyx_v_kwargs == Py_None)) {
8895     PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
8896     __PYX_ERR(0, 496, __pyx_L1_error)
8897   }
8898   if (likely(PyDict_CheckExact(__pyx_v_kwargs))) {
8899     __pyx_t_3 = PyDict_Copy(__pyx_v_kwargs); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 496, __pyx_L1_error)
8900     __Pyx_GOTREF(__pyx_t_3);
8901   } else {
8902     __pyx_t_3 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_kwargs, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 496, __pyx_L1_error)
8903     __Pyx_GOTREF(__pyx_t_3);
8904   }
8905   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_cur_scope->__pyx_v_meth, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 496, __pyx_L1_error)
8906   __Pyx_GOTREF(__pyx_t_1);
8907   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8908   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8909   __pyx_r = __pyx_t_1;
8910   __pyx_t_1 = 0;
8911   goto __pyx_L0;
8912 
8913   /* "lupa/_lupa.pyx":494
8914  *     """
8915  *     @wraps(meth)
8916  *     def wrapper(self, *args):             # <<<<<<<<<<<<<<
8917  *         args, kwargs = _fix_args_kwargs(args)
8918  *         return meth(self, *args, **kwargs)
8919  */
8920 
8921   /* function exit code */
8922   __pyx_L1_error:;
8923   __Pyx_XDECREF(__pyx_t_1);
8924   __Pyx_XDECREF(__pyx_t_2);
8925   __Pyx_XDECREF(__pyx_t_3);
8926   __Pyx_AddTraceback("lupa._lupa.unpacks_lua_table_method.wrapper", __pyx_clineno, __pyx_lineno, __pyx_filename);
8927   __pyx_r = NULL;
8928   __pyx_L0:;
8929   __Pyx_XDECREF(__pyx_v_args);
8930   __Pyx_XDECREF(__pyx_v_kwargs);
8931   __Pyx_XGIVEREF(__pyx_r);
8932   __Pyx_RefNannyFinishContext();
8933   return __pyx_r;
8934 }
8935 
8936 /* "lupa/_lupa.pyx":488
8937  *
8938  *
8939  * def unpacks_lua_table_method(meth):             # <<<<<<<<<<<<<<
8940  *     """
8941  *     This is :func:`unpacks_lua_table` for methods
8942  */
8943 
__pyx_pf_4lupa_5_lupa_4unpacks_lua_table_method(CYTHON_UNUSED PyObject * __pyx_self,PyObject * __pyx_v_meth)8944 static PyObject *__pyx_pf_4lupa_5_lupa_4unpacks_lua_table_method(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_meth) {
8945   struct __pyx_obj_4lupa_5_lupa___pyx_scope_struct_1_unpacks_lua_table_method *__pyx_cur_scope;
8946   PyObject *__pyx_v_wrapper = 0;
8947   PyObject *__pyx_r = NULL;
8948   __Pyx_RefNannyDeclarations
8949   PyObject *__pyx_t_1 = NULL;
8950   PyObject *__pyx_t_2 = NULL;
8951   PyObject *__pyx_t_3 = NULL;
8952   PyObject *__pyx_t_4 = NULL;
8953   int __pyx_lineno = 0;
8954   const char *__pyx_filename = NULL;
8955   int __pyx_clineno = 0;
8956   __Pyx_RefNannySetupContext("unpacks_lua_table_method", 0);
8957   __pyx_cur_scope = (struct __pyx_obj_4lupa_5_lupa___pyx_scope_struct_1_unpacks_lua_table_method *)__pyx_tp_new_4lupa_5_lupa___pyx_scope_struct_1_unpacks_lua_table_method(__pyx_ptype_4lupa_5_lupa___pyx_scope_struct_1_unpacks_lua_table_method, __pyx_empty_tuple, NULL);
8958   if (unlikely(!__pyx_cur_scope)) {
8959     __pyx_cur_scope = ((struct __pyx_obj_4lupa_5_lupa___pyx_scope_struct_1_unpacks_lua_table_method *)Py_None);
8960     __Pyx_INCREF(Py_None);
8961     __PYX_ERR(0, 488, __pyx_L1_error)
8962   } else {
8963     __Pyx_GOTREF(__pyx_cur_scope);
8964   }
8965   __pyx_cur_scope->__pyx_v_meth = __pyx_v_meth;
8966   __Pyx_INCREF(__pyx_cur_scope->__pyx_v_meth);
8967   __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_meth);
8968 
8969   /* "lupa/_lupa.pyx":493
8970  *     (i.e. it knows about the 'self' argument).
8971  *     """
8972  *     @wraps(meth)             # <<<<<<<<<<<<<<
8973  *     def wrapper(self, *args):
8974  *         args, kwargs = _fix_args_kwargs(args)
8975  */
8976   __Pyx_INCREF(__pyx_v_4lupa_5_lupa_wraps);
8977   __pyx_t_3 = __pyx_v_4lupa_5_lupa_wraps; __pyx_t_4 = NULL;
8978   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
8979     __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
8980     if (likely(__pyx_t_4)) {
8981       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
8982       __Pyx_INCREF(__pyx_t_4);
8983       __Pyx_INCREF(function);
8984       __Pyx_DECREF_SET(__pyx_t_3, function);
8985     }
8986   }
8987   __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_cur_scope->__pyx_v_meth) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_cur_scope->__pyx_v_meth);
8988   __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
8989   if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 493, __pyx_L1_error)
8990   __Pyx_GOTREF(__pyx_t_2);
8991   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8992 
8993   /* "lupa/_lupa.pyx":494
8994  *     """
8995  *     @wraps(meth)
8996  *     def wrapper(self, *args):             # <<<<<<<<<<<<<<
8997  *         args, kwargs = _fix_args_kwargs(args)
8998  *         return meth(self, *args, **kwargs)
8999  */
9000   __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_4lupa_5_lupa_24unpacks_lua_table_method_1wrapper, 0, __pyx_n_s_unpacks_lua_table_method_locals, ((PyObject*)__pyx_cur_scope), __pyx_n_s_lupa__lupa, __pyx_d, ((PyObject *)__pyx_codeobj__13)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 494, __pyx_L1_error)
9001   __Pyx_GOTREF(__pyx_t_3);
9002   __pyx_t_4 = NULL;
9003   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
9004     __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
9005     if (likely(__pyx_t_4)) {
9006       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
9007       __Pyx_INCREF(__pyx_t_4);
9008       __Pyx_INCREF(function);
9009       __Pyx_DECREF_SET(__pyx_t_2, function);
9010     }
9011   }
9012   __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
9013   __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
9014   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9015   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 493, __pyx_L1_error)
9016   __Pyx_GOTREF(__pyx_t_1);
9017   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9018   __pyx_v_wrapper = __pyx_t_1;
9019   __pyx_t_1 = 0;
9020 
9021   /* "lupa/_lupa.pyx":497
9022  *         args, kwargs = _fix_args_kwargs(args)
9023  *         return meth(self, *args, **kwargs)
9024  *     return wrapper             # <<<<<<<<<<<<<<
9025  *
9026  *
9027  */
9028   __Pyx_XDECREF(__pyx_r);
9029   __Pyx_INCREF(__pyx_v_wrapper);
9030   __pyx_r = __pyx_v_wrapper;
9031   goto __pyx_L0;
9032 
9033   /* "lupa/_lupa.pyx":488
9034  *
9035  *
9036  * def unpacks_lua_table_method(meth):             # <<<<<<<<<<<<<<
9037  *     """
9038  *     This is :func:`unpacks_lua_table` for methods
9039  */
9040 
9041   /* function exit code */
9042   __pyx_L1_error:;
9043   __Pyx_XDECREF(__pyx_t_1);
9044   __Pyx_XDECREF(__pyx_t_2);
9045   __Pyx_XDECREF(__pyx_t_3);
9046   __Pyx_XDECREF(__pyx_t_4);
9047   __Pyx_AddTraceback("lupa._lupa.unpacks_lua_table_method", __pyx_clineno, __pyx_lineno, __pyx_filename);
9048   __pyx_r = NULL;
9049   __pyx_L0:;
9050   __Pyx_XDECREF(__pyx_v_wrapper);
9051   __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
9052   __Pyx_XGIVEREF(__pyx_r);
9053   __Pyx_RefNannyFinishContext();
9054   return __pyx_r;
9055 }
9056 
9057 /* "lupa/_lupa.pyx":500
9058  *
9059  *
9060  * cdef tuple _fix_args_kwargs(tuple args):             # <<<<<<<<<<<<<<
9061  *     """
9062  *     Extract named arguments from args passed to a Python function by Lua
9063  */
9064 
__pyx_f_4lupa_5_lupa__fix_args_kwargs(PyObject * __pyx_v_args)9065 static PyObject *__pyx_f_4lupa_5_lupa__fix_args_kwargs(PyObject *__pyx_v_args) {
9066   PyObject *__pyx_v_arg = NULL;
9067   struct __pyx_obj_4lupa_5_lupa__LuaTable *__pyx_v_table = NULL;
9068   PyObject *__pyx_v_encoding = NULL;
9069   PyObject *__pyx_v_new_args = NULL;
9070   PyObject *__pyx_v_new_kwargs = NULL;
9071   size_t __pyx_7genexpr__pyx_v_key;
9072   PyObject *__pyx_8genexpr1__pyx_v_key = NULL;
9073   PyObject *__pyx_8genexpr1__pyx_v_value = NULL;
9074   PyObject *__pyx_r = NULL;
9075   __Pyx_RefNannyDeclarations
9076   Py_ssize_t __pyx_t_1;
9077   int __pyx_t_2;
9078   PyObject *__pyx_t_3 = NULL;
9079   PyObject *__pyx_t_4 = NULL;
9080   int __pyx_t_5;
9081   size_t __pyx_t_6;
9082   size_t __pyx_t_7;
9083   size_t __pyx_t_8;
9084   PyObject *__pyx_t_9 = NULL;
9085   PyObject *(*__pyx_t_10)(PyObject *);
9086   PyObject *__pyx_t_11 = NULL;
9087   PyObject *__pyx_t_12 = NULL;
9088   PyObject *__pyx_t_13 = NULL;
9089   PyObject *(*__pyx_t_14)(PyObject *);
9090   int __pyx_t_15;
9091   char const *__pyx_t_16;
9092   int __pyx_lineno = 0;
9093   const char *__pyx_filename = NULL;
9094   int __pyx_clineno = 0;
9095   __Pyx_RefNannySetupContext("_fix_args_kwargs", 0);
9096 
9097   /* "lupa/_lupa.pyx":506
9098  *     it is a table.
9099  *     """
9100  *     if len(args) != 1:             # <<<<<<<<<<<<<<
9101  *         return args, {}
9102  *
9103  */
9104   if (unlikely(__pyx_v_args == Py_None)) {
9105     PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
9106     __PYX_ERR(0, 506, __pyx_L1_error)
9107   }
9108   __pyx_t_1 = PyTuple_GET_SIZE(__pyx_v_args); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 506, __pyx_L1_error)
9109   __pyx_t_2 = ((__pyx_t_1 != 1) != 0);
9110   if (__pyx_t_2) {
9111 
9112     /* "lupa/_lupa.pyx":507
9113  *     """
9114  *     if len(args) != 1:
9115  *         return args, {}             # <<<<<<<<<<<<<<
9116  *
9117  *     arg = args[0]
9118  */
9119     __Pyx_XDECREF(__pyx_r);
9120     __pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 507, __pyx_L1_error)
9121     __Pyx_GOTREF(__pyx_t_3);
9122     __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 507, __pyx_L1_error)
9123     __Pyx_GOTREF(__pyx_t_4);
9124     __Pyx_INCREF(__pyx_v_args);
9125     __Pyx_GIVEREF(__pyx_v_args);
9126     PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_args);
9127     __Pyx_GIVEREF(__pyx_t_3);
9128     PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
9129     __pyx_t_3 = 0;
9130     __pyx_r = ((PyObject*)__pyx_t_4);
9131     __pyx_t_4 = 0;
9132     goto __pyx_L0;
9133 
9134     /* "lupa/_lupa.pyx":506
9135  *     it is a table.
9136  *     """
9137  *     if len(args) != 1:             # <<<<<<<<<<<<<<
9138  *         return args, {}
9139  *
9140  */
9141   }
9142 
9143   /* "lupa/_lupa.pyx":509
9144  *         return args, {}
9145  *
9146  *     arg = args[0]             # <<<<<<<<<<<<<<
9147  *     if not isinstance(arg, _LuaTable):
9148  *         return args, {}
9149  */
9150   if (unlikely(__pyx_v_args == Py_None)) {
9151     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
9152     __PYX_ERR(0, 509, __pyx_L1_error)
9153   }
9154   __pyx_t_4 = __Pyx_GetItemInt_Tuple(__pyx_v_args, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 509, __pyx_L1_error)
9155   __Pyx_GOTREF(__pyx_t_4);
9156   __pyx_v_arg = __pyx_t_4;
9157   __pyx_t_4 = 0;
9158 
9159   /* "lupa/_lupa.pyx":510
9160  *
9161  *     arg = args[0]
9162  *     if not isinstance(arg, _LuaTable):             # <<<<<<<<<<<<<<
9163  *         return args, {}
9164  *
9165  */
9166   __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_arg, __pyx_ptype_4lupa_5_lupa__LuaTable);
9167   __pyx_t_5 = ((!(__pyx_t_2 != 0)) != 0);
9168   if (__pyx_t_5) {
9169 
9170     /* "lupa/_lupa.pyx":511
9171  *     arg = args[0]
9172  *     if not isinstance(arg, _LuaTable):
9173  *         return args, {}             # <<<<<<<<<<<<<<
9174  *
9175  *     table = <_LuaTable>arg
9176  */
9177     __Pyx_XDECREF(__pyx_r);
9178     __pyx_t_4 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 511, __pyx_L1_error)
9179     __Pyx_GOTREF(__pyx_t_4);
9180     __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 511, __pyx_L1_error)
9181     __Pyx_GOTREF(__pyx_t_3);
9182     __Pyx_INCREF(__pyx_v_args);
9183     __Pyx_GIVEREF(__pyx_v_args);
9184     PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_args);
9185     __Pyx_GIVEREF(__pyx_t_4);
9186     PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_4);
9187     __pyx_t_4 = 0;
9188     __pyx_r = ((PyObject*)__pyx_t_3);
9189     __pyx_t_3 = 0;
9190     goto __pyx_L0;
9191 
9192     /* "lupa/_lupa.pyx":510
9193  *
9194  *     arg = args[0]
9195  *     if not isinstance(arg, _LuaTable):             # <<<<<<<<<<<<<<
9196  *         return args, {}
9197  *
9198  */
9199   }
9200 
9201   /* "lupa/_lupa.pyx":513
9202  *         return args, {}
9203  *
9204  *     table = <_LuaTable>arg             # <<<<<<<<<<<<<<
9205  *     encoding = table._runtime._source_encoding
9206  *
9207  */
9208   __pyx_t_3 = __pyx_v_arg;
9209   __Pyx_INCREF(__pyx_t_3);
9210   __pyx_v_table = ((struct __pyx_obj_4lupa_5_lupa__LuaTable *)__pyx_t_3);
9211   __pyx_t_3 = 0;
9212 
9213   /* "lupa/_lupa.pyx":514
9214  *
9215  *     table = <_LuaTable>arg
9216  *     encoding = table._runtime._source_encoding             # <<<<<<<<<<<<<<
9217  *
9218  *     # arguments with keys from 1 to #tbl are passed as positional
9219  */
9220   __pyx_t_3 = __pyx_v_table->__pyx_base._runtime->_source_encoding;
9221   __Pyx_INCREF(__pyx_t_3);
9222   __pyx_v_encoding = ((PyObject*)__pyx_t_3);
9223   __pyx_t_3 = 0;
9224 
9225   /* "lupa/_lupa.pyx":517
9226  *
9227  *     # arguments with keys from 1 to #tbl are passed as positional
9228  *     new_args = [             # <<<<<<<<<<<<<<
9229  *         table._getitem(key, is_attr_access=False)
9230  *         for key in range(1, table._len() + 1)
9231  */
9232   { /* enter inner scope */
9233     __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 517, __pyx_L1_error)
9234     __Pyx_GOTREF(__pyx_t_3);
9235 
9236     /* "lupa/_lupa.pyx":519
9237  *     new_args = [
9238  *         table._getitem(key, is_attr_access=False)
9239  *         for key in range(1, table._len() + 1)             # <<<<<<<<<<<<<<
9240  *     ]
9241  *
9242  */
9243     __pyx_t_6 = (__pyx_f_4lupa_5_lupa_10_LuaObject__len(((struct __pyx_obj_4lupa_5_lupa__LuaObject *)__pyx_v_table)) + 1);
9244     __pyx_t_7 = __pyx_t_6;
9245     for (__pyx_t_8 = 1; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
9246       __pyx_7genexpr__pyx_v_key = __pyx_t_8;
9247 
9248       /* "lupa/_lupa.pyx":518
9249  *     # arguments with keys from 1 to #tbl are passed as positional
9250  *     new_args = [
9251  *         table._getitem(key, is_attr_access=False)             # <<<<<<<<<<<<<<
9252  *         for key in range(1, table._len() + 1)
9253  *     ]
9254  */
9255       __pyx_t_4 = __Pyx_PyInt_FromSize_t(__pyx_7genexpr__pyx_v_key); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 518, __pyx_L1_error)
9256       __Pyx_GOTREF(__pyx_t_4);
9257       __pyx_t_9 = __pyx_f_4lupa_5_lupa_10_LuaObject__getitem(((struct __pyx_obj_4lupa_5_lupa__LuaObject *)__pyx_v_table), __pyx_t_4, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 518, __pyx_L1_error)
9258       __Pyx_GOTREF(__pyx_t_9);
9259       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9260       if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_9))) __PYX_ERR(0, 517, __pyx_L1_error)
9261       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
9262     }
9263   } /* exit inner scope */
9264   __pyx_v_new_args = ((PyObject*)__pyx_t_3);
9265   __pyx_t_3 = 0;
9266 
9267   /* "lupa/_lupa.pyx":523
9268  *
9269  *     # arguments with non-integer keys are passed as named
9270  *     new_kwargs = {             # <<<<<<<<<<<<<<
9271  *         (<bytes>key).decode(encoding) if not IS_PY2 and isinstance(key, bytes) else key: value
9272  *         for key, value in _LuaIter(table, ITEMS)
9273  */
9274   { /* enter inner scope */
9275     __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 523, __pyx_L9_error)
9276     __Pyx_GOTREF(__pyx_t_3);
9277 
9278     /* "lupa/_lupa.pyx":525
9279  *     new_kwargs = {
9280  *         (<bytes>key).decode(encoding) if not IS_PY2 and isinstance(key, bytes) else key: value
9281  *         for key, value in _LuaIter(table, ITEMS)             # <<<<<<<<<<<<<<
9282  *         if not isinstance(key, (int, long))
9283  *     }
9284  */
9285     __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_e_4lupa_5_lupa_ITEMS); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 525, __pyx_L9_error)
9286     __Pyx_GOTREF(__pyx_t_9);
9287     __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 525, __pyx_L9_error)
9288     __Pyx_GOTREF(__pyx_t_4);
9289     __Pyx_INCREF(((PyObject *)__pyx_v_table));
9290     __Pyx_GIVEREF(((PyObject *)__pyx_v_table));
9291     PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_table));
9292     __Pyx_GIVEREF(__pyx_t_9);
9293     PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_9);
9294     __pyx_t_9 = 0;
9295     __pyx_t_9 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4lupa_5_lupa__LuaIter), __pyx_t_4, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 525, __pyx_L9_error)
9296     __Pyx_GOTREF(__pyx_t_9);
9297     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9298     if (likely(PyList_CheckExact(__pyx_t_9)) || PyTuple_CheckExact(__pyx_t_9)) {
9299       __pyx_t_4 = __pyx_t_9; __Pyx_INCREF(__pyx_t_4); __pyx_t_1 = 0;
9300       __pyx_t_10 = NULL;
9301     } else {
9302       __pyx_t_1 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 525, __pyx_L9_error)
9303       __Pyx_GOTREF(__pyx_t_4);
9304       __pyx_t_10 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 525, __pyx_L9_error)
9305     }
9306     __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
9307     for (;;) {
9308       if (likely(!__pyx_t_10)) {
9309         if (likely(PyList_CheckExact(__pyx_t_4))) {
9310           if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_4)) break;
9311           #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
9312           __pyx_t_9 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_1); __Pyx_INCREF(__pyx_t_9); __pyx_t_1++; if (unlikely(0 < 0)) __PYX_ERR(0, 525, __pyx_L9_error)
9313           #else
9314           __pyx_t_9 = PySequence_ITEM(__pyx_t_4, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 525, __pyx_L9_error)
9315           __Pyx_GOTREF(__pyx_t_9);
9316           #endif
9317         } else {
9318           if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
9319           #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
9320           __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_1); __Pyx_INCREF(__pyx_t_9); __pyx_t_1++; if (unlikely(0 < 0)) __PYX_ERR(0, 525, __pyx_L9_error)
9321           #else
9322           __pyx_t_9 = PySequence_ITEM(__pyx_t_4, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 525, __pyx_L9_error)
9323           __Pyx_GOTREF(__pyx_t_9);
9324           #endif
9325         }
9326       } else {
9327         __pyx_t_9 = __pyx_t_10(__pyx_t_4);
9328         if (unlikely(!__pyx_t_9)) {
9329           PyObject* exc_type = PyErr_Occurred();
9330           if (exc_type) {
9331             if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
9332             else __PYX_ERR(0, 525, __pyx_L9_error)
9333           }
9334           break;
9335         }
9336         __Pyx_GOTREF(__pyx_t_9);
9337       }
9338       if ((likely(PyTuple_CheckExact(__pyx_t_9))) || (PyList_CheckExact(__pyx_t_9))) {
9339         PyObject* sequence = __pyx_t_9;
9340         Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
9341         if (unlikely(size != 2)) {
9342           if (size > 2) __Pyx_RaiseTooManyValuesError(2);
9343           else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
9344           __PYX_ERR(0, 525, __pyx_L9_error)
9345         }
9346         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
9347         if (likely(PyTuple_CheckExact(sequence))) {
9348           __pyx_t_11 = PyTuple_GET_ITEM(sequence, 0);
9349           __pyx_t_12 = PyTuple_GET_ITEM(sequence, 1);
9350         } else {
9351           __pyx_t_11 = PyList_GET_ITEM(sequence, 0);
9352           __pyx_t_12 = PyList_GET_ITEM(sequence, 1);
9353         }
9354         __Pyx_INCREF(__pyx_t_11);
9355         __Pyx_INCREF(__pyx_t_12);
9356         #else
9357         __pyx_t_11 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 525, __pyx_L9_error)
9358         __Pyx_GOTREF(__pyx_t_11);
9359         __pyx_t_12 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 525, __pyx_L9_error)
9360         __Pyx_GOTREF(__pyx_t_12);
9361         #endif
9362         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
9363       } else {
9364         Py_ssize_t index = -1;
9365         __pyx_t_13 = PyObject_GetIter(__pyx_t_9); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 525, __pyx_L9_error)
9366         __Pyx_GOTREF(__pyx_t_13);
9367         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
9368         __pyx_t_14 = Py_TYPE(__pyx_t_13)->tp_iternext;
9369         index = 0; __pyx_t_11 = __pyx_t_14(__pyx_t_13); if (unlikely(!__pyx_t_11)) goto __pyx_L12_unpacking_failed;
9370         __Pyx_GOTREF(__pyx_t_11);
9371         index = 1; __pyx_t_12 = __pyx_t_14(__pyx_t_13); if (unlikely(!__pyx_t_12)) goto __pyx_L12_unpacking_failed;
9372         __Pyx_GOTREF(__pyx_t_12);
9373         if (__Pyx_IternextUnpackEndCheck(__pyx_t_14(__pyx_t_13), 2) < 0) __PYX_ERR(0, 525, __pyx_L9_error)
9374         __pyx_t_14 = NULL;
9375         __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
9376         goto __pyx_L13_unpacking_done;
9377         __pyx_L12_unpacking_failed:;
9378         __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
9379         __pyx_t_14 = NULL;
9380         if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
9381         __PYX_ERR(0, 525, __pyx_L9_error)
9382         __pyx_L13_unpacking_done:;
9383       }
9384       __Pyx_XDECREF_SET(__pyx_8genexpr1__pyx_v_key, __pyx_t_11);
9385       __pyx_t_11 = 0;
9386       __Pyx_XDECREF_SET(__pyx_8genexpr1__pyx_v_value, __pyx_t_12);
9387       __pyx_t_12 = 0;
9388 
9389       /* "lupa/_lupa.pyx":526
9390  *         (<bytes>key).decode(encoding) if not IS_PY2 and isinstance(key, bytes) else key: value
9391  *         for key, value in _LuaIter(table, ITEMS)
9392  *         if not isinstance(key, (int, long))             # <<<<<<<<<<<<<<
9393  *     }
9394  *     return new_args, new_kwargs
9395  */
9396       __pyx_t_2 = PyInt_Check(__pyx_8genexpr1__pyx_v_key);
9397       __pyx_t_15 = (__pyx_t_2 != 0);
9398       if (!__pyx_t_15) {
9399       } else {
9400         __pyx_t_5 = __pyx_t_15;
9401         goto __pyx_L15_bool_binop_done;
9402       }
9403       __pyx_t_15 = PyLong_Check(__pyx_8genexpr1__pyx_v_key);
9404       __pyx_t_2 = (__pyx_t_15 != 0);
9405       __pyx_t_5 = __pyx_t_2;
9406       __pyx_L15_bool_binop_done:;
9407       __pyx_t_2 = ((!(__pyx_t_5 != 0)) != 0);
9408       if (__pyx_t_2) {
9409 
9410         /* "lupa/_lupa.pyx":524
9411  *     # arguments with non-integer keys are passed as named
9412  *     new_kwargs = {
9413  *         (<bytes>key).decode(encoding) if not IS_PY2 and isinstance(key, bytes) else key: value             # <<<<<<<<<<<<<<
9414  *         for key, value in _LuaIter(table, ITEMS)
9415  *         if not isinstance(key, (int, long))
9416  */
9417         __pyx_t_5 = ((!(IS_PY2 != 0)) != 0);
9418         if (__pyx_t_5) {
9419         } else {
9420           __pyx_t_2 = __pyx_t_5;
9421           goto __pyx_L17_bool_binop_done;
9422         }
9423         __pyx_t_5 = PyBytes_Check(__pyx_8genexpr1__pyx_v_key);
9424         __pyx_t_15 = (__pyx_t_5 != 0);
9425         __pyx_t_2 = __pyx_t_15;
9426         __pyx_L17_bool_binop_done:;
9427         if (__pyx_t_2) {
9428           if (unlikely(__pyx_8genexpr1__pyx_v_key == Py_None)) {
9429             PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "decode");
9430             __PYX_ERR(0, 524, __pyx_L9_error)
9431           }
9432           if (unlikely(__pyx_v_encoding == Py_None)) {
9433             PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
9434             __PYX_ERR(0, 524, __pyx_L9_error)
9435           }
9436           __pyx_t_16 = __Pyx_PyBytes_AsString(__pyx_v_encoding); if (unlikely((!__pyx_t_16) && PyErr_Occurred())) __PYX_ERR(0, 524, __pyx_L9_error)
9437           __pyx_t_12 = __Pyx_decode_bytes(((PyObject*)__pyx_8genexpr1__pyx_v_key), 0, PY_SSIZE_T_MAX, __pyx_t_16, NULL, NULL); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 524, __pyx_L9_error)
9438           __Pyx_GOTREF(__pyx_t_12);
9439           __pyx_t_9 = __pyx_t_12;
9440           __pyx_t_12 = 0;
9441         } else {
9442           __Pyx_INCREF(__pyx_8genexpr1__pyx_v_key);
9443           __pyx_t_9 = __pyx_8genexpr1__pyx_v_key;
9444         }
9445         if (unlikely(PyDict_SetItem(__pyx_t_3, (PyObject*)__pyx_t_9, (PyObject*)__pyx_8genexpr1__pyx_v_value))) __PYX_ERR(0, 524, __pyx_L9_error)
9446         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
9447 
9448         /* "lupa/_lupa.pyx":526
9449  *         (<bytes>key).decode(encoding) if not IS_PY2 and isinstance(key, bytes) else key: value
9450  *         for key, value in _LuaIter(table, ITEMS)
9451  *         if not isinstance(key, (int, long))             # <<<<<<<<<<<<<<
9452  *     }
9453  *     return new_args, new_kwargs
9454  */
9455       }
9456 
9457       /* "lupa/_lupa.pyx":525
9458  *     new_kwargs = {
9459  *         (<bytes>key).decode(encoding) if not IS_PY2 and isinstance(key, bytes) else key: value
9460  *         for key, value in _LuaIter(table, ITEMS)             # <<<<<<<<<<<<<<
9461  *         if not isinstance(key, (int, long))
9462  *     }
9463  */
9464     }
9465     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9466     __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_key); __pyx_8genexpr1__pyx_v_key = 0;
9467     __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_value); __pyx_8genexpr1__pyx_v_value = 0;
9468     goto __pyx_L19_exit_scope;
9469     __pyx_L9_error:;
9470     __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_key); __pyx_8genexpr1__pyx_v_key = 0;
9471     __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_value); __pyx_8genexpr1__pyx_v_value = 0;
9472     goto __pyx_L1_error;
9473     __pyx_L19_exit_scope:;
9474   } /* exit inner scope */
9475   __pyx_v_new_kwargs = ((PyObject*)__pyx_t_3);
9476   __pyx_t_3 = 0;
9477 
9478   /* "lupa/_lupa.pyx":528
9479  *         if not isinstance(key, (int, long))
9480  *     }
9481  *     return new_args, new_kwargs             # <<<<<<<<<<<<<<
9482  *
9483  *
9484  */
9485   __Pyx_XDECREF(__pyx_r);
9486   __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 528, __pyx_L1_error)
9487   __Pyx_GOTREF(__pyx_t_3);
9488   __Pyx_INCREF(__pyx_v_new_args);
9489   __Pyx_GIVEREF(__pyx_v_new_args);
9490   PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_new_args);
9491   __Pyx_INCREF(__pyx_v_new_kwargs);
9492   __Pyx_GIVEREF(__pyx_v_new_kwargs);
9493   PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_new_kwargs);
9494   __pyx_r = ((PyObject*)__pyx_t_3);
9495   __pyx_t_3 = 0;
9496   goto __pyx_L0;
9497 
9498   /* "lupa/_lupa.pyx":500
9499  *
9500  *
9501  * cdef tuple _fix_args_kwargs(tuple args):             # <<<<<<<<<<<<<<
9502  *     """
9503  *     Extract named arguments from args passed to a Python function by Lua
9504  */
9505 
9506   /* function exit code */
9507   __pyx_L1_error:;
9508   __Pyx_XDECREF(__pyx_t_3);
9509   __Pyx_XDECREF(__pyx_t_4);
9510   __Pyx_XDECREF(__pyx_t_9);
9511   __Pyx_XDECREF(__pyx_t_11);
9512   __Pyx_XDECREF(__pyx_t_12);
9513   __Pyx_XDECREF(__pyx_t_13);
9514   __Pyx_AddTraceback("lupa._lupa._fix_args_kwargs", __pyx_clineno, __pyx_lineno, __pyx_filename);
9515   __pyx_r = 0;
9516   __pyx_L0:;
9517   __Pyx_XDECREF(__pyx_v_arg);
9518   __Pyx_XDECREF((PyObject *)__pyx_v_table);
9519   __Pyx_XDECREF(__pyx_v_encoding);
9520   __Pyx_XDECREF(__pyx_v_new_args);
9521   __Pyx_XDECREF(__pyx_v_new_kwargs);
9522   __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_key);
9523   __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_value);
9524   __Pyx_XGIVEREF(__pyx_r);
9525   __Pyx_RefNannyFinishContext();
9526   return __pyx_r;
9527 }
9528 
9529 /* "lupa/_lupa.pyx":534
9530  * # fast, re-entrant runtime locking
9531  *
9532  * cdef inline int lock_runtime(LuaRuntime runtime) except -1:             # <<<<<<<<<<<<<<
9533  *     if not lock_lock(runtime._lock, pythread.PyThread_get_thread_ident(), True):
9534  *         raise LuaError("Failed to acquire thread lock")
9535  */
9536 
__pyx_f_4lupa_5_lupa_lock_runtime(struct __pyx_obj_4lupa_5_lupa_LuaRuntime * __pyx_v_runtime)9537 static CYTHON_INLINE int __pyx_f_4lupa_5_lupa_lock_runtime(struct __pyx_obj_4lupa_5_lupa_LuaRuntime *__pyx_v_runtime) {
9538   int __pyx_r;
9539   __Pyx_RefNannyDeclarations
9540   PyObject *__pyx_t_1 = NULL;
9541   int __pyx_t_2;
9542   PyObject *__pyx_t_3 = NULL;
9543   PyObject *__pyx_t_4 = NULL;
9544   int __pyx_lineno = 0;
9545   const char *__pyx_filename = NULL;
9546   int __pyx_clineno = 0;
9547   __Pyx_RefNannySetupContext("lock_runtime", 0);
9548 
9549   /* "lupa/_lupa.pyx":535
9550  *
9551  * cdef inline int lock_runtime(LuaRuntime runtime) except -1:
9552  *     if not lock_lock(runtime._lock, pythread.PyThread_get_thread_ident(), True):             # <<<<<<<<<<<<<<
9553  *         raise LuaError("Failed to acquire thread lock")
9554  *     return 0
9555  */
9556   __pyx_t_1 = ((PyObject *)__pyx_v_runtime->_lock);
9557   __Pyx_INCREF(__pyx_t_1);
9558   __pyx_t_2 = ((!(__pyx_f_4lupa_5_lupa_lock_lock(((struct __pyx_obj_4lupa_5_lupa_FastRLock *)__pyx_t_1), PyThread_get_thread_ident(), 1) != 0)) != 0);
9559   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9560   if (unlikely(__pyx_t_2)) {
9561 
9562     /* "lupa/_lupa.pyx":536
9563  * cdef inline int lock_runtime(LuaRuntime runtime) except -1:
9564  *     if not lock_lock(runtime._lock, pythread.PyThread_get_thread_ident(), True):
9565  *         raise LuaError("Failed to acquire thread lock")             # <<<<<<<<<<<<<<
9566  *     return 0
9567  *
9568  */
9569     __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_LuaError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 536, __pyx_L1_error)
9570     __Pyx_GOTREF(__pyx_t_3);
9571     __pyx_t_4 = NULL;
9572     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
9573       __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
9574       if (likely(__pyx_t_4)) {
9575         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
9576         __Pyx_INCREF(__pyx_t_4);
9577         __Pyx_INCREF(function);
9578         __Pyx_DECREF_SET(__pyx_t_3, function);
9579       }
9580     }
9581     __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_kp_s_Failed_to_acquire_thread_lock) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_s_Failed_to_acquire_thread_lock);
9582     __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
9583     if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 536, __pyx_L1_error)
9584     __Pyx_GOTREF(__pyx_t_1);
9585     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9586     __Pyx_Raise(__pyx_t_1, 0, 0, 0);
9587     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9588     __PYX_ERR(0, 536, __pyx_L1_error)
9589 
9590     /* "lupa/_lupa.pyx":535
9591  *
9592  * cdef inline int lock_runtime(LuaRuntime runtime) except -1:
9593  *     if not lock_lock(runtime._lock, pythread.PyThread_get_thread_ident(), True):             # <<<<<<<<<<<<<<
9594  *         raise LuaError("Failed to acquire thread lock")
9595  *     return 0
9596  */
9597   }
9598 
9599   /* "lupa/_lupa.pyx":537
9600  *     if not lock_lock(runtime._lock, pythread.PyThread_get_thread_ident(), True):
9601  *         raise LuaError("Failed to acquire thread lock")
9602  *     return 0             # <<<<<<<<<<<<<<
9603  *
9604  * cdef inline void unlock_runtime(LuaRuntime runtime) nogil:
9605  */
9606   __pyx_r = 0;
9607   goto __pyx_L0;
9608 
9609   /* "lupa/_lupa.pyx":534
9610  * # fast, re-entrant runtime locking
9611  *
9612  * cdef inline int lock_runtime(LuaRuntime runtime) except -1:             # <<<<<<<<<<<<<<
9613  *     if not lock_lock(runtime._lock, pythread.PyThread_get_thread_ident(), True):
9614  *         raise LuaError("Failed to acquire thread lock")
9615  */
9616 
9617   /* function exit code */
9618   __pyx_L1_error:;
9619   __Pyx_XDECREF(__pyx_t_1);
9620   __Pyx_XDECREF(__pyx_t_3);
9621   __Pyx_XDECREF(__pyx_t_4);
9622   __Pyx_AddTraceback("lupa._lupa.lock_runtime", __pyx_clineno, __pyx_lineno, __pyx_filename);
9623   __pyx_r = -1;
9624   __pyx_L0:;
9625   __Pyx_RefNannyFinishContext();
9626   return __pyx_r;
9627 }
9628 
9629 /* "lupa/_lupa.pyx":539
9630  *     return 0
9631  *
9632  * cdef inline void unlock_runtime(LuaRuntime runtime) nogil:             # <<<<<<<<<<<<<<
9633  *     unlock_lock(runtime._lock)
9634  *
9635  */
9636 
__pyx_f_4lupa_5_lupa_unlock_runtime(struct __pyx_obj_4lupa_5_lupa_LuaRuntime * __pyx_v_runtime)9637 static CYTHON_INLINE void __pyx_f_4lupa_5_lupa_unlock_runtime(struct __pyx_obj_4lupa_5_lupa_LuaRuntime *__pyx_v_runtime) {
9638 
9639   /* "lupa/_lupa.pyx":540
9640  *
9641  * cdef inline void unlock_runtime(LuaRuntime runtime) nogil:
9642  *     unlock_lock(runtime._lock)             # <<<<<<<<<<<<<<
9643  *
9644  *
9645  */
9646   __pyx_f_4lupa_5_lupa_unlock_lock(__pyx_v_runtime->_lock);
9647 
9648   /* "lupa/_lupa.pyx":539
9649  *     return 0
9650  *
9651  * cdef inline void unlock_runtime(LuaRuntime runtime) nogil:             # <<<<<<<<<<<<<<
9652  *     unlock_lock(runtime._lock)
9653  *
9654  */
9655 
9656   /* function exit code */
9657 }
9658 
9659 /* "lupa/_lupa.pyx":556
9660  *     cdef int _ref
9661  *
9662  *     def __init__(self):             # <<<<<<<<<<<<<<
9663  *         raise TypeError("Type cannot be instantiated manually")
9664  *
9665  */
9666 
9667 /* Python wrapper */
9668 static int __pyx_pw_4lupa_5_lupa_10_LuaObject_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_pw_4lupa_5_lupa_10_LuaObject_1__init__(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)9669 static int __pyx_pw_4lupa_5_lupa_10_LuaObject_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
9670   int __pyx_r;
9671   __Pyx_RefNannyDeclarations
9672   __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
9673   if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
9674     __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
9675   if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1;
9676   __pyx_r = __pyx_pf_4lupa_5_lupa_10_LuaObject___init__(((struct __pyx_obj_4lupa_5_lupa__LuaObject *)__pyx_v_self));
9677 
9678   /* function exit code */
9679   __Pyx_RefNannyFinishContext();
9680   return __pyx_r;
9681 }
9682 
__pyx_pf_4lupa_5_lupa_10_LuaObject___init__(CYTHON_UNUSED struct __pyx_obj_4lupa_5_lupa__LuaObject * __pyx_v_self)9683 static int __pyx_pf_4lupa_5_lupa_10_LuaObject___init__(CYTHON_UNUSED struct __pyx_obj_4lupa_5_lupa__LuaObject *__pyx_v_self) {
9684   int __pyx_r;
9685   __Pyx_RefNannyDeclarations
9686   PyObject *__pyx_t_1 = NULL;
9687   int __pyx_lineno = 0;
9688   const char *__pyx_filename = NULL;
9689   int __pyx_clineno = 0;
9690   __Pyx_RefNannySetupContext("__init__", 0);
9691 
9692   /* "lupa/_lupa.pyx":557
9693  *
9694  *     def __init__(self):
9695  *         raise TypeError("Type cannot be instantiated manually")             # <<<<<<<<<<<<<<
9696  *
9697  *     def __dealloc__(self):
9698  */
9699   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 557, __pyx_L1_error)
9700   __Pyx_GOTREF(__pyx_t_1);
9701   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
9702   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9703   __PYX_ERR(0, 557, __pyx_L1_error)
9704 
9705   /* "lupa/_lupa.pyx":556
9706  *     cdef int _ref
9707  *
9708  *     def __init__(self):             # <<<<<<<<<<<<<<
9709  *         raise TypeError("Type cannot be instantiated manually")
9710  *
9711  */
9712 
9713   /* function exit code */
9714   __pyx_L1_error:;
9715   __Pyx_XDECREF(__pyx_t_1);
9716   __Pyx_AddTraceback("lupa._lupa._LuaObject.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
9717   __pyx_r = -1;
9718   __Pyx_RefNannyFinishContext();
9719   return __pyx_r;
9720 }
9721 
9722 /* "lupa/_lupa.pyx":559
9723  *         raise TypeError("Type cannot be instantiated manually")
9724  *
9725  *     def __dealloc__(self):             # <<<<<<<<<<<<<<
9726  *         if self._runtime is None:
9727  *             return
9728  */
9729 
9730 /* Python wrapper */
9731 static void __pyx_pw_4lupa_5_lupa_10_LuaObject_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_4lupa_5_lupa_10_LuaObject_3__dealloc__(PyObject * __pyx_v_self)9732 static void __pyx_pw_4lupa_5_lupa_10_LuaObject_3__dealloc__(PyObject *__pyx_v_self) {
9733   __Pyx_RefNannyDeclarations
9734   __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
9735   __pyx_pf_4lupa_5_lupa_10_LuaObject_2__dealloc__(((struct __pyx_obj_4lupa_5_lupa__LuaObject *)__pyx_v_self));
9736 
9737   /* function exit code */
9738   __Pyx_RefNannyFinishContext();
9739 }
9740 
__pyx_pf_4lupa_5_lupa_10_LuaObject_2__dealloc__(struct __pyx_obj_4lupa_5_lupa__LuaObject * __pyx_v_self)9741 static void __pyx_pf_4lupa_5_lupa_10_LuaObject_2__dealloc__(struct __pyx_obj_4lupa_5_lupa__LuaObject *__pyx_v_self) {
9742   lua_State *__pyx_v_L;
9743   int __pyx_v_locked;
9744   __Pyx_RefNannyDeclarations
9745   int __pyx_t_1;
9746   int __pyx_t_2;
9747   lua_State *__pyx_t_3;
9748   PyObject *__pyx_t_4 = NULL;
9749   PyObject *__pyx_t_5 = NULL;
9750   PyObject *__pyx_t_6 = NULL;
9751   PyObject *__pyx_t_7 = NULL;
9752   int __pyx_t_8;
9753   PyObject *__pyx_t_9 = NULL;
9754   PyObject *__pyx_t_10 = NULL;
9755   int __pyx_lineno = 0;
9756   const char *__pyx_filename = NULL;
9757   int __pyx_clineno = 0;
9758   __Pyx_RefNannySetupContext("__dealloc__", 0);
9759 
9760   /* "lupa/_lupa.pyx":560
9761  *
9762  *     def __dealloc__(self):
9763  *         if self._runtime is None:             # <<<<<<<<<<<<<<
9764  *             return
9765  *         cdef lua_State* L = self._state
9766  */
9767   __pyx_t_1 = (((PyObject *)__pyx_v_self->_runtime) == Py_None);
9768   __pyx_t_2 = (__pyx_t_1 != 0);
9769   if (__pyx_t_2) {
9770 
9771     /* "lupa/_lupa.pyx":561
9772  *     def __dealloc__(self):
9773  *         if self._runtime is None:
9774  *             return             # <<<<<<<<<<<<<<
9775  *         cdef lua_State* L = self._state
9776  *         try:
9777  */
9778     goto __pyx_L0;
9779 
9780     /* "lupa/_lupa.pyx":560
9781  *
9782  *     def __dealloc__(self):
9783  *         if self._runtime is None:             # <<<<<<<<<<<<<<
9784  *             return
9785  *         cdef lua_State* L = self._state
9786  */
9787   }
9788 
9789   /* "lupa/_lupa.pyx":562
9790  *         if self._runtime is None:
9791  *             return
9792  *         cdef lua_State* L = self._state             # <<<<<<<<<<<<<<
9793  *         try:
9794  *             lock_runtime(self._runtime)
9795  */
9796   __pyx_t_3 = __pyx_v_self->_state;
9797   __pyx_v_L = __pyx_t_3;
9798 
9799   /* "lupa/_lupa.pyx":563
9800  *             return
9801  *         cdef lua_State* L = self._state
9802  *         try:             # <<<<<<<<<<<<<<
9803  *             lock_runtime(self._runtime)
9804  *             locked = True
9805  */
9806   {
9807     __Pyx_PyThreadState_declare
9808     __Pyx_PyThreadState_assign
9809     __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6);
9810     __Pyx_XGOTREF(__pyx_t_4);
9811     __Pyx_XGOTREF(__pyx_t_5);
9812     __Pyx_XGOTREF(__pyx_t_6);
9813     /*try:*/ {
9814 
9815       /* "lupa/_lupa.pyx":564
9816  *         cdef lua_State* L = self._state
9817  *         try:
9818  *             lock_runtime(self._runtime)             # <<<<<<<<<<<<<<
9819  *             locked = True
9820  *         except:
9821  */
9822       __pyx_t_7 = ((PyObject *)__pyx_v_self->_runtime);
9823       __Pyx_INCREF(__pyx_t_7);
9824       __pyx_t_8 = __pyx_f_4lupa_5_lupa_lock_runtime(((struct __pyx_obj_4lupa_5_lupa_LuaRuntime *)__pyx_t_7)); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 564, __pyx_L4_error)
9825       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
9826 
9827       /* "lupa/_lupa.pyx":565
9828  *         try:
9829  *             lock_runtime(self._runtime)
9830  *             locked = True             # <<<<<<<<<<<<<<
9831  *         except:
9832  *             locked = False
9833  */
9834       __pyx_v_locked = 1;
9835 
9836       /* "lupa/_lupa.pyx":563
9837  *             return
9838  *         cdef lua_State* L = self._state
9839  *         try:             # <<<<<<<<<<<<<<
9840  *             lock_runtime(self._runtime)
9841  *             locked = True
9842  */
9843     }
9844     __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
9845     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
9846     __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
9847     goto __pyx_L9_try_end;
9848     __pyx_L4_error:;
9849     __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
9850 
9851     /* "lupa/_lupa.pyx":566
9852  *             lock_runtime(self._runtime)
9853  *             locked = True
9854  *         except:             # <<<<<<<<<<<<<<
9855  *             locked = False
9856  *         lua.luaL_unref(L, lua.LUA_REGISTRYINDEX, self._ref)
9857  */
9858     /*except:*/ {
9859       __Pyx_AddTraceback("lupa._lupa._LuaObject.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename);
9860       if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_9, &__pyx_t_10) < 0) __PYX_ERR(0, 566, __pyx_L6_except_error)
9861       __Pyx_GOTREF(__pyx_t_7);
9862       __Pyx_GOTREF(__pyx_t_9);
9863       __Pyx_GOTREF(__pyx_t_10);
9864 
9865       /* "lupa/_lupa.pyx":567
9866  *             locked = True
9867  *         except:
9868  *             locked = False             # <<<<<<<<<<<<<<
9869  *         lua.luaL_unref(L, lua.LUA_REGISTRYINDEX, self._ref)
9870  *         if locked:
9871  */
9872       __pyx_v_locked = 0;
9873       __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
9874       __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
9875       __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
9876       goto __pyx_L5_exception_handled;
9877     }
9878     __pyx_L6_except_error:;
9879 
9880     /* "lupa/_lupa.pyx":563
9881  *             return
9882  *         cdef lua_State* L = self._state
9883  *         try:             # <<<<<<<<<<<<<<
9884  *             lock_runtime(self._runtime)
9885  *             locked = True
9886  */
9887     __Pyx_XGIVEREF(__pyx_t_4);
9888     __Pyx_XGIVEREF(__pyx_t_5);
9889     __Pyx_XGIVEREF(__pyx_t_6);
9890     __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
9891     goto __pyx_L1_error;
9892     __pyx_L5_exception_handled:;
9893     __Pyx_XGIVEREF(__pyx_t_4);
9894     __Pyx_XGIVEREF(__pyx_t_5);
9895     __Pyx_XGIVEREF(__pyx_t_6);
9896     __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
9897     __pyx_L9_try_end:;
9898   }
9899 
9900   /* "lupa/_lupa.pyx":568
9901  *         except:
9902  *             locked = False
9903  *         lua.luaL_unref(L, lua.LUA_REGISTRYINDEX, self._ref)             # <<<<<<<<<<<<<<
9904  *         if locked:
9905  *             unlock_runtime(self._runtime)
9906  */
9907   luaL_unref(__pyx_v_L, LUA_REGISTRYINDEX, __pyx_v_self->_ref);
9908 
9909   /* "lupa/_lupa.pyx":569
9910  *             locked = False
9911  *         lua.luaL_unref(L, lua.LUA_REGISTRYINDEX, self._ref)
9912  *         if locked:             # <<<<<<<<<<<<<<
9913  *             unlock_runtime(self._runtime)
9914  *
9915  */
9916   __pyx_t_2 = (__pyx_v_locked != 0);
9917   if (__pyx_t_2) {
9918 
9919     /* "lupa/_lupa.pyx":570
9920  *         lua.luaL_unref(L, lua.LUA_REGISTRYINDEX, self._ref)
9921  *         if locked:
9922  *             unlock_runtime(self._runtime)             # <<<<<<<<<<<<<<
9923  *
9924  *     @cython.final
9925  */
9926     __pyx_t_10 = ((PyObject *)__pyx_v_self->_runtime);
9927     __Pyx_INCREF(__pyx_t_10);
9928     __pyx_f_4lupa_5_lupa_unlock_runtime(((struct __pyx_obj_4lupa_5_lupa_LuaRuntime *)__pyx_t_10));
9929     __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
9930 
9931     /* "lupa/_lupa.pyx":569
9932  *             locked = False
9933  *         lua.luaL_unref(L, lua.LUA_REGISTRYINDEX, self._ref)
9934  *         if locked:             # <<<<<<<<<<<<<<
9935  *             unlock_runtime(self._runtime)
9936  *
9937  */
9938   }
9939 
9940   /* "lupa/_lupa.pyx":559
9941  *         raise TypeError("Type cannot be instantiated manually")
9942  *
9943  *     def __dealloc__(self):             # <<<<<<<<<<<<<<
9944  *         if self._runtime is None:
9945  *             return
9946  */
9947 
9948   /* function exit code */
9949   goto __pyx_L0;
9950   __pyx_L1_error:;
9951   __Pyx_XDECREF(__pyx_t_7);
9952   __Pyx_XDECREF(__pyx_t_9);
9953   __Pyx_XDECREF(__pyx_t_10);
9954   __Pyx_WriteUnraisable("lupa._lupa._LuaObject.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
9955   __pyx_L0:;
9956   __Pyx_RefNannyFinishContext();
9957 }
9958 
9959 /* "lupa/_lupa.pyx":573
9960  *
9961  *     @cython.final
9962  *     cdef inline int push_lua_object(self) except -1:             # <<<<<<<<<<<<<<
9963  *         cdef lua_State* L = self._state
9964  *         lua.lua_rawgeti(L, lua.LUA_REGISTRYINDEX, self._ref)
9965  */
9966 
__pyx_f_4lupa_5_lupa_10_LuaObject_push_lua_object(struct __pyx_obj_4lupa_5_lupa__LuaObject * __pyx_v_self)9967 static CYTHON_INLINE int __pyx_f_4lupa_5_lupa_10_LuaObject_push_lua_object(struct __pyx_obj_4lupa_5_lupa__LuaObject *__pyx_v_self) {
9968   lua_State *__pyx_v_L;
9969   int __pyx_r;
9970   __Pyx_RefNannyDeclarations
9971   lua_State *__pyx_t_1;
9972   int __pyx_t_2;
9973   PyObject *__pyx_t_3 = NULL;
9974   PyObject *__pyx_t_4 = NULL;
9975   PyObject *__pyx_t_5 = NULL;
9976   int __pyx_lineno = 0;
9977   const char *__pyx_filename = NULL;
9978   int __pyx_clineno = 0;
9979   __Pyx_RefNannySetupContext("push_lua_object", 0);
9980 
9981   /* "lupa/_lupa.pyx":574
9982  *     @cython.final
9983  *     cdef inline int push_lua_object(self) except -1:
9984  *         cdef lua_State* L = self._state             # <<<<<<<<<<<<<<
9985  *         lua.lua_rawgeti(L, lua.LUA_REGISTRYINDEX, self._ref)
9986  *         if lua.lua_isnil(L, -1):
9987  */
9988   __pyx_t_1 = __pyx_v_self->_state;
9989   __pyx_v_L = __pyx_t_1;
9990 
9991   /* "lupa/_lupa.pyx":575
9992  *     cdef inline int push_lua_object(self) except -1:
9993  *         cdef lua_State* L = self._state
9994  *         lua.lua_rawgeti(L, lua.LUA_REGISTRYINDEX, self._ref)             # <<<<<<<<<<<<<<
9995  *         if lua.lua_isnil(L, -1):
9996  *             lua.lua_pop(L, 1)
9997  */
9998   lua_rawgeti(__pyx_v_L, LUA_REGISTRYINDEX, __pyx_v_self->_ref);
9999 
10000   /* "lupa/_lupa.pyx":576
10001  *         cdef lua_State* L = self._state
10002  *         lua.lua_rawgeti(L, lua.LUA_REGISTRYINDEX, self._ref)
10003  *         if lua.lua_isnil(L, -1):             # <<<<<<<<<<<<<<
10004  *             lua.lua_pop(L, 1)
10005  *             raise LuaError("lost reference")
10006  */
10007   __pyx_t_2 = (lua_isnil(__pyx_v_L, -1) != 0);
10008   if (unlikely(__pyx_t_2)) {
10009 
10010     /* "lupa/_lupa.pyx":577
10011  *         lua.lua_rawgeti(L, lua.LUA_REGISTRYINDEX, self._ref)
10012  *         if lua.lua_isnil(L, -1):
10013  *             lua.lua_pop(L, 1)             # <<<<<<<<<<<<<<
10014  *             raise LuaError("lost reference")
10015  *
10016  */
10017     lua_pop(__pyx_v_L, 1);
10018 
10019     /* "lupa/_lupa.pyx":578
10020  *         if lua.lua_isnil(L, -1):
10021  *             lua.lua_pop(L, 1)
10022  *             raise LuaError("lost reference")             # <<<<<<<<<<<<<<
10023  *
10024  *     def __call__(self, *args):
10025  */
10026     __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_LuaError); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 578, __pyx_L1_error)
10027     __Pyx_GOTREF(__pyx_t_4);
10028     __pyx_t_5 = NULL;
10029     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
10030       __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
10031       if (likely(__pyx_t_5)) {
10032         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
10033         __Pyx_INCREF(__pyx_t_5);
10034         __Pyx_INCREF(function);
10035         __Pyx_DECREF_SET(__pyx_t_4, function);
10036       }
10037     }
10038     __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_kp_s_lost_reference) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_s_lost_reference);
10039     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
10040     if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 578, __pyx_L1_error)
10041     __Pyx_GOTREF(__pyx_t_3);
10042     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10043     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
10044     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10045     __PYX_ERR(0, 578, __pyx_L1_error)
10046 
10047     /* "lupa/_lupa.pyx":576
10048  *         cdef lua_State* L = self._state
10049  *         lua.lua_rawgeti(L, lua.LUA_REGISTRYINDEX, self._ref)
10050  *         if lua.lua_isnil(L, -1):             # <<<<<<<<<<<<<<
10051  *             lua.lua_pop(L, 1)
10052  *             raise LuaError("lost reference")
10053  */
10054   }
10055 
10056   /* "lupa/_lupa.pyx":573
10057  *
10058  *     @cython.final
10059  *     cdef inline int push_lua_object(self) except -1:             # <<<<<<<<<<<<<<
10060  *         cdef lua_State* L = self._state
10061  *         lua.lua_rawgeti(L, lua.LUA_REGISTRYINDEX, self._ref)
10062  */
10063 
10064   /* function exit code */
10065   __pyx_r = 0;
10066   goto __pyx_L0;
10067   __pyx_L1_error:;
10068   __Pyx_XDECREF(__pyx_t_3);
10069   __Pyx_XDECREF(__pyx_t_4);
10070   __Pyx_XDECREF(__pyx_t_5);
10071   __Pyx_AddTraceback("lupa._lupa._LuaObject.push_lua_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
10072   __pyx_r = -1;
10073   __pyx_L0:;
10074   __Pyx_RefNannyFinishContext();
10075   return __pyx_r;
10076 }
10077 
10078 /* "lupa/_lupa.pyx":580
10079  *             raise LuaError("lost reference")
10080  *
10081  *     def __call__(self, *args):             # <<<<<<<<<<<<<<
10082  *         assert self._runtime is not None
10083  *         cdef lua_State* L = self._state
10084  */
10085 
10086 /* Python wrapper */
10087 static PyObject *__pyx_pw_4lupa_5_lupa_10_LuaObject_5__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_pw_4lupa_5_lupa_10_LuaObject_5__call__(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)10088 static PyObject *__pyx_pw_4lupa_5_lupa_10_LuaObject_5__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
10089   PyObject *__pyx_v_args = 0;
10090   PyObject *__pyx_r = 0;
10091   __Pyx_RefNannyDeclarations
10092   __Pyx_RefNannySetupContext("__call__ (wrapper)", 0);
10093   if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__call__", 0))) return NULL;
10094   __Pyx_INCREF(__pyx_args);
10095   __pyx_v_args = __pyx_args;
10096   __pyx_r = __pyx_pf_4lupa_5_lupa_10_LuaObject_4__call__(((struct __pyx_obj_4lupa_5_lupa__LuaObject *)__pyx_v_self), __pyx_v_args);
10097 
10098   /* function exit code */
10099   __Pyx_XDECREF(__pyx_v_args);
10100   __Pyx_RefNannyFinishContext();
10101   return __pyx_r;
10102 }
10103 
__pyx_pf_4lupa_5_lupa_10_LuaObject_4__call__(struct __pyx_obj_4lupa_5_lupa__LuaObject * __pyx_v_self,PyObject * __pyx_v_args)10104 static PyObject *__pyx_pf_4lupa_5_lupa_10_LuaObject_4__call__(struct __pyx_obj_4lupa_5_lupa__LuaObject *__pyx_v_self, PyObject *__pyx_v_args) {
10105   lua_State *__pyx_v_L;
10106   PyObject *__pyx_r = NULL;
10107   __Pyx_RefNannyDeclarations
10108   int __pyx_t_1;
10109   lua_State *__pyx_t_2;
10110   PyObject *__pyx_t_3 = NULL;
10111   int __pyx_t_4;
10112   PyObject *__pyx_t_5 = NULL;
10113   int __pyx_t_6;
10114   char const *__pyx_t_7;
10115   PyObject *__pyx_t_8 = NULL;
10116   PyObject *__pyx_t_9 = NULL;
10117   PyObject *__pyx_t_10 = NULL;
10118   PyObject *__pyx_t_11 = NULL;
10119   PyObject *__pyx_t_12 = NULL;
10120   PyObject *__pyx_t_13 = NULL;
10121   int __pyx_lineno = 0;
10122   const char *__pyx_filename = NULL;
10123   int __pyx_clineno = 0;
10124   __Pyx_RefNannySetupContext("__call__", 0);
10125 
10126   /* "lupa/_lupa.pyx":581
10127  *
10128  *     def __call__(self, *args):
10129  *         assert self._runtime is not None             # <<<<<<<<<<<<<<
10130  *         cdef lua_State* L = self._state
10131  *         lock_runtime(self._runtime)
10132  */
10133   #ifndef CYTHON_WITHOUT_ASSERTIONS
10134   if (unlikely(!Py_OptimizeFlag)) {
10135     __pyx_t_1 = (((PyObject *)__pyx_v_self->_runtime) != Py_None);
10136     if (unlikely(!(__pyx_t_1 != 0))) {
10137       PyErr_SetNone(PyExc_AssertionError);
10138       __PYX_ERR(0, 581, __pyx_L1_error)
10139     }
10140   }
10141   #endif
10142 
10143   /* "lupa/_lupa.pyx":582
10144  *     def __call__(self, *args):
10145  *         assert self._runtime is not None
10146  *         cdef lua_State* L = self._state             # <<<<<<<<<<<<<<
10147  *         lock_runtime(self._runtime)
10148  *         try:
10149  */
10150   __pyx_t_2 = __pyx_v_self->_state;
10151   __pyx_v_L = __pyx_t_2;
10152 
10153   /* "lupa/_lupa.pyx":583
10154  *         assert self._runtime is not None
10155  *         cdef lua_State* L = self._state
10156  *         lock_runtime(self._runtime)             # <<<<<<<<<<<<<<
10157  *         try:
10158  *             lua.lua_settop(L, 0)
10159  */
10160   __pyx_t_3 = ((PyObject *)__pyx_v_self->_runtime);
10161   __Pyx_INCREF(__pyx_t_3);
10162   __pyx_t_4 = __pyx_f_4lupa_5_lupa_lock_runtime(((struct __pyx_obj_4lupa_5_lupa_LuaRuntime *)__pyx_t_3)); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 583, __pyx_L1_error)
10163   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10164 
10165   /* "lupa/_lupa.pyx":584
10166  *         cdef lua_State* L = self._state
10167  *         lock_runtime(self._runtime)
10168  *         try:             # <<<<<<<<<<<<<<
10169  *             lua.lua_settop(L, 0)
10170  *             self.push_lua_object()
10171  */
10172   /*try:*/ {
10173 
10174     /* "lupa/_lupa.pyx":585
10175  *         lock_runtime(self._runtime)
10176  *         try:
10177  *             lua.lua_settop(L, 0)             # <<<<<<<<<<<<<<
10178  *             self.push_lua_object()
10179  *             return call_lua(self._runtime, L, args)
10180  */
10181     lua_settop(__pyx_v_L, 0);
10182 
10183     /* "lupa/_lupa.pyx":586
10184  *         try:
10185  *             lua.lua_settop(L, 0)
10186  *             self.push_lua_object()             # <<<<<<<<<<<<<<
10187  *             return call_lua(self._runtime, L, args)
10188  *         finally:
10189  */
10190     __pyx_t_4 = __pyx_f_4lupa_5_lupa_10_LuaObject_push_lua_object(__pyx_v_self); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 586, __pyx_L4_error)
10191 
10192     /* "lupa/_lupa.pyx":587
10193  *             lua.lua_settop(L, 0)
10194  *             self.push_lua_object()
10195  *             return call_lua(self._runtime, L, args)             # <<<<<<<<<<<<<<
10196  *         finally:
10197  *             lua.lua_settop(L, 0)
10198  */
10199     __Pyx_XDECREF(__pyx_r);
10200     __pyx_t_3 = ((PyObject *)__pyx_v_self->_runtime);
10201     __Pyx_INCREF(__pyx_t_3);
10202     __pyx_t_5 = __pyx_f_4lupa_5_lupa_call_lua(((struct __pyx_obj_4lupa_5_lupa_LuaRuntime *)__pyx_t_3), __pyx_v_L, __pyx_v_args); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 587, __pyx_L4_error)
10203     __Pyx_GOTREF(__pyx_t_5);
10204     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10205     __pyx_r = __pyx_t_5;
10206     __pyx_t_5 = 0;
10207     goto __pyx_L3_return;
10208   }
10209 
10210   /* "lupa/_lupa.pyx":589
10211  *             return call_lua(self._runtime, L, args)
10212  *         finally:
10213  *             lua.lua_settop(L, 0)             # <<<<<<<<<<<<<<
10214  *             unlock_runtime(self._runtime)
10215  *
10216  */
10217   /*finally:*/ {
10218     __pyx_L4_error:;
10219     /*exception exit:*/{
10220       __Pyx_PyThreadState_declare
10221       __Pyx_PyThreadState_assign
10222       __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0;
10223       __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
10224       __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
10225       if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
10226       if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10) < 0)) __Pyx_ErrFetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
10227       __Pyx_XGOTREF(__pyx_t_8);
10228       __Pyx_XGOTREF(__pyx_t_9);
10229       __Pyx_XGOTREF(__pyx_t_10);
10230       __Pyx_XGOTREF(__pyx_t_11);
10231       __Pyx_XGOTREF(__pyx_t_12);
10232       __Pyx_XGOTREF(__pyx_t_13);
10233       __pyx_t_4 = __pyx_lineno; __pyx_t_6 = __pyx_clineno; __pyx_t_7 = __pyx_filename;
10234       {
10235         lua_settop(__pyx_v_L, 0);
10236 
10237         /* "lupa/_lupa.pyx":590
10238  *         finally:
10239  *             lua.lua_settop(L, 0)
10240  *             unlock_runtime(self._runtime)             # <<<<<<<<<<<<<<
10241  *
10242  *     def __len__(self):
10243  */
10244         __pyx_t_5 = ((PyObject *)__pyx_v_self->_runtime);
10245         __Pyx_INCREF(__pyx_t_5);
10246         __pyx_f_4lupa_5_lupa_unlock_runtime(((struct __pyx_obj_4lupa_5_lupa_LuaRuntime *)__pyx_t_5));
10247         __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
10248       }
10249       if (PY_MAJOR_VERSION >= 3) {
10250         __Pyx_XGIVEREF(__pyx_t_11);
10251         __Pyx_XGIVEREF(__pyx_t_12);
10252         __Pyx_XGIVEREF(__pyx_t_13);
10253         __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13);
10254       }
10255       __Pyx_XGIVEREF(__pyx_t_8);
10256       __Pyx_XGIVEREF(__pyx_t_9);
10257       __Pyx_XGIVEREF(__pyx_t_10);
10258       __Pyx_ErrRestore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
10259       __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0;
10260       __pyx_lineno = __pyx_t_4; __pyx_clineno = __pyx_t_6; __pyx_filename = __pyx_t_7;
10261       goto __pyx_L1_error;
10262     }
10263     __pyx_L3_return: {
10264       __pyx_t_13 = __pyx_r;
10265       __pyx_r = 0;
10266 
10267       /* "lupa/_lupa.pyx":589
10268  *             return call_lua(self._runtime, L, args)
10269  *         finally:
10270  *             lua.lua_settop(L, 0)             # <<<<<<<<<<<<<<
10271  *             unlock_runtime(self._runtime)
10272  *
10273  */
10274       lua_settop(__pyx_v_L, 0);
10275 
10276       /* "lupa/_lupa.pyx":590
10277  *         finally:
10278  *             lua.lua_settop(L, 0)
10279  *             unlock_runtime(self._runtime)             # <<<<<<<<<<<<<<
10280  *
10281  *     def __len__(self):
10282  */
10283       __pyx_t_5 = ((PyObject *)__pyx_v_self->_runtime);
10284       __Pyx_INCREF(__pyx_t_5);
10285       __pyx_f_4lupa_5_lupa_unlock_runtime(((struct __pyx_obj_4lupa_5_lupa_LuaRuntime *)__pyx_t_5));
10286       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
10287       __pyx_r = __pyx_t_13;
10288       __pyx_t_13 = 0;
10289       goto __pyx_L0;
10290     }
10291   }
10292 
10293   /* "lupa/_lupa.pyx":580
10294  *             raise LuaError("lost reference")
10295  *
10296  *     def __call__(self, *args):             # <<<<<<<<<<<<<<
10297  *         assert self._runtime is not None
10298  *         cdef lua_State* L = self._state
10299  */
10300 
10301   /* function exit code */
10302   __pyx_L1_error:;
10303   __Pyx_XDECREF(__pyx_t_3);
10304   __Pyx_XDECREF(__pyx_t_5);
10305   __Pyx_AddTraceback("lupa._lupa._LuaObject.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
10306   __pyx_r = NULL;
10307   __pyx_L0:;
10308   __Pyx_XGIVEREF(__pyx_r);
10309   __Pyx_RefNannyFinishContext();
10310   return __pyx_r;
10311 }
10312 
10313 /* "lupa/_lupa.pyx":592
10314  *             unlock_runtime(self._runtime)
10315  *
10316  *     def __len__(self):             # <<<<<<<<<<<<<<
10317  *         return self._len()
10318  *
10319  */
10320 
10321 /* Python wrapper */
10322 static Py_ssize_t __pyx_pw_4lupa_5_lupa_10_LuaObject_7__len__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_4lupa_5_lupa_10_LuaObject_7__len__(PyObject * __pyx_v_self)10323 static Py_ssize_t __pyx_pw_4lupa_5_lupa_10_LuaObject_7__len__(PyObject *__pyx_v_self) {
10324   Py_ssize_t __pyx_r;
10325   __Pyx_RefNannyDeclarations
10326   __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
10327   __pyx_r = __pyx_pf_4lupa_5_lupa_10_LuaObject_6__len__(((struct __pyx_obj_4lupa_5_lupa__LuaObject *)__pyx_v_self));
10328 
10329   /* function exit code */
10330   __Pyx_RefNannyFinishContext();
10331   return __pyx_r;
10332 }
10333 
__pyx_pf_4lupa_5_lupa_10_LuaObject_6__len__(struct __pyx_obj_4lupa_5_lupa__LuaObject * __pyx_v_self)10334 static Py_ssize_t __pyx_pf_4lupa_5_lupa_10_LuaObject_6__len__(struct __pyx_obj_4lupa_5_lupa__LuaObject *__pyx_v_self) {
10335   Py_ssize_t __pyx_r;
10336   __Pyx_RefNannyDeclarations
10337   __Pyx_RefNannySetupContext("__len__", 0);
10338 
10339   /* "lupa/_lupa.pyx":593
10340  *
10341  *     def __len__(self):
10342  *         return self._len()             # <<<<<<<<<<<<<<
10343  *
10344  *     @cython.final
10345  */
10346   __pyx_r = __pyx_f_4lupa_5_lupa_10_LuaObject__len(__pyx_v_self);
10347   goto __pyx_L0;
10348 
10349   /* "lupa/_lupa.pyx":592
10350  *             unlock_runtime(self._runtime)
10351  *
10352  *     def __len__(self):             # <<<<<<<<<<<<<<
10353  *         return self._len()
10354  *
10355  */
10356 
10357   /* function exit code */
10358   __pyx_L0:;
10359   __Pyx_RefNannyFinishContext();
10360   return __pyx_r;
10361 }
10362 
10363 /* "lupa/_lupa.pyx":596
10364  *
10365  *     @cython.final
10366  *     cdef size_t _len(self):             # <<<<<<<<<<<<<<
10367  *         assert self._runtime is not None
10368  *         cdef lua_State* L = self._state
10369  */
10370 
__pyx_f_4lupa_5_lupa_10_LuaObject__len(struct __pyx_obj_4lupa_5_lupa__LuaObject * __pyx_v_self)10371 static size_t __pyx_f_4lupa_5_lupa_10_LuaObject__len(struct __pyx_obj_4lupa_5_lupa__LuaObject *__pyx_v_self) {
10372   lua_State *__pyx_v_L;
10373   size_t __pyx_v_size;
10374   size_t __pyx_r;
10375   __Pyx_RefNannyDeclarations
10376   int __pyx_t_1;
10377   lua_State *__pyx_t_2;
10378   PyObject *__pyx_t_3 = NULL;
10379   int __pyx_t_4;
10380   int __pyx_t_5;
10381   char const *__pyx_t_6;
10382   PyObject *__pyx_t_7 = NULL;
10383   PyObject *__pyx_t_8 = NULL;
10384   PyObject *__pyx_t_9 = NULL;
10385   PyObject *__pyx_t_10 = NULL;
10386   PyObject *__pyx_t_11 = NULL;
10387   PyObject *__pyx_t_12 = NULL;
10388   int __pyx_lineno = 0;
10389   const char *__pyx_filename = NULL;
10390   int __pyx_clineno = 0;
10391   __Pyx_RefNannySetupContext("_len", 0);
10392 
10393   /* "lupa/_lupa.pyx":597
10394  *     @cython.final
10395  *     cdef size_t _len(self):
10396  *         assert self._runtime is not None             # <<<<<<<<<<<<<<
10397  *         cdef lua_State* L = self._state
10398  *         lock_runtime(self._runtime)
10399  */
10400   #ifndef CYTHON_WITHOUT_ASSERTIONS
10401   if (unlikely(!Py_OptimizeFlag)) {
10402     __pyx_t_1 = (((PyObject *)__pyx_v_self->_runtime) != Py_None);
10403     if (unlikely(!(__pyx_t_1 != 0))) {
10404       PyErr_SetNone(PyExc_AssertionError);
10405       __PYX_ERR(0, 597, __pyx_L1_error)
10406     }
10407   }
10408   #endif
10409 
10410   /* "lupa/_lupa.pyx":598
10411  *     cdef size_t _len(self):
10412  *         assert self._runtime is not None
10413  *         cdef lua_State* L = self._state             # <<<<<<<<<<<<<<
10414  *         lock_runtime(self._runtime)
10415  *         size = 0
10416  */
10417   __pyx_t_2 = __pyx_v_self->_state;
10418   __pyx_v_L = __pyx_t_2;
10419 
10420   /* "lupa/_lupa.pyx":599
10421  *         assert self._runtime is not None
10422  *         cdef lua_State* L = self._state
10423  *         lock_runtime(self._runtime)             # <<<<<<<<<<<<<<
10424  *         size = 0
10425  *         try:
10426  */
10427   __pyx_t_3 = ((PyObject *)__pyx_v_self->_runtime);
10428   __Pyx_INCREF(__pyx_t_3);
10429   __pyx_t_4 = __pyx_f_4lupa_5_lupa_lock_runtime(((struct __pyx_obj_4lupa_5_lupa_LuaRuntime *)__pyx_t_3)); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 599, __pyx_L1_error)
10430   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10431 
10432   /* "lupa/_lupa.pyx":600
10433  *         cdef lua_State* L = self._state
10434  *         lock_runtime(self._runtime)
10435  *         size = 0             # <<<<<<<<<<<<<<
10436  *         try:
10437  *             self.push_lua_object()
10438  */
10439   __pyx_v_size = 0;
10440 
10441   /* "lupa/_lupa.pyx":601
10442  *         lock_runtime(self._runtime)
10443  *         size = 0
10444  *         try:             # <<<<<<<<<<<<<<
10445  *             self.push_lua_object()
10446  *             size = lua.lua_objlen(L, -1)
10447  */
10448   /*try:*/ {
10449 
10450     /* "lupa/_lupa.pyx":602
10451  *         size = 0
10452  *         try:
10453  *             self.push_lua_object()             # <<<<<<<<<<<<<<
10454  *             size = lua.lua_objlen(L, -1)
10455  *             lua.lua_pop(L, 1)
10456  */
10457     __pyx_t_4 = __pyx_f_4lupa_5_lupa_10_LuaObject_push_lua_object(__pyx_v_self); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 602, __pyx_L4_error)
10458 
10459     /* "lupa/_lupa.pyx":603
10460  *         try:
10461  *             self.push_lua_object()
10462  *             size = lua.lua_objlen(L, -1)             # <<<<<<<<<<<<<<
10463  *             lua.lua_pop(L, 1)
10464  *         finally:
10465  */
10466     __pyx_v_size = lua_objlen(__pyx_v_L, -1);
10467 
10468     /* "lupa/_lupa.pyx":604
10469  *             self.push_lua_object()
10470  *             size = lua.lua_objlen(L, -1)
10471  *             lua.lua_pop(L, 1)             # <<<<<<<<<<<<<<
10472  *         finally:
10473  *             unlock_runtime(self._runtime)
10474  */
10475     lua_pop(__pyx_v_L, 1);
10476   }
10477 
10478   /* "lupa/_lupa.pyx":606
10479  *             lua.lua_pop(L, 1)
10480  *         finally:
10481  *             unlock_runtime(self._runtime)             # <<<<<<<<<<<<<<
10482  *         return size
10483  *
10484  */
10485   /*finally:*/ {
10486     /*normal exit:*/{
10487       __pyx_t_3 = ((PyObject *)__pyx_v_self->_runtime);
10488       __Pyx_INCREF(__pyx_t_3);
10489       __pyx_f_4lupa_5_lupa_unlock_runtime(((struct __pyx_obj_4lupa_5_lupa_LuaRuntime *)__pyx_t_3));
10490       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10491       goto __pyx_L5;
10492     }
10493     __pyx_L4_error:;
10494     /*exception exit:*/{
10495       __Pyx_PyThreadState_declare
10496       __Pyx_PyThreadState_assign
10497       __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
10498       __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
10499       if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
10500       if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9) < 0)) __Pyx_ErrFetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
10501       __Pyx_XGOTREF(__pyx_t_7);
10502       __Pyx_XGOTREF(__pyx_t_8);
10503       __Pyx_XGOTREF(__pyx_t_9);
10504       __Pyx_XGOTREF(__pyx_t_10);
10505       __Pyx_XGOTREF(__pyx_t_11);
10506       __Pyx_XGOTREF(__pyx_t_12);
10507       __pyx_t_4 = __pyx_lineno; __pyx_t_5 = __pyx_clineno; __pyx_t_6 = __pyx_filename;
10508       {
10509         __pyx_t_3 = ((PyObject *)__pyx_v_self->_runtime);
10510         __Pyx_INCREF(__pyx_t_3);
10511         __pyx_f_4lupa_5_lupa_unlock_runtime(((struct __pyx_obj_4lupa_5_lupa_LuaRuntime *)__pyx_t_3));
10512         __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10513       }
10514       if (PY_MAJOR_VERSION >= 3) {
10515         __Pyx_XGIVEREF(__pyx_t_10);
10516         __Pyx_XGIVEREF(__pyx_t_11);
10517         __Pyx_XGIVEREF(__pyx_t_12);
10518         __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
10519       }
10520       __Pyx_XGIVEREF(__pyx_t_7);
10521       __Pyx_XGIVEREF(__pyx_t_8);
10522       __Pyx_XGIVEREF(__pyx_t_9);
10523       __Pyx_ErrRestore(__pyx_t_7, __pyx_t_8, __pyx_t_9);
10524       __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
10525       __pyx_lineno = __pyx_t_4; __pyx_clineno = __pyx_t_5; __pyx_filename = __pyx_t_6;
10526       goto __pyx_L1_error;
10527     }
10528     __pyx_L5:;
10529   }
10530 
10531   /* "lupa/_lupa.pyx":607
10532  *         finally:
10533  *             unlock_runtime(self._runtime)
10534  *         return size             # <<<<<<<<<<<<<<
10535  *
10536  *     def __nonzero__(self):
10537  */
10538   __pyx_r = __pyx_v_size;
10539   goto __pyx_L0;
10540 
10541   /* "lupa/_lupa.pyx":596
10542  *
10543  *     @cython.final
10544  *     cdef size_t _len(self):             # <<<<<<<<<<<<<<
10545  *         assert self._runtime is not None
10546  *         cdef lua_State* L = self._state
10547  */
10548 
10549   /* function exit code */
10550   __pyx_L1_error:;
10551   __Pyx_XDECREF(__pyx_t_3);
10552   __Pyx_WriteUnraisable("lupa._lupa._LuaObject._len", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
10553   __pyx_r = 0;
10554   __pyx_L0:;
10555   __Pyx_RefNannyFinishContext();
10556   return __pyx_r;
10557 }
10558 
10559 /* "lupa/_lupa.pyx":609
10560  *         return size
10561  *
10562  *     def __nonzero__(self):             # <<<<<<<<<<<<<<
10563  *         return True
10564  *
10565  */
10566 
10567 /* Python wrapper */
10568 static int __pyx_pw_4lupa_5_lupa_10_LuaObject_9__nonzero__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_4lupa_5_lupa_10_LuaObject_9__nonzero__(PyObject * __pyx_v_self)10569 static int __pyx_pw_4lupa_5_lupa_10_LuaObject_9__nonzero__(PyObject *__pyx_v_self) {
10570   int __pyx_r;
10571   __Pyx_RefNannyDeclarations
10572   __Pyx_RefNannySetupContext("__nonzero__ (wrapper)", 0);
10573   __pyx_r = __pyx_pf_4lupa_5_lupa_10_LuaObject_8__nonzero__(((struct __pyx_obj_4lupa_5_lupa__LuaObject *)__pyx_v_self));
10574 
10575   /* function exit code */
10576   __Pyx_RefNannyFinishContext();
10577   return __pyx_r;
10578 }
10579 
__pyx_pf_4lupa_5_lupa_10_LuaObject_8__nonzero__(CYTHON_UNUSED struct __pyx_obj_4lupa_5_lupa__LuaObject * __pyx_v_self)10580 static int __pyx_pf_4lupa_5_lupa_10_LuaObject_8__nonzero__(CYTHON_UNUSED struct __pyx_obj_4lupa_5_lupa__LuaObject *__pyx_v_self) {
10581   int __pyx_r;
10582   __Pyx_RefNannyDeclarations
10583   __Pyx_RefNannySetupContext("__nonzero__", 0);
10584 
10585   /* "lupa/_lupa.pyx":610
10586  *
10587  *     def __nonzero__(self):
10588  *         return True             # <<<<<<<<<<<<<<
10589  *
10590  *     def __iter__(self):
10591  */
10592   __pyx_r = 1;
10593   goto __pyx_L0;
10594 
10595   /* "lupa/_lupa.pyx":609
10596  *         return size
10597  *
10598  *     def __nonzero__(self):             # <<<<<<<<<<<<<<
10599  *         return True
10600  *
10601  */
10602 
10603   /* function exit code */
10604   __pyx_L0:;
10605   __Pyx_RefNannyFinishContext();
10606   return __pyx_r;
10607 }
10608 
10609 /* "lupa/_lupa.pyx":612
10610  *         return True
10611  *
10612  *     def __iter__(self):             # <<<<<<<<<<<<<<
10613  *         # if not provided, iteration will try item access and call into Lua
10614  *         raise TypeError("iteration is only supported for tables")
10615  */
10616 
10617 /* Python wrapper */
10618 static PyObject *__pyx_pw_4lupa_5_lupa_10_LuaObject_11__iter__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_4lupa_5_lupa_10_LuaObject_11__iter__(PyObject * __pyx_v_self)10619 static PyObject *__pyx_pw_4lupa_5_lupa_10_LuaObject_11__iter__(PyObject *__pyx_v_self) {
10620   PyObject *__pyx_r = 0;
10621   __Pyx_RefNannyDeclarations
10622   __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
10623   __pyx_r = __pyx_pf_4lupa_5_lupa_10_LuaObject_10__iter__(((struct __pyx_obj_4lupa_5_lupa__LuaObject *)__pyx_v_self));
10624 
10625   /* function exit code */
10626   __Pyx_RefNannyFinishContext();
10627   return __pyx_r;
10628 }
10629 
__pyx_pf_4lupa_5_lupa_10_LuaObject_10__iter__(CYTHON_UNUSED struct __pyx_obj_4lupa_5_lupa__LuaObject * __pyx_v_self)10630 static PyObject *__pyx_pf_4lupa_5_lupa_10_LuaObject_10__iter__(CYTHON_UNUSED struct __pyx_obj_4lupa_5_lupa__LuaObject *__pyx_v_self) {
10631   PyObject *__pyx_r = NULL;
10632   __Pyx_RefNannyDeclarations
10633   PyObject *__pyx_t_1 = NULL;
10634   int __pyx_lineno = 0;
10635   const char *__pyx_filename = NULL;
10636   int __pyx_clineno = 0;
10637   __Pyx_RefNannySetupContext("__iter__", 0);
10638 
10639   /* "lupa/_lupa.pyx":614
10640  *     def __iter__(self):
10641  *         # if not provided, iteration will try item access and call into Lua
10642  *         raise TypeError("iteration is only supported for tables")             # <<<<<<<<<<<<<<
10643  *
10644  *     def __repr__(self):
10645  */
10646   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__15, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 614, __pyx_L1_error)
10647   __Pyx_GOTREF(__pyx_t_1);
10648   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
10649   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10650   __PYX_ERR(0, 614, __pyx_L1_error)
10651 
10652   /* "lupa/_lupa.pyx":612
10653  *         return True
10654  *
10655  *     def __iter__(self):             # <<<<<<<<<<<<<<
10656  *         # if not provided, iteration will try item access and call into Lua
10657  *         raise TypeError("iteration is only supported for tables")
10658  */
10659 
10660   /* function exit code */
10661   __pyx_L1_error:;
10662   __Pyx_XDECREF(__pyx_t_1);
10663   __Pyx_AddTraceback("lupa._lupa._LuaObject.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
10664   __pyx_r = NULL;
10665   __Pyx_XGIVEREF(__pyx_r);
10666   __Pyx_RefNannyFinishContext();
10667   return __pyx_r;
10668 }
10669 
10670 /* "lupa/_lupa.pyx":616
10671  *         raise TypeError("iteration is only supported for tables")
10672  *
10673  *     def __repr__(self):             # <<<<<<<<<<<<<<
10674  *         assert self._runtime is not None
10675  *         cdef lua_State* L = self._state
10676  */
10677 
10678 /* Python wrapper */
10679 static PyObject *__pyx_pw_4lupa_5_lupa_10_LuaObject_13__repr__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_4lupa_5_lupa_10_LuaObject_13__repr__(PyObject * __pyx_v_self)10680 static PyObject *__pyx_pw_4lupa_5_lupa_10_LuaObject_13__repr__(PyObject *__pyx_v_self) {
10681   PyObject *__pyx_r = 0;
10682   __Pyx_RefNannyDeclarations
10683   __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
10684   __pyx_r = __pyx_pf_4lupa_5_lupa_10_LuaObject_12__repr__(((struct __pyx_obj_4lupa_5_lupa__LuaObject *)__pyx_v_self));
10685 
10686   /* function exit code */
10687   __Pyx_RefNannyFinishContext();
10688   return __pyx_r;
10689 }
10690 
__pyx_pf_4lupa_5_lupa_10_LuaObject_12__repr__(struct __pyx_obj_4lupa_5_lupa__LuaObject * __pyx_v_self)10691 static PyObject *__pyx_pf_4lupa_5_lupa_10_LuaObject_12__repr__(struct __pyx_obj_4lupa_5_lupa__LuaObject *__pyx_v_self) {
10692   lua_State *__pyx_v_L;
10693   PyObject *__pyx_v_encoding = 0;
10694   PyObject *__pyx_r = NULL;
10695   __Pyx_RefNannyDeclarations
10696   int __pyx_t_1;
10697   lua_State *__pyx_t_2;
10698   PyObject *__pyx_t_3 = NULL;
10699   int __pyx_t_4;
10700   int __pyx_t_5;
10701   char const *__pyx_t_6;
10702   PyObject *__pyx_t_7 = NULL;
10703   PyObject *__pyx_t_8 = NULL;
10704   PyObject *__pyx_t_9 = NULL;
10705   PyObject *__pyx_t_10 = NULL;
10706   PyObject *__pyx_t_11 = NULL;
10707   PyObject *__pyx_t_12 = NULL;
10708   int __pyx_lineno = 0;
10709   const char *__pyx_filename = NULL;
10710   int __pyx_clineno = 0;
10711   __Pyx_RefNannySetupContext("__repr__", 0);
10712 
10713   /* "lupa/_lupa.pyx":617
10714  *
10715  *     def __repr__(self):
10716  *         assert self._runtime is not None             # <<<<<<<<<<<<<<
10717  *         cdef lua_State* L = self._state
10718  *         cdef bytes encoding = self._runtime._encoding or b'UTF-8'
10719  */
10720   #ifndef CYTHON_WITHOUT_ASSERTIONS
10721   if (unlikely(!Py_OptimizeFlag)) {
10722     __pyx_t_1 = (((PyObject *)__pyx_v_self->_runtime) != Py_None);
10723     if (unlikely(!(__pyx_t_1 != 0))) {
10724       PyErr_SetNone(PyExc_AssertionError);
10725       __PYX_ERR(0, 617, __pyx_L1_error)
10726     }
10727   }
10728   #endif
10729 
10730   /* "lupa/_lupa.pyx":618
10731  *     def __repr__(self):
10732  *         assert self._runtime is not None
10733  *         cdef lua_State* L = self._state             # <<<<<<<<<<<<<<
10734  *         cdef bytes encoding = self._runtime._encoding or b'UTF-8'
10735  *         lock_runtime(self._runtime)
10736  */
10737   __pyx_t_2 = __pyx_v_self->_state;
10738   __pyx_v_L = __pyx_t_2;
10739 
10740   /* "lupa/_lupa.pyx":619
10741  *         assert self._runtime is not None
10742  *         cdef lua_State* L = self._state
10743  *         cdef bytes encoding = self._runtime._encoding or b'UTF-8'             # <<<<<<<<<<<<<<
10744  *         lock_runtime(self._runtime)
10745  *         try:
10746  */
10747   __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_self->_runtime->_encoding); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 619, __pyx_L1_error)
10748   if (!__pyx_t_1) {
10749   } else {
10750     __Pyx_INCREF(__pyx_v_self->_runtime->_encoding);
10751     __pyx_t_3 = __pyx_v_self->_runtime->_encoding;
10752     goto __pyx_L3_bool_binop_done;
10753   }
10754   __Pyx_INCREF(__pyx_kp_b_UTF_8);
10755   __pyx_t_3 = __pyx_kp_b_UTF_8;
10756   __pyx_L3_bool_binop_done:;
10757   __pyx_v_encoding = ((PyObject*)__pyx_t_3);
10758   __pyx_t_3 = 0;
10759 
10760   /* "lupa/_lupa.pyx":620
10761  *         cdef lua_State* L = self._state
10762  *         cdef bytes encoding = self._runtime._encoding or b'UTF-8'
10763  *         lock_runtime(self._runtime)             # <<<<<<<<<<<<<<
10764  *         try:
10765  *             self.push_lua_object()
10766  */
10767   __pyx_t_3 = ((PyObject *)__pyx_v_self->_runtime);
10768   __Pyx_INCREF(__pyx_t_3);
10769   __pyx_t_4 = __pyx_f_4lupa_5_lupa_lock_runtime(((struct __pyx_obj_4lupa_5_lupa_LuaRuntime *)__pyx_t_3)); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 620, __pyx_L1_error)
10770   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10771 
10772   /* "lupa/_lupa.pyx":621
10773  *         cdef bytes encoding = self._runtime._encoding or b'UTF-8'
10774  *         lock_runtime(self._runtime)
10775  *         try:             # <<<<<<<<<<<<<<
10776  *             self.push_lua_object()
10777  *             return lua_object_repr(L, encoding)
10778  */
10779   /*try:*/ {
10780 
10781     /* "lupa/_lupa.pyx":622
10782  *         lock_runtime(self._runtime)
10783  *         try:
10784  *             self.push_lua_object()             # <<<<<<<<<<<<<<
10785  *             return lua_object_repr(L, encoding)
10786  *         finally:
10787  */
10788     __pyx_t_4 = __pyx_f_4lupa_5_lupa_10_LuaObject_push_lua_object(__pyx_v_self); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 622, __pyx_L6_error)
10789 
10790     /* "lupa/_lupa.pyx":623
10791  *         try:
10792  *             self.push_lua_object()
10793  *             return lua_object_repr(L, encoding)             # <<<<<<<<<<<<<<
10794  *         finally:
10795  *             lua.lua_pop(L, 1)
10796  */
10797     __Pyx_XDECREF(__pyx_r);
10798     __pyx_t_3 = __pyx_f_4lupa_5_lupa_lua_object_repr(__pyx_v_L, __pyx_v_encoding); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 623, __pyx_L6_error)
10799     __Pyx_GOTREF(__pyx_t_3);
10800     __pyx_r = __pyx_t_3;
10801     __pyx_t_3 = 0;
10802     goto __pyx_L5_return;
10803   }
10804 
10805   /* "lupa/_lupa.pyx":625
10806  *             return lua_object_repr(L, encoding)
10807  *         finally:
10808  *             lua.lua_pop(L, 1)             # <<<<<<<<<<<<<<
10809  *             unlock_runtime(self._runtime)
10810  *
10811  */
10812   /*finally:*/ {
10813     __pyx_L6_error:;
10814     /*exception exit:*/{
10815       __Pyx_PyThreadState_declare
10816       __Pyx_PyThreadState_assign
10817       __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
10818       __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
10819       if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
10820       if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9) < 0)) __Pyx_ErrFetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
10821       __Pyx_XGOTREF(__pyx_t_7);
10822       __Pyx_XGOTREF(__pyx_t_8);
10823       __Pyx_XGOTREF(__pyx_t_9);
10824       __Pyx_XGOTREF(__pyx_t_10);
10825       __Pyx_XGOTREF(__pyx_t_11);
10826       __Pyx_XGOTREF(__pyx_t_12);
10827       __pyx_t_4 = __pyx_lineno; __pyx_t_5 = __pyx_clineno; __pyx_t_6 = __pyx_filename;
10828       {
10829         lua_pop(__pyx_v_L, 1);
10830 
10831         /* "lupa/_lupa.pyx":626
10832  *         finally:
10833  *             lua.lua_pop(L, 1)
10834  *             unlock_runtime(self._runtime)             # <<<<<<<<<<<<<<
10835  *
10836  *     def __str__(self):
10837  */
10838         __pyx_t_3 = ((PyObject *)__pyx_v_self->_runtime);
10839         __Pyx_INCREF(__pyx_t_3);
10840         __pyx_f_4lupa_5_lupa_unlock_runtime(((struct __pyx_obj_4lupa_5_lupa_LuaRuntime *)__pyx_t_3));
10841         __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10842       }
10843       if (PY_MAJOR_VERSION >= 3) {
10844         __Pyx_XGIVEREF(__pyx_t_10);
10845         __Pyx_XGIVEREF(__pyx_t_11);
10846         __Pyx_XGIVEREF(__pyx_t_12);
10847         __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
10848       }
10849       __Pyx_XGIVEREF(__pyx_t_7);
10850       __Pyx_XGIVEREF(__pyx_t_8);
10851       __Pyx_XGIVEREF(__pyx_t_9);
10852       __Pyx_ErrRestore(__pyx_t_7, __pyx_t_8, __pyx_t_9);
10853       __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
10854       __pyx_lineno = __pyx_t_4; __pyx_clineno = __pyx_t_5; __pyx_filename = __pyx_t_6;
10855       goto __pyx_L1_error;
10856     }
10857     __pyx_L5_return: {
10858       __pyx_t_12 = __pyx_r;
10859       __pyx_r = 0;
10860 
10861       /* "lupa/_lupa.pyx":625
10862  *             return lua_object_repr(L, encoding)
10863  *         finally:
10864  *             lua.lua_pop(L, 1)             # <<<<<<<<<<<<<<
10865  *             unlock_runtime(self._runtime)
10866  *
10867  */
10868       lua_pop(__pyx_v_L, 1);
10869 
10870       /* "lupa/_lupa.pyx":626
10871  *         finally:
10872  *             lua.lua_pop(L, 1)
10873  *             unlock_runtime(self._runtime)             # <<<<<<<<<<<<<<
10874  *
10875  *     def __str__(self):
10876  */
10877       __pyx_t_3 = ((PyObject *)__pyx_v_self->_runtime);
10878       __Pyx_INCREF(__pyx_t_3);
10879       __pyx_f_4lupa_5_lupa_unlock_runtime(((struct __pyx_obj_4lupa_5_lupa_LuaRuntime *)__pyx_t_3));
10880       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10881       __pyx_r = __pyx_t_12;
10882       __pyx_t_12 = 0;
10883       goto __pyx_L0;
10884     }
10885   }
10886 
10887   /* "lupa/_lupa.pyx":616
10888  *         raise TypeError("iteration is only supported for tables")
10889  *
10890  *     def __repr__(self):             # <<<<<<<<<<<<<<
10891  *         assert self._runtime is not None
10892  *         cdef lua_State* L = self._state
10893  */
10894 
10895   /* function exit code */
10896   __pyx_L1_error:;
10897   __Pyx_XDECREF(__pyx_t_3);
10898   __Pyx_AddTraceback("lupa._lupa._LuaObject.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
10899   __pyx_r = NULL;
10900   __pyx_L0:;
10901   __Pyx_XDECREF(__pyx_v_encoding);
10902   __Pyx_XGIVEREF(__pyx_r);
10903   __Pyx_RefNannyFinishContext();
10904   return __pyx_r;
10905 }
10906 
10907 /* "lupa/_lupa.pyx":628
10908  *             unlock_runtime(self._runtime)
10909  *
10910  *     def __str__(self):             # <<<<<<<<<<<<<<
10911  *         assert self._runtime is not None
10912  *         cdef lua_State* L = self._state
10913  */
10914 
10915 /* Python wrapper */
10916 static PyObject *__pyx_pw_4lupa_5_lupa_10_LuaObject_15__str__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_4lupa_5_lupa_10_LuaObject_15__str__(PyObject * __pyx_v_self)10917 static PyObject *__pyx_pw_4lupa_5_lupa_10_LuaObject_15__str__(PyObject *__pyx_v_self) {
10918   PyObject *__pyx_r = 0;
10919   __Pyx_RefNannyDeclarations
10920   __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
10921   __pyx_r = __pyx_pf_4lupa_5_lupa_10_LuaObject_14__str__(((struct __pyx_obj_4lupa_5_lupa__LuaObject *)__pyx_v_self));
10922 
10923   /* function exit code */
10924   __Pyx_RefNannyFinishContext();
10925   return __pyx_r;
10926 }
10927 
__pyx_pf_4lupa_5_lupa_10_LuaObject_14__str__(struct __pyx_obj_4lupa_5_lupa__LuaObject * __pyx_v_self)10928 static PyObject *__pyx_pf_4lupa_5_lupa_10_LuaObject_14__str__(struct __pyx_obj_4lupa_5_lupa__LuaObject *__pyx_v_self) {
10929   lua_State *__pyx_v_L;
10930   PyObject *__pyx_v_py_string = 0;
10931   char const *__pyx_v_s;
10932   size_t __pyx_v_size;
10933   PyObject *__pyx_v_encoding = 0;
10934   PyObject *__pyx_v_old_top = NULL;
10935   PyObject *__pyx_r = NULL;
10936   __Pyx_RefNannyDeclarations
10937   int __pyx_t_1;
10938   lua_State *__pyx_t_2;
10939   PyObject *__pyx_t_3 = NULL;
10940   int __pyx_t_4;
10941   int __pyx_t_5;
10942   PyObject *__pyx_t_6 = NULL;
10943   PyObject *__pyx_t_7 = NULL;
10944   PyObject *__pyx_t_8 = NULL;
10945   char const *__pyx_t_9;
10946   PyObject *__pyx_t_10 = NULL;
10947   PyObject *__pyx_t_11 = NULL;
10948   PyObject *__pyx_t_12 = NULL;
10949   int __pyx_t_13;
10950   char const *__pyx_t_14;
10951   PyObject *__pyx_t_15 = NULL;
10952   PyObject *__pyx_t_16 = NULL;
10953   PyObject *__pyx_t_17 = NULL;
10954   int __pyx_t_18;
10955   int __pyx_lineno = 0;
10956   const char *__pyx_filename = NULL;
10957   int __pyx_clineno = 0;
10958   __Pyx_RefNannySetupContext("__str__", 0);
10959 
10960   /* "lupa/_lupa.pyx":629
10961  *
10962  *     def __str__(self):
10963  *         assert self._runtime is not None             # <<<<<<<<<<<<<<
10964  *         cdef lua_State* L = self._state
10965  *         cdef unicode py_string = None
10966  */
10967   #ifndef CYTHON_WITHOUT_ASSERTIONS
10968   if (unlikely(!Py_OptimizeFlag)) {
10969     __pyx_t_1 = (((PyObject *)__pyx_v_self->_runtime) != Py_None);
10970     if (unlikely(!(__pyx_t_1 != 0))) {
10971       PyErr_SetNone(PyExc_AssertionError);
10972       __PYX_ERR(0, 629, __pyx_L1_error)
10973     }
10974   }
10975   #endif
10976 
10977   /* "lupa/_lupa.pyx":630
10978  *     def __str__(self):
10979  *         assert self._runtime is not None
10980  *         cdef lua_State* L = self._state             # <<<<<<<<<<<<<<
10981  *         cdef unicode py_string = None
10982  *         cdef const char *s
10983  */
10984   __pyx_t_2 = __pyx_v_self->_state;
10985   __pyx_v_L = __pyx_t_2;
10986 
10987   /* "lupa/_lupa.pyx":631
10988  *         assert self._runtime is not None
10989  *         cdef lua_State* L = self._state
10990  *         cdef unicode py_string = None             # <<<<<<<<<<<<<<
10991  *         cdef const char *s
10992  *         cdef size_t size = 0
10993  */
10994   __Pyx_INCREF(Py_None);
10995   __pyx_v_py_string = ((PyObject*)Py_None);
10996 
10997   /* "lupa/_lupa.pyx":633
10998  *         cdef unicode py_string = None
10999  *         cdef const char *s
11000  *         cdef size_t size = 0             # <<<<<<<<<<<<<<
11001  *         cdef bytes encoding = self._runtime._encoding or b'UTF-8'
11002  *         lock_runtime(self._runtime)
11003  */
11004   __pyx_v_size = 0;
11005 
11006   /* "lupa/_lupa.pyx":634
11007  *         cdef const char *s
11008  *         cdef size_t size = 0
11009  *         cdef bytes encoding = self._runtime._encoding or b'UTF-8'             # <<<<<<<<<<<<<<
11010  *         lock_runtime(self._runtime)
11011  *         old_top = lua.lua_gettop(L)
11012  */
11013   __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_self->_runtime->_encoding); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 634, __pyx_L1_error)
11014   if (!__pyx_t_1) {
11015   } else {
11016     __Pyx_INCREF(__pyx_v_self->_runtime->_encoding);
11017     __pyx_t_3 = __pyx_v_self->_runtime->_encoding;
11018     goto __pyx_L3_bool_binop_done;
11019   }
11020   __Pyx_INCREF(__pyx_kp_b_UTF_8);
11021   __pyx_t_3 = __pyx_kp_b_UTF_8;
11022   __pyx_L3_bool_binop_done:;
11023   __pyx_v_encoding = ((PyObject*)__pyx_t_3);
11024   __pyx_t_3 = 0;
11025 
11026   /* "lupa/_lupa.pyx":635
11027  *         cdef size_t size = 0
11028  *         cdef bytes encoding = self._runtime._encoding or b'UTF-8'
11029  *         lock_runtime(self._runtime)             # <<<<<<<<<<<<<<
11030  *         old_top = lua.lua_gettop(L)
11031  *         try:
11032  */
11033   __pyx_t_3 = ((PyObject *)__pyx_v_self->_runtime);
11034   __Pyx_INCREF(__pyx_t_3);
11035   __pyx_t_4 = __pyx_f_4lupa_5_lupa_lock_runtime(((struct __pyx_obj_4lupa_5_lupa_LuaRuntime *)__pyx_t_3)); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 635, __pyx_L1_error)
11036   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
11037 
11038   /* "lupa/_lupa.pyx":636
11039  *         cdef bytes encoding = self._runtime._encoding or b'UTF-8'
11040  *         lock_runtime(self._runtime)
11041  *         old_top = lua.lua_gettop(L)             # <<<<<<<<<<<<<<
11042  *         try:
11043  *             self.push_lua_object()
11044  */
11045   __pyx_t_3 = __Pyx_PyInt_From_int(lua_gettop(__pyx_v_L)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 636, __pyx_L1_error)
11046   __Pyx_GOTREF(__pyx_t_3);
11047   __pyx_v_old_top = __pyx_t_3;
11048   __pyx_t_3 = 0;
11049 
11050   /* "lupa/_lupa.pyx":637
11051  *         lock_runtime(self._runtime)
11052  *         old_top = lua.lua_gettop(L)
11053  *         try:             # <<<<<<<<<<<<<<
11054  *             self.push_lua_object()
11055  *             # lookup and call "__tostring" metatable method manually to catch any errors
11056  */
11057   /*try:*/ {
11058 
11059     /* "lupa/_lupa.pyx":638
11060  *         old_top = lua.lua_gettop(L)
11061  *         try:
11062  *             self.push_lua_object()             # <<<<<<<<<<<<<<
11063  *             # lookup and call "__tostring" metatable method manually to catch any errors
11064  *             if lua.lua_getmetatable(L, -1):
11065  */
11066     __pyx_t_4 = __pyx_f_4lupa_5_lupa_10_LuaObject_push_lua_object(__pyx_v_self); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 638, __pyx_L6_error)
11067 
11068     /* "lupa/_lupa.pyx":640
11069  *             self.push_lua_object()
11070  *             # lookup and call "__tostring" metatable method manually to catch any errors
11071  *             if lua.lua_getmetatable(L, -1):             # <<<<<<<<<<<<<<
11072  *                 lua.lua_pushlstring(L, "__tostring", 10)
11073  *                 lua.lua_rawget(L, -2)
11074  */
11075     __pyx_t_1 = (lua_getmetatable(__pyx_v_L, -1) != 0);
11076     if (__pyx_t_1) {
11077 
11078       /* "lupa/_lupa.pyx":641
11079  *             # lookup and call "__tostring" metatable method manually to catch any errors
11080  *             if lua.lua_getmetatable(L, -1):
11081  *                 lua.lua_pushlstring(L, "__tostring", 10)             # <<<<<<<<<<<<<<
11082  *                 lua.lua_rawget(L, -2)
11083  *                 if not lua.lua_isnil(L, -1) and lua.lua_pcall(L, 1, 1, 0) == 0:
11084  */
11085       lua_pushlstring(__pyx_v_L, ((char *)"__tostring"), 10);
11086 
11087       /* "lupa/_lupa.pyx":642
11088  *             if lua.lua_getmetatable(L, -1):
11089  *                 lua.lua_pushlstring(L, "__tostring", 10)
11090  *                 lua.lua_rawget(L, -2)             # <<<<<<<<<<<<<<
11091  *                 if not lua.lua_isnil(L, -1) and lua.lua_pcall(L, 1, 1, 0) == 0:
11092  *                     s = lua.lua_tolstring(L, -1, &size)
11093  */
11094       lua_rawget(__pyx_v_L, -2);
11095 
11096       /* "lupa/_lupa.pyx":643
11097  *                 lua.lua_pushlstring(L, "__tostring", 10)
11098  *                 lua.lua_rawget(L, -2)
11099  *                 if not lua.lua_isnil(L, -1) and lua.lua_pcall(L, 1, 1, 0) == 0:             # <<<<<<<<<<<<<<
11100  *                     s = lua.lua_tolstring(L, -1, &size)
11101  *                     if s:
11102  */
11103       __pyx_t_5 = ((!(lua_isnil(__pyx_v_L, -1) != 0)) != 0);
11104       if (__pyx_t_5) {
11105       } else {
11106         __pyx_t_1 = __pyx_t_5;
11107         goto __pyx_L10_bool_binop_done;
11108       }
11109       __pyx_t_5 = ((lua_pcall(__pyx_v_L, 1, 1, 0) == 0) != 0);
11110       __pyx_t_1 = __pyx_t_5;
11111       __pyx_L10_bool_binop_done:;
11112       if (__pyx_t_1) {
11113 
11114         /* "lupa/_lupa.pyx":644
11115  *                 lua.lua_rawget(L, -2)
11116  *                 if not lua.lua_isnil(L, -1) and lua.lua_pcall(L, 1, 1, 0) == 0:
11117  *                     s = lua.lua_tolstring(L, -1, &size)             # <<<<<<<<<<<<<<
11118  *                     if s:
11119  *                         try:
11120  */
11121         __pyx_v_s = lua_tolstring(__pyx_v_L, -1, (&__pyx_v_size));
11122 
11123         /* "lupa/_lupa.pyx":645
11124  *                 if not lua.lua_isnil(L, -1) and lua.lua_pcall(L, 1, 1, 0) == 0:
11125  *                     s = lua.lua_tolstring(L, -1, &size)
11126  *                     if s:             # <<<<<<<<<<<<<<
11127  *                         try:
11128  *                             py_string = s[:size].decode(encoding)
11129  */
11130         __pyx_t_1 = (__pyx_v_s != 0);
11131         if (__pyx_t_1) {
11132 
11133           /* "lupa/_lupa.pyx":646
11134  *                     s = lua.lua_tolstring(L, -1, &size)
11135  *                     if s:
11136  *                         try:             # <<<<<<<<<<<<<<
11137  *                             py_string = s[:size].decode(encoding)
11138  *                         except UnicodeDecodeError:
11139  */
11140           {
11141             __Pyx_PyThreadState_declare
11142             __Pyx_PyThreadState_assign
11143             __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
11144             __Pyx_XGOTREF(__pyx_t_6);
11145             __Pyx_XGOTREF(__pyx_t_7);
11146             __Pyx_XGOTREF(__pyx_t_8);
11147             /*try:*/ {
11148 
11149               /* "lupa/_lupa.pyx":647
11150  *                     if s:
11151  *                         try:
11152  *                             py_string = s[:size].decode(encoding)             # <<<<<<<<<<<<<<
11153  *                         except UnicodeDecodeError:
11154  *                             # safe 'decode'
11155  */
11156               if (unlikely(__pyx_v_encoding == Py_None)) {
11157                 PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
11158                 __PYX_ERR(0, 647, __pyx_L13_error)
11159               }
11160               __pyx_t_9 = __Pyx_PyBytes_AsString(__pyx_v_encoding); if (unlikely((!__pyx_t_9) && PyErr_Occurred())) __PYX_ERR(0, 647, __pyx_L13_error)
11161               __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_s, 0, __pyx_v_size, __pyx_t_9, NULL, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 647, __pyx_L13_error)
11162               __Pyx_GOTREF(__pyx_t_3);
11163               __Pyx_DECREF_SET(__pyx_v_py_string, ((PyObject*)__pyx_t_3));
11164               __pyx_t_3 = 0;
11165 
11166               /* "lupa/_lupa.pyx":646
11167  *                     s = lua.lua_tolstring(L, -1, &size)
11168  *                     if s:
11169  *                         try:             # <<<<<<<<<<<<<<
11170  *                             py_string = s[:size].decode(encoding)
11171  *                         except UnicodeDecodeError:
11172  */
11173             }
11174             __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
11175             __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
11176             __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
11177             goto __pyx_L18_try_end;
11178             __pyx_L13_error:;
11179             __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
11180 
11181             /* "lupa/_lupa.pyx":648
11182  *                         try:
11183  *                             py_string = s[:size].decode(encoding)
11184  *                         except UnicodeDecodeError:             # <<<<<<<<<<<<<<
11185  *                             # safe 'decode'
11186  *                             py_string = s[:size].decode('ISO-8859-1')
11187  */
11188             __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_UnicodeDecodeError);
11189             if (__pyx_t_4) {
11190               __Pyx_AddTraceback("lupa._lupa._LuaObject.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11191               if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_10, &__pyx_t_11) < 0) __PYX_ERR(0, 648, __pyx_L15_except_error)
11192               __Pyx_GOTREF(__pyx_t_3);
11193               __Pyx_GOTREF(__pyx_t_10);
11194               __Pyx_GOTREF(__pyx_t_11);
11195 
11196               /* "lupa/_lupa.pyx":650
11197  *                         except UnicodeDecodeError:
11198  *                             # safe 'decode'
11199  *                             py_string = s[:size].decode('ISO-8859-1')             # <<<<<<<<<<<<<<
11200  *             if py_string is None:
11201  *                 lua.lua_settop(L, old_top + 1)
11202  */
11203               __pyx_t_12 = __Pyx_decode_c_string(__pyx_v_s, 0, __pyx_v_size, NULL, NULL, PyUnicode_DecodeLatin1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 650, __pyx_L15_except_error)
11204               __Pyx_GOTREF(__pyx_t_12);
11205               __Pyx_DECREF_SET(__pyx_v_py_string, ((PyObject*)__pyx_t_12));
11206               __pyx_t_12 = 0;
11207               __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
11208               __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
11209               __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
11210               goto __pyx_L14_exception_handled;
11211             }
11212             goto __pyx_L15_except_error;
11213             __pyx_L15_except_error:;
11214 
11215             /* "lupa/_lupa.pyx":646
11216  *                     s = lua.lua_tolstring(L, -1, &size)
11217  *                     if s:
11218  *                         try:             # <<<<<<<<<<<<<<
11219  *                             py_string = s[:size].decode(encoding)
11220  *                         except UnicodeDecodeError:
11221  */
11222             __Pyx_XGIVEREF(__pyx_t_6);
11223             __Pyx_XGIVEREF(__pyx_t_7);
11224             __Pyx_XGIVEREF(__pyx_t_8);
11225             __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
11226             goto __pyx_L6_error;
11227             __pyx_L14_exception_handled:;
11228             __Pyx_XGIVEREF(__pyx_t_6);
11229             __Pyx_XGIVEREF(__pyx_t_7);
11230             __Pyx_XGIVEREF(__pyx_t_8);
11231             __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
11232             __pyx_L18_try_end:;
11233           }
11234 
11235           /* "lupa/_lupa.pyx":645
11236  *                 if not lua.lua_isnil(L, -1) and lua.lua_pcall(L, 1, 1, 0) == 0:
11237  *                     s = lua.lua_tolstring(L, -1, &size)
11238  *                     if s:             # <<<<<<<<<<<<<<
11239  *                         try:
11240  *                             py_string = s[:size].decode(encoding)
11241  */
11242         }
11243 
11244         /* "lupa/_lupa.pyx":643
11245  *                 lua.lua_pushlstring(L, "__tostring", 10)
11246  *                 lua.lua_rawget(L, -2)
11247  *                 if not lua.lua_isnil(L, -1) and lua.lua_pcall(L, 1, 1, 0) == 0:             # <<<<<<<<<<<<<<
11248  *                     s = lua.lua_tolstring(L, -1, &size)
11249  *                     if s:
11250  */
11251       }
11252 
11253       /* "lupa/_lupa.pyx":640
11254  *             self.push_lua_object()
11255  *             # lookup and call "__tostring" metatable method manually to catch any errors
11256  *             if lua.lua_getmetatable(L, -1):             # <<<<<<<<<<<<<<
11257  *                 lua.lua_pushlstring(L, "__tostring", 10)
11258  *                 lua.lua_rawget(L, -2)
11259  */
11260     }
11261 
11262     /* "lupa/_lupa.pyx":651
11263  *                             # safe 'decode'
11264  *                             py_string = s[:size].decode('ISO-8859-1')
11265  *             if py_string is None:             # <<<<<<<<<<<<<<
11266  *                 lua.lua_settop(L, old_top + 1)
11267  *                 py_string = lua_object_repr(L, encoding)
11268  */
11269     __pyx_t_1 = (__pyx_v_py_string == ((PyObject*)Py_None));
11270     __pyx_t_5 = (__pyx_t_1 != 0);
11271     if (__pyx_t_5) {
11272 
11273       /* "lupa/_lupa.pyx":652
11274  *                             py_string = s[:size].decode('ISO-8859-1')
11275  *             if py_string is None:
11276  *                 lua.lua_settop(L, old_top + 1)             # <<<<<<<<<<<<<<
11277  *                 py_string = lua_object_repr(L, encoding)
11278  *         finally:
11279  */
11280       __pyx_t_11 = __Pyx_PyInt_AddObjC(__pyx_v_old_top, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 652, __pyx_L6_error)
11281       __Pyx_GOTREF(__pyx_t_11);
11282       __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_11); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 652, __pyx_L6_error)
11283       __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
11284       lua_settop(__pyx_v_L, __pyx_t_4);
11285 
11286       /* "lupa/_lupa.pyx":653
11287  *             if py_string is None:
11288  *                 lua.lua_settop(L, old_top + 1)
11289  *                 py_string = lua_object_repr(L, encoding)             # <<<<<<<<<<<<<<
11290  *         finally:
11291  *             lua.lua_settop(L, old_top)
11292  */
11293       __pyx_t_11 = __pyx_f_4lupa_5_lupa_lua_object_repr(__pyx_v_L, __pyx_v_encoding); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 653, __pyx_L6_error)
11294       __Pyx_GOTREF(__pyx_t_11);
11295       if (!(likely(PyUnicode_CheckExact(__pyx_t_11))||((__pyx_t_11) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_11)->tp_name), 0))) __PYX_ERR(0, 653, __pyx_L6_error)
11296       __Pyx_DECREF_SET(__pyx_v_py_string, ((PyObject*)__pyx_t_11));
11297       __pyx_t_11 = 0;
11298 
11299       /* "lupa/_lupa.pyx":651
11300  *                             # safe 'decode'
11301  *                             py_string = s[:size].decode('ISO-8859-1')
11302  *             if py_string is None:             # <<<<<<<<<<<<<<
11303  *                 lua.lua_settop(L, old_top + 1)
11304  *                 py_string = lua_object_repr(L, encoding)
11305  */
11306     }
11307   }
11308 
11309   /* "lupa/_lupa.pyx":655
11310  *                 py_string = lua_object_repr(L, encoding)
11311  *         finally:
11312  *             lua.lua_settop(L, old_top)             # <<<<<<<<<<<<<<
11313  *             unlock_runtime(self._runtime)
11314  *         return py_string
11315  */
11316   /*finally:*/ {
11317     /*normal exit:*/{
11318       __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_v_old_top); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 655, __pyx_L1_error)
11319       lua_settop(__pyx_v_L, __pyx_t_4);
11320 
11321       /* "lupa/_lupa.pyx":656
11322  *         finally:
11323  *             lua.lua_settop(L, old_top)
11324  *             unlock_runtime(self._runtime)             # <<<<<<<<<<<<<<
11325  *         return py_string
11326  *
11327  */
11328       __pyx_t_11 = ((PyObject *)__pyx_v_self->_runtime);
11329       __Pyx_INCREF(__pyx_t_11);
11330       __pyx_f_4lupa_5_lupa_unlock_runtime(((struct __pyx_obj_4lupa_5_lupa_LuaRuntime *)__pyx_t_11));
11331       __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
11332       goto __pyx_L7;
11333     }
11334     __pyx_L6_error:;
11335     /*exception exit:*/{
11336       __Pyx_PyThreadState_declare
11337       __Pyx_PyThreadState_assign
11338       __pyx_t_8 = 0; __pyx_t_7 = 0; __pyx_t_6 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0;
11339       __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
11340       __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
11341       __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
11342       __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
11343       if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_15, &__pyx_t_16, &__pyx_t_17);
11344       if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6) < 0)) __Pyx_ErrFetch(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6);
11345       __Pyx_XGOTREF(__pyx_t_8);
11346       __Pyx_XGOTREF(__pyx_t_7);
11347       __Pyx_XGOTREF(__pyx_t_6);
11348       __Pyx_XGOTREF(__pyx_t_15);
11349       __Pyx_XGOTREF(__pyx_t_16);
11350       __Pyx_XGOTREF(__pyx_t_17);
11351       __pyx_t_4 = __pyx_lineno; __pyx_t_13 = __pyx_clineno; __pyx_t_14 = __pyx_filename;
11352       {
11353 
11354         /* "lupa/_lupa.pyx":655
11355  *                 py_string = lua_object_repr(L, encoding)
11356  *         finally:
11357  *             lua.lua_settop(L, old_top)             # <<<<<<<<<<<<<<
11358  *             unlock_runtime(self._runtime)
11359  *         return py_string
11360  */
11361         __pyx_t_18 = __Pyx_PyInt_As_int(__pyx_v_old_top); if (unlikely((__pyx_t_18 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 655, __pyx_L23_error)
11362         lua_settop(__pyx_v_L, __pyx_t_18);
11363 
11364         /* "lupa/_lupa.pyx":656
11365  *         finally:
11366  *             lua.lua_settop(L, old_top)
11367  *             unlock_runtime(self._runtime)             # <<<<<<<<<<<<<<
11368  *         return py_string
11369  *
11370  */
11371         __pyx_t_11 = ((PyObject *)__pyx_v_self->_runtime);
11372         __Pyx_INCREF(__pyx_t_11);
11373         __pyx_f_4lupa_5_lupa_unlock_runtime(((struct __pyx_obj_4lupa_5_lupa_LuaRuntime *)__pyx_t_11));
11374         __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
11375       }
11376       if (PY_MAJOR_VERSION >= 3) {
11377         __Pyx_XGIVEREF(__pyx_t_15);
11378         __Pyx_XGIVEREF(__pyx_t_16);
11379         __Pyx_XGIVEREF(__pyx_t_17);
11380         __Pyx_ExceptionReset(__pyx_t_15, __pyx_t_16, __pyx_t_17);
11381       }
11382       __Pyx_XGIVEREF(__pyx_t_8);
11383       __Pyx_XGIVEREF(__pyx_t_7);
11384       __Pyx_XGIVEREF(__pyx_t_6);
11385       __Pyx_ErrRestore(__pyx_t_8, __pyx_t_7, __pyx_t_6);
11386       __pyx_t_8 = 0; __pyx_t_7 = 0; __pyx_t_6 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0;
11387       __pyx_lineno = __pyx_t_4; __pyx_clineno = __pyx_t_13; __pyx_filename = __pyx_t_14;
11388       goto __pyx_L1_error;
11389       __pyx_L23_error:;
11390       if (PY_MAJOR_VERSION >= 3) {
11391         __Pyx_XGIVEREF(__pyx_t_15);
11392         __Pyx_XGIVEREF(__pyx_t_16);
11393         __Pyx_XGIVEREF(__pyx_t_17);
11394         __Pyx_ExceptionReset(__pyx_t_15, __pyx_t_16, __pyx_t_17);
11395       }
11396       __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
11397       __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
11398       __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
11399       __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0;
11400       goto __pyx_L1_error;
11401     }
11402     __pyx_L7:;
11403   }
11404 
11405   /* "lupa/_lupa.pyx":657
11406  *             lua.lua_settop(L, old_top)
11407  *             unlock_runtime(self._runtime)
11408  *         return py_string             # <<<<<<<<<<<<<<
11409  *
11410  *     def __getattr__(self, name):
11411  */
11412   __Pyx_XDECREF(__pyx_r);
11413   __Pyx_INCREF(__pyx_v_py_string);
11414   __pyx_r = __pyx_v_py_string;
11415   goto __pyx_L0;
11416 
11417   /* "lupa/_lupa.pyx":628
11418  *             unlock_runtime(self._runtime)
11419  *
11420  *     def __str__(self):             # <<<<<<<<<<<<<<
11421  *         assert self._runtime is not None
11422  *         cdef lua_State* L = self._state
11423  */
11424 
11425   /* function exit code */
11426   __pyx_L1_error:;
11427   __Pyx_XDECREF(__pyx_t_3);
11428   __Pyx_XDECREF(__pyx_t_10);
11429   __Pyx_XDECREF(__pyx_t_11);
11430   __Pyx_XDECREF(__pyx_t_12);
11431   __Pyx_AddTraceback("lupa._lupa._LuaObject.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11432   __pyx_r = NULL;
11433   __pyx_L0:;
11434   __Pyx_XDECREF(__pyx_v_py_string);
11435   __Pyx_XDECREF(__pyx_v_encoding);
11436   __Pyx_XDECREF(__pyx_v_old_top);
11437   __Pyx_XGIVEREF(__pyx_r);
11438   __Pyx_RefNannyFinishContext();
11439   return __pyx_r;
11440 }
11441 
11442 /* "lupa/_lupa.pyx":659
11443  *         return py_string
11444  *
11445  *     def __getattr__(self, name):             # <<<<<<<<<<<<<<
11446  *         assert self._runtime is not None
11447  *         if isinstance(name, unicode):
11448  */
11449 
11450 /* Python wrapper */
11451 static PyObject *__pyx_pw_4lupa_5_lupa_10_LuaObject_17__getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_name); /*proto*/
__pyx_pw_4lupa_5_lupa_10_LuaObject_17__getattr__(PyObject * __pyx_v_self,PyObject * __pyx_v_name)11452 static PyObject *__pyx_pw_4lupa_5_lupa_10_LuaObject_17__getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_name) {
11453   PyObject *__pyx_r = 0;
11454   __Pyx_RefNannyDeclarations
11455   __Pyx_RefNannySetupContext("__getattr__ (wrapper)", 0);
11456   __pyx_r = __pyx_pf_4lupa_5_lupa_10_LuaObject_16__getattr__(((struct __pyx_obj_4lupa_5_lupa__LuaObject *)__pyx_v_self), ((PyObject *)__pyx_v_name));
11457 
11458   /* function exit code */
11459   __Pyx_RefNannyFinishContext();
11460   return __pyx_r;
11461 }
11462 
__pyx_pf_4lupa_5_lupa_10_LuaObject_16__getattr__(struct __pyx_obj_4lupa_5_lupa__LuaObject * __pyx_v_self,PyObject * __pyx_v_name)11463 static PyObject *__pyx_pf_4lupa_5_lupa_10_LuaObject_16__getattr__(struct __pyx_obj_4lupa_5_lupa__LuaObject *__pyx_v_self, PyObject *__pyx_v_name) {
11464   PyObject *__pyx_r = NULL;
11465   __Pyx_RefNannyDeclarations
11466   int __pyx_t_1;
11467   int __pyx_t_2;
11468   PyObject *__pyx_t_3 = NULL;
11469   PyObject *__pyx_t_4 = NULL;
11470   PyObject *__pyx_t_5 = NULL;
11471   int __pyx_t_6;
11472   PyObject *__pyx_t_7 = NULL;
11473   char const *__pyx_t_8;
11474   int __pyx_lineno = 0;
11475   const char *__pyx_filename = NULL;
11476   int __pyx_clineno = 0;
11477   __Pyx_RefNannySetupContext("__getattr__", 0);
11478   __Pyx_INCREF(__pyx_v_name);
11479 
11480   /* "lupa/_lupa.pyx":660
11481  *
11482  *     def __getattr__(self, name):
11483  *         assert self._runtime is not None             # <<<<<<<<<<<<<<
11484  *         if isinstance(name, unicode):
11485  *             if (<unicode>name).startswith(u'__') and (<unicode>name).endswith(u'__'):
11486  */
11487   #ifndef CYTHON_WITHOUT_ASSERTIONS
11488   if (unlikely(!Py_OptimizeFlag)) {
11489     __pyx_t_1 = (((PyObject *)__pyx_v_self->_runtime) != Py_None);
11490     if (unlikely(!(__pyx_t_1 != 0))) {
11491       PyErr_SetNone(PyExc_AssertionError);
11492       __PYX_ERR(0, 660, __pyx_L1_error)
11493     }
11494   }
11495   #endif
11496 
11497   /* "lupa/_lupa.pyx":661
11498  *     def __getattr__(self, name):
11499  *         assert self._runtime is not None
11500  *         if isinstance(name, unicode):             # <<<<<<<<<<<<<<
11501  *             if (<unicode>name).startswith(u'__') and (<unicode>name).endswith(u'__'):
11502  *                 return object.__getattr__(self, name)
11503  */
11504   __pyx_t_1 = PyUnicode_Check(__pyx_v_name);
11505   __pyx_t_2 = (__pyx_t_1 != 0);
11506   if (__pyx_t_2) {
11507 
11508     /* "lupa/_lupa.pyx":662
11509  *         assert self._runtime is not None
11510  *         if isinstance(name, unicode):
11511  *             if (<unicode>name).startswith(u'__') and (<unicode>name).endswith(u'__'):             # <<<<<<<<<<<<<<
11512  *                 return object.__getattr__(self, name)
11513  *             name = (<unicode>name).encode(self._runtime._source_encoding)
11514  */
11515     if (unlikely(__pyx_v_name == Py_None)) {
11516       PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "startswith");
11517       __PYX_ERR(0, 662, __pyx_L1_error)
11518     }
11519     __pyx_t_1 = __Pyx_PyUnicode_Tailmatch(((PyObject*)__pyx_v_name), __pyx_n_u__16, 0, PY_SSIZE_T_MAX, -1); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 662, __pyx_L1_error)
11520     if ((__pyx_t_1 != 0)) {
11521     } else {
11522       __pyx_t_2 = (__pyx_t_1 != 0);
11523       goto __pyx_L5_bool_binop_done;
11524     }
11525     if (unlikely(__pyx_v_name == Py_None)) {
11526       PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "endswith");
11527       __PYX_ERR(0, 662, __pyx_L1_error)
11528     }
11529     __pyx_t_1 = __Pyx_PyUnicode_Tailmatch(((PyObject*)__pyx_v_name), __pyx_n_u__16, 0, PY_SSIZE_T_MAX, 1); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 662, __pyx_L1_error)
11530     __pyx_t_2 = (__pyx_t_1 != 0);
11531     __pyx_L5_bool_binop_done:;
11532     if (__pyx_t_2) {
11533 
11534       /* "lupa/_lupa.pyx":663
11535  *         if isinstance(name, unicode):
11536  *             if (<unicode>name).startswith(u'__') and (<unicode>name).endswith(u'__'):
11537  *                 return object.__getattr__(self, name)             # <<<<<<<<<<<<<<
11538  *             name = (<unicode>name).encode(self._runtime._source_encoding)
11539  *         elif isinstance(name, bytes):
11540  */
11541       __Pyx_XDECREF(__pyx_r);
11542       __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_builtin_object, __pyx_n_s_getattr); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 663, __pyx_L1_error)
11543       __Pyx_GOTREF(__pyx_t_4);
11544       __pyx_t_5 = NULL;
11545       __pyx_t_6 = 0;
11546       if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
11547         __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
11548         if (likely(__pyx_t_5)) {
11549           PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
11550           __Pyx_INCREF(__pyx_t_5);
11551           __Pyx_INCREF(function);
11552           __Pyx_DECREF_SET(__pyx_t_4, function);
11553           __pyx_t_6 = 1;
11554         }
11555       }
11556       #if CYTHON_FAST_PYCALL
11557       if (PyFunction_Check(__pyx_t_4)) {
11558         PyObject *__pyx_temp[3] = {__pyx_t_5, ((PyObject *)__pyx_v_self), __pyx_v_name};
11559         __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 663, __pyx_L1_error)
11560         __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
11561         __Pyx_GOTREF(__pyx_t_3);
11562       } else
11563       #endif
11564       #if CYTHON_FAST_PYCCALL
11565       if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
11566         PyObject *__pyx_temp[3] = {__pyx_t_5, ((PyObject *)__pyx_v_self), __pyx_v_name};
11567         __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 663, __pyx_L1_error)
11568         __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
11569         __Pyx_GOTREF(__pyx_t_3);
11570       } else
11571       #endif
11572       {
11573         __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 663, __pyx_L1_error)
11574         __Pyx_GOTREF(__pyx_t_7);
11575         if (__pyx_t_5) {
11576           __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
11577         }
11578         __Pyx_INCREF(((PyObject *)__pyx_v_self));
11579         __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
11580         PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, ((PyObject *)__pyx_v_self));
11581         __Pyx_INCREF(__pyx_v_name);
11582         __Pyx_GIVEREF(__pyx_v_name);
11583         PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_v_name);
11584         __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 663, __pyx_L1_error)
11585         __Pyx_GOTREF(__pyx_t_3);
11586         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
11587       }
11588       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
11589       __pyx_r = __pyx_t_3;
11590       __pyx_t_3 = 0;
11591       goto __pyx_L0;
11592 
11593       /* "lupa/_lupa.pyx":662
11594  *         assert self._runtime is not None
11595  *         if isinstance(name, unicode):
11596  *             if (<unicode>name).startswith(u'__') and (<unicode>name).endswith(u'__'):             # <<<<<<<<<<<<<<
11597  *                 return object.__getattr__(self, name)
11598  *             name = (<unicode>name).encode(self._runtime._source_encoding)
11599  */
11600     }
11601 
11602     /* "lupa/_lupa.pyx":664
11603  *             if (<unicode>name).startswith(u'__') and (<unicode>name).endswith(u'__'):
11604  *                 return object.__getattr__(self, name)
11605  *             name = (<unicode>name).encode(self._runtime._source_encoding)             # <<<<<<<<<<<<<<
11606  *         elif isinstance(name, bytes):
11607  *             if (<bytes>name).startswith(b'__') and (<bytes>name).endswith(b'__'):
11608  */
11609     if (unlikely(__pyx_v_name == Py_None)) {
11610       PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode");
11611       __PYX_ERR(0, 664, __pyx_L1_error)
11612     }
11613     if (unlikely(__pyx_v_self->_runtime->_source_encoding == Py_None)) {
11614       PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
11615       __PYX_ERR(0, 664, __pyx_L1_error)
11616     }
11617     __pyx_t_8 = __Pyx_PyBytes_AsString(__pyx_v_self->_runtime->_source_encoding); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) __PYX_ERR(0, 664, __pyx_L1_error)
11618     __pyx_t_3 = PyUnicode_AsEncodedString(((PyObject*)__pyx_v_name), __pyx_t_8, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 664, __pyx_L1_error)
11619     __Pyx_GOTREF(__pyx_t_3);
11620     __Pyx_DECREF_SET(__pyx_v_name, __pyx_t_3);
11621     __pyx_t_3 = 0;
11622 
11623     /* "lupa/_lupa.pyx":661
11624  *     def __getattr__(self, name):
11625  *         assert self._runtime is not None
11626  *         if isinstance(name, unicode):             # <<<<<<<<<<<<<<
11627  *             if (<unicode>name).startswith(u'__') and (<unicode>name).endswith(u'__'):
11628  *                 return object.__getattr__(self, name)
11629  */
11630     goto __pyx_L3;
11631   }
11632 
11633   /* "lupa/_lupa.pyx":665
11634  *                 return object.__getattr__(self, name)
11635  *             name = (<unicode>name).encode(self._runtime._source_encoding)
11636  *         elif isinstance(name, bytes):             # <<<<<<<<<<<<<<
11637  *             if (<bytes>name).startswith(b'__') and (<bytes>name).endswith(b'__'):
11638  *                 return object.__getattr__(self, name)
11639  */
11640   __pyx_t_2 = PyBytes_Check(__pyx_v_name);
11641   __pyx_t_1 = (__pyx_t_2 != 0);
11642   if (__pyx_t_1) {
11643 
11644     /* "lupa/_lupa.pyx":666
11645  *             name = (<unicode>name).encode(self._runtime._source_encoding)
11646  *         elif isinstance(name, bytes):
11647  *             if (<bytes>name).startswith(b'__') and (<bytes>name).endswith(b'__'):             # <<<<<<<<<<<<<<
11648  *                 return object.__getattr__(self, name)
11649  *         return self._getitem(name, is_attr_access=True)
11650  */
11651     if (unlikely(__pyx_v_name == Py_None)) {
11652       PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "startswith");
11653       __PYX_ERR(0, 666, __pyx_L1_error)
11654     }
11655     __pyx_t_2 = __Pyx_PyBytes_Tailmatch(((PyObject*)__pyx_v_name), __pyx_n_b__16, 0, PY_SSIZE_T_MAX, -1); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 666, __pyx_L1_error)
11656     if ((__pyx_t_2 != 0)) {
11657     } else {
11658       __pyx_t_1 = (__pyx_t_2 != 0);
11659       goto __pyx_L8_bool_binop_done;
11660     }
11661     if (unlikely(__pyx_v_name == Py_None)) {
11662       PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "endswith");
11663       __PYX_ERR(0, 666, __pyx_L1_error)
11664     }
11665     __pyx_t_2 = __Pyx_PyBytes_Tailmatch(((PyObject*)__pyx_v_name), __pyx_n_b__16, 0, PY_SSIZE_T_MAX, 1); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 666, __pyx_L1_error)
11666     __pyx_t_1 = (__pyx_t_2 != 0);
11667     __pyx_L8_bool_binop_done:;
11668     if (__pyx_t_1) {
11669 
11670       /* "lupa/_lupa.pyx":667
11671  *         elif isinstance(name, bytes):
11672  *             if (<bytes>name).startswith(b'__') and (<bytes>name).endswith(b'__'):
11673  *                 return object.__getattr__(self, name)             # <<<<<<<<<<<<<<
11674  *         return self._getitem(name, is_attr_access=True)
11675  *
11676  */
11677       __Pyx_XDECREF(__pyx_r);
11678       __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_builtin_object, __pyx_n_s_getattr); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 667, __pyx_L1_error)
11679       __Pyx_GOTREF(__pyx_t_4);
11680       __pyx_t_7 = NULL;
11681       __pyx_t_6 = 0;
11682       if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
11683         __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4);
11684         if (likely(__pyx_t_7)) {
11685           PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
11686           __Pyx_INCREF(__pyx_t_7);
11687           __Pyx_INCREF(function);
11688           __Pyx_DECREF_SET(__pyx_t_4, function);
11689           __pyx_t_6 = 1;
11690         }
11691       }
11692       #if CYTHON_FAST_PYCALL
11693       if (PyFunction_Check(__pyx_t_4)) {
11694         PyObject *__pyx_temp[3] = {__pyx_t_7, ((PyObject *)__pyx_v_self), __pyx_v_name};
11695         __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 667, __pyx_L1_error)
11696         __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
11697         __Pyx_GOTREF(__pyx_t_3);
11698       } else
11699       #endif
11700       #if CYTHON_FAST_PYCCALL
11701       if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
11702         PyObject *__pyx_temp[3] = {__pyx_t_7, ((PyObject *)__pyx_v_self), __pyx_v_name};
11703         __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 667, __pyx_L1_error)
11704         __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
11705         __Pyx_GOTREF(__pyx_t_3);
11706       } else
11707       #endif
11708       {
11709         __pyx_t_5 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 667, __pyx_L1_error)
11710         __Pyx_GOTREF(__pyx_t_5);
11711         if (__pyx_t_7) {
11712           __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_7); __pyx_t_7 = NULL;
11713         }
11714         __Pyx_INCREF(((PyObject *)__pyx_v_self));
11715         __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
11716         PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_6, ((PyObject *)__pyx_v_self));
11717         __Pyx_INCREF(__pyx_v_name);
11718         __Pyx_GIVEREF(__pyx_v_name);
11719         PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_6, __pyx_v_name);
11720         __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 667, __pyx_L1_error)
11721         __Pyx_GOTREF(__pyx_t_3);
11722         __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11723       }
11724       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
11725       __pyx_r = __pyx_t_3;
11726       __pyx_t_3 = 0;
11727       goto __pyx_L0;
11728 
11729       /* "lupa/_lupa.pyx":666
11730  *             name = (<unicode>name).encode(self._runtime._source_encoding)
11731  *         elif isinstance(name, bytes):
11732  *             if (<bytes>name).startswith(b'__') and (<bytes>name).endswith(b'__'):             # <<<<<<<<<<<<<<
11733  *                 return object.__getattr__(self, name)
11734  *         return self._getitem(name, is_attr_access=True)
11735  */
11736     }
11737 
11738     /* "lupa/_lupa.pyx":665
11739  *                 return object.__getattr__(self, name)
11740  *             name = (<unicode>name).encode(self._runtime._source_encoding)
11741  *         elif isinstance(name, bytes):             # <<<<<<<<<<<<<<
11742  *             if (<bytes>name).startswith(b'__') and (<bytes>name).endswith(b'__'):
11743  *                 return object.__getattr__(self, name)
11744  */
11745   }
11746   __pyx_L3:;
11747 
11748   /* "lupa/_lupa.pyx":668
11749  *             if (<bytes>name).startswith(b'__') and (<bytes>name).endswith(b'__'):
11750  *                 return object.__getattr__(self, name)
11751  *         return self._getitem(name, is_attr_access=True)             # <<<<<<<<<<<<<<
11752  *
11753  *     def __getitem__(self, index_or_name):
11754  */
11755   __Pyx_XDECREF(__pyx_r);
11756   __pyx_t_3 = __pyx_f_4lupa_5_lupa_10_LuaObject__getitem(__pyx_v_self, __pyx_v_name, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 668, __pyx_L1_error)
11757   __Pyx_GOTREF(__pyx_t_3);
11758   __pyx_r = __pyx_t_3;
11759   __pyx_t_3 = 0;
11760   goto __pyx_L0;
11761 
11762   /* "lupa/_lupa.pyx":659
11763  *         return py_string
11764  *
11765  *     def __getattr__(self, name):             # <<<<<<<<<<<<<<
11766  *         assert self._runtime is not None
11767  *         if isinstance(name, unicode):
11768  */
11769 
11770   /* function exit code */
11771   __pyx_L1_error:;
11772   __Pyx_XDECREF(__pyx_t_3);
11773   __Pyx_XDECREF(__pyx_t_4);
11774   __Pyx_XDECREF(__pyx_t_5);
11775   __Pyx_XDECREF(__pyx_t_7);
11776   __Pyx_AddTraceback("lupa._lupa._LuaObject.__getattr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11777   __pyx_r = NULL;
11778   __pyx_L0:;
11779   __Pyx_XDECREF(__pyx_v_name);
11780   __Pyx_XGIVEREF(__pyx_r);
11781   __Pyx_RefNannyFinishContext();
11782   return __pyx_r;
11783 }
11784 
11785 /* "lupa/_lupa.pyx":670
11786  *         return self._getitem(name, is_attr_access=True)
11787  *
11788  *     def __getitem__(self, index_or_name):             # <<<<<<<<<<<<<<
11789  *         return self._getitem(index_or_name, is_attr_access=False)
11790  *
11791  */
11792 
11793 /* Python wrapper */
11794 static PyObject *__pyx_pw_4lupa_5_lupa_10_LuaObject_19__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index_or_name); /*proto*/
__pyx_pw_4lupa_5_lupa_10_LuaObject_19__getitem__(PyObject * __pyx_v_self,PyObject * __pyx_v_index_or_name)11795 static PyObject *__pyx_pw_4lupa_5_lupa_10_LuaObject_19__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index_or_name) {
11796   PyObject *__pyx_r = 0;
11797   __Pyx_RefNannyDeclarations
11798   __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
11799   __pyx_r = __pyx_pf_4lupa_5_lupa_10_LuaObject_18__getitem__(((struct __pyx_obj_4lupa_5_lupa__LuaObject *)__pyx_v_self), ((PyObject *)__pyx_v_index_or_name));
11800 
11801   /* function exit code */
11802   __Pyx_RefNannyFinishContext();
11803   return __pyx_r;
11804 }
11805 
__pyx_pf_4lupa_5_lupa_10_LuaObject_18__getitem__(struct __pyx_obj_4lupa_5_lupa__LuaObject * __pyx_v_self,PyObject * __pyx_v_index_or_name)11806 static PyObject *__pyx_pf_4lupa_5_lupa_10_LuaObject_18__getitem__(struct __pyx_obj_4lupa_5_lupa__LuaObject *__pyx_v_self, PyObject *__pyx_v_index_or_name) {
11807   PyObject *__pyx_r = NULL;
11808   __Pyx_RefNannyDeclarations
11809   PyObject *__pyx_t_1 = NULL;
11810   int __pyx_lineno = 0;
11811   const char *__pyx_filename = NULL;
11812   int __pyx_clineno = 0;
11813   __Pyx_RefNannySetupContext("__getitem__", 0);
11814 
11815   /* "lupa/_lupa.pyx":671
11816  *
11817  *     def __getitem__(self, index_or_name):
11818  *         return self._getitem(index_or_name, is_attr_access=False)             # <<<<<<<<<<<<<<
11819  *
11820  *     @cython.final
11821  */
11822   __Pyx_XDECREF(__pyx_r);
11823   __pyx_t_1 = __pyx_f_4lupa_5_lupa_10_LuaObject__getitem(__pyx_v_self, __pyx_v_index_or_name, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 671, __pyx_L1_error)
11824   __Pyx_GOTREF(__pyx_t_1);
11825   __pyx_r = __pyx_t_1;
11826   __pyx_t_1 = 0;
11827   goto __pyx_L0;
11828 
11829   /* "lupa/_lupa.pyx":670
11830  *         return self._getitem(name, is_attr_access=True)
11831  *
11832  *     def __getitem__(self, index_or_name):             # <<<<<<<<<<<<<<
11833  *         return self._getitem(index_or_name, is_attr_access=False)
11834  *
11835  */
11836 
11837   /* function exit code */
11838   __pyx_L1_error:;
11839   __Pyx_XDECREF(__pyx_t_1);
11840   __Pyx_AddTraceback("lupa._lupa._LuaObject.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11841   __pyx_r = NULL;
11842   __pyx_L0:;
11843   __Pyx_XGIVEREF(__pyx_r);
11844   __Pyx_RefNannyFinishContext();
11845   return __pyx_r;
11846 }
11847 
11848 /* "lupa/_lupa.pyx":674
11849  *
11850  *     @cython.final
11851  *     cdef _getitem(self, name, bint is_attr_access):             # <<<<<<<<<<<<<<
11852  *         cdef lua_State* L = self._state
11853  *         lock_runtime(self._runtime)
11854  */
11855 
__pyx_f_4lupa_5_lupa_10_LuaObject__getitem(struct __pyx_obj_4lupa_5_lupa__LuaObject * __pyx_v_self,PyObject * __pyx_v_name,int __pyx_v_is_attr_access)11856 static PyObject *__pyx_f_4lupa_5_lupa_10_LuaObject__getitem(struct __pyx_obj_4lupa_5_lupa__LuaObject *__pyx_v_self, PyObject *__pyx_v_name, int __pyx_v_is_attr_access) {
11857   lua_State *__pyx_v_L;
11858   int __pyx_v_old_top;
11859   int __pyx_v_lua_type;
11860   PyObject *__pyx_r = NULL;
11861   __Pyx_RefNannyDeclarations
11862   lua_State *__pyx_t_1;
11863   PyObject *__pyx_t_2 = NULL;
11864   int __pyx_t_3;
11865   PyObject *__pyx_t_4 = NULL;
11866   PyObject *__pyx_t_5 = NULL;
11867   struct __pyx_opt_args_4lupa_5_lupa_py_to_lua __pyx_t_6;
11868   int __pyx_t_7;
11869   char const *__pyx_t_8;
11870   PyObject *__pyx_t_9 = NULL;
11871   PyObject *__pyx_t_10 = NULL;
11872   PyObject *__pyx_t_11 = NULL;
11873   PyObject *__pyx_t_12 = NULL;
11874   PyObject *__pyx_t_13 = NULL;
11875   PyObject *__pyx_t_14 = NULL;
11876   int __pyx_lineno = 0;
11877   const char *__pyx_filename = NULL;
11878   int __pyx_clineno = 0;
11879   __Pyx_RefNannySetupContext("_getitem", 0);
11880 
11881   /* "lupa/_lupa.pyx":675
11882  *     @cython.final
11883  *     cdef _getitem(self, name, bint is_attr_access):
11884  *         cdef lua_State* L = self._state             # <<<<<<<<<<<<<<
11885  *         lock_runtime(self._runtime)
11886  *         old_top = lua.lua_gettop(L)
11887  */
11888   __pyx_t_1 = __pyx_v_self->_state;
11889   __pyx_v_L = __pyx_t_1;
11890 
11891   /* "lupa/_lupa.pyx":676
11892  *     cdef _getitem(self, name, bint is_attr_access):
11893  *         cdef lua_State* L = self._state
11894  *         lock_runtime(self._runtime)             # <<<<<<<<<<<<<<
11895  *         old_top = lua.lua_gettop(L)
11896  *         try:
11897  */
11898   __pyx_t_2 = ((PyObject *)__pyx_v_self->_runtime);
11899   __Pyx_INCREF(__pyx_t_2);
11900   __pyx_t_3 = __pyx_f_4lupa_5_lupa_lock_runtime(((struct __pyx_obj_4lupa_5_lupa_LuaRuntime *)__pyx_t_2)); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 676, __pyx_L1_error)
11901   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11902 
11903   /* "lupa/_lupa.pyx":677
11904  *         cdef lua_State* L = self._state
11905  *         lock_runtime(self._runtime)
11906  *         old_top = lua.lua_gettop(L)             # <<<<<<<<<<<<<<
11907  *         try:
11908  *             self.push_lua_object()
11909  */
11910   __pyx_v_old_top = lua_gettop(__pyx_v_L);
11911 
11912   /* "lupa/_lupa.pyx":678
11913  *         lock_runtime(self._runtime)
11914  *         old_top = lua.lua_gettop(L)
11915  *         try:             # <<<<<<<<<<<<<<
11916  *             self.push_lua_object()
11917  *             lua_type = lua.lua_type(L, -1)
11918  */
11919   /*try:*/ {
11920 
11921     /* "lupa/_lupa.pyx":679
11922  *         old_top = lua.lua_gettop(L)
11923  *         try:
11924  *             self.push_lua_object()             # <<<<<<<<<<<<<<
11925  *             lua_type = lua.lua_type(L, -1)
11926  *             if lua_type == lua.LUA_TFUNCTION or lua_type == lua.LUA_TTHREAD:
11927  */
11928     __pyx_t_3 = __pyx_f_4lupa_5_lupa_10_LuaObject_push_lua_object(__pyx_v_self); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 679, __pyx_L4_error)
11929 
11930     /* "lupa/_lupa.pyx":680
11931  *         try:
11932  *             self.push_lua_object()
11933  *             lua_type = lua.lua_type(L, -1)             # <<<<<<<<<<<<<<
11934  *             if lua_type == lua.LUA_TFUNCTION or lua_type == lua.LUA_TTHREAD:
11935  *                 lua.lua_pop(L, 1)
11936  */
11937     __pyx_v_lua_type = lua_type(__pyx_v_L, -1);
11938 
11939     /* "lupa/_lupa.pyx":681
11940  *             self.push_lua_object()
11941  *             lua_type = lua.lua_type(L, -1)
11942  *             if lua_type == lua.LUA_TFUNCTION or lua_type == lua.LUA_TTHREAD:             # <<<<<<<<<<<<<<
11943  *                 lua.lua_pop(L, 1)
11944  *                 raise (AttributeError if is_attr_access else TypeError)(
11945  */
11946     switch (__pyx_v_lua_type) {
11947       case LUA_TFUNCTION:
11948       case LUA_TTHREAD:
11949 
11950       /* "lupa/_lupa.pyx":682
11951  *             lua_type = lua.lua_type(L, -1)
11952  *             if lua_type == lua.LUA_TFUNCTION or lua_type == lua.LUA_TTHREAD:
11953  *                 lua.lua_pop(L, 1)             # <<<<<<<<<<<<<<
11954  *                 raise (AttributeError if is_attr_access else TypeError)(
11955  *                     "item/attribute access not supported on functions")
11956  */
11957       lua_pop(__pyx_v_L, 1);
11958 
11959       /* "lupa/_lupa.pyx":683
11960  *             if lua_type == lua.LUA_TFUNCTION or lua_type == lua.LUA_TTHREAD:
11961  *                 lua.lua_pop(L, 1)
11962  *                 raise (AttributeError if is_attr_access else TypeError)(             # <<<<<<<<<<<<<<
11963  *                     "item/attribute access not supported on functions")
11964  *             # table[nil] fails, so map None -> python.none for Lua tables
11965  */
11966       if ((__pyx_v_is_attr_access != 0)) {
11967         __Pyx_INCREF(__pyx_builtin_AttributeError);
11968         __pyx_t_4 = __pyx_builtin_AttributeError;
11969       } else {
11970         __Pyx_INCREF(__pyx_builtin_TypeError);
11971         __pyx_t_4 = __pyx_builtin_TypeError;
11972       }
11973       __pyx_t_5 = NULL;
11974       if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
11975         __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
11976         if (likely(__pyx_t_5)) {
11977           PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
11978           __Pyx_INCREF(__pyx_t_5);
11979           __Pyx_INCREF(function);
11980           __Pyx_DECREF_SET(__pyx_t_4, function);
11981         }
11982       }
11983       __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_kp_s_item_attribute_access_not_suppor) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_s_item_attribute_access_not_suppor);
11984       __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
11985       if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 683, __pyx_L4_error)
11986       __Pyx_GOTREF(__pyx_t_2);
11987       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
11988       __Pyx_Raise(__pyx_t_2, 0, 0, 0);
11989       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11990       __PYX_ERR(0, 683, __pyx_L4_error)
11991 
11992       /* "lupa/_lupa.pyx":681
11993  *             self.push_lua_object()
11994  *             lua_type = lua.lua_type(L, -1)
11995  *             if lua_type == lua.LUA_TFUNCTION or lua_type == lua.LUA_TTHREAD:             # <<<<<<<<<<<<<<
11996  *                 lua.lua_pop(L, 1)
11997  *                 raise (AttributeError if is_attr_access else TypeError)(
11998  */
11999       break;
12000       default: break;
12001     }
12002 
12003     /* "lupa/_lupa.pyx":686
12004  *                     "item/attribute access not supported on functions")
12005  *             # table[nil] fails, so map None -> python.none for Lua tables
12006  *             py_to_lua(self._runtime, L, name, wrap_none=lua_type == lua.LUA_TTABLE)             # <<<<<<<<<<<<<<
12007  *             lua.lua_gettable(L, -2)
12008  *             return py_from_lua(self._runtime, L, -1)
12009  */
12010     __pyx_t_2 = ((PyObject *)__pyx_v_self->_runtime);
12011     __Pyx_INCREF(__pyx_t_2);
12012     __pyx_t_6.__pyx_n = 1;
12013     __pyx_t_6.wrap_none = (__pyx_v_lua_type == LUA_TTABLE);
12014     __pyx_t_3 = __pyx_f_4lupa_5_lupa_py_to_lua(((struct __pyx_obj_4lupa_5_lupa_LuaRuntime *)__pyx_t_2), __pyx_v_L, __pyx_v_name, &__pyx_t_6); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 686, __pyx_L4_error)
12015     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12016 
12017     /* "lupa/_lupa.pyx":687
12018  *             # table[nil] fails, so map None -> python.none for Lua tables
12019  *             py_to_lua(self._runtime, L, name, wrap_none=lua_type == lua.LUA_TTABLE)
12020  *             lua.lua_gettable(L, -2)             # <<<<<<<<<<<<<<
12021  *             return py_from_lua(self._runtime, L, -1)
12022  *         finally:
12023  */
12024     lua_gettable(__pyx_v_L, -2);
12025 
12026     /* "lupa/_lupa.pyx":688
12027  *             py_to_lua(self._runtime, L, name, wrap_none=lua_type == lua.LUA_TTABLE)
12028  *             lua.lua_gettable(L, -2)
12029  *             return py_from_lua(self._runtime, L, -1)             # <<<<<<<<<<<<<<
12030  *         finally:
12031  *             lua.lua_settop(L, old_top)
12032  */
12033     __Pyx_XDECREF(__pyx_r);
12034     __pyx_t_2 = ((PyObject *)__pyx_v_self->_runtime);
12035     __Pyx_INCREF(__pyx_t_2);
12036     __pyx_t_4 = __pyx_f_4lupa_5_lupa_py_from_lua(((struct __pyx_obj_4lupa_5_lupa_LuaRuntime *)__pyx_t_2), __pyx_v_L, -1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 688, __pyx_L4_error)
12037     __Pyx_GOTREF(__pyx_t_4);
12038     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12039     __pyx_r = __pyx_t_4;
12040     __pyx_t_4 = 0;
12041     goto __pyx_L3_return;
12042   }
12043 
12044   /* "lupa/_lupa.pyx":690
12045  *             return py_from_lua(self._runtime, L, -1)
12046  *         finally:
12047  *             lua.lua_settop(L, old_top)             # <<<<<<<<<<<<<<
12048  *             unlock_runtime(self._runtime)
12049  *
12050  */
12051   /*finally:*/ {
12052     __pyx_L4_error:;
12053     /*exception exit:*/{
12054       __Pyx_PyThreadState_declare
12055       __Pyx_PyThreadState_assign
12056       __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0;
12057       __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
12058       __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
12059       __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
12060       if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14);
12061       if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11) < 0)) __Pyx_ErrFetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
12062       __Pyx_XGOTREF(__pyx_t_9);
12063       __Pyx_XGOTREF(__pyx_t_10);
12064       __Pyx_XGOTREF(__pyx_t_11);
12065       __Pyx_XGOTREF(__pyx_t_12);
12066       __Pyx_XGOTREF(__pyx_t_13);
12067       __Pyx_XGOTREF(__pyx_t_14);
12068       __pyx_t_3 = __pyx_lineno; __pyx_t_7 = __pyx_clineno; __pyx_t_8 = __pyx_filename;
12069       {
12070         lua_settop(__pyx_v_L, __pyx_v_old_top);
12071 
12072         /* "lupa/_lupa.pyx":691
12073  *         finally:
12074  *             lua.lua_settop(L, old_top)
12075  *             unlock_runtime(self._runtime)             # <<<<<<<<<<<<<<
12076  *
12077  *
12078  */
12079         __pyx_t_4 = ((PyObject *)__pyx_v_self->_runtime);
12080         __Pyx_INCREF(__pyx_t_4);
12081         __pyx_f_4lupa_5_lupa_unlock_runtime(((struct __pyx_obj_4lupa_5_lupa_LuaRuntime *)__pyx_t_4));
12082         __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
12083       }
12084       if (PY_MAJOR_VERSION >= 3) {
12085         __Pyx_XGIVEREF(__pyx_t_12);
12086         __Pyx_XGIVEREF(__pyx_t_13);
12087         __Pyx_XGIVEREF(__pyx_t_14);
12088         __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_13, __pyx_t_14);
12089       }
12090       __Pyx_XGIVEREF(__pyx_t_9);
12091       __Pyx_XGIVEREF(__pyx_t_10);
12092       __Pyx_XGIVEREF(__pyx_t_11);
12093       __Pyx_ErrRestore(__pyx_t_9, __pyx_t_10, __pyx_t_11);
12094       __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0;
12095       __pyx_lineno = __pyx_t_3; __pyx_clineno = __pyx_t_7; __pyx_filename = __pyx_t_8;
12096       goto __pyx_L1_error;
12097     }
12098     __pyx_L3_return: {
12099       __pyx_t_14 = __pyx_r;
12100       __pyx_r = 0;
12101 
12102       /* "lupa/_lupa.pyx":690
12103  *             return py_from_lua(self._runtime, L, -1)
12104  *         finally:
12105  *             lua.lua_settop(L, old_top)             # <<<<<<<<<<<<<<
12106  *             unlock_runtime(self._runtime)
12107  *
12108  */
12109       lua_settop(__pyx_v_L, __pyx_v_old_top);
12110 
12111       /* "lupa/_lupa.pyx":691
12112  *         finally:
12113  *             lua.lua_settop(L, old_top)
12114  *             unlock_runtime(self._runtime)             # <<<<<<<<<<<<<<
12115  *
12116  *
12117  */
12118       __pyx_t_4 = ((PyObject *)__pyx_v_self->_runtime);
12119       __Pyx_INCREF(__pyx_t_4);
12120       __pyx_f_4lupa_5_lupa_unlock_runtime(((struct __pyx_obj_4lupa_5_lupa_LuaRuntime *)__pyx_t_4));
12121       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
12122       __pyx_r = __pyx_t_14;
12123       __pyx_t_14 = 0;
12124       goto __pyx_L0;
12125     }
12126   }
12127 
12128   /* "lupa/_lupa.pyx":674
12129  *
12130  *     @cython.final
12131  *     cdef _getitem(self, name, bint is_attr_access):             # <<<<<<<<<<<<<<
12132  *         cdef lua_State* L = self._state
12133  *         lock_runtime(self._runtime)
12134  */
12135 
12136   /* function exit code */
12137   __pyx_L1_error:;
12138   __Pyx_XDECREF(__pyx_t_2);
12139   __Pyx_XDECREF(__pyx_t_4);
12140   __Pyx_XDECREF(__pyx_t_5);
12141   __Pyx_AddTraceback("lupa._lupa._LuaObject._getitem", __pyx_clineno, __pyx_lineno, __pyx_filename);
12142   __pyx_r = 0;
12143   __pyx_L0:;
12144   __Pyx_XGIVEREF(__pyx_r);
12145   __Pyx_RefNannyFinishContext();
12146   return __pyx_r;
12147 }
12148 
12149 /* "(tree fragment)":1
12150  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
12151  *     raise TypeError("self._state cannot be converted to a Python object for pickling")
12152  * def __setstate_cython__(self, __pyx_state):
12153  */
12154 
12155 /* Python wrapper */
12156 static PyObject *__pyx_pw_4lupa_5_lupa_10_LuaObject_21__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
12157 static char __pyx_doc_4lupa_5_lupa_10_LuaObject_20__reduce_cython__[] = "_LuaObject.__reduce_cython__(self)";
12158 static PyMethodDef __pyx_mdef_4lupa_5_lupa_10_LuaObject_21__reduce_cython__ = {"__reduce_cython__", (PyCFunction)__pyx_pw_4lupa_5_lupa_10_LuaObject_21__reduce_cython__, METH_NOARGS, __pyx_doc_4lupa_5_lupa_10_LuaObject_20__reduce_cython__};
__pyx_pw_4lupa_5_lupa_10_LuaObject_21__reduce_cython__(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)12159 static PyObject *__pyx_pw_4lupa_5_lupa_10_LuaObject_21__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
12160   PyObject *__pyx_r = 0;
12161   __Pyx_RefNannyDeclarations
12162   __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
12163   __pyx_r = __pyx_pf_4lupa_5_lupa_10_LuaObject_20__reduce_cython__(((struct __pyx_obj_4lupa_5_lupa__LuaObject *)__pyx_v_self));
12164 
12165   /* function exit code */
12166   __Pyx_RefNannyFinishContext();
12167   return __pyx_r;
12168 }
12169 
__pyx_pf_4lupa_5_lupa_10_LuaObject_20__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_4lupa_5_lupa__LuaObject * __pyx_v_self)12170 static PyObject *__pyx_pf_4lupa_5_lupa_10_LuaObject_20__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_4lupa_5_lupa__LuaObject *__pyx_v_self) {
12171   PyObject *__pyx_r = NULL;
12172   __Pyx_RefNannyDeclarations
12173   PyObject *__pyx_t_1 = NULL;
12174   int __pyx_lineno = 0;
12175   const char *__pyx_filename = NULL;
12176   int __pyx_clineno = 0;
12177   __Pyx_RefNannySetupContext("__reduce_cython__", 0);
12178 
12179   /* "(tree fragment)":2
12180  * def __reduce_cython__(self):
12181  *     raise TypeError("self._state cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
12182  * def __setstate_cython__(self, __pyx_state):
12183  *     raise TypeError("self._state cannot be converted to a Python object for pickling")
12184  */
12185   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error)
12186   __Pyx_GOTREF(__pyx_t_1);
12187   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
12188   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12189   __PYX_ERR(2, 2, __pyx_L1_error)
12190 
12191   /* "(tree fragment)":1
12192  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
12193  *     raise TypeError("self._state cannot be converted to a Python object for pickling")
12194  * def __setstate_cython__(self, __pyx_state):
12195  */
12196 
12197   /* function exit code */
12198   __pyx_L1_error:;
12199   __Pyx_XDECREF(__pyx_t_1);
12200   __Pyx_AddTraceback("lupa._lupa._LuaObject.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12201   __pyx_r = NULL;
12202   __Pyx_XGIVEREF(__pyx_r);
12203   __Pyx_RefNannyFinishContext();
12204   return __pyx_r;
12205 }
12206 
12207 /* "(tree fragment)":3
12208  * def __reduce_cython__(self):
12209  *     raise TypeError("self._state cannot be converted to a Python object for pickling")
12210  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
12211  *     raise TypeError("self._state cannot be converted to a Python object for pickling")
12212  */
12213 
12214 /* Python wrapper */
12215 static PyObject *__pyx_pw_4lupa_5_lupa_10_LuaObject_23__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
12216 static char __pyx_doc_4lupa_5_lupa_10_LuaObject_22__setstate_cython__[] = "_LuaObject.__setstate_cython__(self, __pyx_state)";
12217 static PyMethodDef __pyx_mdef_4lupa_5_lupa_10_LuaObject_23__setstate_cython__ = {"__setstate_cython__", (PyCFunction)__pyx_pw_4lupa_5_lupa_10_LuaObject_23__setstate_cython__, METH_O, __pyx_doc_4lupa_5_lupa_10_LuaObject_22__setstate_cython__};
__pyx_pw_4lupa_5_lupa_10_LuaObject_23__setstate_cython__(PyObject * __pyx_v_self,PyObject * __pyx_v___pyx_state)12218 static PyObject *__pyx_pw_4lupa_5_lupa_10_LuaObject_23__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
12219   PyObject *__pyx_r = 0;
12220   __Pyx_RefNannyDeclarations
12221   __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
12222   __pyx_r = __pyx_pf_4lupa_5_lupa_10_LuaObject_22__setstate_cython__(((struct __pyx_obj_4lupa_5_lupa__LuaObject *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
12223 
12224   /* function exit code */
12225   __Pyx_RefNannyFinishContext();
12226   return __pyx_r;
12227 }
12228 
__pyx_pf_4lupa_5_lupa_10_LuaObject_22__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_4lupa_5_lupa__LuaObject * __pyx_v_self,CYTHON_UNUSED PyObject * __pyx_v___pyx_state)12229 static PyObject *__pyx_pf_4lupa_5_lupa_10_LuaObject_22__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_4lupa_5_lupa__LuaObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
12230   PyObject *__pyx_r = NULL;
12231   __Pyx_RefNannyDeclarations
12232   PyObject *__pyx_t_1 = NULL;
12233   int __pyx_lineno = 0;
12234   const char *__pyx_filename = NULL;
12235   int __pyx_clineno = 0;
12236   __Pyx_RefNannySetupContext("__setstate_cython__", 0);
12237 
12238   /* "(tree fragment)":4
12239  *     raise TypeError("self._state cannot be converted to a Python object for pickling")
12240  * def __setstate_cython__(self, __pyx_state):
12241  *     raise TypeError("self._state cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
12242  */
12243   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error)
12244   __Pyx_GOTREF(__pyx_t_1);
12245   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
12246   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12247   __PYX_ERR(2, 4, __pyx_L1_error)
12248 
12249   /* "(tree fragment)":3
12250  * def __reduce_cython__(self):
12251  *     raise TypeError("self._state cannot be converted to a Python object for pickling")
12252  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
12253  *     raise TypeError("self._state cannot be converted to a Python object for pickling")
12254  */
12255 
12256   /* function exit code */
12257   __pyx_L1_error:;
12258   __Pyx_XDECREF(__pyx_t_1);
12259   __Pyx_AddTraceback("lupa._lupa._LuaObject.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12260   __pyx_r = NULL;
12261   __Pyx_XGIVEREF(__pyx_r);
12262   __Pyx_RefNannyFinishContext();
12263   return __pyx_r;
12264 }
12265 
12266 /* "lupa/_lupa.pyx":694
12267  *
12268  *
12269  * cdef _LuaObject new_lua_object(LuaRuntime runtime, lua_State* L, int n):             # <<<<<<<<<<<<<<
12270  *     cdef _LuaObject obj = _LuaObject.__new__(_LuaObject)
12271  *     init_lua_object(obj, runtime, L, n)
12272  */
12273 
__pyx_f_4lupa_5_lupa_new_lua_object(struct __pyx_obj_4lupa_5_lupa_LuaRuntime * __pyx_v_runtime,lua_State * __pyx_v_L,int __pyx_v_n)12274 static struct __pyx_obj_4lupa_5_lupa__LuaObject *__pyx_f_4lupa_5_lupa_new_lua_object(struct __pyx_obj_4lupa_5_lupa_LuaRuntime *__pyx_v_runtime, lua_State *__pyx_v_L, int __pyx_v_n) {
12275   struct __pyx_obj_4lupa_5_lupa__LuaObject *__pyx_v_obj = 0;
12276   struct __pyx_obj_4lupa_5_lupa__LuaObject *__pyx_r = NULL;
12277   __Pyx_RefNannyDeclarations
12278   PyObject *__pyx_t_1 = NULL;
12279   int __pyx_lineno = 0;
12280   const char *__pyx_filename = NULL;
12281   int __pyx_clineno = 0;
12282   __Pyx_RefNannySetupContext("new_lua_object", 0);
12283 
12284   /* "lupa/_lupa.pyx":695
12285  *
12286  * cdef _LuaObject new_lua_object(LuaRuntime runtime, lua_State* L, int n):
12287  *     cdef _LuaObject obj = _LuaObject.__new__(_LuaObject)             # <<<<<<<<<<<<<<
12288  *     init_lua_object(obj, runtime, L, n)
12289  *     return obj
12290  */
12291   __pyx_t_1 = ((PyObject *)__pyx_tp_new_4lupa_5_lupa__LuaObject(((PyTypeObject *)__pyx_ptype_4lupa_5_lupa__LuaObject), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 695, __pyx_L1_error)
12292   __Pyx_GOTREF(((PyObject *)__pyx_t_1));
12293   __pyx_v_obj = ((struct __pyx_obj_4lupa_5_lupa__LuaObject *)__pyx_t_1);
12294   __pyx_t_1 = 0;
12295 
12296   /* "lupa/_lupa.pyx":696
12297  * cdef _LuaObject new_lua_object(LuaRuntime runtime, lua_State* L, int n):
12298  *     cdef _LuaObject obj = _LuaObject.__new__(_LuaObject)
12299  *     init_lua_object(obj, runtime, L, n)             # <<<<<<<<<<<<<<
12300  *     return obj
12301  *
12302  */
12303   __pyx_f_4lupa_5_lupa_init_lua_object(__pyx_v_obj, __pyx_v_runtime, __pyx_v_L, __pyx_v_n);
12304 
12305   /* "lupa/_lupa.pyx":697
12306  *     cdef _LuaObject obj = _LuaObject.__new__(_LuaObject)
12307  *     init_lua_object(obj, runtime, L, n)
12308  *     return obj             # <<<<<<<<<<<<<<
12309  *
12310  * cdef void init_lua_object(_LuaObject obj, LuaRuntime runtime, lua_State* L, int n):
12311  */
12312   __Pyx_XDECREF(((PyObject *)__pyx_r));
12313   __Pyx_INCREF(((PyObject *)__pyx_v_obj));
12314   __pyx_r = __pyx_v_obj;
12315   goto __pyx_L0;
12316 
12317   /* "lupa/_lupa.pyx":694
12318  *
12319  *
12320  * cdef _LuaObject new_lua_object(LuaRuntime runtime, lua_State* L, int n):             # <<<<<<<<<<<<<<
12321  *     cdef _LuaObject obj = _LuaObject.__new__(_LuaObject)
12322  *     init_lua_object(obj, runtime, L, n)
12323  */
12324 
12325   /* function exit code */
12326   __pyx_L1_error:;
12327   __Pyx_XDECREF(__pyx_t_1);
12328   __Pyx_AddTraceback("lupa._lupa.new_lua_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
12329   __pyx_r = 0;
12330   __pyx_L0:;
12331   __Pyx_XDECREF((PyObject *)__pyx_v_obj);
12332   __Pyx_XGIVEREF((PyObject *)__pyx_r);
12333   __Pyx_RefNannyFinishContext();
12334   return __pyx_r;
12335 }
12336 
12337 /* "lupa/_lupa.pyx":699
12338  *     return obj
12339  *
12340  * cdef void init_lua_object(_LuaObject obj, LuaRuntime runtime, lua_State* L, int n):             # <<<<<<<<<<<<<<
12341  *     obj._runtime = runtime
12342  *     obj._state = L
12343  */
12344 
__pyx_f_4lupa_5_lupa_init_lua_object(struct __pyx_obj_4lupa_5_lupa__LuaObject * __pyx_v_obj,struct __pyx_obj_4lupa_5_lupa_LuaRuntime * __pyx_v_runtime,lua_State * __pyx_v_L,int __pyx_v_n)12345 static void __pyx_f_4lupa_5_lupa_init_lua_object(struct __pyx_obj_4lupa_5_lupa__LuaObject *__pyx_v_obj, struct __pyx_obj_4lupa_5_lupa_LuaRuntime *__pyx_v_runtime, lua_State *__pyx_v_L, int __pyx_v_n) {
12346   __Pyx_RefNannyDeclarations
12347   __Pyx_RefNannySetupContext("init_lua_object", 0);
12348 
12349   /* "lupa/_lupa.pyx":700
12350  *
12351  * cdef void init_lua_object(_LuaObject obj, LuaRuntime runtime, lua_State* L, int n):
12352  *     obj._runtime = runtime             # <<<<<<<<<<<<<<
12353  *     obj._state = L
12354  *     lua.lua_pushvalue(L, n)
12355  */
12356   __Pyx_INCREF(((PyObject *)__pyx_v_runtime));
12357   __Pyx_GIVEREF(((PyObject *)__pyx_v_runtime));
12358   __Pyx_GOTREF(__pyx_v_obj->_runtime);
12359   __Pyx_DECREF(((PyObject *)__pyx_v_obj->_runtime));
12360   __pyx_v_obj->_runtime = __pyx_v_runtime;
12361 
12362   /* "lupa/_lupa.pyx":701
12363  * cdef void init_lua_object(_LuaObject obj, LuaRuntime runtime, lua_State* L, int n):
12364  *     obj._runtime = runtime
12365  *     obj._state = L             # <<<<<<<<<<<<<<
12366  *     lua.lua_pushvalue(L, n)
12367  *     obj._ref = lua.luaL_ref(L, lua.LUA_REGISTRYINDEX)
12368  */
12369   __pyx_v_obj->_state = __pyx_v_L;
12370 
12371   /* "lupa/_lupa.pyx":702
12372  *     obj._runtime = runtime
12373  *     obj._state = L
12374  *     lua.lua_pushvalue(L, n)             # <<<<<<<<<<<<<<
12375  *     obj._ref = lua.luaL_ref(L, lua.LUA_REGISTRYINDEX)
12376  *
12377  */
12378   lua_pushvalue(__pyx_v_L, __pyx_v_n);
12379 
12380   /* "lupa/_lupa.pyx":703
12381  *     obj._state = L
12382  *     lua.lua_pushvalue(L, n)
12383  *     obj._ref = lua.luaL_ref(L, lua.LUA_REGISTRYINDEX)             # <<<<<<<<<<<<<<
12384  *
12385  * cdef object lua_object_repr(lua_State* L, bytes encoding):
12386  */
12387   __pyx_v_obj->_ref = luaL_ref(__pyx_v_L, LUA_REGISTRYINDEX);
12388 
12389   /* "lupa/_lupa.pyx":699
12390  *     return obj
12391  *
12392  * cdef void init_lua_object(_LuaObject obj, LuaRuntime runtime, lua_State* L, int n):             # <<<<<<<<<<<<<<
12393  *     obj._runtime = runtime
12394  *     obj._state = L
12395  */
12396 
12397   /* function exit code */
12398   __Pyx_RefNannyFinishContext();
12399 }
12400 
12401 /* "lupa/_lupa.pyx":705
12402  *     obj._ref = lua.luaL_ref(L, lua.LUA_REGISTRYINDEX)
12403  *
12404  * cdef object lua_object_repr(lua_State* L, bytes encoding):             # <<<<<<<<<<<<<<
12405  *     cdef bytes py_bytes
12406  *     lua_type = lua.lua_type(L, -1)
12407  */
12408 
__pyx_f_4lupa_5_lupa_lua_object_repr(lua_State * __pyx_v_L,PyObject * __pyx_v_encoding)12409 static PyObject *__pyx_f_4lupa_5_lupa_lua_object_repr(lua_State *__pyx_v_L, PyObject *__pyx_v_encoding) {
12410   PyObject *__pyx_v_py_bytes = 0;
12411   int __pyx_v_lua_type;
12412   void *__pyx_v_ptr;
12413   PyObject *__pyx_r = NULL;
12414   __Pyx_RefNannyDeclarations
12415   int __pyx_t_1;
12416   PyObject *__pyx_t_2 = NULL;
12417   PyObject *__pyx_t_3 = NULL;
12418   PyObject *__pyx_t_4 = NULL;
12419   PyObject *__pyx_t_5 = NULL;
12420   char const *__pyx_t_6;
12421   int __pyx_t_7;
12422   PyObject *__pyx_t_8 = NULL;
12423   PyObject *__pyx_t_9 = NULL;
12424   PyObject *__pyx_t_10 = NULL;
12425   int __pyx_lineno = 0;
12426   const char *__pyx_filename = NULL;
12427   int __pyx_clineno = 0;
12428   __Pyx_RefNannySetupContext("lua_object_repr", 0);
12429 
12430   /* "lupa/_lupa.pyx":707
12431  * cdef object lua_object_repr(lua_State* L, bytes encoding):
12432  *     cdef bytes py_bytes
12433  *     lua_type = lua.lua_type(L, -1)             # <<<<<<<<<<<<<<
12434  *     if lua_type in (lua.LUA_TTABLE, lua.LUA_TFUNCTION):
12435  *         ptr = <void*>lua.lua_topointer(L, -1)
12436  */
12437   __pyx_v_lua_type = lua_type(__pyx_v_L, -1);
12438 
12439   /* "lupa/_lupa.pyx":708
12440  *     cdef bytes py_bytes
12441  *     lua_type = lua.lua_type(L, -1)
12442  *     if lua_type in (lua.LUA_TTABLE, lua.LUA_TFUNCTION):             # <<<<<<<<<<<<<<
12443  *         ptr = <void*>lua.lua_topointer(L, -1)
12444  *     elif lua_type in (lua.LUA_TUSERDATA, lua.LUA_TLIGHTUSERDATA):
12445  */
12446   switch (__pyx_v_lua_type) {
12447     case LUA_TTABLE:
12448     case LUA_TFUNCTION:
12449 
12450     /* "lupa/_lupa.pyx":709
12451  *     lua_type = lua.lua_type(L, -1)
12452  *     if lua_type in (lua.LUA_TTABLE, lua.LUA_TFUNCTION):
12453  *         ptr = <void*>lua.lua_topointer(L, -1)             # <<<<<<<<<<<<<<
12454  *     elif lua_type in (lua.LUA_TUSERDATA, lua.LUA_TLIGHTUSERDATA):
12455  *         ptr = <void*>lua.lua_touserdata(L, -1)
12456  */
12457     __pyx_v_ptr = ((void *)lua_topointer(__pyx_v_L, -1));
12458 
12459     /* "lupa/_lupa.pyx":708
12460  *     cdef bytes py_bytes
12461  *     lua_type = lua.lua_type(L, -1)
12462  *     if lua_type in (lua.LUA_TTABLE, lua.LUA_TFUNCTION):             # <<<<<<<<<<<<<<
12463  *         ptr = <void*>lua.lua_topointer(L, -1)
12464  *     elif lua_type in (lua.LUA_TUSERDATA, lua.LUA_TLIGHTUSERDATA):
12465  */
12466     break;
12467     case LUA_TUSERDATA:
12468 
12469     /* "lupa/_lupa.pyx":710
12470  *     if lua_type in (lua.LUA_TTABLE, lua.LUA_TFUNCTION):
12471  *         ptr = <void*>lua.lua_topointer(L, -1)
12472  *     elif lua_type in (lua.LUA_TUSERDATA, lua.LUA_TLIGHTUSERDATA):             # <<<<<<<<<<<<<<
12473  *         ptr = <void*>lua.lua_touserdata(L, -1)
12474  *     elif lua_type == lua.LUA_TTHREAD:
12475  */
12476     case LUA_TLIGHTUSERDATA:
12477 
12478     /* "lupa/_lupa.pyx":711
12479  *         ptr = <void*>lua.lua_topointer(L, -1)
12480  *     elif lua_type in (lua.LUA_TUSERDATA, lua.LUA_TLIGHTUSERDATA):
12481  *         ptr = <void*>lua.lua_touserdata(L, -1)             # <<<<<<<<<<<<<<
12482  *     elif lua_type == lua.LUA_TTHREAD:
12483  *         ptr = <void*>lua.lua_tothread(L, -1)
12484  */
12485     __pyx_v_ptr = ((void *)lua_touserdata(__pyx_v_L, -1));
12486 
12487     /* "lupa/_lupa.pyx":710
12488  *     if lua_type in (lua.LUA_TTABLE, lua.LUA_TFUNCTION):
12489  *         ptr = <void*>lua.lua_topointer(L, -1)
12490  *     elif lua_type in (lua.LUA_TUSERDATA, lua.LUA_TLIGHTUSERDATA):             # <<<<<<<<<<<<<<
12491  *         ptr = <void*>lua.lua_touserdata(L, -1)
12492  *     elif lua_type == lua.LUA_TTHREAD:
12493  */
12494     break;
12495     case LUA_TTHREAD:
12496 
12497     /* "lupa/_lupa.pyx":713
12498  *         ptr = <void*>lua.lua_touserdata(L, -1)
12499  *     elif lua_type == lua.LUA_TTHREAD:
12500  *         ptr = <void*>lua.lua_tothread(L, -1)             # <<<<<<<<<<<<<<
12501  *     else:
12502  *         ptr = NULL
12503  */
12504     __pyx_v_ptr = ((void *)lua_tothread(__pyx_v_L, -1));
12505 
12506     /* "lupa/_lupa.pyx":712
12507  *     elif lua_type in (lua.LUA_TUSERDATA, lua.LUA_TLIGHTUSERDATA):
12508  *         ptr = <void*>lua.lua_touserdata(L, -1)
12509  *     elif lua_type == lua.LUA_TTHREAD:             # <<<<<<<<<<<<<<
12510  *         ptr = <void*>lua.lua_tothread(L, -1)
12511  *     else:
12512  */
12513     break;
12514     default:
12515 
12516     /* "lupa/_lupa.pyx":715
12517  *         ptr = <void*>lua.lua_tothread(L, -1)
12518  *     else:
12519  *         ptr = NULL             # <<<<<<<<<<<<<<
12520  *     if ptr:
12521  *         py_bytes = PyBytes_FromFormat(
12522  */
12523     __pyx_v_ptr = NULL;
12524     break;
12525   }
12526 
12527   /* "lupa/_lupa.pyx":716
12528  *     else:
12529  *         ptr = NULL
12530  *     if ptr:             # <<<<<<<<<<<<<<
12531  *         py_bytes = PyBytes_FromFormat(
12532  *             "<Lua %s at %p>", lua.lua_typename(L, lua_type), ptr)
12533  */
12534   __pyx_t_1 = (__pyx_v_ptr != 0);
12535   if (__pyx_t_1) {
12536 
12537     /* "lupa/_lupa.pyx":717
12538  *         ptr = NULL
12539  *     if ptr:
12540  *         py_bytes = PyBytes_FromFormat(             # <<<<<<<<<<<<<<
12541  *             "<Lua %s at %p>", lua.lua_typename(L, lua_type), ptr)
12542  *     else:
12543  */
12544     __pyx_t_2 = PyBytes_FromFormat(((char *)"<Lua %s at %p>"), lua_typename(__pyx_v_L, __pyx_v_lua_type), __pyx_v_ptr); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 717, __pyx_L1_error)
12545     __Pyx_GOTREF(__pyx_t_2);
12546     __pyx_v_py_bytes = ((PyObject*)__pyx_t_2);
12547     __pyx_t_2 = 0;
12548 
12549     /* "lupa/_lupa.pyx":716
12550  *     else:
12551  *         ptr = NULL
12552  *     if ptr:             # <<<<<<<<<<<<<<
12553  *         py_bytes = PyBytes_FromFormat(
12554  *             "<Lua %s at %p>", lua.lua_typename(L, lua_type), ptr)
12555  */
12556     goto __pyx_L3;
12557   }
12558 
12559   /* "lupa/_lupa.pyx":720
12560  *             "<Lua %s at %p>", lua.lua_typename(L, lua_type), ptr)
12561  *     else:
12562  *         py_bytes = PyBytes_FromFormat(             # <<<<<<<<<<<<<<
12563  *             "<Lua %s>", lua.lua_typename(L, lua_type))
12564  *     try:
12565  */
12566   /*else*/ {
12567 
12568     /* "lupa/_lupa.pyx":721
12569  *     else:
12570  *         py_bytes = PyBytes_FromFormat(
12571  *             "<Lua %s>", lua.lua_typename(L, lua_type))             # <<<<<<<<<<<<<<
12572  *     try:
12573  *         return py_bytes.decode(encoding)
12574  */
12575     __pyx_t_2 = PyBytes_FromFormat(((char *)"<Lua %s>"), lua_typename(__pyx_v_L, __pyx_v_lua_type)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 720, __pyx_L1_error)
12576     __Pyx_GOTREF(__pyx_t_2);
12577     __pyx_v_py_bytes = ((PyObject*)__pyx_t_2);
12578     __pyx_t_2 = 0;
12579   }
12580   __pyx_L3:;
12581 
12582   /* "lupa/_lupa.pyx":722
12583  *         py_bytes = PyBytes_FromFormat(
12584  *             "<Lua %s>", lua.lua_typename(L, lua_type))
12585  *     try:             # <<<<<<<<<<<<<<
12586  *         return py_bytes.decode(encoding)
12587  *     except UnicodeDecodeError:
12588  */
12589   {
12590     __Pyx_PyThreadState_declare
12591     __Pyx_PyThreadState_assign
12592     __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
12593     __Pyx_XGOTREF(__pyx_t_3);
12594     __Pyx_XGOTREF(__pyx_t_4);
12595     __Pyx_XGOTREF(__pyx_t_5);
12596     /*try:*/ {
12597 
12598       /* "lupa/_lupa.pyx":723
12599  *             "<Lua %s>", lua.lua_typename(L, lua_type))
12600  *     try:
12601  *         return py_bytes.decode(encoding)             # <<<<<<<<<<<<<<
12602  *     except UnicodeDecodeError:
12603  *         # safe 'decode'
12604  */
12605       __Pyx_XDECREF(__pyx_r);
12606       if (unlikely(__pyx_v_py_bytes == Py_None)) {
12607         PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "decode");
12608         __PYX_ERR(0, 723, __pyx_L4_error)
12609       }
12610       if (unlikely(__pyx_v_encoding == Py_None)) {
12611         PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
12612         __PYX_ERR(0, 723, __pyx_L4_error)
12613       }
12614       __pyx_t_6 = __Pyx_PyBytes_AsString(__pyx_v_encoding); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) __PYX_ERR(0, 723, __pyx_L4_error)
12615       __pyx_t_2 = __Pyx_decode_bytes(__pyx_v_py_bytes, 0, PY_SSIZE_T_MAX, __pyx_t_6, NULL, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 723, __pyx_L4_error)
12616       __Pyx_GOTREF(__pyx_t_2);
12617       __pyx_r = __pyx_t_2;
12618       __pyx_t_2 = 0;
12619       goto __pyx_L8_try_return;
12620 
12621       /* "lupa/_lupa.pyx":722
12622  *         py_bytes = PyBytes_FromFormat(
12623  *             "<Lua %s>", lua.lua_typename(L, lua_type))
12624  *     try:             # <<<<<<<<<<<<<<
12625  *         return py_bytes.decode(encoding)
12626  *     except UnicodeDecodeError:
12627  */
12628     }
12629     __pyx_L4_error:;
12630     __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
12631 
12632     /* "lupa/_lupa.pyx":724
12633  *     try:
12634  *         return py_bytes.decode(encoding)
12635  *     except UnicodeDecodeError:             # <<<<<<<<<<<<<<
12636  *         # safe 'decode'
12637  *         return py_bytes.decode('ISO-8859-1')
12638  */
12639     __pyx_t_7 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_UnicodeDecodeError);
12640     if (__pyx_t_7) {
12641       __Pyx_AddTraceback("lupa._lupa.lua_object_repr", __pyx_clineno, __pyx_lineno, __pyx_filename);
12642       if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_8, &__pyx_t_9) < 0) __PYX_ERR(0, 724, __pyx_L6_except_error)
12643       __Pyx_GOTREF(__pyx_t_2);
12644       __Pyx_GOTREF(__pyx_t_8);
12645       __Pyx_GOTREF(__pyx_t_9);
12646 
12647       /* "lupa/_lupa.pyx":726
12648  *     except UnicodeDecodeError:
12649  *         # safe 'decode'
12650  *         return py_bytes.decode('ISO-8859-1')             # <<<<<<<<<<<<<<
12651  *
12652  *
12653  */
12654       __Pyx_XDECREF(__pyx_r);
12655       if (unlikely(__pyx_v_py_bytes == Py_None)) {
12656         PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "decode");
12657         __PYX_ERR(0, 726, __pyx_L6_except_error)
12658       }
12659       __pyx_t_10 = __Pyx_decode_bytes(__pyx_v_py_bytes, 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeLatin1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 726, __pyx_L6_except_error)
12660       __Pyx_GOTREF(__pyx_t_10);
12661       __pyx_r = __pyx_t_10;
12662       __pyx_t_10 = 0;
12663       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12664       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
12665       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
12666       goto __pyx_L7_except_return;
12667     }
12668     goto __pyx_L6_except_error;
12669     __pyx_L6_except_error:;
12670 
12671     /* "lupa/_lupa.pyx":722
12672  *         py_bytes = PyBytes_FromFormat(
12673  *             "<Lua %s>", lua.lua_typename(L, lua_type))
12674  *     try:             # <<<<<<<<<<<<<<
12675  *         return py_bytes.decode(encoding)
12676  *     except UnicodeDecodeError:
12677  */
12678     __Pyx_XGIVEREF(__pyx_t_3);
12679     __Pyx_XGIVEREF(__pyx_t_4);
12680     __Pyx_XGIVEREF(__pyx_t_5);
12681     __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
12682     goto __pyx_L1_error;
12683     __pyx_L8_try_return:;
12684     __Pyx_XGIVEREF(__pyx_t_3);
12685     __Pyx_XGIVEREF(__pyx_t_4);
12686     __Pyx_XGIVEREF(__pyx_t_5);
12687     __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
12688     goto __pyx_L0;
12689     __pyx_L7_except_return:;
12690     __Pyx_XGIVEREF(__pyx_t_3);
12691     __Pyx_XGIVEREF(__pyx_t_4);
12692     __Pyx_XGIVEREF(__pyx_t_5);
12693     __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
12694     goto __pyx_L0;
12695   }
12696 
12697   /* "lupa/_lupa.pyx":705
12698  *     obj._ref = lua.luaL_ref(L, lua.LUA_REGISTRYINDEX)
12699  *
12700  * cdef object lua_object_repr(lua_State* L, bytes encoding):             # <<<<<<<<<<<<<<
12701  *     cdef bytes py_bytes
12702  *     lua_type = lua.lua_type(L, -1)
12703  */
12704 
12705   /* function exit code */
12706   __pyx_L1_error:;
12707   __Pyx_XDECREF(__pyx_t_2);
12708   __Pyx_XDECREF(__pyx_t_8);
12709   __Pyx_XDECREF(__pyx_t_9);
12710   __Pyx_XDECREF(__pyx_t_10);
12711   __Pyx_AddTraceback("lupa._lupa.lua_object_repr", __pyx_clineno, __pyx_lineno, __pyx_filename);
12712   __pyx_r = 0;
12713   __pyx_L0:;
12714   __Pyx_XDECREF(__pyx_v_py_bytes);
12715   __Pyx_XGIVEREF(__pyx_r);
12716   __Pyx_RefNannyFinishContext();
12717   return __pyx_r;
12718 }
12719 
12720 /* "lupa/_lupa.pyx":733
12721  * @cython.no_gc_clear
12722  * cdef class _LuaTable(_LuaObject):
12723  *     def __iter__(self):             # <<<<<<<<<<<<<<
12724  *         return _LuaIter(self, KEYS)
12725  *
12726  */
12727 
12728 /* Python wrapper */
12729 static PyObject *__pyx_pw_4lupa_5_lupa_9_LuaTable_1__iter__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_4lupa_5_lupa_9_LuaTable_1__iter__(PyObject * __pyx_v_self)12730 static PyObject *__pyx_pw_4lupa_5_lupa_9_LuaTable_1__iter__(PyObject *__pyx_v_self) {
12731   PyObject *__pyx_r = 0;
12732   __Pyx_RefNannyDeclarations
12733   __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
12734   __pyx_r = __pyx_pf_4lupa_5_lupa_9_LuaTable___iter__(((struct __pyx_obj_4lupa_5_lupa__LuaTable *)__pyx_v_self));
12735 
12736   /* function exit code */
12737   __Pyx_RefNannyFinishContext();
12738   return __pyx_r;
12739 }
12740 
__pyx_pf_4lupa_5_lupa_9_LuaTable___iter__(struct __pyx_obj_4lupa_5_lupa__LuaTable * __pyx_v_self)12741 static PyObject *__pyx_pf_4lupa_5_lupa_9_LuaTable___iter__(struct __pyx_obj_4lupa_5_lupa__LuaTable *__pyx_v_self) {
12742   PyObject *__pyx_r = NULL;
12743   __Pyx_RefNannyDeclarations
12744   PyObject *__pyx_t_1 = NULL;
12745   PyObject *__pyx_t_2 = NULL;
12746   int __pyx_lineno = 0;
12747   const char *__pyx_filename = NULL;
12748   int __pyx_clineno = 0;
12749   __Pyx_RefNannySetupContext("__iter__", 0);
12750 
12751   /* "lupa/_lupa.pyx":734
12752  * cdef class _LuaTable(_LuaObject):
12753  *     def __iter__(self):
12754  *         return _LuaIter(self, KEYS)             # <<<<<<<<<<<<<<
12755  *
12756  *     def keys(self):
12757  */
12758   __Pyx_XDECREF(__pyx_r);
12759   __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_e_4lupa_5_lupa_KEYS); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 734, __pyx_L1_error)
12760   __Pyx_GOTREF(__pyx_t_1);
12761   __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 734, __pyx_L1_error)
12762   __Pyx_GOTREF(__pyx_t_2);
12763   __Pyx_INCREF(((PyObject *)__pyx_v_self));
12764   __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
12765   PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_self));
12766   __Pyx_GIVEREF(__pyx_t_1);
12767   PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);
12768   __pyx_t_1 = 0;
12769   __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4lupa_5_lupa__LuaIter), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 734, __pyx_L1_error)
12770   __Pyx_GOTREF(__pyx_t_1);
12771   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12772   __pyx_r = __pyx_t_1;
12773   __pyx_t_1 = 0;
12774   goto __pyx_L0;
12775 
12776   /* "lupa/_lupa.pyx":733
12777  * @cython.no_gc_clear
12778  * cdef class _LuaTable(_LuaObject):
12779  *     def __iter__(self):             # <<<<<<<<<<<<<<
12780  *         return _LuaIter(self, KEYS)
12781  *
12782  */
12783 
12784   /* function exit code */
12785   __pyx_L1_error:;
12786   __Pyx_XDECREF(__pyx_t_1);
12787   __Pyx_XDECREF(__pyx_t_2);
12788   __Pyx_AddTraceback("lupa._lupa._LuaTable.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12789   __pyx_r = NULL;
12790   __pyx_L0:;
12791   __Pyx_XGIVEREF(__pyx_r);
12792   __Pyx_RefNannyFinishContext();
12793   return __pyx_r;
12794 }
12795 
12796 /* "lupa/_lupa.pyx":736
12797  *         return _LuaIter(self, KEYS)
12798  *
12799  *     def keys(self):             # <<<<<<<<<<<<<<
12800  *         """Returns an iterator over the keys of a table that this
12801  *         object represents.  Same as iter(obj).
12802  */
12803 
12804 /* Python wrapper */
12805 static PyObject *__pyx_pw_4lupa_5_lupa_9_LuaTable_3keys(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
12806 static char __pyx_doc_4lupa_5_lupa_9_LuaTable_2keys[] = "_LuaTable.keys(self)\nReturns an iterator over the keys of a table that this\n        object represents.  Same as iter(obj).\n        ";
12807 static PyMethodDef __pyx_mdef_4lupa_5_lupa_9_LuaTable_3keys = {"keys", (PyCFunction)__pyx_pw_4lupa_5_lupa_9_LuaTable_3keys, METH_NOARGS, __pyx_doc_4lupa_5_lupa_9_LuaTable_2keys};
__pyx_pw_4lupa_5_lupa_9_LuaTable_3keys(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)12808 static PyObject *__pyx_pw_4lupa_5_lupa_9_LuaTable_3keys(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
12809   PyObject *__pyx_r = 0;
12810   __Pyx_RefNannyDeclarations
12811   __Pyx_RefNannySetupContext("keys (wrapper)", 0);
12812   __pyx_r = __pyx_pf_4lupa_5_lupa_9_LuaTable_2keys(((struct __pyx_obj_4lupa_5_lupa__LuaTable *)__pyx_v_self));
12813 
12814   /* function exit code */
12815   __Pyx_RefNannyFinishContext();
12816   return __pyx_r;
12817 }
12818 
__pyx_pf_4lupa_5_lupa_9_LuaTable_2keys(struct __pyx_obj_4lupa_5_lupa__LuaTable * __pyx_v_self)12819 static PyObject *__pyx_pf_4lupa_5_lupa_9_LuaTable_2keys(struct __pyx_obj_4lupa_5_lupa__LuaTable *__pyx_v_self) {
12820   PyObject *__pyx_r = NULL;
12821   __Pyx_RefNannyDeclarations
12822   PyObject *__pyx_t_1 = NULL;
12823   PyObject *__pyx_t_2 = NULL;
12824   int __pyx_lineno = 0;
12825   const char *__pyx_filename = NULL;
12826   int __pyx_clineno = 0;
12827   __Pyx_RefNannySetupContext("keys", 0);
12828 
12829   /* "lupa/_lupa.pyx":740
12830  *         object represents.  Same as iter(obj).
12831  *         """
12832  *         return _LuaIter(self, KEYS)             # <<<<<<<<<<<<<<
12833  *
12834  *     def values(self):
12835  */
12836   __Pyx_XDECREF(__pyx_r);
12837   __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_e_4lupa_5_lupa_KEYS); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 740, __pyx_L1_error)
12838   __Pyx_GOTREF(__pyx_t_1);
12839   __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 740, __pyx_L1_error)
12840   __Pyx_GOTREF(__pyx_t_2);
12841   __Pyx_INCREF(((PyObject *)__pyx_v_self));
12842   __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
12843   PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_self));
12844   __Pyx_GIVEREF(__pyx_t_1);
12845   PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);
12846   __pyx_t_1 = 0;
12847   __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4lupa_5_lupa__LuaIter), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 740, __pyx_L1_error)
12848   __Pyx_GOTREF(__pyx_t_1);
12849   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12850   __pyx_r = __pyx_t_1;
12851   __pyx_t_1 = 0;
12852   goto __pyx_L0;
12853 
12854   /* "lupa/_lupa.pyx":736
12855  *         return _LuaIter(self, KEYS)
12856  *
12857  *     def keys(self):             # <<<<<<<<<<<<<<
12858  *         """Returns an iterator over the keys of a table that this
12859  *         object represents.  Same as iter(obj).
12860  */
12861 
12862   /* function exit code */
12863   __pyx_L1_error:;
12864   __Pyx_XDECREF(__pyx_t_1);
12865   __Pyx_XDECREF(__pyx_t_2);
12866   __Pyx_AddTraceback("lupa._lupa._LuaTable.keys", __pyx_clineno, __pyx_lineno, __pyx_filename);
12867   __pyx_r = NULL;
12868   __pyx_L0:;
12869   __Pyx_XGIVEREF(__pyx_r);
12870   __Pyx_RefNannyFinishContext();
12871   return __pyx_r;
12872 }
12873 
12874 /* "lupa/_lupa.pyx":742
12875  *         return _LuaIter(self, KEYS)
12876  *
12877  *     def values(self):             # <<<<<<<<<<<<<<
12878  *         """Returns an iterator over the values of a table that this
12879  *         object represents.
12880  */
12881 
12882 /* Python wrapper */
12883 static PyObject *__pyx_pw_4lupa_5_lupa_9_LuaTable_5values(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
12884 static char __pyx_doc_4lupa_5_lupa_9_LuaTable_4values[] = "_LuaTable.values(self)\nReturns an iterator over the values of a table that this\n        object represents.\n        ";
12885 static PyMethodDef __pyx_mdef_4lupa_5_lupa_9_LuaTable_5values = {"values", (PyCFunction)__pyx_pw_4lupa_5_lupa_9_LuaTable_5values, METH_NOARGS, __pyx_doc_4lupa_5_lupa_9_LuaTable_4values};
__pyx_pw_4lupa_5_lupa_9_LuaTable_5values(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)12886 static PyObject *__pyx_pw_4lupa_5_lupa_9_LuaTable_5values(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
12887   PyObject *__pyx_r = 0;
12888   __Pyx_RefNannyDeclarations
12889   __Pyx_RefNannySetupContext("values (wrapper)", 0);
12890   __pyx_r = __pyx_pf_4lupa_5_lupa_9_LuaTable_4values(((struct __pyx_obj_4lupa_5_lupa__LuaTable *)__pyx_v_self));
12891 
12892   /* function exit code */
12893   __Pyx_RefNannyFinishContext();
12894   return __pyx_r;
12895 }
12896 
__pyx_pf_4lupa_5_lupa_9_LuaTable_4values(struct __pyx_obj_4lupa_5_lupa__LuaTable * __pyx_v_self)12897 static PyObject *__pyx_pf_4lupa_5_lupa_9_LuaTable_4values(struct __pyx_obj_4lupa_5_lupa__LuaTable *__pyx_v_self) {
12898   PyObject *__pyx_r = NULL;
12899   __Pyx_RefNannyDeclarations
12900   PyObject *__pyx_t_1 = NULL;
12901   PyObject *__pyx_t_2 = NULL;
12902   int __pyx_lineno = 0;
12903   const char *__pyx_filename = NULL;
12904   int __pyx_clineno = 0;
12905   __Pyx_RefNannySetupContext("values", 0);
12906 
12907   /* "lupa/_lupa.pyx":746
12908  *         object represents.
12909  *         """
12910  *         return _LuaIter(self, VALUES)             # <<<<<<<<<<<<<<
12911  *
12912  *     def items(self):
12913  */
12914   __Pyx_XDECREF(__pyx_r);
12915   __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_e_4lupa_5_lupa_VALUES); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 746, __pyx_L1_error)
12916   __Pyx_GOTREF(__pyx_t_1);
12917   __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 746, __pyx_L1_error)
12918   __Pyx_GOTREF(__pyx_t_2);
12919   __Pyx_INCREF(((PyObject *)__pyx_v_self));
12920   __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
12921   PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_self));
12922   __Pyx_GIVEREF(__pyx_t_1);
12923   PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);
12924   __pyx_t_1 = 0;
12925   __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4lupa_5_lupa__LuaIter), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 746, __pyx_L1_error)
12926   __Pyx_GOTREF(__pyx_t_1);
12927   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12928   __pyx_r = __pyx_t_1;
12929   __pyx_t_1 = 0;
12930   goto __pyx_L0;
12931 
12932   /* "lupa/_lupa.pyx":742
12933  *         return _LuaIter(self, KEYS)
12934  *
12935  *     def values(self):             # <<<<<<<<<<<<<<
12936  *         """Returns an iterator over the values of a table that this
12937  *         object represents.
12938  */
12939 
12940   /* function exit code */
12941   __pyx_L1_error:;
12942   __Pyx_XDECREF(__pyx_t_1);
12943   __Pyx_XDECREF(__pyx_t_2);
12944   __Pyx_AddTraceback("lupa._lupa._LuaTable.values", __pyx_clineno, __pyx_lineno, __pyx_filename);
12945   __pyx_r = NULL;
12946   __pyx_L0:;
12947   __Pyx_XGIVEREF(__pyx_r);
12948   __Pyx_RefNannyFinishContext();
12949   return __pyx_r;
12950 }
12951 
12952 /* "lupa/_lupa.pyx":748
12953  *         return _LuaIter(self, VALUES)
12954  *
12955  *     def items(self):             # <<<<<<<<<<<<<<
12956  *         """Returns an iterator over the key-value pairs of a table
12957  *         that this object represents.
12958  */
12959 
12960 /* Python wrapper */
12961 static PyObject *__pyx_pw_4lupa_5_lupa_9_LuaTable_7items(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
12962 static char __pyx_doc_4lupa_5_lupa_9_LuaTable_6items[] = "_LuaTable.items(self)\nReturns an iterator over the key-value pairs of a table\n        that this object represents.\n        ";
12963 static PyMethodDef __pyx_mdef_4lupa_5_lupa_9_LuaTable_7items = {"items", (PyCFunction)__pyx_pw_4lupa_5_lupa_9_LuaTable_7items, METH_NOARGS, __pyx_doc_4lupa_5_lupa_9_LuaTable_6items};
__pyx_pw_4lupa_5_lupa_9_LuaTable_7items(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)12964 static PyObject *__pyx_pw_4lupa_5_lupa_9_LuaTable_7items(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
12965   PyObject *__pyx_r = 0;
12966   __Pyx_RefNannyDeclarations
12967   __Pyx_RefNannySetupContext("items (wrapper)", 0);
12968   __pyx_r = __pyx_pf_4lupa_5_lupa_9_LuaTable_6items(((struct __pyx_obj_4lupa_5_lupa__LuaTable *)__pyx_v_self));
12969 
12970   /* function exit code */
12971   __Pyx_RefNannyFinishContext();
12972   return __pyx_r;
12973 }
12974 
__pyx_pf_4lupa_5_lupa_9_LuaTable_6items(struct __pyx_obj_4lupa_5_lupa__LuaTable * __pyx_v_self)12975 static PyObject *__pyx_pf_4lupa_5_lupa_9_LuaTable_6items(struct __pyx_obj_4lupa_5_lupa__LuaTable *__pyx_v_self) {
12976   PyObject *__pyx_r = NULL;
12977   __Pyx_RefNannyDeclarations
12978   PyObject *__pyx_t_1 = NULL;
12979   PyObject *__pyx_t_2 = NULL;
12980   int __pyx_lineno = 0;
12981   const char *__pyx_filename = NULL;
12982   int __pyx_clineno = 0;
12983   __Pyx_RefNannySetupContext("items", 0);
12984 
12985   /* "lupa/_lupa.pyx":752
12986  *         that this object represents.
12987  *         """
12988  *         return _LuaIter(self, ITEMS)             # <<<<<<<<<<<<<<
12989  *
12990  *     def __setattr__(self, name, value):
12991  */
12992   __Pyx_XDECREF(__pyx_r);
12993   __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_e_4lupa_5_lupa_ITEMS); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 752, __pyx_L1_error)
12994   __Pyx_GOTREF(__pyx_t_1);
12995   __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 752, __pyx_L1_error)
12996   __Pyx_GOTREF(__pyx_t_2);
12997   __Pyx_INCREF(((PyObject *)__pyx_v_self));
12998   __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
12999   PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_self));
13000   __Pyx_GIVEREF(__pyx_t_1);
13001   PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);
13002   __pyx_t_1 = 0;
13003   __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4lupa_5_lupa__LuaIter), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 752, __pyx_L1_error)
13004   __Pyx_GOTREF(__pyx_t_1);
13005   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13006   __pyx_r = __pyx_t_1;
13007   __pyx_t_1 = 0;
13008   goto __pyx_L0;
13009 
13010   /* "lupa/_lupa.pyx":748
13011  *         return _LuaIter(self, VALUES)
13012  *
13013  *     def items(self):             # <<<<<<<<<<<<<<
13014  *         """Returns an iterator over the key-value pairs of a table
13015  *         that this object represents.
13016  */
13017 
13018   /* function exit code */
13019   __pyx_L1_error:;
13020   __Pyx_XDECREF(__pyx_t_1);
13021   __Pyx_XDECREF(__pyx_t_2);
13022   __Pyx_AddTraceback("lupa._lupa._LuaTable.items", __pyx_clineno, __pyx_lineno, __pyx_filename);
13023   __pyx_r = NULL;
13024   __pyx_L0:;
13025   __Pyx_XGIVEREF(__pyx_r);
13026   __Pyx_RefNannyFinishContext();
13027   return __pyx_r;
13028 }
13029 
13030 /* "lupa/_lupa.pyx":754
13031  *         return _LuaIter(self, ITEMS)
13032  *
13033  *     def __setattr__(self, name, value):             # <<<<<<<<<<<<<<
13034  *         assert self._runtime is not None
13035  *         if isinstance(name, unicode):
13036  */
13037 
13038 /* Python wrapper */
13039 static int __pyx_pw_4lupa_5_lupa_9_LuaTable_9__setattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_value); /*proto*/
__pyx_pw_4lupa_5_lupa_9_LuaTable_9__setattr__(PyObject * __pyx_v_self,PyObject * __pyx_v_name,PyObject * __pyx_v_value)13040 static int __pyx_pw_4lupa_5_lupa_9_LuaTable_9__setattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_value) {
13041   int __pyx_r;
13042   __Pyx_RefNannyDeclarations
13043   __Pyx_RefNannySetupContext("__setattr__ (wrapper)", 0);
13044   __pyx_r = __pyx_pf_4lupa_5_lupa_9_LuaTable_8__setattr__(((struct __pyx_obj_4lupa_5_lupa__LuaTable *)__pyx_v_self), ((PyObject *)__pyx_v_name), ((PyObject *)__pyx_v_value));
13045 
13046   /* function exit code */
13047   __Pyx_RefNannyFinishContext();
13048   return __pyx_r;
13049 }
13050 
__pyx_pf_4lupa_5_lupa_9_LuaTable_8__setattr__(struct __pyx_obj_4lupa_5_lupa__LuaTable * __pyx_v_self,PyObject * __pyx_v_name,PyObject * __pyx_v_value)13051 static int __pyx_pf_4lupa_5_lupa_9_LuaTable_8__setattr__(struct __pyx_obj_4lupa_5_lupa__LuaTable *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_value) {
13052   int __pyx_r;
13053   __Pyx_RefNannyDeclarations
13054   int __pyx_t_1;
13055   int __pyx_t_2;
13056   PyObject *__pyx_t_3 = NULL;
13057   PyObject *__pyx_t_4 = NULL;
13058   PyObject *__pyx_t_5 = NULL;
13059   int __pyx_t_6;
13060   PyObject *__pyx_t_7 = NULL;
13061   char const *__pyx_t_8;
13062   int __pyx_t_9;
13063   int __pyx_lineno = 0;
13064   const char *__pyx_filename = NULL;
13065   int __pyx_clineno = 0;
13066   __Pyx_RefNannySetupContext("__setattr__", 0);
13067   __Pyx_INCREF(__pyx_v_name);
13068 
13069   /* "lupa/_lupa.pyx":755
13070  *
13071  *     def __setattr__(self, name, value):
13072  *         assert self._runtime is not None             # <<<<<<<<<<<<<<
13073  *         if isinstance(name, unicode):
13074  *             if (<unicode>name).startswith(u'__') and (<unicode>name).endswith(u'__'):
13075  */
13076   #ifndef CYTHON_WITHOUT_ASSERTIONS
13077   if (unlikely(!Py_OptimizeFlag)) {
13078     __pyx_t_1 = (((PyObject *)__pyx_v_self->__pyx_base._runtime) != Py_None);
13079     if (unlikely(!(__pyx_t_1 != 0))) {
13080       PyErr_SetNone(PyExc_AssertionError);
13081       __PYX_ERR(0, 755, __pyx_L1_error)
13082     }
13083   }
13084   #endif
13085 
13086   /* "lupa/_lupa.pyx":756
13087  *     def __setattr__(self, name, value):
13088  *         assert self._runtime is not None
13089  *         if isinstance(name, unicode):             # <<<<<<<<<<<<<<
13090  *             if (<unicode>name).startswith(u'__') and (<unicode>name).endswith(u'__'):
13091  *                 object.__setattr__(self, name, value)
13092  */
13093   __pyx_t_1 = PyUnicode_Check(__pyx_v_name);
13094   __pyx_t_2 = (__pyx_t_1 != 0);
13095   if (__pyx_t_2) {
13096 
13097     /* "lupa/_lupa.pyx":757
13098  *         assert self._runtime is not None
13099  *         if isinstance(name, unicode):
13100  *             if (<unicode>name).startswith(u'__') and (<unicode>name).endswith(u'__'):             # <<<<<<<<<<<<<<
13101  *                 object.__setattr__(self, name, value)
13102  *                 return
13103  */
13104     if (unlikely(__pyx_v_name == Py_None)) {
13105       PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "startswith");
13106       __PYX_ERR(0, 757, __pyx_L1_error)
13107     }
13108     __pyx_t_1 = __Pyx_PyUnicode_Tailmatch(((PyObject*)__pyx_v_name), __pyx_n_u__16, 0, PY_SSIZE_T_MAX, -1); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 757, __pyx_L1_error)
13109     if ((__pyx_t_1 != 0)) {
13110     } else {
13111       __pyx_t_2 = (__pyx_t_1 != 0);
13112       goto __pyx_L5_bool_binop_done;
13113     }
13114     if (unlikely(__pyx_v_name == Py_None)) {
13115       PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "endswith");
13116       __PYX_ERR(0, 757, __pyx_L1_error)
13117     }
13118     __pyx_t_1 = __Pyx_PyUnicode_Tailmatch(((PyObject*)__pyx_v_name), __pyx_n_u__16, 0, PY_SSIZE_T_MAX, 1); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 757, __pyx_L1_error)
13119     __pyx_t_2 = (__pyx_t_1 != 0);
13120     __pyx_L5_bool_binop_done:;
13121     if (__pyx_t_2) {
13122 
13123       /* "lupa/_lupa.pyx":758
13124  *         if isinstance(name, unicode):
13125  *             if (<unicode>name).startswith(u'__') and (<unicode>name).endswith(u'__'):
13126  *                 object.__setattr__(self, name, value)             # <<<<<<<<<<<<<<
13127  *                 return
13128  *             name = (<unicode>name).encode(self._runtime._source_encoding)
13129  */
13130       __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_builtin_object, __pyx_n_s_setattr); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 758, __pyx_L1_error)
13131       __Pyx_GOTREF(__pyx_t_4);
13132       __pyx_t_5 = NULL;
13133       __pyx_t_6 = 0;
13134       if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
13135         __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
13136         if (likely(__pyx_t_5)) {
13137           PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
13138           __Pyx_INCREF(__pyx_t_5);
13139           __Pyx_INCREF(function);
13140           __Pyx_DECREF_SET(__pyx_t_4, function);
13141           __pyx_t_6 = 1;
13142         }
13143       }
13144       #if CYTHON_FAST_PYCALL
13145       if (PyFunction_Check(__pyx_t_4)) {
13146         PyObject *__pyx_temp[4] = {__pyx_t_5, ((PyObject *)__pyx_v_self), __pyx_v_name, __pyx_v_value};
13147         __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 758, __pyx_L1_error)
13148         __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
13149         __Pyx_GOTREF(__pyx_t_3);
13150       } else
13151       #endif
13152       #if CYTHON_FAST_PYCCALL
13153       if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
13154         PyObject *__pyx_temp[4] = {__pyx_t_5, ((PyObject *)__pyx_v_self), __pyx_v_name, __pyx_v_value};
13155         __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 758, __pyx_L1_error)
13156         __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
13157         __Pyx_GOTREF(__pyx_t_3);
13158       } else
13159       #endif
13160       {
13161         __pyx_t_7 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 758, __pyx_L1_error)
13162         __Pyx_GOTREF(__pyx_t_7);
13163         if (__pyx_t_5) {
13164           __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
13165         }
13166         __Pyx_INCREF(((PyObject *)__pyx_v_self));
13167         __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
13168         PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, ((PyObject *)__pyx_v_self));
13169         __Pyx_INCREF(__pyx_v_name);
13170         __Pyx_GIVEREF(__pyx_v_name);
13171         PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_v_name);
13172         __Pyx_INCREF(__pyx_v_value);
13173         __Pyx_GIVEREF(__pyx_v_value);
13174         PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_6, __pyx_v_value);
13175         __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 758, __pyx_L1_error)
13176         __Pyx_GOTREF(__pyx_t_3);
13177         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
13178       }
13179       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
13180       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
13181 
13182       /* "lupa/_lupa.pyx":759
13183  *             if (<unicode>name).startswith(u'__') and (<unicode>name).endswith(u'__'):
13184  *                 object.__setattr__(self, name, value)
13185  *                 return             # <<<<<<<<<<<<<<
13186  *             name = (<unicode>name).encode(self._runtime._source_encoding)
13187  *         elif isinstance(name, bytes) and (<bytes>name).startswith(b'__') and (<bytes>name).endswith(b'__'):
13188  */
13189       __pyx_r = 0;
13190       goto __pyx_L0;
13191 
13192       /* "lupa/_lupa.pyx":757
13193  *         assert self._runtime is not None
13194  *         if isinstance(name, unicode):
13195  *             if (<unicode>name).startswith(u'__') and (<unicode>name).endswith(u'__'):             # <<<<<<<<<<<<<<
13196  *                 object.__setattr__(self, name, value)
13197  *                 return
13198  */
13199     }
13200 
13201     /* "lupa/_lupa.pyx":760
13202  *                 object.__setattr__(self, name, value)
13203  *                 return
13204  *             name = (<unicode>name).encode(self._runtime._source_encoding)             # <<<<<<<<<<<<<<
13205  *         elif isinstance(name, bytes) and (<bytes>name).startswith(b'__') and (<bytes>name).endswith(b'__'):
13206  *             object.__setattr__(self, name, value)
13207  */
13208     if (unlikely(__pyx_v_name == Py_None)) {
13209       PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode");
13210       __PYX_ERR(0, 760, __pyx_L1_error)
13211     }
13212     if (unlikely(__pyx_v_self->__pyx_base._runtime->_source_encoding == Py_None)) {
13213       PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
13214       __PYX_ERR(0, 760, __pyx_L1_error)
13215     }
13216     __pyx_t_8 = __Pyx_PyBytes_AsString(__pyx_v_self->__pyx_base._runtime->_source_encoding); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) __PYX_ERR(0, 760, __pyx_L1_error)
13217     __pyx_t_3 = PyUnicode_AsEncodedString(((PyObject*)__pyx_v_name), __pyx_t_8, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 760, __pyx_L1_error)
13218     __Pyx_GOTREF(__pyx_t_3);
13219     __Pyx_DECREF_SET(__pyx_v_name, __pyx_t_3);
13220     __pyx_t_3 = 0;
13221 
13222     /* "lupa/_lupa.pyx":756
13223  *     def __setattr__(self, name, value):
13224  *         assert self._runtime is not None
13225  *         if isinstance(name, unicode):             # <<<<<<<<<<<<<<
13226  *             if (<unicode>name).startswith(u'__') and (<unicode>name).endswith(u'__'):
13227  *                 object.__setattr__(self, name, value)
13228  */
13229     goto __pyx_L3;
13230   }
13231 
13232   /* "lupa/_lupa.pyx":761
13233  *                 return
13234  *             name = (<unicode>name).encode(self._runtime._source_encoding)
13235  *         elif isinstance(name, bytes) and (<bytes>name).startswith(b'__') and (<bytes>name).endswith(b'__'):             # <<<<<<<<<<<<<<
13236  *             object.__setattr__(self, name, value)
13237  *             return
13238  */
13239   __pyx_t_1 = PyBytes_Check(__pyx_v_name);
13240   __pyx_t_9 = (__pyx_t_1 != 0);
13241   if (__pyx_t_9) {
13242   } else {
13243     __pyx_t_2 = __pyx_t_9;
13244     goto __pyx_L7_bool_binop_done;
13245   }
13246   if (unlikely(__pyx_v_name == Py_None)) {
13247     PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "startswith");
13248     __PYX_ERR(0, 761, __pyx_L1_error)
13249   }
13250   __pyx_t_9 = __Pyx_PyBytes_Tailmatch(((PyObject*)__pyx_v_name), __pyx_n_b__16, 0, PY_SSIZE_T_MAX, -1); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 761, __pyx_L1_error)
13251   if ((__pyx_t_9 != 0)) {
13252   } else {
13253     __pyx_t_2 = (__pyx_t_9 != 0);
13254     goto __pyx_L7_bool_binop_done;
13255   }
13256   if (unlikely(__pyx_v_name == Py_None)) {
13257     PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "endswith");
13258     __PYX_ERR(0, 761, __pyx_L1_error)
13259   }
13260   __pyx_t_9 = __Pyx_PyBytes_Tailmatch(((PyObject*)__pyx_v_name), __pyx_n_b__16, 0, PY_SSIZE_T_MAX, 1); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 761, __pyx_L1_error)
13261   __pyx_t_2 = (__pyx_t_9 != 0);
13262   __pyx_L7_bool_binop_done:;
13263   if (__pyx_t_2) {
13264 
13265     /* "lupa/_lupa.pyx":762
13266  *             name = (<unicode>name).encode(self._runtime._source_encoding)
13267  *         elif isinstance(name, bytes) and (<bytes>name).startswith(b'__') and (<bytes>name).endswith(b'__'):
13268  *             object.__setattr__(self, name, value)             # <<<<<<<<<<<<<<
13269  *             return
13270  *         self._setitem(name, value)
13271  */
13272     __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_builtin_object, __pyx_n_s_setattr); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 762, __pyx_L1_error)
13273     __Pyx_GOTREF(__pyx_t_4);
13274     __pyx_t_7 = NULL;
13275     __pyx_t_6 = 0;
13276     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
13277       __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4);
13278       if (likely(__pyx_t_7)) {
13279         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
13280         __Pyx_INCREF(__pyx_t_7);
13281         __Pyx_INCREF(function);
13282         __Pyx_DECREF_SET(__pyx_t_4, function);
13283         __pyx_t_6 = 1;
13284       }
13285     }
13286     #if CYTHON_FAST_PYCALL
13287     if (PyFunction_Check(__pyx_t_4)) {
13288       PyObject *__pyx_temp[4] = {__pyx_t_7, ((PyObject *)__pyx_v_self), __pyx_v_name, __pyx_v_value};
13289       __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 762, __pyx_L1_error)
13290       __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
13291       __Pyx_GOTREF(__pyx_t_3);
13292     } else
13293     #endif
13294     #if CYTHON_FAST_PYCCALL
13295     if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
13296       PyObject *__pyx_temp[4] = {__pyx_t_7, ((PyObject *)__pyx_v_self), __pyx_v_name, __pyx_v_value};
13297       __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 762, __pyx_L1_error)
13298       __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
13299       __Pyx_GOTREF(__pyx_t_3);
13300     } else
13301     #endif
13302     {
13303       __pyx_t_5 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 762, __pyx_L1_error)
13304       __Pyx_GOTREF(__pyx_t_5);
13305       if (__pyx_t_7) {
13306         __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_7); __pyx_t_7 = NULL;
13307       }
13308       __Pyx_INCREF(((PyObject *)__pyx_v_self));
13309       __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
13310       PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_6, ((PyObject *)__pyx_v_self));
13311       __Pyx_INCREF(__pyx_v_name);
13312       __Pyx_GIVEREF(__pyx_v_name);
13313       PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_6, __pyx_v_name);
13314       __Pyx_INCREF(__pyx_v_value);
13315       __Pyx_GIVEREF(__pyx_v_value);
13316       PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_6, __pyx_v_value);
13317       __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 762, __pyx_L1_error)
13318       __Pyx_GOTREF(__pyx_t_3);
13319       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
13320     }
13321     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
13322     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
13323 
13324     /* "lupa/_lupa.pyx":763
13325  *         elif isinstance(name, bytes) and (<bytes>name).startswith(b'__') and (<bytes>name).endswith(b'__'):
13326  *             object.__setattr__(self, name, value)
13327  *             return             # <<<<<<<<<<<<<<
13328  *         self._setitem(name, value)
13329  *
13330  */
13331     __pyx_r = 0;
13332     goto __pyx_L0;
13333 
13334     /* "lupa/_lupa.pyx":761
13335  *                 return
13336  *             name = (<unicode>name).encode(self._runtime._source_encoding)
13337  *         elif isinstance(name, bytes) and (<bytes>name).startswith(b'__') and (<bytes>name).endswith(b'__'):             # <<<<<<<<<<<<<<
13338  *             object.__setattr__(self, name, value)
13339  *             return
13340  */
13341   }
13342   __pyx_L3:;
13343 
13344   /* "lupa/_lupa.pyx":764
13345  *             object.__setattr__(self, name, value)
13346  *             return
13347  *         self._setitem(name, value)             # <<<<<<<<<<<<<<
13348  *
13349  *     def __setitem__(self, index_or_name, value):
13350  */
13351   __pyx_t_6 = __pyx_f_4lupa_5_lupa_9_LuaTable__setitem(__pyx_v_self, __pyx_v_name, __pyx_v_value); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 764, __pyx_L1_error)
13352 
13353   /* "lupa/_lupa.pyx":754
13354  *         return _LuaIter(self, ITEMS)
13355  *
13356  *     def __setattr__(self, name, value):             # <<<<<<<<<<<<<<
13357  *         assert self._runtime is not None
13358  *         if isinstance(name, unicode):
13359  */
13360 
13361   /* function exit code */
13362   __pyx_r = 0;
13363   goto __pyx_L0;
13364   __pyx_L1_error:;
13365   __Pyx_XDECREF(__pyx_t_3);
13366   __Pyx_XDECREF(__pyx_t_4);
13367   __Pyx_XDECREF(__pyx_t_5);
13368   __Pyx_XDECREF(__pyx_t_7);
13369   __Pyx_AddTraceback("lupa._lupa._LuaTable.__setattr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
13370   __pyx_r = -1;
13371   __pyx_L0:;
13372   __Pyx_XDECREF(__pyx_v_name);
13373   __Pyx_RefNannyFinishContext();
13374   return __pyx_r;
13375 }
13376 
13377 /* "lupa/_lupa.pyx":766
13378  *         self._setitem(name, value)
13379  *
13380  *     def __setitem__(self, index_or_name, value):             # <<<<<<<<<<<<<<
13381  *         self._setitem(index_or_name, value)
13382  *
13383  */
13384 
13385 /* Python wrapper */
13386 static int __pyx_pw_4lupa_5_lupa_9_LuaTable_11__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index_or_name, PyObject *__pyx_v_value); /*proto*/
__pyx_pw_4lupa_5_lupa_9_LuaTable_11__setitem__(PyObject * __pyx_v_self,PyObject * __pyx_v_index_or_name,PyObject * __pyx_v_value)13387 static int __pyx_pw_4lupa_5_lupa_9_LuaTable_11__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index_or_name, PyObject *__pyx_v_value) {
13388   int __pyx_r;
13389   __Pyx_RefNannyDeclarations
13390   __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
13391   __pyx_r = __pyx_pf_4lupa_5_lupa_9_LuaTable_10__setitem__(((struct __pyx_obj_4lupa_5_lupa__LuaTable *)__pyx_v_self), ((PyObject *)__pyx_v_index_or_name), ((PyObject *)__pyx_v_value));
13392 
13393   /* function exit code */
13394   __Pyx_RefNannyFinishContext();
13395   return __pyx_r;
13396 }
13397 
__pyx_pf_4lupa_5_lupa_9_LuaTable_10__setitem__(struct __pyx_obj_4lupa_5_lupa__LuaTable * __pyx_v_self,PyObject * __pyx_v_index_or_name,PyObject * __pyx_v_value)13398 static int __pyx_pf_4lupa_5_lupa_9_LuaTable_10__setitem__(struct __pyx_obj_4lupa_5_lupa__LuaTable *__pyx_v_self, PyObject *__pyx_v_index_or_name, PyObject *__pyx_v_value) {
13399   int __pyx_r;
13400   __Pyx_RefNannyDeclarations
13401   int __pyx_t_1;
13402   int __pyx_lineno = 0;
13403   const char *__pyx_filename = NULL;
13404   int __pyx_clineno = 0;
13405   __Pyx_RefNannySetupContext("__setitem__", 0);
13406 
13407   /* "lupa/_lupa.pyx":767
13408  *
13409  *     def __setitem__(self, index_or_name, value):
13410  *         self._setitem(index_or_name, value)             # <<<<<<<<<<<<<<
13411  *
13412  *     @cython.final
13413  */
13414   __pyx_t_1 = __pyx_f_4lupa_5_lupa_9_LuaTable__setitem(__pyx_v_self, __pyx_v_index_or_name, __pyx_v_value); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 767, __pyx_L1_error)
13415 
13416   /* "lupa/_lupa.pyx":766
13417  *         self._setitem(name, value)
13418  *
13419  *     def __setitem__(self, index_or_name, value):             # <<<<<<<<<<<<<<
13420  *         self._setitem(index_or_name, value)
13421  *
13422  */
13423 
13424   /* function exit code */
13425   __pyx_r = 0;
13426   goto __pyx_L0;
13427   __pyx_L1_error:;
13428   __Pyx_AddTraceback("lupa._lupa._LuaTable.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
13429   __pyx_r = -1;
13430   __pyx_L0:;
13431   __Pyx_RefNannyFinishContext();
13432   return __pyx_r;
13433 }
13434 
13435 /* "lupa/_lupa.pyx":770
13436  *
13437  *     @cython.final
13438  *     cdef int _setitem(self, name, value) except -1:             # <<<<<<<<<<<<<<
13439  *         cdef lua_State* L = self._state
13440  *         lock_runtime(self._runtime)
13441  */
13442 
__pyx_f_4lupa_5_lupa_9_LuaTable__setitem(struct __pyx_obj_4lupa_5_lupa__LuaTable * __pyx_v_self,PyObject * __pyx_v_name,PyObject * __pyx_v_value)13443 static int __pyx_f_4lupa_5_lupa_9_LuaTable__setitem(struct __pyx_obj_4lupa_5_lupa__LuaTable *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_value) {
13444   lua_State *__pyx_v_L;
13445   int __pyx_v_old_top;
13446   int __pyx_r;
13447   __Pyx_RefNannyDeclarations
13448   lua_State *__pyx_t_1;
13449   PyObject *__pyx_t_2 = NULL;
13450   int __pyx_t_3;
13451   struct __pyx_opt_args_4lupa_5_lupa_py_to_lua __pyx_t_4;
13452   int __pyx_t_5;
13453   char const *__pyx_t_6;
13454   PyObject *__pyx_t_7 = NULL;
13455   PyObject *__pyx_t_8 = NULL;
13456   PyObject *__pyx_t_9 = NULL;
13457   PyObject *__pyx_t_10 = NULL;
13458   PyObject *__pyx_t_11 = NULL;
13459   PyObject *__pyx_t_12 = NULL;
13460   int __pyx_lineno = 0;
13461   const char *__pyx_filename = NULL;
13462   int __pyx_clineno = 0;
13463   __Pyx_RefNannySetupContext("_setitem", 0);
13464 
13465   /* "lupa/_lupa.pyx":771
13466  *     @cython.final
13467  *     cdef int _setitem(self, name, value) except -1:
13468  *         cdef lua_State* L = self._state             # <<<<<<<<<<<<<<
13469  *         lock_runtime(self._runtime)
13470  *         old_top = lua.lua_gettop(L)
13471  */
13472   __pyx_t_1 = __pyx_v_self->__pyx_base._state;
13473   __pyx_v_L = __pyx_t_1;
13474 
13475   /* "lupa/_lupa.pyx":772
13476  *     cdef int _setitem(self, name, value) except -1:
13477  *         cdef lua_State* L = self._state
13478  *         lock_runtime(self._runtime)             # <<<<<<<<<<<<<<
13479  *         old_top = lua.lua_gettop(L)
13480  *         try:
13481  */
13482   __pyx_t_2 = ((PyObject *)__pyx_v_self->__pyx_base._runtime);
13483   __Pyx_INCREF(__pyx_t_2);
13484   __pyx_t_3 = __pyx_f_4lupa_5_lupa_lock_runtime(((struct __pyx_obj_4lupa_5_lupa_LuaRuntime *)__pyx_t_2)); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 772, __pyx_L1_error)
13485   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13486 
13487   /* "lupa/_lupa.pyx":773
13488  *         cdef lua_State* L = self._state
13489  *         lock_runtime(self._runtime)
13490  *         old_top = lua.lua_gettop(L)             # <<<<<<<<<<<<<<
13491  *         try:
13492  *             self.push_lua_object()
13493  */
13494   __pyx_v_old_top = lua_gettop(__pyx_v_L);
13495 
13496   /* "lupa/_lupa.pyx":774
13497  *         lock_runtime(self._runtime)
13498  *         old_top = lua.lua_gettop(L)
13499  *         try:             # <<<<<<<<<<<<<<
13500  *             self.push_lua_object()
13501  *             # table[nil] fails, so map None -> python.none for Lua tables
13502  */
13503   /*try:*/ {
13504 
13505     /* "lupa/_lupa.pyx":775
13506  *         old_top = lua.lua_gettop(L)
13507  *         try:
13508  *             self.push_lua_object()             # <<<<<<<<<<<<<<
13509  *             # table[nil] fails, so map None -> python.none for Lua tables
13510  *             py_to_lua(self._runtime, L, name, wrap_none=True)
13511  */
13512     __pyx_t_3 = __pyx_f_4lupa_5_lupa_10_LuaObject_push_lua_object(((struct __pyx_obj_4lupa_5_lupa__LuaObject *)__pyx_v_self)); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 775, __pyx_L4_error)
13513 
13514     /* "lupa/_lupa.pyx":777
13515  *             self.push_lua_object()
13516  *             # table[nil] fails, so map None -> python.none for Lua tables
13517  *             py_to_lua(self._runtime, L, name, wrap_none=True)             # <<<<<<<<<<<<<<
13518  *             py_to_lua(self._runtime, L, value)
13519  *             lua.lua_settable(L, -3)
13520  */
13521     __pyx_t_2 = ((PyObject *)__pyx_v_self->__pyx_base._runtime);
13522     __Pyx_INCREF(__pyx_t_2);
13523     __pyx_t_4.__pyx_n = 1;
13524     __pyx_t_4.wrap_none = 1;
13525     __pyx_t_3 = __pyx_f_4lupa_5_lupa_py_to_lua(((struct __pyx_obj_4lupa_5_lupa_LuaRuntime *)__pyx_t_2), __pyx_v_L, __pyx_v_name, &__pyx_t_4); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 777, __pyx_L4_error)
13526     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13527 
13528     /* "lupa/_lupa.pyx":778
13529  *             # table[nil] fails, so map None -> python.none for Lua tables
13530  *             py_to_lua(self._runtime, L, name, wrap_none=True)
13531  *             py_to_lua(self._runtime, L, value)             # <<<<<<<<<<<<<<
13532  *             lua.lua_settable(L, -3)
13533  *         finally:
13534  */
13535     __pyx_t_2 = ((PyObject *)__pyx_v_self->__pyx_base._runtime);
13536     __Pyx_INCREF(__pyx_t_2);
13537     __pyx_t_3 = __pyx_f_4lupa_5_lupa_py_to_lua(((struct __pyx_obj_4lupa_5_lupa_LuaRuntime *)__pyx_t_2), __pyx_v_L, __pyx_v_value, NULL); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 778, __pyx_L4_error)
13538     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13539 
13540     /* "lupa/_lupa.pyx":779
13541  *             py_to_lua(self._runtime, L, name, wrap_none=True)
13542  *             py_to_lua(self._runtime, L, value)
13543  *             lua.lua_settable(L, -3)             # <<<<<<<<<<<<<<
13544  *         finally:
13545  *             lua.lua_settop(L, old_top)
13546  */
13547     lua_settable(__pyx_v_L, -3);
13548   }
13549 
13550   /* "lupa/_lupa.pyx":781
13551  *             lua.lua_settable(L, -3)
13552  *         finally:
13553  *             lua.lua_settop(L, old_top)             # <<<<<<<<<<<<<<
13554  *             unlock_runtime(self._runtime)
13555  *         return 0
13556  */
13557   /*finally:*/ {
13558     /*normal exit:*/{
13559       lua_settop(__pyx_v_L, __pyx_v_old_top);
13560 
13561       /* "lupa/_lupa.pyx":782
13562  *         finally:
13563  *             lua.lua_settop(L, old_top)
13564  *             unlock_runtime(self._runtime)             # <<<<<<<<<<<<<<
13565  *         return 0
13566  *
13567  */
13568       __pyx_t_2 = ((PyObject *)__pyx_v_self->__pyx_base._runtime);
13569       __Pyx_INCREF(__pyx_t_2);
13570       __pyx_f_4lupa_5_lupa_unlock_runtime(((struct __pyx_obj_4lupa_5_lupa_LuaRuntime *)__pyx_t_2));
13571       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13572       goto __pyx_L5;
13573     }
13574     __pyx_L4_error:;
13575     /*exception exit:*/{
13576       __Pyx_PyThreadState_declare
13577       __Pyx_PyThreadState_assign
13578       __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
13579       __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
13580       if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
13581       if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9) < 0)) __Pyx_ErrFetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
13582       __Pyx_XGOTREF(__pyx_t_7);
13583       __Pyx_XGOTREF(__pyx_t_8);
13584       __Pyx_XGOTREF(__pyx_t_9);
13585       __Pyx_XGOTREF(__pyx_t_10);
13586       __Pyx_XGOTREF(__pyx_t_11);
13587       __Pyx_XGOTREF(__pyx_t_12);
13588       __pyx_t_3 = __pyx_lineno; __pyx_t_5 = __pyx_clineno; __pyx_t_6 = __pyx_filename;
13589       {
13590 
13591         /* "lupa/_lupa.pyx":781
13592  *             lua.lua_settable(L, -3)
13593  *         finally:
13594  *             lua.lua_settop(L, old_top)             # <<<<<<<<<<<<<<
13595  *             unlock_runtime(self._runtime)
13596  *         return 0
13597  */
13598         lua_settop(__pyx_v_L, __pyx_v_old_top);
13599 
13600         /* "lupa/_lupa.pyx":782
13601  *         finally:
13602  *             lua.lua_settop(L, old_top)
13603  *             unlock_runtime(self._runtime)             # <<<<<<<<<<<<<<
13604  *         return 0
13605  *
13606  */
13607         __pyx_t_2 = ((PyObject *)__pyx_v_self->__pyx_base._runtime);
13608         __Pyx_INCREF(__pyx_t_2);
13609         __pyx_f_4lupa_5_lupa_unlock_runtime(((struct __pyx_obj_4lupa_5_lupa_LuaRuntime *)__pyx_t_2));
13610         __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13611       }
13612       if (PY_MAJOR_VERSION >= 3) {
13613         __Pyx_XGIVEREF(__pyx_t_10);
13614         __Pyx_XGIVEREF(__pyx_t_11);
13615         __Pyx_XGIVEREF(__pyx_t_12);
13616         __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
13617       }
13618       __Pyx_XGIVEREF(__pyx_t_7);
13619       __Pyx_XGIVEREF(__pyx_t_8);
13620       __Pyx_XGIVEREF(__pyx_t_9);
13621       __Pyx_ErrRestore(__pyx_t_7, __pyx_t_8, __pyx_t_9);
13622       __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
13623       __pyx_lineno = __pyx_t_3; __pyx_clineno = __pyx_t_5; __pyx_filename = __pyx_t_6;
13624       goto __pyx_L1_error;
13625     }
13626     __pyx_L5:;
13627   }
13628 
13629   /* "lupa/_lupa.pyx":783
13630  *             lua.lua_settop(L, old_top)
13631  *             unlock_runtime(self._runtime)
13632  *         return 0             # <<<<<<<<<<<<<<
13633  *
13634  *     def __delattr__(self, item):
13635  */
13636   __pyx_r = 0;
13637   goto __pyx_L0;
13638 
13639   /* "lupa/_lupa.pyx":770
13640  *
13641  *     @cython.final
13642  *     cdef int _setitem(self, name, value) except -1:             # <<<<<<<<<<<<<<
13643  *         cdef lua_State* L = self._state
13644  *         lock_runtime(self._runtime)
13645  */
13646 
13647   /* function exit code */
13648   __pyx_L1_error:;
13649   __Pyx_XDECREF(__pyx_t_2);
13650   __Pyx_AddTraceback("lupa._lupa._LuaTable._setitem", __pyx_clineno, __pyx_lineno, __pyx_filename);
13651   __pyx_r = -1;
13652   __pyx_L0:;
13653   __Pyx_RefNannyFinishContext();
13654   return __pyx_r;
13655 }
13656 
13657 /* "lupa/_lupa.pyx":785
13658  *         return 0
13659  *
13660  *     def __delattr__(self, item):             # <<<<<<<<<<<<<<
13661  *         assert self._runtime is not None
13662  *         if isinstance(item, unicode):
13663  */
13664 
13665 /* Python wrapper */
13666 static int __pyx_pw_4lupa_5_lupa_9_LuaTable_13__delattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/
__pyx_pw_4lupa_5_lupa_9_LuaTable_13__delattr__(PyObject * __pyx_v_self,PyObject * __pyx_v_item)13667 static int __pyx_pw_4lupa_5_lupa_9_LuaTable_13__delattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_item) {
13668   int __pyx_r;
13669   __Pyx_RefNannyDeclarations
13670   __Pyx_RefNannySetupContext("__delattr__ (wrapper)", 0);
13671   __pyx_r = __pyx_pf_4lupa_5_lupa_9_LuaTable_12__delattr__(((struct __pyx_obj_4lupa_5_lupa__LuaTable *)__pyx_v_self), ((PyObject *)__pyx_v_item));
13672 
13673   /* function exit code */
13674   __Pyx_RefNannyFinishContext();
13675   return __pyx_r;
13676 }
13677 
__pyx_pf_4lupa_5_lupa_9_LuaTable_12__delattr__(struct __pyx_obj_4lupa_5_lupa__LuaTable * __pyx_v_self,PyObject * __pyx_v_item)13678 static int __pyx_pf_4lupa_5_lupa_9_LuaTable_12__delattr__(struct __pyx_obj_4lupa_5_lupa__LuaTable *__pyx_v_self, PyObject *__pyx_v_item) {
13679   int __pyx_r;
13680   __Pyx_RefNannyDeclarations
13681   int __pyx_t_1;
13682   int __pyx_t_2;
13683   PyObject *__pyx_t_3 = NULL;
13684   PyObject *__pyx_t_4 = NULL;
13685   PyObject *__pyx_t_5 = NULL;
13686   int __pyx_t_6;
13687   PyObject *__pyx_t_7 = NULL;
13688   char const *__pyx_t_8;
13689   int __pyx_t_9;
13690   int __pyx_lineno = 0;
13691   const char *__pyx_filename = NULL;
13692   int __pyx_clineno = 0;
13693   __Pyx_RefNannySetupContext("__delattr__", 0);
13694   __Pyx_INCREF(__pyx_v_item);
13695 
13696   /* "lupa/_lupa.pyx":786
13697  *
13698  *     def __delattr__(self, item):
13699  *         assert self._runtime is not None             # <<<<<<<<<<<<<<
13700  *         if isinstance(item, unicode):
13701  *             if (<unicode>item).startswith(u'__') and (<unicode>item).endswith(u'__'):
13702  */
13703   #ifndef CYTHON_WITHOUT_ASSERTIONS
13704   if (unlikely(!Py_OptimizeFlag)) {
13705     __pyx_t_1 = (((PyObject *)__pyx_v_self->__pyx_base._runtime) != Py_None);
13706     if (unlikely(!(__pyx_t_1 != 0))) {
13707       PyErr_SetNone(PyExc_AssertionError);
13708       __PYX_ERR(0, 786, __pyx_L1_error)
13709     }
13710   }
13711   #endif
13712 
13713   /* "lupa/_lupa.pyx":787
13714  *     def __delattr__(self, item):
13715  *         assert self._runtime is not None
13716  *         if isinstance(item, unicode):             # <<<<<<<<<<<<<<
13717  *             if (<unicode>item).startswith(u'__') and (<unicode>item).endswith(u'__'):
13718  *                 object.__delattr__(self, item)
13719  */
13720   __pyx_t_1 = PyUnicode_Check(__pyx_v_item);
13721   __pyx_t_2 = (__pyx_t_1 != 0);
13722   if (__pyx_t_2) {
13723 
13724     /* "lupa/_lupa.pyx":788
13725  *         assert self._runtime is not None
13726  *         if isinstance(item, unicode):
13727  *             if (<unicode>item).startswith(u'__') and (<unicode>item).endswith(u'__'):             # <<<<<<<<<<<<<<
13728  *                 object.__delattr__(self, item)
13729  *                 return
13730  */
13731     if (unlikely(__pyx_v_item == Py_None)) {
13732       PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "startswith");
13733       __PYX_ERR(0, 788, __pyx_L1_error)
13734     }
13735     __pyx_t_1 = __Pyx_PyUnicode_Tailmatch(((PyObject*)__pyx_v_item), __pyx_n_u__16, 0, PY_SSIZE_T_MAX, -1); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 788, __pyx_L1_error)
13736     if ((__pyx_t_1 != 0)) {
13737     } else {
13738       __pyx_t_2 = (__pyx_t_1 != 0);
13739       goto __pyx_L5_bool_binop_done;
13740     }
13741     if (unlikely(__pyx_v_item == Py_None)) {
13742       PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "endswith");
13743       __PYX_ERR(0, 788, __pyx_L1_error)
13744     }
13745     __pyx_t_1 = __Pyx_PyUnicode_Tailmatch(((PyObject*)__pyx_v_item), __pyx_n_u__16, 0, PY_SSIZE_T_MAX, 1); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 788, __pyx_L1_error)
13746     __pyx_t_2 = (__pyx_t_1 != 0);
13747     __pyx_L5_bool_binop_done:;
13748     if (__pyx_t_2) {
13749 
13750       /* "lupa/_lupa.pyx":789
13751  *         if isinstance(item, unicode):
13752  *             if (<unicode>item).startswith(u'__') and (<unicode>item).endswith(u'__'):
13753  *                 object.__delattr__(self, item)             # <<<<<<<<<<<<<<
13754  *                 return
13755  *             item = (<unicode>item).encode(self._runtime._source_encoding)
13756  */
13757       __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_builtin_object, __pyx_n_s_delattr); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 789, __pyx_L1_error)
13758       __Pyx_GOTREF(__pyx_t_4);
13759       __pyx_t_5 = NULL;
13760       __pyx_t_6 = 0;
13761       if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
13762         __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
13763         if (likely(__pyx_t_5)) {
13764           PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
13765           __Pyx_INCREF(__pyx_t_5);
13766           __Pyx_INCREF(function);
13767           __Pyx_DECREF_SET(__pyx_t_4, function);
13768           __pyx_t_6 = 1;
13769         }
13770       }
13771       #if CYTHON_FAST_PYCALL
13772       if (PyFunction_Check(__pyx_t_4)) {
13773         PyObject *__pyx_temp[3] = {__pyx_t_5, ((PyObject *)__pyx_v_self), __pyx_v_item};
13774         __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 789, __pyx_L1_error)
13775         __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
13776         __Pyx_GOTREF(__pyx_t_3);
13777       } else
13778       #endif
13779       #if CYTHON_FAST_PYCCALL
13780       if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
13781         PyObject *__pyx_temp[3] = {__pyx_t_5, ((PyObject *)__pyx_v_self), __pyx_v_item};
13782         __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 789, __pyx_L1_error)
13783         __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
13784         __Pyx_GOTREF(__pyx_t_3);
13785       } else
13786       #endif
13787       {
13788         __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 789, __pyx_L1_error)
13789         __Pyx_GOTREF(__pyx_t_7);
13790         if (__pyx_t_5) {
13791           __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
13792         }
13793         __Pyx_INCREF(((PyObject *)__pyx_v_self));
13794         __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
13795         PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, ((PyObject *)__pyx_v_self));
13796         __Pyx_INCREF(__pyx_v_item);
13797         __Pyx_GIVEREF(__pyx_v_item);
13798         PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_v_item);
13799         __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 789, __pyx_L1_error)
13800         __Pyx_GOTREF(__pyx_t_3);
13801         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
13802       }
13803       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
13804       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
13805 
13806       /* "lupa/_lupa.pyx":790
13807  *             if (<unicode>item).startswith(u'__') and (<unicode>item).endswith(u'__'):
13808  *                 object.__delattr__(self, item)
13809  *                 return             # <<<<<<<<<<<<<<
13810  *             item = (<unicode>item).encode(self._runtime._source_encoding)
13811  *         elif isinstance(item, bytes) and (<bytes>item).startswith(b'__') and (<bytes>item).endswith(b'__'):
13812  */
13813       __pyx_r = 0;
13814       goto __pyx_L0;
13815 
13816       /* "lupa/_lupa.pyx":788
13817  *         assert self._runtime is not None
13818  *         if isinstance(item, unicode):
13819  *             if (<unicode>item).startswith(u'__') and (<unicode>item).endswith(u'__'):             # <<<<<<<<<<<<<<
13820  *                 object.__delattr__(self, item)
13821  *                 return
13822  */
13823     }
13824 
13825     /* "lupa/_lupa.pyx":791
13826  *                 object.__delattr__(self, item)
13827  *                 return
13828  *             item = (<unicode>item).encode(self._runtime._source_encoding)             # <<<<<<<<<<<<<<
13829  *         elif isinstance(item, bytes) and (<bytes>item).startswith(b'__') and (<bytes>item).endswith(b'__'):
13830  *             object.__delattr__(self, item)
13831  */
13832     if (unlikely(__pyx_v_item == Py_None)) {
13833       PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode");
13834       __PYX_ERR(0, 791, __pyx_L1_error)
13835     }
13836     if (unlikely(__pyx_v_self->__pyx_base._runtime->_source_encoding == Py_None)) {
13837       PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
13838       __PYX_ERR(0, 791, __pyx_L1_error)
13839     }
13840     __pyx_t_8 = __Pyx_PyBytes_AsString(__pyx_v_self->__pyx_base._runtime->_source_encoding); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) __PYX_ERR(0, 791, __pyx_L1_error)
13841     __pyx_t_3 = PyUnicode_AsEncodedString(((PyObject*)__pyx_v_item), __pyx_t_8, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 791, __pyx_L1_error)
13842     __Pyx_GOTREF(__pyx_t_3);
13843     __Pyx_DECREF_SET(__pyx_v_item, __pyx_t_3);
13844     __pyx_t_3 = 0;
13845 
13846     /* "lupa/_lupa.pyx":787
13847  *     def __delattr__(self, item):
13848  *         assert self._runtime is not None
13849  *         if isinstance(item, unicode):             # <<<<<<<<<<<<<<
13850  *             if (<unicode>item).startswith(u'__') and (<unicode>item).endswith(u'__'):
13851  *                 object.__delattr__(self, item)
13852  */
13853     goto __pyx_L3;
13854   }
13855 
13856   /* "lupa/_lupa.pyx":792
13857  *                 return
13858  *             item = (<unicode>item).encode(self._runtime._source_encoding)
13859  *         elif isinstance(item, bytes) and (<bytes>item).startswith(b'__') and (<bytes>item).endswith(b'__'):             # <<<<<<<<<<<<<<
13860  *             object.__delattr__(self, item)
13861  *             return
13862  */
13863   __pyx_t_1 = PyBytes_Check(__pyx_v_item);
13864   __pyx_t_9 = (__pyx_t_1 != 0);
13865   if (__pyx_t_9) {
13866   } else {
13867     __pyx_t_2 = __pyx_t_9;
13868     goto __pyx_L7_bool_binop_done;
13869   }
13870   if (unlikely(__pyx_v_item == Py_None)) {
13871     PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "startswith");
13872     __PYX_ERR(0, 792, __pyx_L1_error)
13873   }
13874   __pyx_t_9 = __Pyx_PyBytes_Tailmatch(((PyObject*)__pyx_v_item), __pyx_n_b__16, 0, PY_SSIZE_T_MAX, -1); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 792, __pyx_L1_error)
13875   if ((__pyx_t_9 != 0)) {
13876   } else {
13877     __pyx_t_2 = (__pyx_t_9 != 0);
13878     goto __pyx_L7_bool_binop_done;
13879   }
13880   if (unlikely(__pyx_v_item == Py_None)) {
13881     PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "endswith");
13882     __PYX_ERR(0, 792, __pyx_L1_error)
13883   }
13884   __pyx_t_9 = __Pyx_PyBytes_Tailmatch(((PyObject*)__pyx_v_item), __pyx_n_b__16, 0, PY_SSIZE_T_MAX, 1); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 792, __pyx_L1_error)
13885   __pyx_t_2 = (__pyx_t_9 != 0);
13886   __pyx_L7_bool_binop_done:;
13887   if (__pyx_t_2) {
13888 
13889     /* "lupa/_lupa.pyx":793
13890  *             item = (<unicode>item).encode(self._runtime._source_encoding)
13891  *         elif isinstance(item, bytes) and (<bytes>item).startswith(b'__') and (<bytes>item).endswith(b'__'):
13892  *             object.__delattr__(self, item)             # <<<<<<<<<<<<<<
13893  *             return
13894  *         self._delitem(item)
13895  */
13896     __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_builtin_object, __pyx_n_s_delattr); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 793, __pyx_L1_error)
13897     __Pyx_GOTREF(__pyx_t_4);
13898     __pyx_t_7 = NULL;
13899     __pyx_t_6 = 0;
13900     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
13901       __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4);
13902       if (likely(__pyx_t_7)) {
13903         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
13904         __Pyx_INCREF(__pyx_t_7);
13905         __Pyx_INCREF(function);
13906         __Pyx_DECREF_SET(__pyx_t_4, function);
13907         __pyx_t_6 = 1;
13908       }
13909     }
13910     #if CYTHON_FAST_PYCALL
13911     if (PyFunction_Check(__pyx_t_4)) {
13912       PyObject *__pyx_temp[3] = {__pyx_t_7, ((PyObject *)__pyx_v_self), __pyx_v_item};
13913       __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 793, __pyx_L1_error)
13914       __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
13915       __Pyx_GOTREF(__pyx_t_3);
13916     } else
13917     #endif
13918     #if CYTHON_FAST_PYCCALL
13919     if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
13920       PyObject *__pyx_temp[3] = {__pyx_t_7, ((PyObject *)__pyx_v_self), __pyx_v_item};
13921       __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 793, __pyx_L1_error)
13922       __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
13923       __Pyx_GOTREF(__pyx_t_3);
13924     } else
13925     #endif
13926     {
13927       __pyx_t_5 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 793, __pyx_L1_error)
13928       __Pyx_GOTREF(__pyx_t_5);
13929       if (__pyx_t_7) {
13930         __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_7); __pyx_t_7 = NULL;
13931       }
13932       __Pyx_INCREF(((PyObject *)__pyx_v_self));
13933       __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
13934       PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_6, ((PyObject *)__pyx_v_self));
13935       __Pyx_INCREF(__pyx_v_item);
13936       __Pyx_GIVEREF(__pyx_v_item);
13937       PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_6, __pyx_v_item);
13938       __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 793, __pyx_L1_error)
13939       __Pyx_GOTREF(__pyx_t_3);
13940       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
13941     }
13942     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
13943     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
13944 
13945     /* "lupa/_lupa.pyx":794
13946  *         elif isinstance(item, bytes) and (<bytes>item).startswith(b'__') and (<bytes>item).endswith(b'__'):
13947  *             object.__delattr__(self, item)
13948  *             return             # <<<<<<<<<<<<<<
13949  *         self._delitem(item)
13950  *
13951  */
13952     __pyx_r = 0;
13953     goto __pyx_L0;
13954 
13955     /* "lupa/_lupa.pyx":792
13956  *                 return
13957  *             item = (<unicode>item).encode(self._runtime._source_encoding)
13958  *         elif isinstance(item, bytes) and (<bytes>item).startswith(b'__') and (<bytes>item).endswith(b'__'):             # <<<<<<<<<<<<<<
13959  *             object.__delattr__(self, item)
13960  *             return
13961  */
13962   }
13963   __pyx_L3:;
13964 
13965   /* "lupa/_lupa.pyx":795
13966  *             object.__delattr__(self, item)
13967  *             return
13968  *         self._delitem(item)             # <<<<<<<<<<<<<<
13969  *
13970  *     def __delitem__(self, key):
13971  */
13972   __pyx_t_3 = __pyx_f_4lupa_5_lupa_9_LuaTable__delitem(__pyx_v_self, __pyx_v_item); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 795, __pyx_L1_error)
13973   __Pyx_GOTREF(__pyx_t_3);
13974   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
13975 
13976   /* "lupa/_lupa.pyx":785
13977  *         return 0
13978  *
13979  *     def __delattr__(self, item):             # <<<<<<<<<<<<<<
13980  *         assert self._runtime is not None
13981  *         if isinstance(item, unicode):
13982  */
13983 
13984   /* function exit code */
13985   __pyx_r = 0;
13986   goto __pyx_L0;
13987   __pyx_L1_error:;
13988   __Pyx_XDECREF(__pyx_t_3);
13989   __Pyx_XDECREF(__pyx_t_4);
13990   __Pyx_XDECREF(__pyx_t_5);
13991   __Pyx_XDECREF(__pyx_t_7);
13992   __Pyx_AddTraceback("lupa._lupa._LuaTable.__delattr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
13993   __pyx_r = -1;
13994   __pyx_L0:;
13995   __Pyx_XDECREF(__pyx_v_item);
13996   __Pyx_RefNannyFinishContext();
13997   return __pyx_r;
13998 }
13999 
14000 /* "lupa/_lupa.pyx":797
14001  *         self._delitem(item)
14002  *
14003  *     def __delitem__(self, key):             # <<<<<<<<<<<<<<
14004  *         self._delitem(key)
14005  *
14006  */
14007 
14008 /* Python wrapper */
14009 static int __pyx_pw_4lupa_5_lupa_9_LuaTable_15__delitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
__pyx_pw_4lupa_5_lupa_9_LuaTable_15__delitem__(PyObject * __pyx_v_self,PyObject * __pyx_v_key)14010 static int __pyx_pw_4lupa_5_lupa_9_LuaTable_15__delitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
14011   int __pyx_r;
14012   __Pyx_RefNannyDeclarations
14013   __Pyx_RefNannySetupContext("__delitem__ (wrapper)", 0);
14014   __pyx_r = __pyx_pf_4lupa_5_lupa_9_LuaTable_14__delitem__(((struct __pyx_obj_4lupa_5_lupa__LuaTable *)__pyx_v_self), ((PyObject *)__pyx_v_key));
14015 
14016   /* function exit code */
14017   __Pyx_RefNannyFinishContext();
14018   return __pyx_r;
14019 }
14020 
__pyx_pf_4lupa_5_lupa_9_LuaTable_14__delitem__(struct __pyx_obj_4lupa_5_lupa__LuaTable * __pyx_v_self,PyObject * __pyx_v_key)14021 static int __pyx_pf_4lupa_5_lupa_9_LuaTable_14__delitem__(struct __pyx_obj_4lupa_5_lupa__LuaTable *__pyx_v_self, PyObject *__pyx_v_key) {
14022   int __pyx_r;
14023   __Pyx_RefNannyDeclarations
14024   PyObject *__pyx_t_1 = NULL;
14025   int __pyx_lineno = 0;
14026   const char *__pyx_filename = NULL;
14027   int __pyx_clineno = 0;
14028   __Pyx_RefNannySetupContext("__delitem__", 0);
14029 
14030   /* "lupa/_lupa.pyx":798
14031  *
14032  *     def __delitem__(self, key):
14033  *         self._delitem(key)             # <<<<<<<<<<<<<<
14034  *
14035  *     @cython.final
14036  */
14037   __pyx_t_1 = __pyx_f_4lupa_5_lupa_9_LuaTable__delitem(__pyx_v_self, __pyx_v_key); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 798, __pyx_L1_error)
14038   __Pyx_GOTREF(__pyx_t_1);
14039   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14040 
14041   /* "lupa/_lupa.pyx":797
14042  *         self._delitem(item)
14043  *
14044  *     def __delitem__(self, key):             # <<<<<<<<<<<<<<
14045  *         self._delitem(key)
14046  *
14047  */
14048 
14049   /* function exit code */
14050   __pyx_r = 0;
14051   goto __pyx_L0;
14052   __pyx_L1_error:;
14053   __Pyx_XDECREF(__pyx_t_1);
14054   __Pyx_AddTraceback("lupa._lupa._LuaTable.__delitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
14055   __pyx_r = -1;
14056   __pyx_L0:;
14057   __Pyx_RefNannyFinishContext();
14058   return __pyx_r;
14059 }
14060 
14061 /* "lupa/_lupa.pyx":801
14062  *
14063  *     @cython.final
14064  *     cdef _delitem(self, name):             # <<<<<<<<<<<<<<
14065  *         cdef lua_State* L = self._state
14066  *         lock_runtime(self._runtime)
14067  */
14068 
__pyx_f_4lupa_5_lupa_9_LuaTable__delitem(struct __pyx_obj_4lupa_5_lupa__LuaTable * __pyx_v_self,PyObject * __pyx_v_name)14069 static PyObject *__pyx_f_4lupa_5_lupa_9_LuaTable__delitem(struct __pyx_obj_4lupa_5_lupa__LuaTable *__pyx_v_self, PyObject *__pyx_v_name) {
14070   lua_State *__pyx_v_L;
14071   int __pyx_v_old_top;
14072   PyObject *__pyx_r = NULL;
14073   __Pyx_RefNannyDeclarations
14074   lua_State *__pyx_t_1;
14075   PyObject *__pyx_t_2 = NULL;
14076   int __pyx_t_3;
14077   struct __pyx_opt_args_4lupa_5_lupa_py_to_lua __pyx_t_4;
14078   int __pyx_t_5;
14079   char const *__pyx_t_6;
14080   PyObject *__pyx_t_7 = NULL;
14081   PyObject *__pyx_t_8 = NULL;
14082   PyObject *__pyx_t_9 = NULL;
14083   PyObject *__pyx_t_10 = NULL;
14084   PyObject *__pyx_t_11 = NULL;
14085   PyObject *__pyx_t_12 = NULL;
14086   int __pyx_lineno = 0;
14087   const char *__pyx_filename = NULL;
14088   int __pyx_clineno = 0;
14089   __Pyx_RefNannySetupContext("_delitem", 0);
14090 
14091   /* "lupa/_lupa.pyx":802
14092  *     @cython.final
14093  *     cdef _delitem(self, name):
14094  *         cdef lua_State* L = self._state             # <<<<<<<<<<<<<<
14095  *         lock_runtime(self._runtime)
14096  *         old_top = lua.lua_gettop(L)
14097  */
14098   __pyx_t_1 = __pyx_v_self->__pyx_base._state;
14099   __pyx_v_L = __pyx_t_1;
14100 
14101   /* "lupa/_lupa.pyx":803
14102  *     cdef _delitem(self, name):
14103  *         cdef lua_State* L = self._state
14104  *         lock_runtime(self._runtime)             # <<<<<<<<<<<<<<
14105  *         old_top = lua.lua_gettop(L)
14106  *         try:
14107  */
14108   __pyx_t_2 = ((PyObject *)__pyx_v_self->__pyx_base._runtime);
14109   __Pyx_INCREF(__pyx_t_2);
14110   __pyx_t_3 = __pyx_f_4lupa_5_lupa_lock_runtime(((struct __pyx_obj_4lupa_5_lupa_LuaRuntime *)__pyx_t_2)); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 803, __pyx_L1_error)
14111   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
14112 
14113   /* "lupa/_lupa.pyx":804
14114  *         cdef lua_State* L = self._state
14115  *         lock_runtime(self._runtime)
14116  *         old_top = lua.lua_gettop(L)             # <<<<<<<<<<<<<<
14117  *         try:
14118  *             self.push_lua_object()
14119  */
14120   __pyx_v_old_top = lua_gettop(__pyx_v_L);
14121 
14122   /* "lupa/_lupa.pyx":805
14123  *         lock_runtime(self._runtime)
14124  *         old_top = lua.lua_gettop(L)
14125  *         try:             # <<<<<<<<<<<<<<
14126  *             self.push_lua_object()
14127  *             py_to_lua(self._runtime, L, name, wrap_none=True)
14128  */
14129   /*try:*/ {
14130 
14131     /* "lupa/_lupa.pyx":806
14132  *         old_top = lua.lua_gettop(L)
14133  *         try:
14134  *             self.push_lua_object()             # <<<<<<<<<<<<<<
14135  *             py_to_lua(self._runtime, L, name, wrap_none=True)
14136  *             lua.lua_pushnil(L)
14137  */
14138     __pyx_t_3 = __pyx_f_4lupa_5_lupa_10_LuaObject_push_lua_object(((struct __pyx_obj_4lupa_5_lupa__LuaObject *)__pyx_v_self)); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 806, __pyx_L4_error)
14139 
14140     /* "lupa/_lupa.pyx":807
14141  *         try:
14142  *             self.push_lua_object()
14143  *             py_to_lua(self._runtime, L, name, wrap_none=True)             # <<<<<<<<<<<<<<
14144  *             lua.lua_pushnil(L)
14145  *             lua.lua_settable(L, -3)
14146  */
14147     __pyx_t_2 = ((PyObject *)__pyx_v_self->__pyx_base._runtime);
14148     __Pyx_INCREF(__pyx_t_2);
14149     __pyx_t_4.__pyx_n = 1;
14150     __pyx_t_4.wrap_none = 1;
14151     __pyx_t_3 = __pyx_f_4lupa_5_lupa_py_to_lua(((struct __pyx_obj_4lupa_5_lupa_LuaRuntime *)__pyx_t_2), __pyx_v_L, __pyx_v_name, &__pyx_t_4); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 807, __pyx_L4_error)
14152     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
14153 
14154     /* "lupa/_lupa.pyx":808
14155  *             self.push_lua_object()
14156  *             py_to_lua(self._runtime, L, name, wrap_none=True)
14157  *             lua.lua_pushnil(L)             # <<<<<<<<<<<<<<
14158  *             lua.lua_settable(L, -3)
14159  *         finally:
14160  */
14161     lua_pushnil(__pyx_v_L);
14162 
14163     /* "lupa/_lupa.pyx":809
14164  *             py_to_lua(self._runtime, L, name, wrap_none=True)
14165  *             lua.lua_pushnil(L)
14166  *             lua.lua_settable(L, -3)             # <<<<<<<<<<<<<<
14167  *         finally:
14168  *             lua.lua_settop(L, old_top)
14169  */
14170     lua_settable(__pyx_v_L, -3);
14171   }
14172 
14173   /* "lupa/_lupa.pyx":811
14174  *             lua.lua_settable(L, -3)
14175  *         finally:
14176  *             lua.lua_settop(L, old_top)             # <<<<<<<<<<<<<<
14177  *             unlock_runtime(self._runtime)
14178  *
14179  */
14180   /*finally:*/ {
14181     /*normal exit:*/{
14182       lua_settop(__pyx_v_L, __pyx_v_old_top);
14183 
14184       /* "lupa/_lupa.pyx":812
14185  *         finally:
14186  *             lua.lua_settop(L, old_top)
14187  *             unlock_runtime(self._runtime)             # <<<<<<<<<<<<<<
14188  *
14189  *
14190  */
14191       __pyx_t_2 = ((PyObject *)__pyx_v_self->__pyx_base._runtime);
14192       __Pyx_INCREF(__pyx_t_2);
14193       __pyx_f_4lupa_5_lupa_unlock_runtime(((struct __pyx_obj_4lupa_5_lupa_LuaRuntime *)__pyx_t_2));
14194       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
14195       goto __pyx_L5;
14196     }
14197     __pyx_L4_error:;
14198     /*exception exit:*/{
14199       __Pyx_PyThreadState_declare
14200       __Pyx_PyThreadState_assign
14201       __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
14202       __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
14203       if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
14204       if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9) < 0)) __Pyx_ErrFetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
14205       __Pyx_XGOTREF(__pyx_t_7);
14206       __Pyx_XGOTREF(__pyx_t_8);
14207       __Pyx_XGOTREF(__pyx_t_9);
14208       __Pyx_XGOTREF(__pyx_t_10);
14209       __Pyx_XGOTREF(__pyx_t_11);
14210       __Pyx_XGOTREF(__pyx_t_12);
14211       __pyx_t_3 = __pyx_lineno; __pyx_t_5 = __pyx_clineno; __pyx_t_6 = __pyx_filename;
14212       {
14213 
14214         /* "lupa/_lupa.pyx":811
14215  *             lua.lua_settable(L, -3)
14216  *         finally:
14217  *             lua.lua_settop(L, old_top)             # <<<<<<<<<<<<<<
14218  *             unlock_runtime(self._runtime)
14219  *
14220  */
14221         lua_settop(__pyx_v_L, __pyx_v_old_top);
14222 
14223         /* "lupa/_lupa.pyx":812
14224  *         finally:
14225  *             lua.lua_settop(L, old_top)
14226  *             unlock_runtime(self._runtime)             # <<<<<<<<<<<<<<
14227  *
14228  *
14229  */
14230         __pyx_t_2 = ((PyObject *)__pyx_v_self->__pyx_base._runtime);
14231         __Pyx_INCREF(__pyx_t_2);
14232         __pyx_f_4lupa_5_lupa_unlock_runtime(((struct __pyx_obj_4lupa_5_lupa_LuaRuntime *)__pyx_t_2));
14233         __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
14234       }
14235       if (PY_MAJOR_VERSION >= 3) {
14236         __Pyx_XGIVEREF(__pyx_t_10);
14237         __Pyx_XGIVEREF(__pyx_t_11);
14238         __Pyx_XGIVEREF(__pyx_t_12);
14239         __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
14240       }
14241       __Pyx_XGIVEREF(__pyx_t_7);
14242       __Pyx_XGIVEREF(__pyx_t_8);
14243       __Pyx_XGIVEREF(__pyx_t_9);
14244       __Pyx_ErrRestore(__pyx_t_7, __pyx_t_8, __pyx_t_9);
14245       __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
14246       __pyx_lineno = __pyx_t_3; __pyx_clineno = __pyx_t_5; __pyx_filename = __pyx_t_6;
14247       goto __pyx_L1_error;
14248     }
14249     __pyx_L5:;
14250   }
14251 
14252   /* "lupa/_lupa.pyx":801
14253  *
14254  *     @cython.final
14255  *     cdef _delitem(self, name):             # <<<<<<<<<<<<<<
14256  *         cdef lua_State* L = self._state
14257  *         lock_runtime(self._runtime)
14258  */
14259 
14260   /* function exit code */
14261   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
14262   goto __pyx_L0;
14263   __pyx_L1_error:;
14264   __Pyx_XDECREF(__pyx_t_2);
14265   __Pyx_AddTraceback("lupa._lupa._LuaTable._delitem", __pyx_clineno, __pyx_lineno, __pyx_filename);
14266   __pyx_r = 0;
14267   __pyx_L0:;
14268   __Pyx_XGIVEREF(__pyx_r);
14269   __Pyx_RefNannyFinishContext();
14270   return __pyx_r;
14271 }
14272 
14273 /* "(tree fragment)":1
14274  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
14275  *     raise TypeError("self._state cannot be converted to a Python object for pickling")
14276  * def __setstate_cython__(self, __pyx_state):
14277  */
14278 
14279 /* Python wrapper */
14280 static PyObject *__pyx_pw_4lupa_5_lupa_9_LuaTable_17__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
14281 static char __pyx_doc_4lupa_5_lupa_9_LuaTable_16__reduce_cython__[] = "_LuaTable.__reduce_cython__(self)";
14282 static PyMethodDef __pyx_mdef_4lupa_5_lupa_9_LuaTable_17__reduce_cython__ = {"__reduce_cython__", (PyCFunction)__pyx_pw_4lupa_5_lupa_9_LuaTable_17__reduce_cython__, METH_NOARGS, __pyx_doc_4lupa_5_lupa_9_LuaTable_16__reduce_cython__};
__pyx_pw_4lupa_5_lupa_9_LuaTable_17__reduce_cython__(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)14283 static PyObject *__pyx_pw_4lupa_5_lupa_9_LuaTable_17__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
14284   PyObject *__pyx_r = 0;
14285   __Pyx_RefNannyDeclarations
14286   __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
14287   __pyx_r = __pyx_pf_4lupa_5_lupa_9_LuaTable_16__reduce_cython__(((struct __pyx_obj_4lupa_5_lupa__LuaTable *)__pyx_v_self));
14288 
14289   /* function exit code */
14290   __Pyx_RefNannyFinishContext();
14291   return __pyx_r;
14292 }
14293 
__pyx_pf_4lupa_5_lupa_9_LuaTable_16__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_4lupa_5_lupa__LuaTable * __pyx_v_self)14294 static PyObject *__pyx_pf_4lupa_5_lupa_9_LuaTable_16__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_4lupa_5_lupa__LuaTable *__pyx_v_self) {
14295   PyObject *__pyx_r = NULL;
14296   __Pyx_RefNannyDeclarations
14297   PyObject *__pyx_t_1 = NULL;
14298   int __pyx_lineno = 0;
14299   const char *__pyx_filename = NULL;
14300   int __pyx_clineno = 0;
14301   __Pyx_RefNannySetupContext("__reduce_cython__", 0);
14302 
14303   /* "(tree fragment)":2
14304  * def __reduce_cython__(self):
14305  *     raise TypeError("self._state cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
14306  * def __setstate_cython__(self, __pyx_state):
14307  *     raise TypeError("self._state cannot be converted to a Python object for pickling")
14308  */
14309   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error)
14310   __Pyx_GOTREF(__pyx_t_1);
14311   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
14312   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14313   __PYX_ERR(2, 2, __pyx_L1_error)
14314 
14315   /* "(tree fragment)":1
14316  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
14317  *     raise TypeError("self._state cannot be converted to a Python object for pickling")
14318  * def __setstate_cython__(self, __pyx_state):
14319  */
14320 
14321   /* function exit code */
14322   __pyx_L1_error:;
14323   __Pyx_XDECREF(__pyx_t_1);
14324   __Pyx_AddTraceback("lupa._lupa._LuaTable.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
14325   __pyx_r = NULL;
14326   __Pyx_XGIVEREF(__pyx_r);
14327   __Pyx_RefNannyFinishContext();
14328   return __pyx_r;
14329 }
14330 
14331 /* "(tree fragment)":3
14332  * def __reduce_cython__(self):
14333  *     raise TypeError("self._state cannot be converted to a Python object for pickling")
14334  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
14335  *     raise TypeError("self._state cannot be converted to a Python object for pickling")
14336  */
14337 
14338 /* Python wrapper */
14339 static PyObject *__pyx_pw_4lupa_5_lupa_9_LuaTable_19__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
14340 static char __pyx_doc_4lupa_5_lupa_9_LuaTable_18__setstate_cython__[] = "_LuaTable.__setstate_cython__(self, __pyx_state)";
14341 static PyMethodDef __pyx_mdef_4lupa_5_lupa_9_LuaTable_19__setstate_cython__ = {"__setstate_cython__", (PyCFunction)__pyx_pw_4lupa_5_lupa_9_LuaTable_19__setstate_cython__, METH_O, __pyx_doc_4lupa_5_lupa_9_LuaTable_18__setstate_cython__};
__pyx_pw_4lupa_5_lupa_9_LuaTable_19__setstate_cython__(PyObject * __pyx_v_self,PyObject * __pyx_v___pyx_state)14342 static PyObject *__pyx_pw_4lupa_5_lupa_9_LuaTable_19__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
14343   PyObject *__pyx_r = 0;
14344   __Pyx_RefNannyDeclarations
14345   __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
14346   __pyx_r = __pyx_pf_4lupa_5_lupa_9_LuaTable_18__setstate_cython__(((struct __pyx_obj_4lupa_5_lupa__LuaTable *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
14347 
14348   /* function exit code */
14349   __Pyx_RefNannyFinishContext();
14350   return __pyx_r;
14351 }
14352 
__pyx_pf_4lupa_5_lupa_9_LuaTable_18__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_4lupa_5_lupa__LuaTable * __pyx_v_self,CYTHON_UNUSED PyObject * __pyx_v___pyx_state)14353 static PyObject *__pyx_pf_4lupa_5_lupa_9_LuaTable_18__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_4lupa_5_lupa__LuaTable *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
14354   PyObject *__pyx_r = NULL;
14355   __Pyx_RefNannyDeclarations
14356   PyObject *__pyx_t_1 = NULL;
14357   int __pyx_lineno = 0;
14358   const char *__pyx_filename = NULL;
14359   int __pyx_clineno = 0;
14360   __Pyx_RefNannySetupContext("__setstate_cython__", 0);
14361 
14362   /* "(tree fragment)":4
14363  *     raise TypeError("self._state cannot be converted to a Python object for pickling")
14364  * def __setstate_cython__(self, __pyx_state):
14365  *     raise TypeError("self._state cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
14366  */
14367   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__20, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error)
14368   __Pyx_GOTREF(__pyx_t_1);
14369   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
14370   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14371   __PYX_ERR(2, 4, __pyx_L1_error)
14372 
14373   /* "(tree fragment)":3
14374  * def __reduce_cython__(self):
14375  *     raise TypeError("self._state cannot be converted to a Python object for pickling")
14376  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
14377  *     raise TypeError("self._state cannot be converted to a Python object for pickling")
14378  */
14379 
14380   /* function exit code */
14381   __pyx_L1_error:;
14382   __Pyx_XDECREF(__pyx_t_1);
14383   __Pyx_AddTraceback("lupa._lupa._LuaTable.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
14384   __pyx_r = NULL;
14385   __Pyx_XGIVEREF(__pyx_r);
14386   __Pyx_RefNannyFinishContext();
14387   return __pyx_r;
14388 }
14389 
14390 /* "lupa/_lupa.pyx":815
14391  *
14392  *
14393  * cdef _LuaTable new_lua_table(LuaRuntime runtime, lua_State* L, int n):             # <<<<<<<<<<<<<<
14394  *     cdef _LuaTable obj = _LuaTable.__new__(_LuaTable)
14395  *     init_lua_object(obj, runtime, L, n)
14396  */
14397 
__pyx_f_4lupa_5_lupa_new_lua_table(struct __pyx_obj_4lupa_5_lupa_LuaRuntime * __pyx_v_runtime,lua_State * __pyx_v_L,int __pyx_v_n)14398 static struct __pyx_obj_4lupa_5_lupa__LuaTable *__pyx_f_4lupa_5_lupa_new_lua_table(struct __pyx_obj_4lupa_5_lupa_LuaRuntime *__pyx_v_runtime, lua_State *__pyx_v_L, int __pyx_v_n) {
14399   struct __pyx_obj_4lupa_5_lupa__LuaTable *__pyx_v_obj = 0;
14400   struct __pyx_obj_4lupa_5_lupa__LuaTable *__pyx_r = NULL;
14401   __Pyx_RefNannyDeclarations
14402   PyObject *__pyx_t_1 = NULL;
14403   int __pyx_lineno = 0;
14404   const char *__pyx_filename = NULL;
14405   int __pyx_clineno = 0;
14406   __Pyx_RefNannySetupContext("new_lua_table", 0);
14407 
14408   /* "lupa/_lupa.pyx":816
14409  *
14410  * cdef _LuaTable new_lua_table(LuaRuntime runtime, lua_State* L, int n):
14411  *     cdef _LuaTable obj = _LuaTable.__new__(_LuaTable)             # <<<<<<<<<<<<<<
14412  *     init_lua_object(obj, runtime, L, n)
14413  *     return obj
14414  */
14415   __pyx_t_1 = ((PyObject *)__pyx_tp_new_4lupa_5_lupa__LuaTable(((PyTypeObject *)__pyx_ptype_4lupa_5_lupa__LuaTable), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 816, __pyx_L1_error)
14416   __Pyx_GOTREF(((PyObject *)__pyx_t_1));
14417   __pyx_v_obj = ((struct __pyx_obj_4lupa_5_lupa__LuaTable *)__pyx_t_1);
14418   __pyx_t_1 = 0;
14419 
14420   /* "lupa/_lupa.pyx":817
14421  * cdef _LuaTable new_lua_table(LuaRuntime runtime, lua_State* L, int n):
14422  *     cdef _LuaTable obj = _LuaTable.__new__(_LuaTable)
14423  *     init_lua_object(obj, runtime, L, n)             # <<<<<<<<<<<<<<
14424  *     return obj
14425  *
14426  */
14427   __pyx_f_4lupa_5_lupa_init_lua_object(((struct __pyx_obj_4lupa_5_lupa__LuaObject *)__pyx_v_obj), __pyx_v_runtime, __pyx_v_L, __pyx_v_n);
14428 
14429   /* "lupa/_lupa.pyx":818
14430  *     cdef _LuaTable obj = _LuaTable.__new__(_LuaTable)
14431  *     init_lua_object(obj, runtime, L, n)
14432  *     return obj             # <<<<<<<<<<<<<<
14433  *
14434  *
14435  */
14436   __Pyx_XDECREF(((PyObject *)__pyx_r));
14437   __Pyx_INCREF(((PyObject *)__pyx_v_obj));
14438   __pyx_r = __pyx_v_obj;
14439   goto __pyx_L0;
14440 
14441   /* "lupa/_lupa.pyx":815
14442  *
14443  *
14444  * cdef _LuaTable new_lua_table(LuaRuntime runtime, lua_State* L, int n):             # <<<<<<<<<<<<<<
14445  *     cdef _LuaTable obj = _LuaTable.__new__(_LuaTable)
14446  *     init_lua_object(obj, runtime, L, n)
14447  */
14448 
14449   /* function exit code */
14450   __pyx_L1_error:;
14451   __Pyx_XDECREF(__pyx_t_1);
14452   __Pyx_AddTraceback("lupa._lupa.new_lua_table", __pyx_clineno, __pyx_lineno, __pyx_filename);
14453   __pyx_r = 0;
14454   __pyx_L0:;
14455   __Pyx_XDECREF((PyObject *)__pyx_v_obj);
14456   __Pyx_XGIVEREF((PyObject *)__pyx_r);
14457   __Pyx_RefNannyFinishContext();
14458   return __pyx_r;
14459 }
14460 
14461 /* "lupa/_lupa.pyx":826
14462  *     """A Lua function (which may become a coroutine).
14463  *     """
14464  *     def coroutine(self, *args):             # <<<<<<<<<<<<<<
14465  *         """Create a Lua coroutine from a Lua function and call it with
14466  *         the passed parameters to start it up.
14467  */
14468 
14469 /* Python wrapper */
14470 static PyObject *__pyx_pw_4lupa_5_lupa_12_LuaFunction_1coroutine(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
14471 static char __pyx_doc_4lupa_5_lupa_12_LuaFunction_coroutine[] = "_LuaFunction.coroutine(self, *args)\nCreate a Lua coroutine from a Lua function and call it with\n        the passed parameters to start it up.\n        ";
14472 static PyMethodDef __pyx_mdef_4lupa_5_lupa_12_LuaFunction_1coroutine = {"coroutine", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lupa_5_lupa_12_LuaFunction_1coroutine, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4lupa_5_lupa_12_LuaFunction_coroutine};
__pyx_pw_4lupa_5_lupa_12_LuaFunction_1coroutine(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)14473 static PyObject *__pyx_pw_4lupa_5_lupa_12_LuaFunction_1coroutine(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
14474   PyObject *__pyx_v_args = 0;
14475   PyObject *__pyx_r = 0;
14476   __Pyx_RefNannyDeclarations
14477   __Pyx_RefNannySetupContext("coroutine (wrapper)", 0);
14478   if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "coroutine", 0))) return NULL;
14479   __Pyx_INCREF(__pyx_args);
14480   __pyx_v_args = __pyx_args;
14481   __pyx_r = __pyx_pf_4lupa_5_lupa_12_LuaFunction_coroutine(((struct __pyx_obj_4lupa_5_lupa__LuaFunction *)__pyx_v_self), __pyx_v_args);
14482 
14483   /* function exit code */
14484   __Pyx_XDECREF(__pyx_v_args);
14485   __Pyx_RefNannyFinishContext();
14486   return __pyx_r;
14487 }
14488 
__pyx_pf_4lupa_5_lupa_12_LuaFunction_coroutine(struct __pyx_obj_4lupa_5_lupa__LuaFunction * __pyx_v_self,PyObject * __pyx_v_args)14489 static PyObject *__pyx_pf_4lupa_5_lupa_12_LuaFunction_coroutine(struct __pyx_obj_4lupa_5_lupa__LuaFunction *__pyx_v_self, PyObject *__pyx_v_args) {
14490   lua_State *__pyx_v_L;
14491   lua_State *__pyx_v_co;
14492   struct __pyx_obj_4lupa_5_lupa__LuaThread *__pyx_v_thread = 0;
14493   int __pyx_v_old_top;
14494   PyObject *__pyx_r = NULL;
14495   __Pyx_RefNannyDeclarations
14496   int __pyx_t_1;
14497   lua_State *__pyx_t_2;
14498   PyObject *__pyx_t_3 = NULL;
14499   int __pyx_t_4;
14500   int __pyx_t_5;
14501   PyObject *__pyx_t_6 = NULL;
14502   int __pyx_t_7;
14503   char const *__pyx_t_8;
14504   PyObject *__pyx_t_9 = NULL;
14505   PyObject *__pyx_t_10 = NULL;
14506   PyObject *__pyx_t_11 = NULL;
14507   PyObject *__pyx_t_12 = NULL;
14508   PyObject *__pyx_t_13 = NULL;
14509   PyObject *__pyx_t_14 = NULL;
14510   int __pyx_lineno = 0;
14511   const char *__pyx_filename = NULL;
14512   int __pyx_clineno = 0;
14513   __Pyx_RefNannySetupContext("coroutine", 0);
14514 
14515   /* "lupa/_lupa.pyx":830
14516  *         the passed parameters to start it up.
14517  *         """
14518  *         assert self._runtime is not None             # <<<<<<<<<<<<<<
14519  *         cdef lua_State* L = self._state
14520  *         cdef lua_State* co
14521  */
14522   #ifndef CYTHON_WITHOUT_ASSERTIONS
14523   if (unlikely(!Py_OptimizeFlag)) {
14524     __pyx_t_1 = (((PyObject *)__pyx_v_self->__pyx_base._runtime) != Py_None);
14525     if (unlikely(!(__pyx_t_1 != 0))) {
14526       PyErr_SetNone(PyExc_AssertionError);
14527       __PYX_ERR(0, 830, __pyx_L1_error)
14528     }
14529   }
14530   #endif
14531 
14532   /* "lupa/_lupa.pyx":831
14533  *         """
14534  *         assert self._runtime is not None
14535  *         cdef lua_State* L = self._state             # <<<<<<<<<<<<<<
14536  *         cdef lua_State* co
14537  *         cdef _LuaThread thread
14538  */
14539   __pyx_t_2 = __pyx_v_self->__pyx_base._state;
14540   __pyx_v_L = __pyx_t_2;
14541 
14542   /* "lupa/_lupa.pyx":834
14543  *         cdef lua_State* co
14544  *         cdef _LuaThread thread
14545  *         lock_runtime(self._runtime)             # <<<<<<<<<<<<<<
14546  *         old_top = lua.lua_gettop(L)
14547  *         try:
14548  */
14549   __pyx_t_3 = ((PyObject *)__pyx_v_self->__pyx_base._runtime);
14550   __Pyx_INCREF(__pyx_t_3);
14551   __pyx_t_4 = __pyx_f_4lupa_5_lupa_lock_runtime(((struct __pyx_obj_4lupa_5_lupa_LuaRuntime *)__pyx_t_3)); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 834, __pyx_L1_error)
14552   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14553 
14554   /* "lupa/_lupa.pyx":835
14555  *         cdef _LuaThread thread
14556  *         lock_runtime(self._runtime)
14557  *         old_top = lua.lua_gettop(L)             # <<<<<<<<<<<<<<
14558  *         try:
14559  *             self.push_lua_object()
14560  */
14561   __pyx_v_old_top = lua_gettop(__pyx_v_L);
14562 
14563   /* "lupa/_lupa.pyx":836
14564  *         lock_runtime(self._runtime)
14565  *         old_top = lua.lua_gettop(L)
14566  *         try:             # <<<<<<<<<<<<<<
14567  *             self.push_lua_object()
14568  *             if not lua.lua_isfunction(L, -1) or lua.lua_iscfunction(L, -1):
14569  */
14570   /*try:*/ {
14571 
14572     /* "lupa/_lupa.pyx":837
14573  *         old_top = lua.lua_gettop(L)
14574  *         try:
14575  *             self.push_lua_object()             # <<<<<<<<<<<<<<
14576  *             if not lua.lua_isfunction(L, -1) or lua.lua_iscfunction(L, -1):
14577  *                 raise TypeError("Lua object is not a function")
14578  */
14579     __pyx_t_4 = __pyx_f_4lupa_5_lupa_10_LuaObject_push_lua_object(((struct __pyx_obj_4lupa_5_lupa__LuaObject *)__pyx_v_self)); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 837, __pyx_L4_error)
14580 
14581     /* "lupa/_lupa.pyx":838
14582  *         try:
14583  *             self.push_lua_object()
14584  *             if not lua.lua_isfunction(L, -1) or lua.lua_iscfunction(L, -1):             # <<<<<<<<<<<<<<
14585  *                 raise TypeError("Lua object is not a function")
14586  *             # create thread stack and push the function on it
14587  */
14588     __pyx_t_5 = ((!(lua_isfunction(__pyx_v_L, -1) != 0)) != 0);
14589     if (!__pyx_t_5) {
14590     } else {
14591       __pyx_t_1 = __pyx_t_5;
14592       goto __pyx_L7_bool_binop_done;
14593     }
14594     __pyx_t_5 = (lua_iscfunction(__pyx_v_L, -1) != 0);
14595     __pyx_t_1 = __pyx_t_5;
14596     __pyx_L7_bool_binop_done:;
14597     if (unlikely(__pyx_t_1)) {
14598 
14599       /* "lupa/_lupa.pyx":839
14600  *             self.push_lua_object()
14601  *             if not lua.lua_isfunction(L, -1) or lua.lua_iscfunction(L, -1):
14602  *                 raise TypeError("Lua object is not a function")             # <<<<<<<<<<<<<<
14603  *             # create thread stack and push the function on it
14604  *             co = lua.lua_newthread(L)
14605  */
14606       __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__21, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 839, __pyx_L4_error)
14607       __Pyx_GOTREF(__pyx_t_3);
14608       __Pyx_Raise(__pyx_t_3, 0, 0, 0);
14609       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14610       __PYX_ERR(0, 839, __pyx_L4_error)
14611 
14612       /* "lupa/_lupa.pyx":838
14613  *         try:
14614  *             self.push_lua_object()
14615  *             if not lua.lua_isfunction(L, -1) or lua.lua_iscfunction(L, -1):             # <<<<<<<<<<<<<<
14616  *                 raise TypeError("Lua object is not a function")
14617  *             # create thread stack and push the function on it
14618  */
14619     }
14620 
14621     /* "lupa/_lupa.pyx":841
14622  *                 raise TypeError("Lua object is not a function")
14623  *             # create thread stack and push the function on it
14624  *             co = lua.lua_newthread(L)             # <<<<<<<<<<<<<<
14625  *             lua.lua_pushvalue(L, 1)
14626  *             lua.lua_xmove(L, co, 1)
14627  */
14628     __pyx_v_co = lua_newthread(__pyx_v_L);
14629 
14630     /* "lupa/_lupa.pyx":842
14631  *             # create thread stack and push the function on it
14632  *             co = lua.lua_newthread(L)
14633  *             lua.lua_pushvalue(L, 1)             # <<<<<<<<<<<<<<
14634  *             lua.lua_xmove(L, co, 1)
14635  *             # create the coroutine object and initialise it
14636  */
14637     lua_pushvalue(__pyx_v_L, 1);
14638 
14639     /* "lupa/_lupa.pyx":843
14640  *             co = lua.lua_newthread(L)
14641  *             lua.lua_pushvalue(L, 1)
14642  *             lua.lua_xmove(L, co, 1)             # <<<<<<<<<<<<<<
14643  *             # create the coroutine object and initialise it
14644  *             assert lua.lua_isthread(L, -1)
14645  */
14646     lua_xmove(__pyx_v_L, __pyx_v_co, 1);
14647 
14648     /* "lupa/_lupa.pyx":845
14649  *             lua.lua_xmove(L, co, 1)
14650  *             # create the coroutine object and initialise it
14651  *             assert lua.lua_isthread(L, -1)             # <<<<<<<<<<<<<<
14652  *             thread = new_lua_thread(self._runtime, L, -1)
14653  *             thread._arguments = args # always a tuple, not None !
14654  */
14655     #ifndef CYTHON_WITHOUT_ASSERTIONS
14656     if (unlikely(!Py_OptimizeFlag)) {
14657       if (unlikely(!(lua_isthread(__pyx_v_L, -1) != 0))) {
14658         PyErr_SetNone(PyExc_AssertionError);
14659         __PYX_ERR(0, 845, __pyx_L4_error)
14660       }
14661     }
14662     #endif
14663 
14664     /* "lupa/_lupa.pyx":846
14665  *             # create the coroutine object and initialise it
14666  *             assert lua.lua_isthread(L, -1)
14667  *             thread = new_lua_thread(self._runtime, L, -1)             # <<<<<<<<<<<<<<
14668  *             thread._arguments = args # always a tuple, not None !
14669  *             return thread
14670  */
14671     __pyx_t_3 = ((PyObject *)__pyx_v_self->__pyx_base._runtime);
14672     __Pyx_INCREF(__pyx_t_3);
14673     __pyx_t_6 = ((PyObject *)__pyx_f_4lupa_5_lupa_new_lua_thread(((struct __pyx_obj_4lupa_5_lupa_LuaRuntime *)__pyx_t_3), __pyx_v_L, -1)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 846, __pyx_L4_error)
14674     __Pyx_GOTREF(__pyx_t_6);
14675     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14676     __pyx_v_thread = ((struct __pyx_obj_4lupa_5_lupa__LuaThread *)__pyx_t_6);
14677     __pyx_t_6 = 0;
14678 
14679     /* "lupa/_lupa.pyx":847
14680  *             assert lua.lua_isthread(L, -1)
14681  *             thread = new_lua_thread(self._runtime, L, -1)
14682  *             thread._arguments = args # always a tuple, not None !             # <<<<<<<<<<<<<<
14683  *             return thread
14684  *         finally:
14685  */
14686     __Pyx_INCREF(__pyx_v_args);
14687     __Pyx_GIVEREF(__pyx_v_args);
14688     __Pyx_GOTREF(__pyx_v_thread->_arguments);
14689     __Pyx_DECREF(__pyx_v_thread->_arguments);
14690     __pyx_v_thread->_arguments = __pyx_v_args;
14691 
14692     /* "lupa/_lupa.pyx":848
14693  *             thread = new_lua_thread(self._runtime, L, -1)
14694  *             thread._arguments = args # always a tuple, not None !
14695  *             return thread             # <<<<<<<<<<<<<<
14696  *         finally:
14697  *             lua.lua_settop(L, old_top)
14698  */
14699     __Pyx_XDECREF(__pyx_r);
14700     __Pyx_INCREF(((PyObject *)__pyx_v_thread));
14701     __pyx_r = ((PyObject *)__pyx_v_thread);
14702     goto __pyx_L3_return;
14703   }
14704 
14705   /* "lupa/_lupa.pyx":850
14706  *             return thread
14707  *         finally:
14708  *             lua.lua_settop(L, old_top)             # <<<<<<<<<<<<<<
14709  *             unlock_runtime(self._runtime)
14710  *
14711  */
14712   /*finally:*/ {
14713     __pyx_L4_error:;
14714     /*exception exit:*/{
14715       __Pyx_PyThreadState_declare
14716       __Pyx_PyThreadState_assign
14717       __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0;
14718       __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
14719       __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
14720       if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14);
14721       if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11) < 0)) __Pyx_ErrFetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
14722       __Pyx_XGOTREF(__pyx_t_9);
14723       __Pyx_XGOTREF(__pyx_t_10);
14724       __Pyx_XGOTREF(__pyx_t_11);
14725       __Pyx_XGOTREF(__pyx_t_12);
14726       __Pyx_XGOTREF(__pyx_t_13);
14727       __Pyx_XGOTREF(__pyx_t_14);
14728       __pyx_t_4 = __pyx_lineno; __pyx_t_7 = __pyx_clineno; __pyx_t_8 = __pyx_filename;
14729       {
14730         lua_settop(__pyx_v_L, __pyx_v_old_top);
14731 
14732         /* "lupa/_lupa.pyx":851
14733  *         finally:
14734  *             lua.lua_settop(L, old_top)
14735  *             unlock_runtime(self._runtime)             # <<<<<<<<<<<<<<
14736  *
14737  * cdef _LuaFunction new_lua_function(LuaRuntime runtime, lua_State* L, int n):
14738  */
14739         __pyx_t_6 = ((PyObject *)__pyx_v_self->__pyx_base._runtime);
14740         __Pyx_INCREF(__pyx_t_6);
14741         __pyx_f_4lupa_5_lupa_unlock_runtime(((struct __pyx_obj_4lupa_5_lupa_LuaRuntime *)__pyx_t_6));
14742         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
14743       }
14744       if (PY_MAJOR_VERSION >= 3) {
14745         __Pyx_XGIVEREF(__pyx_t_12);
14746         __Pyx_XGIVEREF(__pyx_t_13);
14747         __Pyx_XGIVEREF(__pyx_t_14);
14748         __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_13, __pyx_t_14);
14749       }
14750       __Pyx_XGIVEREF(__pyx_t_9);
14751       __Pyx_XGIVEREF(__pyx_t_10);
14752       __Pyx_XGIVEREF(__pyx_t_11);
14753       __Pyx_ErrRestore(__pyx_t_9, __pyx_t_10, __pyx_t_11);
14754       __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0;
14755       __pyx_lineno = __pyx_t_4; __pyx_clineno = __pyx_t_7; __pyx_filename = __pyx_t_8;
14756       goto __pyx_L1_error;
14757     }
14758     __pyx_L3_return: {
14759       __pyx_t_14 = __pyx_r;
14760       __pyx_r = 0;
14761 
14762       /* "lupa/_lupa.pyx":850
14763  *             return thread
14764  *         finally:
14765  *             lua.lua_settop(L, old_top)             # <<<<<<<<<<<<<<
14766  *             unlock_runtime(self._runtime)
14767  *
14768  */
14769       lua_settop(__pyx_v_L, __pyx_v_old_top);
14770 
14771       /* "lupa/_lupa.pyx":851
14772  *         finally:
14773  *             lua.lua_settop(L, old_top)
14774  *             unlock_runtime(self._runtime)             # <<<<<<<<<<<<<<
14775  *
14776  * cdef _LuaFunction new_lua_function(LuaRuntime runtime, lua_State* L, int n):
14777  */
14778       __pyx_t_6 = ((PyObject *)__pyx_v_self->__pyx_base._runtime);
14779       __Pyx_INCREF(__pyx_t_6);
14780       __pyx_f_4lupa_5_lupa_unlock_runtime(((struct __pyx_obj_4lupa_5_lupa_LuaRuntime *)__pyx_t_6));
14781       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
14782       __pyx_r = __pyx_t_14;
14783       __pyx_t_14 = 0;
14784       goto __pyx_L0;
14785     }
14786   }
14787 
14788   /* "lupa/_lupa.pyx":826
14789  *     """A Lua function (which may become a coroutine).
14790  *     """
14791  *     def coroutine(self, *args):             # <<<<<<<<<<<<<<
14792  *         """Create a Lua coroutine from a Lua function and call it with
14793  *         the passed parameters to start it up.
14794  */
14795 
14796   /* function exit code */
14797   __pyx_L1_error:;
14798   __Pyx_XDECREF(__pyx_t_3);
14799   __Pyx_XDECREF(__pyx_t_6);
14800   __Pyx_AddTraceback("lupa._lupa._LuaFunction.coroutine", __pyx_clineno, __pyx_lineno, __pyx_filename);
14801   __pyx_r = NULL;
14802   __pyx_L0:;
14803   __Pyx_XDECREF((PyObject *)__pyx_v_thread);
14804   __Pyx_XGIVEREF(__pyx_r);
14805   __Pyx_RefNannyFinishContext();
14806   return __pyx_r;
14807 }
14808 
14809 /* "(tree fragment)":1
14810  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
14811  *     raise TypeError("self._state cannot be converted to a Python object for pickling")
14812  * def __setstate_cython__(self, __pyx_state):
14813  */
14814 
14815 /* Python wrapper */
14816 static PyObject *__pyx_pw_4lupa_5_lupa_12_LuaFunction_3__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
14817 static char __pyx_doc_4lupa_5_lupa_12_LuaFunction_2__reduce_cython__[] = "_LuaFunction.__reduce_cython__(self)";
14818 static PyMethodDef __pyx_mdef_4lupa_5_lupa_12_LuaFunction_3__reduce_cython__ = {"__reduce_cython__", (PyCFunction)__pyx_pw_4lupa_5_lupa_12_LuaFunction_3__reduce_cython__, METH_NOARGS, __pyx_doc_4lupa_5_lupa_12_LuaFunction_2__reduce_cython__};
__pyx_pw_4lupa_5_lupa_12_LuaFunction_3__reduce_cython__(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)14819 static PyObject *__pyx_pw_4lupa_5_lupa_12_LuaFunction_3__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
14820   PyObject *__pyx_r = 0;
14821   __Pyx_RefNannyDeclarations
14822   __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
14823   __pyx_r = __pyx_pf_4lupa_5_lupa_12_LuaFunction_2__reduce_cython__(((struct __pyx_obj_4lupa_5_lupa__LuaFunction *)__pyx_v_self));
14824 
14825   /* function exit code */
14826   __Pyx_RefNannyFinishContext();
14827   return __pyx_r;
14828 }
14829 
__pyx_pf_4lupa_5_lupa_12_LuaFunction_2__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_4lupa_5_lupa__LuaFunction * __pyx_v_self)14830 static PyObject *__pyx_pf_4lupa_5_lupa_12_LuaFunction_2__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_4lupa_5_lupa__LuaFunction *__pyx_v_self) {
14831   PyObject *__pyx_r = NULL;
14832   __Pyx_RefNannyDeclarations
14833   PyObject *__pyx_t_1 = NULL;
14834   int __pyx_lineno = 0;
14835   const char *__pyx_filename = NULL;
14836   int __pyx_clineno = 0;
14837   __Pyx_RefNannySetupContext("__reduce_cython__", 0);
14838 
14839   /* "(tree fragment)":2
14840  * def __reduce_cython__(self):
14841  *     raise TypeError("self._state cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
14842  * def __setstate_cython__(self, __pyx_state):
14843  *     raise TypeError("self._state cannot be converted to a Python object for pickling")
14844  */
14845   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__22, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error)
14846   __Pyx_GOTREF(__pyx_t_1);
14847   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
14848   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14849   __PYX_ERR(2, 2, __pyx_L1_error)
14850 
14851   /* "(tree fragment)":1
14852  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
14853  *     raise TypeError("self._state cannot be converted to a Python object for pickling")
14854  * def __setstate_cython__(self, __pyx_state):
14855  */
14856 
14857   /* function exit code */
14858   __pyx_L1_error:;
14859   __Pyx_XDECREF(__pyx_t_1);
14860   __Pyx_AddTraceback("lupa._lupa._LuaFunction.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
14861   __pyx_r = NULL;
14862   __Pyx_XGIVEREF(__pyx_r);
14863   __Pyx_RefNannyFinishContext();
14864   return __pyx_r;
14865 }
14866 
14867 /* "(tree fragment)":3
14868  * def __reduce_cython__(self):
14869  *     raise TypeError("self._state cannot be converted to a Python object for pickling")
14870  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
14871  *     raise TypeError("self._state cannot be converted to a Python object for pickling")
14872  */
14873 
14874 /* Python wrapper */
14875 static PyObject *__pyx_pw_4lupa_5_lupa_12_LuaFunction_5__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
14876 static char __pyx_doc_4lupa_5_lupa_12_LuaFunction_4__setstate_cython__[] = "_LuaFunction.__setstate_cython__(self, __pyx_state)";
14877 static PyMethodDef __pyx_mdef_4lupa_5_lupa_12_LuaFunction_5__setstate_cython__ = {"__setstate_cython__", (PyCFunction)__pyx_pw_4lupa_5_lupa_12_LuaFunction_5__setstate_cython__, METH_O, __pyx_doc_4lupa_5_lupa_12_LuaFunction_4__setstate_cython__};
__pyx_pw_4lupa_5_lupa_12_LuaFunction_5__setstate_cython__(PyObject * __pyx_v_self,PyObject * __pyx_v___pyx_state)14878 static PyObject *__pyx_pw_4lupa_5_lupa_12_LuaFunction_5__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
14879   PyObject *__pyx_r = 0;
14880   __Pyx_RefNannyDeclarations
14881   __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
14882   __pyx_r = __pyx_pf_4lupa_5_lupa_12_LuaFunction_4__setstate_cython__(((struct __pyx_obj_4lupa_5_lupa__LuaFunction *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
14883 
14884   /* function exit code */
14885   __Pyx_RefNannyFinishContext();
14886   return __pyx_r;
14887 }
14888 
__pyx_pf_4lupa_5_lupa_12_LuaFunction_4__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_4lupa_5_lupa__LuaFunction * __pyx_v_self,CYTHON_UNUSED PyObject * __pyx_v___pyx_state)14889 static PyObject *__pyx_pf_4lupa_5_lupa_12_LuaFunction_4__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_4lupa_5_lupa__LuaFunction *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
14890   PyObject *__pyx_r = NULL;
14891   __Pyx_RefNannyDeclarations
14892   PyObject *__pyx_t_1 = NULL;
14893   int __pyx_lineno = 0;
14894   const char *__pyx_filename = NULL;
14895   int __pyx_clineno = 0;
14896   __Pyx_RefNannySetupContext("__setstate_cython__", 0);
14897 
14898   /* "(tree fragment)":4
14899  *     raise TypeError("self._state cannot be converted to a Python object for pickling")
14900  * def __setstate_cython__(self, __pyx_state):
14901  *     raise TypeError("self._state cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
14902  */
14903   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__23, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error)
14904   __Pyx_GOTREF(__pyx_t_1);
14905   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
14906   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14907   __PYX_ERR(2, 4, __pyx_L1_error)
14908 
14909   /* "(tree fragment)":3
14910  * def __reduce_cython__(self):
14911  *     raise TypeError("self._state cannot be converted to a Python object for pickling")
14912  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
14913  *     raise TypeError("self._state cannot be converted to a Python object for pickling")
14914  */
14915 
14916   /* function exit code */
14917   __pyx_L1_error:;
14918   __Pyx_XDECREF(__pyx_t_1);
14919   __Pyx_AddTraceback("lupa._lupa._LuaFunction.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
14920   __pyx_r = NULL;
14921   __Pyx_XGIVEREF(__pyx_r);
14922   __Pyx_RefNannyFinishContext();
14923   return __pyx_r;
14924 }
14925 
14926 /* "lupa/_lupa.pyx":853
14927  *             unlock_runtime(self._runtime)
14928  *
14929  * cdef _LuaFunction new_lua_function(LuaRuntime runtime, lua_State* L, int n):             # <<<<<<<<<<<<<<
14930  *     cdef _LuaFunction obj = _LuaFunction.__new__(_LuaFunction)
14931  *     init_lua_object(obj, runtime, L, n)
14932  */
14933 
__pyx_f_4lupa_5_lupa_new_lua_function(struct __pyx_obj_4lupa_5_lupa_LuaRuntime * __pyx_v_runtime,lua_State * __pyx_v_L,int __pyx_v_n)14934 static struct __pyx_obj_4lupa_5_lupa__LuaFunction *__pyx_f_4lupa_5_lupa_new_lua_function(struct __pyx_obj_4lupa_5_lupa_LuaRuntime *__pyx_v_runtime, lua_State *__pyx_v_L, int __pyx_v_n) {
14935   struct __pyx_obj_4lupa_5_lupa__LuaFunction *__pyx_v_obj = 0;
14936   struct __pyx_obj_4lupa_5_lupa__LuaFunction *__pyx_r = NULL;
14937   __Pyx_RefNannyDeclarations
14938   PyObject *__pyx_t_1 = NULL;
14939   int __pyx_lineno = 0;
14940   const char *__pyx_filename = NULL;
14941   int __pyx_clineno = 0;
14942   __Pyx_RefNannySetupContext("new_lua_function", 0);
14943 
14944   /* "lupa/_lupa.pyx":854
14945  *
14946  * cdef _LuaFunction new_lua_function(LuaRuntime runtime, lua_State* L, int n):
14947  *     cdef _LuaFunction obj = _LuaFunction.__new__(_LuaFunction)             # <<<<<<<<<<<<<<
14948  *     init_lua_object(obj, runtime, L, n)
14949  *     return obj
14950  */
14951   __pyx_t_1 = ((PyObject *)__pyx_tp_new_4lupa_5_lupa__LuaFunction(((PyTypeObject *)__pyx_ptype_4lupa_5_lupa__LuaFunction), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 854, __pyx_L1_error)
14952   __Pyx_GOTREF(((PyObject *)__pyx_t_1));
14953   __pyx_v_obj = ((struct __pyx_obj_4lupa_5_lupa__LuaFunction *)__pyx_t_1);
14954   __pyx_t_1 = 0;
14955 
14956   /* "lupa/_lupa.pyx":855
14957  * cdef _LuaFunction new_lua_function(LuaRuntime runtime, lua_State* L, int n):
14958  *     cdef _LuaFunction obj = _LuaFunction.__new__(_LuaFunction)
14959  *     init_lua_object(obj, runtime, L, n)             # <<<<<<<<<<<<<<
14960  *     return obj
14961  *
14962  */
14963   __pyx_f_4lupa_5_lupa_init_lua_object(((struct __pyx_obj_4lupa_5_lupa__LuaObject *)__pyx_v_obj), __pyx_v_runtime, __pyx_v_L, __pyx_v_n);
14964 
14965   /* "lupa/_lupa.pyx":856
14966  *     cdef _LuaFunction obj = _LuaFunction.__new__(_LuaFunction)
14967  *     init_lua_object(obj, runtime, L, n)
14968  *     return obj             # <<<<<<<<<<<<<<
14969  *
14970  *
14971  */
14972   __Pyx_XDECREF(((PyObject *)__pyx_r));
14973   __Pyx_INCREF(((PyObject *)__pyx_v_obj));
14974   __pyx_r = __pyx_v_obj;
14975   goto __pyx_L0;
14976 
14977   /* "lupa/_lupa.pyx":853
14978  *             unlock_runtime(self._runtime)
14979  *
14980  * cdef _LuaFunction new_lua_function(LuaRuntime runtime, lua_State* L, int n):             # <<<<<<<<<<<<<<
14981  *     cdef _LuaFunction obj = _LuaFunction.__new__(_LuaFunction)
14982  *     init_lua_object(obj, runtime, L, n)
14983  */
14984 
14985   /* function exit code */
14986   __pyx_L1_error:;
14987   __Pyx_XDECREF(__pyx_t_1);
14988   __Pyx_AddTraceback("lupa._lupa.new_lua_function", __pyx_clineno, __pyx_lineno, __pyx_filename);
14989   __pyx_r = 0;
14990   __pyx_L0:;
14991   __Pyx_XDECREF((PyObject *)__pyx_v_obj);
14992   __Pyx_XGIVEREF((PyObject *)__pyx_r);
14993   __Pyx_RefNannyFinishContext();
14994   return __pyx_r;
14995 }
14996 
14997 /* "lupa/_lupa.pyx":865
14998  *     """A function that returns a new coroutine when called.
14999  *     """
15000  *     def __call__(self, *args):             # <<<<<<<<<<<<<<
15001  *         return self.coroutine(*args)
15002  *
15003  */
15004 
15005 /* Python wrapper */
15006 static PyObject *__pyx_pw_4lupa_5_lupa_21_LuaCoroutineFunction_1__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_pw_4lupa_5_lupa_21_LuaCoroutineFunction_1__call__(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)15007 static PyObject *__pyx_pw_4lupa_5_lupa_21_LuaCoroutineFunction_1__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
15008   PyObject *__pyx_v_args = 0;
15009   PyObject *__pyx_r = 0;
15010   __Pyx_RefNannyDeclarations
15011   __Pyx_RefNannySetupContext("__call__ (wrapper)", 0);
15012   if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__call__", 0))) return NULL;
15013   __Pyx_INCREF(__pyx_args);
15014   __pyx_v_args = __pyx_args;
15015   __pyx_r = __pyx_pf_4lupa_5_lupa_21_LuaCoroutineFunction___call__(((struct __pyx_obj_4lupa_5_lupa__LuaCoroutineFunction *)__pyx_v_self), __pyx_v_args);
15016 
15017   /* function exit code */
15018   __Pyx_XDECREF(__pyx_v_args);
15019   __Pyx_RefNannyFinishContext();
15020   return __pyx_r;
15021 }
15022 
__pyx_pf_4lupa_5_lupa_21_LuaCoroutineFunction___call__(struct __pyx_obj_4lupa_5_lupa__LuaCoroutineFunction * __pyx_v_self,PyObject * __pyx_v_args)15023 static PyObject *__pyx_pf_4lupa_5_lupa_21_LuaCoroutineFunction___call__(struct __pyx_obj_4lupa_5_lupa__LuaCoroutineFunction *__pyx_v_self, PyObject *__pyx_v_args) {
15024   PyObject *__pyx_r = NULL;
15025   __Pyx_RefNannyDeclarations
15026   PyObject *__pyx_t_1 = NULL;
15027   PyObject *__pyx_t_2 = NULL;
15028   int __pyx_lineno = 0;
15029   const char *__pyx_filename = NULL;
15030   int __pyx_clineno = 0;
15031   __Pyx_RefNannySetupContext("__call__", 0);
15032 
15033   /* "lupa/_lupa.pyx":866
15034  *     """
15035  *     def __call__(self, *args):
15036  *         return self.coroutine(*args)             # <<<<<<<<<<<<<<
15037  *
15038  * cdef _LuaCoroutineFunction new_lua_coroutine_function(LuaRuntime runtime, lua_State* L, int n):
15039  */
15040   __Pyx_XDECREF(__pyx_r);
15041   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_coroutine); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 866, __pyx_L1_error)
15042   __Pyx_GOTREF(__pyx_t_1);
15043   __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_v_args, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 866, __pyx_L1_error)
15044   __Pyx_GOTREF(__pyx_t_2);
15045   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
15046   __pyx_r = __pyx_t_2;
15047   __pyx_t_2 = 0;
15048   goto __pyx_L0;
15049 
15050   /* "lupa/_lupa.pyx":865
15051  *     """A function that returns a new coroutine when called.
15052  *     """
15053  *     def __call__(self, *args):             # <<<<<<<<<<<<<<
15054  *         return self.coroutine(*args)
15055  *
15056  */
15057 
15058   /* function exit code */
15059   __pyx_L1_error:;
15060   __Pyx_XDECREF(__pyx_t_1);
15061   __Pyx_XDECREF(__pyx_t_2);
15062   __Pyx_AddTraceback("lupa._lupa._LuaCoroutineFunction.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
15063   __pyx_r = NULL;
15064   __pyx_L0:;
15065   __Pyx_XGIVEREF(__pyx_r);
15066   __Pyx_RefNannyFinishContext();
15067   return __pyx_r;
15068 }
15069 
15070 /* "(tree fragment)":1
15071  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
15072  *     raise TypeError("self._state cannot be converted to a Python object for pickling")
15073  * def __setstate_cython__(self, __pyx_state):
15074  */
15075 
15076 /* Python wrapper */
15077 static PyObject *__pyx_pw_4lupa_5_lupa_21_LuaCoroutineFunction_3__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
15078 static char __pyx_doc_4lupa_5_lupa_21_LuaCoroutineFunction_2__reduce_cython__[] = "_LuaCoroutineFunction.__reduce_cython__(self)";
15079 static PyMethodDef __pyx_mdef_4lupa_5_lupa_21_LuaCoroutineFunction_3__reduce_cython__ = {"__reduce_cython__", (PyCFunction)__pyx_pw_4lupa_5_lupa_21_LuaCoroutineFunction_3__reduce_cython__, METH_NOARGS, __pyx_doc_4lupa_5_lupa_21_LuaCoroutineFunction_2__reduce_cython__};
__pyx_pw_4lupa_5_lupa_21_LuaCoroutineFunction_3__reduce_cython__(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)15080 static PyObject *__pyx_pw_4lupa_5_lupa_21_LuaCoroutineFunction_3__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
15081   PyObject *__pyx_r = 0;
15082   __Pyx_RefNannyDeclarations
15083   __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
15084   __pyx_r = __pyx_pf_4lupa_5_lupa_21_LuaCoroutineFunction_2__reduce_cython__(((struct __pyx_obj_4lupa_5_lupa__LuaCoroutineFunction *)__pyx_v_self));
15085 
15086   /* function exit code */
15087   __Pyx_RefNannyFinishContext();
15088   return __pyx_r;
15089 }
15090 
__pyx_pf_4lupa_5_lupa_21_LuaCoroutineFunction_2__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_4lupa_5_lupa__LuaCoroutineFunction * __pyx_v_self)15091 static PyObject *__pyx_pf_4lupa_5_lupa_21_LuaCoroutineFunction_2__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_4lupa_5_lupa__LuaCoroutineFunction *__pyx_v_self) {
15092   PyObject *__pyx_r = NULL;
15093   __Pyx_RefNannyDeclarations
15094   PyObject *__pyx_t_1 = NULL;
15095   int __pyx_lineno = 0;
15096   const char *__pyx_filename = NULL;
15097   int __pyx_clineno = 0;
15098   __Pyx_RefNannySetupContext("__reduce_cython__", 0);
15099 
15100   /* "(tree fragment)":2
15101  * def __reduce_cython__(self):
15102  *     raise TypeError("self._state cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
15103  * def __setstate_cython__(self, __pyx_state):
15104  *     raise TypeError("self._state cannot be converted to a Python object for pickling")
15105  */
15106   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__24, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error)
15107   __Pyx_GOTREF(__pyx_t_1);
15108   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
15109   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
15110   __PYX_ERR(2, 2, __pyx_L1_error)
15111 
15112   /* "(tree fragment)":1
15113  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
15114  *     raise TypeError("self._state cannot be converted to a Python object for pickling")
15115  * def __setstate_cython__(self, __pyx_state):
15116  */
15117 
15118   /* function exit code */
15119   __pyx_L1_error:;
15120   __Pyx_XDECREF(__pyx_t_1);
15121   __Pyx_AddTraceback("lupa._lupa._LuaCoroutineFunction.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
15122   __pyx_r = NULL;
15123   __Pyx_XGIVEREF(__pyx_r);
15124   __Pyx_RefNannyFinishContext();
15125   return __pyx_r;
15126 }
15127 
15128 /* "(tree fragment)":3
15129  * def __reduce_cython__(self):
15130  *     raise TypeError("self._state cannot be converted to a Python object for pickling")
15131  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
15132  *     raise TypeError("self._state cannot be converted to a Python object for pickling")
15133  */
15134 
15135 /* Python wrapper */
15136 static PyObject *__pyx_pw_4lupa_5_lupa_21_LuaCoroutineFunction_5__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
15137 static char __pyx_doc_4lupa_5_lupa_21_LuaCoroutineFunction_4__setstate_cython__[] = "_LuaCoroutineFunction.__setstate_cython__(self, __pyx_state)";
15138 static PyMethodDef __pyx_mdef_4lupa_5_lupa_21_LuaCoroutineFunction_5__setstate_cython__ = {"__setstate_cython__", (PyCFunction)__pyx_pw_4lupa_5_lupa_21_LuaCoroutineFunction_5__setstate_cython__, METH_O, __pyx_doc_4lupa_5_lupa_21_LuaCoroutineFunction_4__setstate_cython__};
__pyx_pw_4lupa_5_lupa_21_LuaCoroutineFunction_5__setstate_cython__(PyObject * __pyx_v_self,PyObject * __pyx_v___pyx_state)15139 static PyObject *__pyx_pw_4lupa_5_lupa_21_LuaCoroutineFunction_5__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
15140   PyObject *__pyx_r = 0;
15141   __Pyx_RefNannyDeclarations
15142   __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
15143   __pyx_r = __pyx_pf_4lupa_5_lupa_21_LuaCoroutineFunction_4__setstate_cython__(((struct __pyx_obj_4lupa_5_lupa__LuaCoroutineFunction *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
15144 
15145   /* function exit code */
15146   __Pyx_RefNannyFinishContext();
15147   return __pyx_r;
15148 }
15149 
__pyx_pf_4lupa_5_lupa_21_LuaCoroutineFunction_4__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_4lupa_5_lupa__LuaCoroutineFunction * __pyx_v_self,CYTHON_UNUSED PyObject * __pyx_v___pyx_state)15150 static PyObject *__pyx_pf_4lupa_5_lupa_21_LuaCoroutineFunction_4__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_4lupa_5_lupa__LuaCoroutineFunction *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
15151   PyObject *__pyx_r = NULL;
15152   __Pyx_RefNannyDeclarations
15153   PyObject *__pyx_t_1 = NULL;
15154   int __pyx_lineno = 0;
15155   const char *__pyx_filename = NULL;
15156   int __pyx_clineno = 0;
15157   __Pyx_RefNannySetupContext("__setstate_cython__", 0);
15158 
15159   /* "(tree fragment)":4
15160  *     raise TypeError("self._state cannot be converted to a Python object for pickling")
15161  * def __setstate_cython__(self, __pyx_state):
15162  *     raise TypeError("self._state cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
15163  */
15164   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__25, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error)
15165   __Pyx_GOTREF(__pyx_t_1);
15166   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
15167   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
15168   __PYX_ERR(2, 4, __pyx_L1_error)
15169 
15170   /* "(tree fragment)":3
15171  * def __reduce_cython__(self):
15172  *     raise TypeError("self._state cannot be converted to a Python object for pickling")
15173  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
15174  *     raise TypeError("self._state cannot be converted to a Python object for pickling")
15175  */
15176 
15177   /* function exit code */
15178   __pyx_L1_error:;
15179   __Pyx_XDECREF(__pyx_t_1);
15180   __Pyx_AddTraceback("lupa._lupa._LuaCoroutineFunction.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
15181   __pyx_r = NULL;
15182   __Pyx_XGIVEREF(__pyx_r);
15183   __Pyx_RefNannyFinishContext();
15184   return __pyx_r;
15185 }
15186 
15187 /* "lupa/_lupa.pyx":868
15188  *         return self.coroutine(*args)
15189  *
15190  * cdef _LuaCoroutineFunction new_lua_coroutine_function(LuaRuntime runtime, lua_State* L, int n):             # <<<<<<<<<<<<<<
15191  *     cdef _LuaCoroutineFunction obj = _LuaCoroutineFunction.__new__(_LuaCoroutineFunction)
15192  *     init_lua_object(obj, runtime, L, n)
15193  */
15194 
__pyx_f_4lupa_5_lupa_new_lua_coroutine_function(struct __pyx_obj_4lupa_5_lupa_LuaRuntime * __pyx_v_runtime,lua_State * __pyx_v_L,int __pyx_v_n)15195 static struct __pyx_obj_4lupa_5_lupa__LuaCoroutineFunction *__pyx_f_4lupa_5_lupa_new_lua_coroutine_function(struct __pyx_obj_4lupa_5_lupa_LuaRuntime *__pyx_v_runtime, lua_State *__pyx_v_L, int __pyx_v_n) {
15196   struct __pyx_obj_4lupa_5_lupa__LuaCoroutineFunction *__pyx_v_obj = 0;
15197   struct __pyx_obj_4lupa_5_lupa__LuaCoroutineFunction *__pyx_r = NULL;
15198   __Pyx_RefNannyDeclarations
15199   PyObject *__pyx_t_1 = NULL;
15200   int __pyx_lineno = 0;
15201   const char *__pyx_filename = NULL;
15202   int __pyx_clineno = 0;
15203   __Pyx_RefNannySetupContext("new_lua_coroutine_function", 0);
15204 
15205   /* "lupa/_lupa.pyx":869
15206  *
15207  * cdef _LuaCoroutineFunction new_lua_coroutine_function(LuaRuntime runtime, lua_State* L, int n):
15208  *     cdef _LuaCoroutineFunction obj = _LuaCoroutineFunction.__new__(_LuaCoroutineFunction)             # <<<<<<<<<<<<<<
15209  *     init_lua_object(obj, runtime, L, n)
15210  *     return obj
15211  */
15212   __pyx_t_1 = ((PyObject *)__pyx_tp_new_4lupa_5_lupa__LuaCoroutineFunction(((PyTypeObject *)__pyx_ptype_4lupa_5_lupa__LuaCoroutineFunction), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 869, __pyx_L1_error)
15213   __Pyx_GOTREF(((PyObject *)__pyx_t_1));
15214   __pyx_v_obj = ((struct __pyx_obj_4lupa_5_lupa__LuaCoroutineFunction *)__pyx_t_1);
15215   __pyx_t_1 = 0;
15216 
15217   /* "lupa/_lupa.pyx":870
15218  * cdef _LuaCoroutineFunction new_lua_coroutine_function(LuaRuntime runtime, lua_State* L, int n):
15219  *     cdef _LuaCoroutineFunction obj = _LuaCoroutineFunction.__new__(_LuaCoroutineFunction)
15220  *     init_lua_object(obj, runtime, L, n)             # <<<<<<<<<<<<<<
15221  *     return obj
15222  *
15223  */
15224   __pyx_f_4lupa_5_lupa_init_lua_object(((struct __pyx_obj_4lupa_5_lupa__LuaObject *)__pyx_v_obj), __pyx_v_runtime, __pyx_v_L, __pyx_v_n);
15225 
15226   /* "lupa/_lupa.pyx":871
15227  *     cdef _LuaCoroutineFunction obj = _LuaCoroutineFunction.__new__(_LuaCoroutineFunction)
15228  *     init_lua_object(obj, runtime, L, n)
15229  *     return obj             # <<<<<<<<<<<<<<
15230  *
15231  *
15232  */
15233   __Pyx_XDECREF(((PyObject *)__pyx_r));
15234   __Pyx_INCREF(((PyObject *)__pyx_v_obj));
15235   __pyx_r = __pyx_v_obj;
15236   goto __pyx_L0;
15237 
15238   /* "lupa/_lupa.pyx":868
15239  *         return self.coroutine(*args)
15240  *
15241  * cdef _LuaCoroutineFunction new_lua_coroutine_function(LuaRuntime runtime, lua_State* L, int n):             # <<<<<<<<<<<<<<
15242  *     cdef _LuaCoroutineFunction obj = _LuaCoroutineFunction.__new__(_LuaCoroutineFunction)
15243  *     init_lua_object(obj, runtime, L, n)
15244  */
15245 
15246   /* function exit code */
15247   __pyx_L1_error:;
15248   __Pyx_XDECREF(__pyx_t_1);
15249   __Pyx_AddTraceback("lupa._lupa.new_lua_coroutine_function", __pyx_clineno, __pyx_lineno, __pyx_filename);
15250   __pyx_r = 0;
15251   __pyx_L0:;
15252   __Pyx_XDECREF((PyObject *)__pyx_v_obj);
15253   __Pyx_XGIVEREF((PyObject *)__pyx_r);
15254   __Pyx_RefNannyFinishContext();
15255   return __pyx_r;
15256 }
15257 
15258 /* "lupa/_lupa.pyx":882
15259  *     cdef lua_State* _co_state
15260  *     cdef tuple _arguments
15261  *     def __iter__(self):             # <<<<<<<<<<<<<<
15262  *         return self
15263  *
15264  */
15265 
15266 /* Python wrapper */
15267 static PyObject *__pyx_pw_4lupa_5_lupa_10_LuaThread_1__iter__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_4lupa_5_lupa_10_LuaThread_1__iter__(PyObject * __pyx_v_self)15268 static PyObject *__pyx_pw_4lupa_5_lupa_10_LuaThread_1__iter__(PyObject *__pyx_v_self) {
15269   PyObject *__pyx_r = 0;
15270   __Pyx_RefNannyDeclarations
15271   __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
15272   __pyx_r = __pyx_pf_4lupa_5_lupa_10_LuaThread___iter__(((struct __pyx_obj_4lupa_5_lupa__LuaThread *)__pyx_v_self));
15273 
15274   /* function exit code */
15275   __Pyx_RefNannyFinishContext();
15276   return __pyx_r;
15277 }
15278 
__pyx_pf_4lupa_5_lupa_10_LuaThread___iter__(struct __pyx_obj_4lupa_5_lupa__LuaThread * __pyx_v_self)15279 static PyObject *__pyx_pf_4lupa_5_lupa_10_LuaThread___iter__(struct __pyx_obj_4lupa_5_lupa__LuaThread *__pyx_v_self) {
15280   PyObject *__pyx_r = NULL;
15281   __Pyx_RefNannyDeclarations
15282   __Pyx_RefNannySetupContext("__iter__", 0);
15283 
15284   /* "lupa/_lupa.pyx":883
15285  *     cdef tuple _arguments
15286  *     def __iter__(self):
15287  *         return self             # <<<<<<<<<<<<<<
15288  *
15289  *     def __next__(self):
15290  */
15291   __Pyx_XDECREF(__pyx_r);
15292   __Pyx_INCREF(((PyObject *)__pyx_v_self));
15293   __pyx_r = ((PyObject *)__pyx_v_self);
15294   goto __pyx_L0;
15295 
15296   /* "lupa/_lupa.pyx":882
15297  *     cdef lua_State* _co_state
15298  *     cdef tuple _arguments
15299  *     def __iter__(self):             # <<<<<<<<<<<<<<
15300  *         return self
15301  *
15302  */
15303 
15304   /* function exit code */
15305   __pyx_L0:;
15306   __Pyx_XGIVEREF(__pyx_r);
15307   __Pyx_RefNannyFinishContext();
15308   return __pyx_r;
15309 }
15310 
15311 /* "lupa/_lupa.pyx":885
15312  *         return self
15313  *
15314  *     def __next__(self):             # <<<<<<<<<<<<<<
15315  *         assert self._runtime is not None
15316  *         cdef tuple args = self._arguments
15317  */
15318 
15319 /* Python wrapper */
15320 static PyObject *__pyx_pw_4lupa_5_lupa_10_LuaThread_3__next__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_4lupa_5_lupa_10_LuaThread_3__next__(PyObject * __pyx_v_self)15321 static PyObject *__pyx_pw_4lupa_5_lupa_10_LuaThread_3__next__(PyObject *__pyx_v_self) {
15322   PyObject *__pyx_r = 0;
15323   __Pyx_RefNannyDeclarations
15324   __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
15325   __pyx_r = __pyx_pf_4lupa_5_lupa_10_LuaThread_2__next__(((struct __pyx_obj_4lupa_5_lupa__LuaThread *)__pyx_v_self));
15326 
15327   /* function exit code */
15328   __Pyx_RefNannyFinishContext();
15329   return __pyx_r;
15330 }
15331 
__pyx_pf_4lupa_5_lupa_10_LuaThread_2__next__(struct __pyx_obj_4lupa_5_lupa__LuaThread * __pyx_v_self)15332 static PyObject *__pyx_pf_4lupa_5_lupa_10_LuaThread_2__next__(struct __pyx_obj_4lupa_5_lupa__LuaThread *__pyx_v_self) {
15333   PyObject *__pyx_v_args = 0;
15334   PyObject *__pyx_r = NULL;
15335   __Pyx_RefNannyDeclarations
15336   int __pyx_t_1;
15337   PyObject *__pyx_t_2 = NULL;
15338   int __pyx_t_3;
15339   int __pyx_lineno = 0;
15340   const char *__pyx_filename = NULL;
15341   int __pyx_clineno = 0;
15342   __Pyx_RefNannySetupContext("__next__", 0);
15343 
15344   /* "lupa/_lupa.pyx":886
15345  *
15346  *     def __next__(self):
15347  *         assert self._runtime is not None             # <<<<<<<<<<<<<<
15348  *         cdef tuple args = self._arguments
15349  *         if args is not None:
15350  */
15351   #ifndef CYTHON_WITHOUT_ASSERTIONS
15352   if (unlikely(!Py_OptimizeFlag)) {
15353     __pyx_t_1 = (((PyObject *)__pyx_v_self->__pyx_base._runtime) != Py_None);
15354     if (unlikely(!(__pyx_t_1 != 0))) {
15355       PyErr_SetNone(PyExc_AssertionError);
15356       __PYX_ERR(0, 886, __pyx_L1_error)
15357     }
15358   }
15359   #endif
15360 
15361   /* "lupa/_lupa.pyx":887
15362  *     def __next__(self):
15363  *         assert self._runtime is not None
15364  *         cdef tuple args = self._arguments             # <<<<<<<<<<<<<<
15365  *         if args is not None:
15366  *             self._arguments = None
15367  */
15368   __pyx_t_2 = __pyx_v_self->_arguments;
15369   __Pyx_INCREF(__pyx_t_2);
15370   __pyx_v_args = ((PyObject*)__pyx_t_2);
15371   __pyx_t_2 = 0;
15372 
15373   /* "lupa/_lupa.pyx":888
15374  *         assert self._runtime is not None
15375  *         cdef tuple args = self._arguments
15376  *         if args is not None:             # <<<<<<<<<<<<<<
15377  *             self._arguments = None
15378  *         return resume_lua_thread(self, args)
15379  */
15380   __pyx_t_1 = (__pyx_v_args != ((PyObject*)Py_None));
15381   __pyx_t_3 = (__pyx_t_1 != 0);
15382   if (__pyx_t_3) {
15383 
15384     /* "lupa/_lupa.pyx":889
15385  *         cdef tuple args = self._arguments
15386  *         if args is not None:
15387  *             self._arguments = None             # <<<<<<<<<<<<<<
15388  *         return resume_lua_thread(self, args)
15389  *
15390  */
15391     __Pyx_INCREF(Py_None);
15392     __Pyx_GIVEREF(Py_None);
15393     __Pyx_GOTREF(__pyx_v_self->_arguments);
15394     __Pyx_DECREF(__pyx_v_self->_arguments);
15395     __pyx_v_self->_arguments = ((PyObject*)Py_None);
15396 
15397     /* "lupa/_lupa.pyx":888
15398  *         assert self._runtime is not None
15399  *         cdef tuple args = self._arguments
15400  *         if args is not None:             # <<<<<<<<<<<<<<
15401  *             self._arguments = None
15402  *         return resume_lua_thread(self, args)
15403  */
15404   }
15405 
15406   /* "lupa/_lupa.pyx":890
15407  *         if args is not None:
15408  *             self._arguments = None
15409  *         return resume_lua_thread(self, args)             # <<<<<<<<<<<<<<
15410  *
15411  *     def send(self, value):
15412  */
15413   __Pyx_XDECREF(__pyx_r);
15414   __pyx_t_2 = __pyx_f_4lupa_5_lupa_resume_lua_thread(__pyx_v_self, __pyx_v_args); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 890, __pyx_L1_error)
15415   __Pyx_GOTREF(__pyx_t_2);
15416   __pyx_r = __pyx_t_2;
15417   __pyx_t_2 = 0;
15418   goto __pyx_L0;
15419 
15420   /* "lupa/_lupa.pyx":885
15421  *         return self
15422  *
15423  *     def __next__(self):             # <<<<<<<<<<<<<<
15424  *         assert self._runtime is not None
15425  *         cdef tuple args = self._arguments
15426  */
15427 
15428   /* function exit code */
15429   __pyx_L1_error:;
15430   __Pyx_XDECREF(__pyx_t_2);
15431   __Pyx_AddTraceback("lupa._lupa._LuaThread.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
15432   __pyx_r = NULL;
15433   __pyx_L0:;
15434   __Pyx_XDECREF(__pyx_v_args);
15435   __Pyx_XGIVEREF(__pyx_r);
15436   __Pyx_RefNannyFinishContext();
15437   return __pyx_r;
15438 }
15439 
15440 /* "lupa/_lupa.pyx":892
15441  *         return resume_lua_thread(self, args)
15442  *
15443  *     def send(self, value):             # <<<<<<<<<<<<<<
15444  *         """Send a value into the coroutine.  If the value is a tuple,
15445  *         send the unpacked elements.
15446  */
15447 
15448 /* Python wrapper */
15449 static PyObject *__pyx_pw_4lupa_5_lupa_10_LuaThread_5send(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
15450 static char __pyx_doc_4lupa_5_lupa_10_LuaThread_4send[] = "_LuaThread.send(self, value)\nSend a value into the coroutine.  If the value is a tuple,\n        send the unpacked elements.\n        ";
15451 static PyMethodDef __pyx_mdef_4lupa_5_lupa_10_LuaThread_5send = {"send", (PyCFunction)__pyx_pw_4lupa_5_lupa_10_LuaThread_5send, METH_O, __pyx_doc_4lupa_5_lupa_10_LuaThread_4send};
__pyx_pw_4lupa_5_lupa_10_LuaThread_5send(PyObject * __pyx_v_self,PyObject * __pyx_v_value)15452 static PyObject *__pyx_pw_4lupa_5_lupa_10_LuaThread_5send(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
15453   PyObject *__pyx_r = 0;
15454   __Pyx_RefNannyDeclarations
15455   __Pyx_RefNannySetupContext("send (wrapper)", 0);
15456   __pyx_r = __pyx_pf_4lupa_5_lupa_10_LuaThread_4send(((struct __pyx_obj_4lupa_5_lupa__LuaThread *)__pyx_v_self), ((PyObject *)__pyx_v_value));
15457 
15458   /* function exit code */
15459   __Pyx_RefNannyFinishContext();
15460   return __pyx_r;
15461 }
15462 
__pyx_pf_4lupa_5_lupa_10_LuaThread_4send(struct __pyx_obj_4lupa_5_lupa__LuaThread * __pyx_v_self,PyObject * __pyx_v_value)15463 static PyObject *__pyx_pf_4lupa_5_lupa_10_LuaThread_4send(struct __pyx_obj_4lupa_5_lupa__LuaThread *__pyx_v_self, PyObject *__pyx_v_value) {
15464   PyObject *__pyx_r = NULL;
15465   __Pyx_RefNannyDeclarations
15466   int __pyx_t_1;
15467   int __pyx_t_2;
15468   PyObject *__pyx_t_3 = NULL;
15469   int __pyx_lineno = 0;
15470   const char *__pyx_filename = NULL;
15471   int __pyx_clineno = 0;
15472   __Pyx_RefNannySetupContext("send", 0);
15473   __Pyx_INCREF(__pyx_v_value);
15474 
15475   /* "lupa/_lupa.pyx":896
15476  *         send the unpacked elements.
15477  *         """
15478  *         if value is not None:             # <<<<<<<<<<<<<<
15479  *             if self._arguments is not None:
15480  *                 raise TypeError("can't send non-None value to a just-started generator")
15481  */
15482   __pyx_t_1 = (__pyx_v_value != Py_None);
15483   __pyx_t_2 = (__pyx_t_1 != 0);
15484   if (__pyx_t_2) {
15485 
15486     /* "lupa/_lupa.pyx":897
15487  *         """
15488  *         if value is not None:
15489  *             if self._arguments is not None:             # <<<<<<<<<<<<<<
15490  *                 raise TypeError("can't send non-None value to a just-started generator")
15491  *             if not isinstance(value, tuple):
15492  */
15493     __pyx_t_2 = (__pyx_v_self->_arguments != ((PyObject*)Py_None));
15494     __pyx_t_1 = (__pyx_t_2 != 0);
15495     if (unlikely(__pyx_t_1)) {
15496 
15497       /* "lupa/_lupa.pyx":898
15498  *         if value is not None:
15499  *             if self._arguments is not None:
15500  *                 raise TypeError("can't send non-None value to a just-started generator")             # <<<<<<<<<<<<<<
15501  *             if not isinstance(value, tuple):
15502  *                 value = (value,)
15503  */
15504       __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__26, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 898, __pyx_L1_error)
15505       __Pyx_GOTREF(__pyx_t_3);
15506       __Pyx_Raise(__pyx_t_3, 0, 0, 0);
15507       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
15508       __PYX_ERR(0, 898, __pyx_L1_error)
15509 
15510       /* "lupa/_lupa.pyx":897
15511  *         """
15512  *         if value is not None:
15513  *             if self._arguments is not None:             # <<<<<<<<<<<<<<
15514  *                 raise TypeError("can't send non-None value to a just-started generator")
15515  *             if not isinstance(value, tuple):
15516  */
15517     }
15518 
15519     /* "lupa/_lupa.pyx":899
15520  *             if self._arguments is not None:
15521  *                 raise TypeError("can't send non-None value to a just-started generator")
15522  *             if not isinstance(value, tuple):             # <<<<<<<<<<<<<<
15523  *                 value = (value,)
15524  *         elif self._arguments is not None:
15525  */
15526     __pyx_t_1 = PyTuple_Check(__pyx_v_value);
15527     __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
15528     if (__pyx_t_2) {
15529 
15530       /* "lupa/_lupa.pyx":900
15531  *                 raise TypeError("can't send non-None value to a just-started generator")
15532  *             if not isinstance(value, tuple):
15533  *                 value = (value,)             # <<<<<<<<<<<<<<
15534  *         elif self._arguments is not None:
15535  *             value = self._arguments
15536  */
15537       __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 900, __pyx_L1_error)
15538       __Pyx_GOTREF(__pyx_t_3);
15539       __Pyx_INCREF(__pyx_v_value);
15540       __Pyx_GIVEREF(__pyx_v_value);
15541       PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_value);
15542       __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_3);
15543       __pyx_t_3 = 0;
15544 
15545       /* "lupa/_lupa.pyx":899
15546  *             if self._arguments is not None:
15547  *                 raise TypeError("can't send non-None value to a just-started generator")
15548  *             if not isinstance(value, tuple):             # <<<<<<<<<<<<<<
15549  *                 value = (value,)
15550  *         elif self._arguments is not None:
15551  */
15552     }
15553 
15554     /* "lupa/_lupa.pyx":896
15555  *         send the unpacked elements.
15556  *         """
15557  *         if value is not None:             # <<<<<<<<<<<<<<
15558  *             if self._arguments is not None:
15559  *                 raise TypeError("can't send non-None value to a just-started generator")
15560  */
15561     goto __pyx_L3;
15562   }
15563 
15564   /* "lupa/_lupa.pyx":901
15565  *             if not isinstance(value, tuple):
15566  *                 value = (value,)
15567  *         elif self._arguments is not None:             # <<<<<<<<<<<<<<
15568  *             value = self._arguments
15569  *             self._arguments = None
15570  */
15571   __pyx_t_2 = (__pyx_v_self->_arguments != ((PyObject*)Py_None));
15572   __pyx_t_1 = (__pyx_t_2 != 0);
15573   if (__pyx_t_1) {
15574 
15575     /* "lupa/_lupa.pyx":902
15576  *                 value = (value,)
15577  *         elif self._arguments is not None:
15578  *             value = self._arguments             # <<<<<<<<<<<<<<
15579  *             self._arguments = None
15580  *         return resume_lua_thread(self, <tuple>value)
15581  */
15582     __pyx_t_3 = __pyx_v_self->_arguments;
15583     __Pyx_INCREF(__pyx_t_3);
15584     __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_3);
15585     __pyx_t_3 = 0;
15586 
15587     /* "lupa/_lupa.pyx":903
15588  *         elif self._arguments is not None:
15589  *             value = self._arguments
15590  *             self._arguments = None             # <<<<<<<<<<<<<<
15591  *         return resume_lua_thread(self, <tuple>value)
15592  *
15593  */
15594     __Pyx_INCREF(Py_None);
15595     __Pyx_GIVEREF(Py_None);
15596     __Pyx_GOTREF(__pyx_v_self->_arguments);
15597     __Pyx_DECREF(__pyx_v_self->_arguments);
15598     __pyx_v_self->_arguments = ((PyObject*)Py_None);
15599 
15600     /* "lupa/_lupa.pyx":901
15601  *             if not isinstance(value, tuple):
15602  *                 value = (value,)
15603  *         elif self._arguments is not None:             # <<<<<<<<<<<<<<
15604  *             value = self._arguments
15605  *             self._arguments = None
15606  */
15607   }
15608   __pyx_L3:;
15609 
15610   /* "lupa/_lupa.pyx":904
15611  *             value = self._arguments
15612  *             self._arguments = None
15613  *         return resume_lua_thread(self, <tuple>value)             # <<<<<<<<<<<<<<
15614  *
15615  *     def __bool__(self):
15616  */
15617   __Pyx_XDECREF(__pyx_r);
15618   __pyx_t_3 = __pyx_f_4lupa_5_lupa_resume_lua_thread(__pyx_v_self, ((PyObject*)__pyx_v_value)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 904, __pyx_L1_error)
15619   __Pyx_GOTREF(__pyx_t_3);
15620   __pyx_r = __pyx_t_3;
15621   __pyx_t_3 = 0;
15622   goto __pyx_L0;
15623 
15624   /* "lupa/_lupa.pyx":892
15625  *         return resume_lua_thread(self, args)
15626  *
15627  *     def send(self, value):             # <<<<<<<<<<<<<<
15628  *         """Send a value into the coroutine.  If the value is a tuple,
15629  *         send the unpacked elements.
15630  */
15631 
15632   /* function exit code */
15633   __pyx_L1_error:;
15634   __Pyx_XDECREF(__pyx_t_3);
15635   __Pyx_AddTraceback("lupa._lupa._LuaThread.send", __pyx_clineno, __pyx_lineno, __pyx_filename);
15636   __pyx_r = NULL;
15637   __pyx_L0:;
15638   __Pyx_XDECREF(__pyx_v_value);
15639   __Pyx_XGIVEREF(__pyx_r);
15640   __Pyx_RefNannyFinishContext();
15641   return __pyx_r;
15642 }
15643 
15644 /* "lupa/_lupa.pyx":906
15645  *         return resume_lua_thread(self, <tuple>value)
15646  *
15647  *     def __bool__(self):             # <<<<<<<<<<<<<<
15648  *         cdef lua.lua_Debug dummy
15649  *         assert self._runtime is not None
15650  */
15651 
15652 /* Python wrapper */
15653 static int __pyx_pw_4lupa_5_lupa_10_LuaThread_7__bool__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_4lupa_5_lupa_10_LuaThread_7__bool__(PyObject * __pyx_v_self)15654 static int __pyx_pw_4lupa_5_lupa_10_LuaThread_7__bool__(PyObject *__pyx_v_self) {
15655   int __pyx_r;
15656   __Pyx_RefNannyDeclarations
15657   __Pyx_RefNannySetupContext("__bool__ (wrapper)", 0);
15658   __pyx_r = __pyx_pf_4lupa_5_lupa_10_LuaThread_6__bool__(((struct __pyx_obj_4lupa_5_lupa__LuaThread *)__pyx_v_self));
15659 
15660   /* function exit code */
15661   __Pyx_RefNannyFinishContext();
15662   return __pyx_r;
15663 }
15664 
__pyx_pf_4lupa_5_lupa_10_LuaThread_6__bool__(struct __pyx_obj_4lupa_5_lupa__LuaThread * __pyx_v_self)15665 static int __pyx_pf_4lupa_5_lupa_10_LuaThread_6__bool__(struct __pyx_obj_4lupa_5_lupa__LuaThread *__pyx_v_self) {
15666   lua_Debug __pyx_v_dummy;
15667   int __pyx_v_status;
15668   int __pyx_r;
15669   __Pyx_RefNannyDeclarations
15670   int __pyx_t_1;
15671   int __pyx_lineno = 0;
15672   const char *__pyx_filename = NULL;
15673   int __pyx_clineno = 0;
15674   __Pyx_RefNannySetupContext("__bool__", 0);
15675 
15676   /* "lupa/_lupa.pyx":908
15677  *     def __bool__(self):
15678  *         cdef lua.lua_Debug dummy
15679  *         assert self._runtime is not None             # <<<<<<<<<<<<<<
15680  *         cdef int status = lua.lua_status(self._co_state)
15681  *         if status == lua.LUA_YIELD:
15682  */
15683   #ifndef CYTHON_WITHOUT_ASSERTIONS
15684   if (unlikely(!Py_OptimizeFlag)) {
15685     __pyx_t_1 = (((PyObject *)__pyx_v_self->__pyx_base._runtime) != Py_None);
15686     if (unlikely(!(__pyx_t_1 != 0))) {
15687       PyErr_SetNone(PyExc_AssertionError);
15688       __PYX_ERR(0, 908, __pyx_L1_error)
15689     }
15690   }
15691   #endif
15692 
15693   /* "lupa/_lupa.pyx":909
15694  *         cdef lua.lua_Debug dummy
15695  *         assert self._runtime is not None
15696  *         cdef int status = lua.lua_status(self._co_state)             # <<<<<<<<<<<<<<
15697  *         if status == lua.LUA_YIELD:
15698  *             return True
15699  */
15700   __pyx_v_status = lua_status(__pyx_v_self->_co_state);
15701 
15702   /* "lupa/_lupa.pyx":910
15703  *         assert self._runtime is not None
15704  *         cdef int status = lua.lua_status(self._co_state)
15705  *         if status == lua.LUA_YIELD:             # <<<<<<<<<<<<<<
15706  *             return True
15707  *         if status == 0:
15708  */
15709   __pyx_t_1 = ((__pyx_v_status == LUA_YIELD) != 0);
15710   if (__pyx_t_1) {
15711 
15712     /* "lupa/_lupa.pyx":911
15713  *         cdef int status = lua.lua_status(self._co_state)
15714  *         if status == lua.LUA_YIELD:
15715  *             return True             # <<<<<<<<<<<<<<
15716  *         if status == 0:
15717  *             # copied from Lua code: check for frames
15718  */
15719     __pyx_r = 1;
15720     goto __pyx_L0;
15721 
15722     /* "lupa/_lupa.pyx":910
15723  *         assert self._runtime is not None
15724  *         cdef int status = lua.lua_status(self._co_state)
15725  *         if status == lua.LUA_YIELD:             # <<<<<<<<<<<<<<
15726  *             return True
15727  *         if status == 0:
15728  */
15729   }
15730 
15731   /* "lupa/_lupa.pyx":912
15732  *         if status == lua.LUA_YIELD:
15733  *             return True
15734  *         if status == 0:             # <<<<<<<<<<<<<<
15735  *             # copied from Lua code: check for frames
15736  *             if lua.lua_getstack(self._co_state, 0, &dummy) > 0:
15737  */
15738   __pyx_t_1 = ((__pyx_v_status == 0) != 0);
15739   if (__pyx_t_1) {
15740 
15741     /* "lupa/_lupa.pyx":914
15742  *         if status == 0:
15743  *             # copied from Lua code: check for frames
15744  *             if lua.lua_getstack(self._co_state, 0, &dummy) > 0:             # <<<<<<<<<<<<<<
15745  *                 return True # currently running
15746  *             elif lua.lua_gettop(self._co_state) > 0:
15747  */
15748     __pyx_t_1 = ((lua_getstack(__pyx_v_self->_co_state, 0, (&__pyx_v_dummy)) > 0) != 0);
15749     if (__pyx_t_1) {
15750 
15751       /* "lupa/_lupa.pyx":915
15752  *             # copied from Lua code: check for frames
15753  *             if lua.lua_getstack(self._co_state, 0, &dummy) > 0:
15754  *                 return True # currently running             # <<<<<<<<<<<<<<
15755  *             elif lua.lua_gettop(self._co_state) > 0:
15756  *                 return True # not started yet
15757  */
15758       __pyx_r = 1;
15759       goto __pyx_L0;
15760 
15761       /* "lupa/_lupa.pyx":914
15762  *         if status == 0:
15763  *             # copied from Lua code: check for frames
15764  *             if lua.lua_getstack(self._co_state, 0, &dummy) > 0:             # <<<<<<<<<<<<<<
15765  *                 return True # currently running
15766  *             elif lua.lua_gettop(self._co_state) > 0:
15767  */
15768     }
15769 
15770     /* "lupa/_lupa.pyx":916
15771  *             if lua.lua_getstack(self._co_state, 0, &dummy) > 0:
15772  *                 return True # currently running
15773  *             elif lua.lua_gettop(self._co_state) > 0:             # <<<<<<<<<<<<<<
15774  *                 return True # not started yet
15775  *         return False
15776  */
15777     __pyx_t_1 = ((lua_gettop(__pyx_v_self->_co_state) > 0) != 0);
15778     if (__pyx_t_1) {
15779 
15780       /* "lupa/_lupa.pyx":917
15781  *                 return True # currently running
15782  *             elif lua.lua_gettop(self._co_state) > 0:
15783  *                 return True # not started yet             # <<<<<<<<<<<<<<
15784  *         return False
15785  *
15786  */
15787       __pyx_r = 1;
15788       goto __pyx_L0;
15789 
15790       /* "lupa/_lupa.pyx":916
15791  *             if lua.lua_getstack(self._co_state, 0, &dummy) > 0:
15792  *                 return True # currently running
15793  *             elif lua.lua_gettop(self._co_state) > 0:             # <<<<<<<<<<<<<<
15794  *                 return True # not started yet
15795  *         return False
15796  */
15797     }
15798 
15799     /* "lupa/_lupa.pyx":912
15800  *         if status == lua.LUA_YIELD:
15801  *             return True
15802  *         if status == 0:             # <<<<<<<<<<<<<<
15803  *             # copied from Lua code: check for frames
15804  *             if lua.lua_getstack(self._co_state, 0, &dummy) > 0:
15805  */
15806   }
15807 
15808   /* "lupa/_lupa.pyx":918
15809  *             elif lua.lua_gettop(self._co_state) > 0:
15810  *                 return True # not started yet
15811  *         return False             # <<<<<<<<<<<<<<
15812  *
15813  * cdef _LuaThread new_lua_thread(LuaRuntime runtime, lua_State* L, int n):
15814  */
15815   __pyx_r = 0;
15816   goto __pyx_L0;
15817 
15818   /* "lupa/_lupa.pyx":906
15819  *         return resume_lua_thread(self, <tuple>value)
15820  *
15821  *     def __bool__(self):             # <<<<<<<<<<<<<<
15822  *         cdef lua.lua_Debug dummy
15823  *         assert self._runtime is not None
15824  */
15825 
15826   /* function exit code */
15827   __pyx_L1_error:;
15828   __Pyx_AddTraceback("lupa._lupa._LuaThread.__bool__", __pyx_clineno, __pyx_lineno, __pyx_filename);
15829   __pyx_r = -1;
15830   __pyx_L0:;
15831   __Pyx_RefNannyFinishContext();
15832   return __pyx_r;
15833 }
15834 
15835 /* "(tree fragment)":1
15836  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
15837  *     raise TypeError("self._co_state,self._state cannot be converted to a Python object for pickling")
15838  * def __setstate_cython__(self, __pyx_state):
15839  */
15840 
15841 /* Python wrapper */
15842 static PyObject *__pyx_pw_4lupa_5_lupa_10_LuaThread_9__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
15843 static char __pyx_doc_4lupa_5_lupa_10_LuaThread_8__reduce_cython__[] = "_LuaThread.__reduce_cython__(self)";
15844 static PyMethodDef __pyx_mdef_4lupa_5_lupa_10_LuaThread_9__reduce_cython__ = {"__reduce_cython__", (PyCFunction)__pyx_pw_4lupa_5_lupa_10_LuaThread_9__reduce_cython__, METH_NOARGS, __pyx_doc_4lupa_5_lupa_10_LuaThread_8__reduce_cython__};
__pyx_pw_4lupa_5_lupa_10_LuaThread_9__reduce_cython__(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)15845 static PyObject *__pyx_pw_4lupa_5_lupa_10_LuaThread_9__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
15846   PyObject *__pyx_r = 0;
15847   __Pyx_RefNannyDeclarations
15848   __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
15849   __pyx_r = __pyx_pf_4lupa_5_lupa_10_LuaThread_8__reduce_cython__(((struct __pyx_obj_4lupa_5_lupa__LuaThread *)__pyx_v_self));
15850 
15851   /* function exit code */
15852   __Pyx_RefNannyFinishContext();
15853   return __pyx_r;
15854 }
15855 
__pyx_pf_4lupa_5_lupa_10_LuaThread_8__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_4lupa_5_lupa__LuaThread * __pyx_v_self)15856 static PyObject *__pyx_pf_4lupa_5_lupa_10_LuaThread_8__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_4lupa_5_lupa__LuaThread *__pyx_v_self) {
15857   PyObject *__pyx_r = NULL;
15858   __Pyx_RefNannyDeclarations
15859   PyObject *__pyx_t_1 = NULL;
15860   int __pyx_lineno = 0;
15861   const char *__pyx_filename = NULL;
15862   int __pyx_clineno = 0;
15863   __Pyx_RefNannySetupContext("__reduce_cython__", 0);
15864 
15865   /* "(tree fragment)":2
15866  * def __reduce_cython__(self):
15867  *     raise TypeError("self._co_state,self._state cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
15868  * def __setstate_cython__(self, __pyx_state):
15869  *     raise TypeError("self._co_state,self._state cannot be converted to a Python object for pickling")
15870  */
15871   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__27, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error)
15872   __Pyx_GOTREF(__pyx_t_1);
15873   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
15874   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
15875   __PYX_ERR(2, 2, __pyx_L1_error)
15876 
15877   /* "(tree fragment)":1
15878  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
15879  *     raise TypeError("self._co_state,self._state cannot be converted to a Python object for pickling")
15880  * def __setstate_cython__(self, __pyx_state):
15881  */
15882 
15883   /* function exit code */
15884   __pyx_L1_error:;
15885   __Pyx_XDECREF(__pyx_t_1);
15886   __Pyx_AddTraceback("lupa._lupa._LuaThread.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
15887   __pyx_r = NULL;
15888   __Pyx_XGIVEREF(__pyx_r);
15889   __Pyx_RefNannyFinishContext();
15890   return __pyx_r;
15891 }
15892 
15893 /* "(tree fragment)":3
15894  * def __reduce_cython__(self):
15895  *     raise TypeError("self._co_state,self._state cannot be converted to a Python object for pickling")
15896  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
15897  *     raise TypeError("self._co_state,self._state cannot be converted to a Python object for pickling")
15898  */
15899 
15900 /* Python wrapper */
15901 static PyObject *__pyx_pw_4lupa_5_lupa_10_LuaThread_11__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
15902 static char __pyx_doc_4lupa_5_lupa_10_LuaThread_10__setstate_cython__[] = "_LuaThread.__setstate_cython__(self, __pyx_state)";
15903 static PyMethodDef __pyx_mdef_4lupa_5_lupa_10_LuaThread_11__setstate_cython__ = {"__setstate_cython__", (PyCFunction)__pyx_pw_4lupa_5_lupa_10_LuaThread_11__setstate_cython__, METH_O, __pyx_doc_4lupa_5_lupa_10_LuaThread_10__setstate_cython__};
__pyx_pw_4lupa_5_lupa_10_LuaThread_11__setstate_cython__(PyObject * __pyx_v_self,PyObject * __pyx_v___pyx_state)15904 static PyObject *__pyx_pw_4lupa_5_lupa_10_LuaThread_11__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
15905   PyObject *__pyx_r = 0;
15906   __Pyx_RefNannyDeclarations
15907   __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
15908   __pyx_r = __pyx_pf_4lupa_5_lupa_10_LuaThread_10__setstate_cython__(((struct __pyx_obj_4lupa_5_lupa__LuaThread *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
15909 
15910   /* function exit code */
15911   __Pyx_RefNannyFinishContext();
15912   return __pyx_r;
15913 }
15914 
__pyx_pf_4lupa_5_lupa_10_LuaThread_10__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_4lupa_5_lupa__LuaThread * __pyx_v_self,CYTHON_UNUSED PyObject * __pyx_v___pyx_state)15915 static PyObject *__pyx_pf_4lupa_5_lupa_10_LuaThread_10__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_4lupa_5_lupa__LuaThread *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
15916   PyObject *__pyx_r = NULL;
15917   __Pyx_RefNannyDeclarations
15918   PyObject *__pyx_t_1 = NULL;
15919   int __pyx_lineno = 0;
15920   const char *__pyx_filename = NULL;
15921   int __pyx_clineno = 0;
15922   __Pyx_RefNannySetupContext("__setstate_cython__", 0);
15923 
15924   /* "(tree fragment)":4
15925  *     raise TypeError("self._co_state,self._state cannot be converted to a Python object for pickling")
15926  * def __setstate_cython__(self, __pyx_state):
15927  *     raise TypeError("self._co_state,self._state cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
15928  */
15929   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__28, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error)
15930   __Pyx_GOTREF(__pyx_t_1);
15931   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
15932   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
15933   __PYX_ERR(2, 4, __pyx_L1_error)
15934 
15935   /* "(tree fragment)":3
15936  * def __reduce_cython__(self):
15937  *     raise TypeError("self._co_state,self._state cannot be converted to a Python object for pickling")
15938  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
15939  *     raise TypeError("self._co_state,self._state cannot be converted to a Python object for pickling")
15940  */
15941 
15942   /* function exit code */
15943   __pyx_L1_error:;
15944   __Pyx_XDECREF(__pyx_t_1);
15945   __Pyx_AddTraceback("lupa._lupa._LuaThread.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
15946   __pyx_r = NULL;
15947   __Pyx_XGIVEREF(__pyx_r);
15948   __Pyx_RefNannyFinishContext();
15949   return __pyx_r;
15950 }
15951 
15952 /* "lupa/_lupa.pyx":920
15953  *         return False
15954  *
15955  * cdef _LuaThread new_lua_thread(LuaRuntime runtime, lua_State* L, int n):             # <<<<<<<<<<<<<<
15956  *     cdef _LuaThread obj = _LuaThread.__new__(_LuaThread)
15957  *     init_lua_object(obj, runtime, L, n)
15958  */
15959 
__pyx_f_4lupa_5_lupa_new_lua_thread(struct __pyx_obj_4lupa_5_lupa_LuaRuntime * __pyx_v_runtime,lua_State * __pyx_v_L,int __pyx_v_n)15960 static struct __pyx_obj_4lupa_5_lupa__LuaThread *__pyx_f_4lupa_5_lupa_new_lua_thread(struct __pyx_obj_4lupa_5_lupa_LuaRuntime *__pyx_v_runtime, lua_State *__pyx_v_L, int __pyx_v_n) {
15961   struct __pyx_obj_4lupa_5_lupa__LuaThread *__pyx_v_obj = 0;
15962   struct __pyx_obj_4lupa_5_lupa__LuaThread *__pyx_r = NULL;
15963   __Pyx_RefNannyDeclarations
15964   PyObject *__pyx_t_1 = NULL;
15965   int __pyx_lineno = 0;
15966   const char *__pyx_filename = NULL;
15967   int __pyx_clineno = 0;
15968   __Pyx_RefNannySetupContext("new_lua_thread", 0);
15969 
15970   /* "lupa/_lupa.pyx":921
15971  *
15972  * cdef _LuaThread new_lua_thread(LuaRuntime runtime, lua_State* L, int n):
15973  *     cdef _LuaThread obj = _LuaThread.__new__(_LuaThread)             # <<<<<<<<<<<<<<
15974  *     init_lua_object(obj, runtime, L, n)
15975  *     obj._co_state = lua.lua_tothread(L, n)
15976  */
15977   __pyx_t_1 = ((PyObject *)__pyx_tp_new_4lupa_5_lupa__LuaThread(((PyTypeObject *)__pyx_ptype_4lupa_5_lupa__LuaThread), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 921, __pyx_L1_error)
15978   __Pyx_GOTREF(((PyObject *)__pyx_t_1));
15979   __pyx_v_obj = ((struct __pyx_obj_4lupa_5_lupa__LuaThread *)__pyx_t_1);
15980   __pyx_t_1 = 0;
15981 
15982   /* "lupa/_lupa.pyx":922
15983  * cdef _LuaThread new_lua_thread(LuaRuntime runtime, lua_State* L, int n):
15984  *     cdef _LuaThread obj = _LuaThread.__new__(_LuaThread)
15985  *     init_lua_object(obj, runtime, L, n)             # <<<<<<<<<<<<<<
15986  *     obj._co_state = lua.lua_tothread(L, n)
15987  *     return obj
15988  */
15989   __pyx_f_4lupa_5_lupa_init_lua_object(((struct __pyx_obj_4lupa_5_lupa__LuaObject *)__pyx_v_obj), __pyx_v_runtime, __pyx_v_L, __pyx_v_n);
15990 
15991   /* "lupa/_lupa.pyx":923
15992  *     cdef _LuaThread obj = _LuaThread.__new__(_LuaThread)
15993  *     init_lua_object(obj, runtime, L, n)
15994  *     obj._co_state = lua.lua_tothread(L, n)             # <<<<<<<<<<<<<<
15995  *     return obj
15996  *
15997  */
15998   __pyx_v_obj->_co_state = lua_tothread(__pyx_v_L, __pyx_v_n);
15999 
16000   /* "lupa/_lupa.pyx":924
16001  *     init_lua_object(obj, runtime, L, n)
16002  *     obj._co_state = lua.lua_tothread(L, n)
16003  *     return obj             # <<<<<<<<<<<<<<
16004  *
16005  *
16006  */
16007   __Pyx_XDECREF(((PyObject *)__pyx_r));
16008   __Pyx_INCREF(((PyObject *)__pyx_v_obj));
16009   __pyx_r = __pyx_v_obj;
16010   goto __pyx_L0;
16011 
16012   /* "lupa/_lupa.pyx":920
16013  *         return False
16014  *
16015  * cdef _LuaThread new_lua_thread(LuaRuntime runtime, lua_State* L, int n):             # <<<<<<<<<<<<<<
16016  *     cdef _LuaThread obj = _LuaThread.__new__(_LuaThread)
16017  *     init_lua_object(obj, runtime, L, n)
16018  */
16019 
16020   /* function exit code */
16021   __pyx_L1_error:;
16022   __Pyx_XDECREF(__pyx_t_1);
16023   __Pyx_AddTraceback("lupa._lupa.new_lua_thread", __pyx_clineno, __pyx_lineno, __pyx_filename);
16024   __pyx_r = 0;
16025   __pyx_L0:;
16026   __Pyx_XDECREF((PyObject *)__pyx_v_obj);
16027   __Pyx_XGIVEREF((PyObject *)__pyx_r);
16028   __Pyx_RefNannyFinishContext();
16029   return __pyx_r;
16030 }
16031 
16032 /* "lupa/_lupa.pyx":927
16033  *
16034  *
16035  * cdef _LuaObject new_lua_thread_or_function(LuaRuntime runtime, lua_State* L, int n):             # <<<<<<<<<<<<<<
16036  *     # this is special - we replace a new (unstarted) thread by its
16037  *     # underlying function to better follow Python's own generator
16038  */
16039 
__pyx_f_4lupa_5_lupa_new_lua_thread_or_function(struct __pyx_obj_4lupa_5_lupa_LuaRuntime * __pyx_v_runtime,lua_State * __pyx_v_L,int __pyx_v_n)16040 static struct __pyx_obj_4lupa_5_lupa__LuaObject *__pyx_f_4lupa_5_lupa_new_lua_thread_or_function(struct __pyx_obj_4lupa_5_lupa_LuaRuntime *__pyx_v_runtime, lua_State *__pyx_v_L, int __pyx_v_n) {
16041   lua_State *__pyx_v_co;
16042   struct __pyx_obj_4lupa_5_lupa__LuaObject *__pyx_r = NULL;
16043   __Pyx_RefNannyDeclarations
16044   int __pyx_t_1;
16045   int __pyx_t_2;
16046   PyObject *__pyx_t_3 = NULL;
16047   int __pyx_t_4;
16048   int __pyx_t_5;
16049   char const *__pyx_t_6;
16050   PyObject *__pyx_t_7 = NULL;
16051   PyObject *__pyx_t_8 = NULL;
16052   PyObject *__pyx_t_9 = NULL;
16053   PyObject *__pyx_t_10 = NULL;
16054   PyObject *__pyx_t_11 = NULL;
16055   PyObject *__pyx_t_12 = NULL;
16056   struct __pyx_obj_4lupa_5_lupa__LuaObject *__pyx_t_13 = NULL;
16057   int __pyx_lineno = 0;
16058   const char *__pyx_filename = NULL;
16059   int __pyx_clineno = 0;
16060   __Pyx_RefNannySetupContext("new_lua_thread_or_function", 0);
16061 
16062   /* "lupa/_lupa.pyx":931
16063  *     # underlying function to better follow Python's own generator
16064  *     # protocol
16065  *     cdef lua_State* co = lua.lua_tothread(L, n)             # <<<<<<<<<<<<<<
16066  *     assert co is not NULL
16067  *     if lua.lua_status(co) == 0 and lua.lua_gettop(co) == 1:
16068  */
16069   __pyx_v_co = lua_tothread(__pyx_v_L, __pyx_v_n);
16070 
16071   /* "lupa/_lupa.pyx":932
16072  *     # protocol
16073  *     cdef lua_State* co = lua.lua_tothread(L, n)
16074  *     assert co is not NULL             # <<<<<<<<<<<<<<
16075  *     if lua.lua_status(co) == 0 and lua.lua_gettop(co) == 1:
16076  *         # not started yet => get the function and return that
16077  */
16078   #ifndef CYTHON_WITHOUT_ASSERTIONS
16079   if (unlikely(!Py_OptimizeFlag)) {
16080     if (unlikely(!((__pyx_v_co != NULL) != 0))) {
16081       PyErr_SetNone(PyExc_AssertionError);
16082       __PYX_ERR(0, 932, __pyx_L1_error)
16083     }
16084   }
16085   #endif
16086 
16087   /* "lupa/_lupa.pyx":933
16088  *     cdef lua_State* co = lua.lua_tothread(L, n)
16089  *     assert co is not NULL
16090  *     if lua.lua_status(co) == 0 and lua.lua_gettop(co) == 1:             # <<<<<<<<<<<<<<
16091  *         # not started yet => get the function and return that
16092  *         lua.lua_pushvalue(co, 1)
16093  */
16094   __pyx_t_2 = ((lua_status(__pyx_v_co) == 0) != 0);
16095   if (__pyx_t_2) {
16096   } else {
16097     __pyx_t_1 = __pyx_t_2;
16098     goto __pyx_L4_bool_binop_done;
16099   }
16100   __pyx_t_2 = ((lua_gettop(__pyx_v_co) == 1) != 0);
16101   __pyx_t_1 = __pyx_t_2;
16102   __pyx_L4_bool_binop_done:;
16103   if (__pyx_t_1) {
16104 
16105     /* "lupa/_lupa.pyx":935
16106  *     if lua.lua_status(co) == 0 and lua.lua_gettop(co) == 1:
16107  *         # not started yet => get the function and return that
16108  *         lua.lua_pushvalue(co, 1)             # <<<<<<<<<<<<<<
16109  *         lua.lua_xmove(co, L, 1)
16110  *         try:
16111  */
16112     lua_pushvalue(__pyx_v_co, 1);
16113 
16114     /* "lupa/_lupa.pyx":936
16115  *         # not started yet => get the function and return that
16116  *         lua.lua_pushvalue(co, 1)
16117  *         lua.lua_xmove(co, L, 1)             # <<<<<<<<<<<<<<
16118  *         try:
16119  *             return new_lua_coroutine_function(runtime, L, -1)
16120  */
16121     lua_xmove(__pyx_v_co, __pyx_v_L, 1);
16122 
16123     /* "lupa/_lupa.pyx":937
16124  *         lua.lua_pushvalue(co, 1)
16125  *         lua.lua_xmove(co, L, 1)
16126  *         try:             # <<<<<<<<<<<<<<
16127  *             return new_lua_coroutine_function(runtime, L, -1)
16128  *         finally:
16129  */
16130     /*try:*/ {
16131 
16132       /* "lupa/_lupa.pyx":938
16133  *         lua.lua_xmove(co, L, 1)
16134  *         try:
16135  *             return new_lua_coroutine_function(runtime, L, -1)             # <<<<<<<<<<<<<<
16136  *         finally:
16137  *             lua.lua_pop(L, 1)
16138  */
16139       __Pyx_XDECREF(((PyObject *)__pyx_r));
16140       __pyx_t_3 = ((PyObject *)__pyx_f_4lupa_5_lupa_new_lua_coroutine_function(__pyx_v_runtime, __pyx_v_L, -1)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 938, __pyx_L7_error)
16141       __Pyx_GOTREF(__pyx_t_3);
16142       __pyx_r = ((struct __pyx_obj_4lupa_5_lupa__LuaObject *)__pyx_t_3);
16143       __pyx_t_3 = 0;
16144       goto __pyx_L6_return;
16145     }
16146 
16147     /* "lupa/_lupa.pyx":940
16148  *             return new_lua_coroutine_function(runtime, L, -1)
16149  *         finally:
16150  *             lua.lua_pop(L, 1)             # <<<<<<<<<<<<<<
16151  *     else:
16152  *         # already started => wrap the thread
16153  */
16154     /*finally:*/ {
16155       __pyx_L7_error:;
16156       /*exception exit:*/{
16157         __Pyx_PyThreadState_declare
16158         __Pyx_PyThreadState_assign
16159         __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
16160         __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
16161         if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
16162         if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9) < 0)) __Pyx_ErrFetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
16163         __Pyx_XGOTREF(__pyx_t_7);
16164         __Pyx_XGOTREF(__pyx_t_8);
16165         __Pyx_XGOTREF(__pyx_t_9);
16166         __Pyx_XGOTREF(__pyx_t_10);
16167         __Pyx_XGOTREF(__pyx_t_11);
16168         __Pyx_XGOTREF(__pyx_t_12);
16169         __pyx_t_4 = __pyx_lineno; __pyx_t_5 = __pyx_clineno; __pyx_t_6 = __pyx_filename;
16170         {
16171           lua_pop(__pyx_v_L, 1);
16172         }
16173         if (PY_MAJOR_VERSION >= 3) {
16174           __Pyx_XGIVEREF(__pyx_t_10);
16175           __Pyx_XGIVEREF(__pyx_t_11);
16176           __Pyx_XGIVEREF(__pyx_t_12);
16177           __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
16178         }
16179         __Pyx_XGIVEREF(__pyx_t_7);
16180         __Pyx_XGIVEREF(__pyx_t_8);
16181         __Pyx_XGIVEREF(__pyx_t_9);
16182         __Pyx_ErrRestore(__pyx_t_7, __pyx_t_8, __pyx_t_9);
16183         __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
16184         __pyx_lineno = __pyx_t_4; __pyx_clineno = __pyx_t_5; __pyx_filename = __pyx_t_6;
16185         goto __pyx_L1_error;
16186       }
16187       __pyx_L6_return: {
16188         __pyx_t_13 = __pyx_r;
16189         __pyx_r = 0;
16190         lua_pop(__pyx_v_L, 1);
16191         __pyx_r = __pyx_t_13;
16192         __pyx_t_13 = 0;
16193         goto __pyx_L0;
16194       }
16195     }
16196 
16197     /* "lupa/_lupa.pyx":933
16198  *     cdef lua_State* co = lua.lua_tothread(L, n)
16199  *     assert co is not NULL
16200  *     if lua.lua_status(co) == 0 and lua.lua_gettop(co) == 1:             # <<<<<<<<<<<<<<
16201  *         # not started yet => get the function and return that
16202  *         lua.lua_pushvalue(co, 1)
16203  */
16204   }
16205 
16206   /* "lupa/_lupa.pyx":943
16207  *     else:
16208  *         # already started => wrap the thread
16209  *         return new_lua_thread(runtime, L, n)             # <<<<<<<<<<<<<<
16210  *
16211  *
16212  */
16213   /*else*/ {
16214     __Pyx_XDECREF(((PyObject *)__pyx_r));
16215     __pyx_t_3 = ((PyObject *)__pyx_f_4lupa_5_lupa_new_lua_thread(__pyx_v_runtime, __pyx_v_L, __pyx_v_n)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 943, __pyx_L1_error)
16216     __Pyx_GOTREF(__pyx_t_3);
16217     __pyx_r = ((struct __pyx_obj_4lupa_5_lupa__LuaObject *)__pyx_t_3);
16218     __pyx_t_3 = 0;
16219     goto __pyx_L0;
16220   }
16221 
16222   /* "lupa/_lupa.pyx":927
16223  *
16224  *
16225  * cdef _LuaObject new_lua_thread_or_function(LuaRuntime runtime, lua_State* L, int n):             # <<<<<<<<<<<<<<
16226  *     # this is special - we replace a new (unstarted) thread by its
16227  *     # underlying function to better follow Python's own generator
16228  */
16229 
16230   /* function exit code */
16231   __pyx_L1_error:;
16232   __Pyx_XDECREF(__pyx_t_3);
16233   __Pyx_AddTraceback("lupa._lupa.new_lua_thread_or_function", __pyx_clineno, __pyx_lineno, __pyx_filename);
16234   __pyx_r = 0;
16235   __pyx_L0:;
16236   __Pyx_XGIVEREF((PyObject *)__pyx_r);
16237   __Pyx_RefNannyFinishContext();
16238   return __pyx_r;
16239 }
16240 
16241 /* "lupa/_lupa.pyx":946
16242  *
16243  *
16244  * cdef object resume_lua_thread(_LuaThread thread, tuple args):             # <<<<<<<<<<<<<<
16245  *     cdef lua_State* co = thread._co_state
16246  *     cdef lua_State* L = thread._state
16247  */
16248 
__pyx_f_4lupa_5_lupa_resume_lua_thread(struct __pyx_obj_4lupa_5_lupa__LuaThread * __pyx_v_thread,PyObject * __pyx_v_args)16249 static PyObject *__pyx_f_4lupa_5_lupa_resume_lua_thread(struct __pyx_obj_4lupa_5_lupa__LuaThread *__pyx_v_thread, PyObject *__pyx_v_args) {
16250   lua_State *__pyx_v_co;
16251   lua_State *__pyx_v_L;
16252   int __pyx_v_status;
16253   int __pyx_v_nargs;
16254   int __pyx_v_nres;
16255   int __pyx_v_old_top;
16256   PyObject *__pyx_r = NULL;
16257   __Pyx_RefNannyDeclarations
16258   lua_State *__pyx_t_1;
16259   PyObject *__pyx_t_2 = NULL;
16260   int __pyx_t_3;
16261   int __pyx_t_4;
16262   int __pyx_t_5;
16263   Py_ssize_t __pyx_t_6;
16264   PyObject *__pyx_t_7 = NULL;
16265   int __pyx_t_8;
16266   char const *__pyx_t_9;
16267   PyObject *__pyx_t_10 = NULL;
16268   PyObject *__pyx_t_11 = NULL;
16269   PyObject *__pyx_t_12 = NULL;
16270   PyObject *__pyx_t_13 = NULL;
16271   PyObject *__pyx_t_14 = NULL;
16272   PyObject *__pyx_t_15 = NULL;
16273   int __pyx_lineno = 0;
16274   const char *__pyx_filename = NULL;
16275   int __pyx_clineno = 0;
16276   __Pyx_RefNannySetupContext("resume_lua_thread", 0);
16277 
16278   /* "lupa/_lupa.pyx":947
16279  *
16280  * cdef object resume_lua_thread(_LuaThread thread, tuple args):
16281  *     cdef lua_State* co = thread._co_state             # <<<<<<<<<<<<<<
16282  *     cdef lua_State* L = thread._state
16283  *     cdef int status, i, nargs = 0, nres = 0
16284  */
16285   __pyx_t_1 = __pyx_v_thread->_co_state;
16286   __pyx_v_co = __pyx_t_1;
16287 
16288   /* "lupa/_lupa.pyx":948
16289  * cdef object resume_lua_thread(_LuaThread thread, tuple args):
16290  *     cdef lua_State* co = thread._co_state
16291  *     cdef lua_State* L = thread._state             # <<<<<<<<<<<<<<
16292  *     cdef int status, i, nargs = 0, nres = 0
16293  *     lock_runtime(thread._runtime)
16294  */
16295   __pyx_t_1 = __pyx_v_thread->__pyx_base._state;
16296   __pyx_v_L = __pyx_t_1;
16297 
16298   /* "lupa/_lupa.pyx":949
16299  *     cdef lua_State* co = thread._co_state
16300  *     cdef lua_State* L = thread._state
16301  *     cdef int status, i, nargs = 0, nres = 0             # <<<<<<<<<<<<<<
16302  *     lock_runtime(thread._runtime)
16303  *     old_top = lua.lua_gettop(L)
16304  */
16305   __pyx_v_nargs = 0;
16306   __pyx_v_nres = 0;
16307 
16308   /* "lupa/_lupa.pyx":950
16309  *     cdef lua_State* L = thread._state
16310  *     cdef int status, i, nargs = 0, nres = 0
16311  *     lock_runtime(thread._runtime)             # <<<<<<<<<<<<<<
16312  *     old_top = lua.lua_gettop(L)
16313  *     try:
16314  */
16315   __pyx_t_2 = ((PyObject *)__pyx_v_thread->__pyx_base._runtime);
16316   __Pyx_INCREF(__pyx_t_2);
16317   __pyx_t_3 = __pyx_f_4lupa_5_lupa_lock_runtime(((struct __pyx_obj_4lupa_5_lupa_LuaRuntime *)__pyx_t_2)); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 950, __pyx_L1_error)
16318   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
16319 
16320   /* "lupa/_lupa.pyx":951
16321  *     cdef int status, i, nargs = 0, nres = 0
16322  *     lock_runtime(thread._runtime)
16323  *     old_top = lua.lua_gettop(L)             # <<<<<<<<<<<<<<
16324  *     try:
16325  *         if lua.lua_status(co) == 0 and lua.lua_gettop(co) == 0:
16326  */
16327   __pyx_v_old_top = lua_gettop(__pyx_v_L);
16328 
16329   /* "lupa/_lupa.pyx":952
16330  *     lock_runtime(thread._runtime)
16331  *     old_top = lua.lua_gettop(L)
16332  *     try:             # <<<<<<<<<<<<<<
16333  *         if lua.lua_status(co) == 0 and lua.lua_gettop(co) == 0:
16334  *             # already terminated
16335  */
16336   /*try:*/ {
16337 
16338     /* "lupa/_lupa.pyx":953
16339  *     old_top = lua.lua_gettop(L)
16340  *     try:
16341  *         if lua.lua_status(co) == 0 and lua.lua_gettop(co) == 0:             # <<<<<<<<<<<<<<
16342  *             # already terminated
16343  *             raise StopIteration
16344  */
16345     __pyx_t_5 = ((lua_status(__pyx_v_co) == 0) != 0);
16346     if (__pyx_t_5) {
16347     } else {
16348       __pyx_t_4 = __pyx_t_5;
16349       goto __pyx_L7_bool_binop_done;
16350     }
16351     __pyx_t_5 = ((lua_gettop(__pyx_v_co) == 0) != 0);
16352     __pyx_t_4 = __pyx_t_5;
16353     __pyx_L7_bool_binop_done:;
16354     if (unlikely(__pyx_t_4)) {
16355 
16356       /* "lupa/_lupa.pyx":955
16357  *         if lua.lua_status(co) == 0 and lua.lua_gettop(co) == 0:
16358  *             # already terminated
16359  *             raise StopIteration             # <<<<<<<<<<<<<<
16360  *         if args:
16361  *             nargs = len(args)
16362  */
16363       __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0, 0);
16364       __PYX_ERR(0, 955, __pyx_L4_error)
16365 
16366       /* "lupa/_lupa.pyx":953
16367  *     old_top = lua.lua_gettop(L)
16368  *     try:
16369  *         if lua.lua_status(co) == 0 and lua.lua_gettop(co) == 0:             # <<<<<<<<<<<<<<
16370  *             # already terminated
16371  *             raise StopIteration
16372  */
16373     }
16374 
16375     /* "lupa/_lupa.pyx":956
16376  *             # already terminated
16377  *             raise StopIteration
16378  *         if args:             # <<<<<<<<<<<<<<
16379  *             nargs = len(args)
16380  *             push_lua_arguments(thread._runtime, co, args)
16381  */
16382     __pyx_t_4 = (__pyx_v_args != Py_None)&&(PyTuple_GET_SIZE(__pyx_v_args) != 0);
16383     if (__pyx_t_4) {
16384 
16385       /* "lupa/_lupa.pyx":957
16386  *             raise StopIteration
16387  *         if args:
16388  *             nargs = len(args)             # <<<<<<<<<<<<<<
16389  *             push_lua_arguments(thread._runtime, co, args)
16390  *         with nogil:
16391  */
16392       if (unlikely(__pyx_v_args == Py_None)) {
16393         PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
16394         __PYX_ERR(0, 957, __pyx_L4_error)
16395       }
16396       __pyx_t_6 = PyTuple_GET_SIZE(__pyx_v_args); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 957, __pyx_L4_error)
16397       __pyx_v_nargs = __pyx_t_6;
16398 
16399       /* "lupa/_lupa.pyx":958
16400  *         if args:
16401  *             nargs = len(args)
16402  *             push_lua_arguments(thread._runtime, co, args)             # <<<<<<<<<<<<<<
16403  *         with nogil:
16404  *             status = lua.lua_resume(co, L, nargs, &nres)
16405  */
16406       __pyx_t_2 = ((PyObject *)__pyx_v_thread->__pyx_base._runtime);
16407       __Pyx_INCREF(__pyx_t_2);
16408       __pyx_t_3 = __pyx_f_4lupa_5_lupa_push_lua_arguments(((struct __pyx_obj_4lupa_5_lupa_LuaRuntime *)__pyx_t_2), __pyx_v_co, __pyx_v_args, NULL); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 958, __pyx_L4_error)
16409       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
16410 
16411       /* "lupa/_lupa.pyx":956
16412  *             # already terminated
16413  *             raise StopIteration
16414  *         if args:             # <<<<<<<<<<<<<<
16415  *             nargs = len(args)
16416  *             push_lua_arguments(thread._runtime, co, args)
16417  */
16418     }
16419 
16420     /* "lupa/_lupa.pyx":959
16421  *             nargs = len(args)
16422  *             push_lua_arguments(thread._runtime, co, args)
16423  *         with nogil:             # <<<<<<<<<<<<<<
16424  *             status = lua.lua_resume(co, L, nargs, &nres)
16425  *         if status != lua.LUA_YIELD:
16426  */
16427     {
16428         #ifdef WITH_THREAD
16429         PyThreadState *_save;
16430         Py_UNBLOCK_THREADS
16431         __Pyx_FastGIL_Remember();
16432         #endif
16433         /*try:*/ {
16434 
16435           /* "lupa/_lupa.pyx":960
16436  *             push_lua_arguments(thread._runtime, co, args)
16437  *         with nogil:
16438  *             status = lua.lua_resume(co, L, nargs, &nres)             # <<<<<<<<<<<<<<
16439  *         if status != lua.LUA_YIELD:
16440  *             if status == 0:
16441  */
16442           __pyx_v_status = __lupa_lua_resume(__pyx_v_co, __pyx_v_L, __pyx_v_nargs, (&__pyx_v_nres));
16443         }
16444 
16445         /* "lupa/_lupa.pyx":959
16446  *             nargs = len(args)
16447  *             push_lua_arguments(thread._runtime, co, args)
16448  *         with nogil:             # <<<<<<<<<<<<<<
16449  *             status = lua.lua_resume(co, L, nargs, &nres)
16450  *         if status != lua.LUA_YIELD:
16451  */
16452         /*finally:*/ {
16453           /*normal exit:*/{
16454             #ifdef WITH_THREAD
16455             __Pyx_FastGIL_Forget();
16456             Py_BLOCK_THREADS
16457             #endif
16458             goto __pyx_L12;
16459           }
16460           __pyx_L12:;
16461         }
16462     }
16463 
16464     /* "lupa/_lupa.pyx":961
16465  *         with nogil:
16466  *             status = lua.lua_resume(co, L, nargs, &nres)
16467  *         if status != lua.LUA_YIELD:             # <<<<<<<<<<<<<<
16468  *             if status == 0:
16469  *                 # terminated
16470  */
16471     __pyx_t_4 = ((__pyx_v_status != LUA_YIELD) != 0);
16472     if (__pyx_t_4) {
16473 
16474       /* "lupa/_lupa.pyx":962
16475  *             status = lua.lua_resume(co, L, nargs, &nres)
16476  *         if status != lua.LUA_YIELD:
16477  *             if status == 0:             # <<<<<<<<<<<<<<
16478  *                 # terminated
16479  *                 if nres == 0:
16480  */
16481       __pyx_t_4 = ((__pyx_v_status == 0) != 0);
16482       if (__pyx_t_4) {
16483 
16484         /* "lupa/_lupa.pyx":964
16485  *             if status == 0:
16486  *                 # terminated
16487  *                 if nres == 0:             # <<<<<<<<<<<<<<
16488  *                     # no values left to return
16489  *                     raise StopIteration
16490  */
16491         __pyx_t_4 = ((__pyx_v_nres == 0) != 0);
16492         if (unlikely(__pyx_t_4)) {
16493 
16494           /* "lupa/_lupa.pyx":966
16495  *                 if nres == 0:
16496  *                     # no values left to return
16497  *                     raise StopIteration             # <<<<<<<<<<<<<<
16498  *             else:
16499  *                 raise_lua_error(thread._runtime, co, status)
16500  */
16501           __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0, 0);
16502           __PYX_ERR(0, 966, __pyx_L4_error)
16503 
16504           /* "lupa/_lupa.pyx":964
16505  *             if status == 0:
16506  *                 # terminated
16507  *                 if nres == 0:             # <<<<<<<<<<<<<<
16508  *                     # no values left to return
16509  *                     raise StopIteration
16510  */
16511         }
16512 
16513         /* "lupa/_lupa.pyx":962
16514  *             status = lua.lua_resume(co, L, nargs, &nres)
16515  *         if status != lua.LUA_YIELD:
16516  *             if status == 0:             # <<<<<<<<<<<<<<
16517  *                 # terminated
16518  *                 if nres == 0:
16519  */
16520         goto __pyx_L14;
16521       }
16522 
16523       /* "lupa/_lupa.pyx":968
16524  *                     raise StopIteration
16525  *             else:
16526  *                 raise_lua_error(thread._runtime, co, status)             # <<<<<<<<<<<<<<
16527  *
16528  *         # Move yielded values to the main state before unpacking.
16529  */
16530       /*else*/ {
16531         __pyx_t_2 = ((PyObject *)__pyx_v_thread->__pyx_base._runtime);
16532         __Pyx_INCREF(__pyx_t_2);
16533         __pyx_t_3 = __pyx_f_4lupa_5_lupa_raise_lua_error(((struct __pyx_obj_4lupa_5_lupa_LuaRuntime *)__pyx_t_2), __pyx_v_co, __pyx_v_status); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 968, __pyx_L4_error)
16534         __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
16535       }
16536       __pyx_L14:;
16537 
16538       /* "lupa/_lupa.pyx":961
16539  *         with nogil:
16540  *             status = lua.lua_resume(co, L, nargs, &nres)
16541  *         if status != lua.LUA_YIELD:             # <<<<<<<<<<<<<<
16542  *             if status == 0:
16543  *                 # terminated
16544  */
16545     }
16546 
16547     /* "lupa/_lupa.pyx":973
16548  *         # This is what Lua's internal auxresume function is doing;
16549  *         # it affects wrapped Lua functions returned to Python.
16550  *         lua.lua_xmove(co, L, nres)             # <<<<<<<<<<<<<<
16551  *         return unpack_lua_results(thread._runtime, L)
16552  *     finally:
16553  */
16554     lua_xmove(__pyx_v_co, __pyx_v_L, __pyx_v_nres);
16555 
16556     /* "lupa/_lupa.pyx":974
16557  *         # it affects wrapped Lua functions returned to Python.
16558  *         lua.lua_xmove(co, L, nres)
16559  *         return unpack_lua_results(thread._runtime, L)             # <<<<<<<<<<<<<<
16560  *     finally:
16561  *         # FIXME: check that coroutine state is OK in case of errors?
16562  */
16563     __Pyx_XDECREF(__pyx_r);
16564     __pyx_t_2 = ((PyObject *)__pyx_v_thread->__pyx_base._runtime);
16565     __Pyx_INCREF(__pyx_t_2);
16566     __pyx_t_7 = __pyx_f_4lupa_5_lupa_unpack_lua_results(((struct __pyx_obj_4lupa_5_lupa_LuaRuntime *)__pyx_t_2), __pyx_v_L); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 974, __pyx_L4_error)
16567     __Pyx_GOTREF(__pyx_t_7);
16568     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
16569     __pyx_r = __pyx_t_7;
16570     __pyx_t_7 = 0;
16571     goto __pyx_L3_return;
16572   }
16573 
16574   /* "lupa/_lupa.pyx":977
16575  *     finally:
16576  *         # FIXME: check that coroutine state is OK in case of errors?
16577  *         lua.lua_settop(L, old_top)             # <<<<<<<<<<<<<<
16578  *         unlock_runtime(thread._runtime)
16579  *
16580  */
16581   /*finally:*/ {
16582     __pyx_L4_error:;
16583     /*exception exit:*/{
16584       __Pyx_PyThreadState_declare
16585       __Pyx_PyThreadState_assign
16586       __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0;
16587       __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
16588       __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
16589       if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15);
16590       if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12) < 0)) __Pyx_ErrFetch(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
16591       __Pyx_XGOTREF(__pyx_t_10);
16592       __Pyx_XGOTREF(__pyx_t_11);
16593       __Pyx_XGOTREF(__pyx_t_12);
16594       __Pyx_XGOTREF(__pyx_t_13);
16595       __Pyx_XGOTREF(__pyx_t_14);
16596       __Pyx_XGOTREF(__pyx_t_15);
16597       __pyx_t_3 = __pyx_lineno; __pyx_t_8 = __pyx_clineno; __pyx_t_9 = __pyx_filename;
16598       {
16599         lua_settop(__pyx_v_L, __pyx_v_old_top);
16600 
16601         /* "lupa/_lupa.pyx":978
16602  *         # FIXME: check that coroutine state is OK in case of errors?
16603  *         lua.lua_settop(L, old_top)
16604  *         unlock_runtime(thread._runtime)             # <<<<<<<<<<<<<<
16605  *
16606  *
16607  */
16608         __pyx_t_7 = ((PyObject *)__pyx_v_thread->__pyx_base._runtime);
16609         __Pyx_INCREF(__pyx_t_7);
16610         __pyx_f_4lupa_5_lupa_unlock_runtime(((struct __pyx_obj_4lupa_5_lupa_LuaRuntime *)__pyx_t_7));
16611         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
16612       }
16613       if (PY_MAJOR_VERSION >= 3) {
16614         __Pyx_XGIVEREF(__pyx_t_13);
16615         __Pyx_XGIVEREF(__pyx_t_14);
16616         __Pyx_XGIVEREF(__pyx_t_15);
16617         __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_14, __pyx_t_15);
16618       }
16619       __Pyx_XGIVEREF(__pyx_t_10);
16620       __Pyx_XGIVEREF(__pyx_t_11);
16621       __Pyx_XGIVEREF(__pyx_t_12);
16622       __Pyx_ErrRestore(__pyx_t_10, __pyx_t_11, __pyx_t_12);
16623       __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0;
16624       __pyx_lineno = __pyx_t_3; __pyx_clineno = __pyx_t_8; __pyx_filename = __pyx_t_9;
16625       goto __pyx_L1_error;
16626     }
16627     __pyx_L3_return: {
16628       __pyx_t_15 = __pyx_r;
16629       __pyx_r = 0;
16630 
16631       /* "lupa/_lupa.pyx":977
16632  *     finally:
16633  *         # FIXME: check that coroutine state is OK in case of errors?
16634  *         lua.lua_settop(L, old_top)             # <<<<<<<<<<<<<<
16635  *         unlock_runtime(thread._runtime)
16636  *
16637  */
16638       lua_settop(__pyx_v_L, __pyx_v_old_top);
16639 
16640       /* "lupa/_lupa.pyx":978
16641  *         # FIXME: check that coroutine state is OK in case of errors?
16642  *         lua.lua_settop(L, old_top)
16643  *         unlock_runtime(thread._runtime)             # <<<<<<<<<<<<<<
16644  *
16645  *
16646  */
16647       __pyx_t_7 = ((PyObject *)__pyx_v_thread->__pyx_base._runtime);
16648       __Pyx_INCREF(__pyx_t_7);
16649       __pyx_f_4lupa_5_lupa_unlock_runtime(((struct __pyx_obj_4lupa_5_lupa_LuaRuntime *)__pyx_t_7));
16650       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
16651       __pyx_r = __pyx_t_15;
16652       __pyx_t_15 = 0;
16653       goto __pyx_L0;
16654     }
16655   }
16656 
16657   /* "lupa/_lupa.pyx":946
16658  *
16659  *
16660  * cdef object resume_lua_thread(_LuaThread thread, tuple args):             # <<<<<<<<<<<<<<
16661  *     cdef lua_State* co = thread._co_state
16662  *     cdef lua_State* L = thread._state
16663  */
16664 
16665   /* function exit code */
16666   __pyx_L1_error:;
16667   __Pyx_XDECREF(__pyx_t_2);
16668   __Pyx_XDECREF(__pyx_t_7);
16669   __Pyx_AddTraceback("lupa._lupa.resume_lua_thread", __pyx_clineno, __pyx_lineno, __pyx_filename);
16670   __pyx_r = 0;
16671   __pyx_L0:;
16672   __Pyx_XGIVEREF(__pyx_r);
16673   __Pyx_RefNannyFinishContext();
16674   return __pyx_r;
16675 }
16676 
16677 /* "lupa/_lupa.pyx":997
16678  *     cdef char _what
16679  *
16680  *     def __cinit__(self, _LuaObject obj not None, int what):             # <<<<<<<<<<<<<<
16681  *         self._state = NULL
16682  *         assert obj._runtime is not None
16683  */
16684 
16685 /* Python wrapper */
16686 static int __pyx_pw_4lupa_5_lupa_8_LuaIter_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_pw_4lupa_5_lupa_8_LuaIter_1__cinit__(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)16687 static int __pyx_pw_4lupa_5_lupa_8_LuaIter_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
16688   struct __pyx_obj_4lupa_5_lupa__LuaObject *__pyx_v_obj = 0;
16689   int __pyx_v_what;
16690   int __pyx_lineno = 0;
16691   const char *__pyx_filename = NULL;
16692   int __pyx_clineno = 0;
16693   int __pyx_r;
16694   __Pyx_RefNannyDeclarations
16695   __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
16696   {
16697     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_obj,&__pyx_n_s_what,0};
16698     PyObject* values[2] = {0,0};
16699     if (unlikely(__pyx_kwds)) {
16700       Py_ssize_t kw_args;
16701       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
16702       switch (pos_args) {
16703         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
16704         CYTHON_FALLTHROUGH;
16705         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
16706         CYTHON_FALLTHROUGH;
16707         case  0: break;
16708         default: goto __pyx_L5_argtuple_error;
16709       }
16710       kw_args = PyDict_Size(__pyx_kwds);
16711       switch (pos_args) {
16712         case  0:
16713         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_obj)) != 0)) kw_args--;
16714         else goto __pyx_L5_argtuple_error;
16715         CYTHON_FALLTHROUGH;
16716         case  1:
16717         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_what)) != 0)) kw_args--;
16718         else {
16719           __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, 1); __PYX_ERR(0, 997, __pyx_L3_error)
16720         }
16721       }
16722       if (unlikely(kw_args > 0)) {
16723         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(0, 997, __pyx_L3_error)
16724       }
16725     } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
16726       goto __pyx_L5_argtuple_error;
16727     } else {
16728       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
16729       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
16730     }
16731     __pyx_v_obj = ((struct __pyx_obj_4lupa_5_lupa__LuaObject *)values[0]);
16732     __pyx_v_what = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_what == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 997, __pyx_L3_error)
16733   }
16734   goto __pyx_L4_argument_unpacking_done;
16735   __pyx_L5_argtuple_error:;
16736   __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 997, __pyx_L3_error)
16737   __pyx_L3_error:;
16738   __Pyx_AddTraceback("lupa._lupa._LuaIter.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
16739   __Pyx_RefNannyFinishContext();
16740   return -1;
16741   __pyx_L4_argument_unpacking_done:;
16742   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_obj), __pyx_ptype_4lupa_5_lupa__LuaObject, 0, "obj", 0))) __PYX_ERR(0, 997, __pyx_L1_error)
16743   __pyx_r = __pyx_pf_4lupa_5_lupa_8_LuaIter___cinit__(((struct __pyx_obj_4lupa_5_lupa__LuaIter *)__pyx_v_self), __pyx_v_obj, __pyx_v_what);
16744 
16745   /* function exit code */
16746   goto __pyx_L0;
16747   __pyx_L1_error:;
16748   __pyx_r = -1;
16749   __pyx_L0:;
16750   __Pyx_RefNannyFinishContext();
16751   return __pyx_r;
16752 }
16753 
__pyx_pf_4lupa_5_lupa_8_LuaIter___cinit__(struct __pyx_obj_4lupa_5_lupa__LuaIter * __pyx_v_self,struct __pyx_obj_4lupa_5_lupa__LuaObject * __pyx_v_obj,int __pyx_v_what)16754 static int __pyx_pf_4lupa_5_lupa_8_LuaIter___cinit__(struct __pyx_obj_4lupa_5_lupa__LuaIter *__pyx_v_self, struct __pyx_obj_4lupa_5_lupa__LuaObject *__pyx_v_obj, int __pyx_v_what) {
16755   int __pyx_r;
16756   __Pyx_RefNannyDeclarations
16757   int __pyx_t_1;
16758   PyObject *__pyx_t_2 = NULL;
16759   lua_State *__pyx_t_3;
16760   int __pyx_lineno = 0;
16761   const char *__pyx_filename = NULL;
16762   int __pyx_clineno = 0;
16763   __Pyx_RefNannySetupContext("__cinit__", 0);
16764 
16765   /* "lupa/_lupa.pyx":998
16766  *
16767  *     def __cinit__(self, _LuaObject obj not None, int what):
16768  *         self._state = NULL             # <<<<<<<<<<<<<<
16769  *         assert obj._runtime is not None
16770  *         self._runtime = obj._runtime
16771  */
16772   __pyx_v_self->_state = NULL;
16773 
16774   /* "lupa/_lupa.pyx":999
16775  *     def __cinit__(self, _LuaObject obj not None, int what):
16776  *         self._state = NULL
16777  *         assert obj._runtime is not None             # <<<<<<<<<<<<<<
16778  *         self._runtime = obj._runtime
16779  *         self._obj = obj
16780  */
16781   #ifndef CYTHON_WITHOUT_ASSERTIONS
16782   if (unlikely(!Py_OptimizeFlag)) {
16783     __pyx_t_1 = (((PyObject *)__pyx_v_obj->_runtime) != Py_None);
16784     if (unlikely(!(__pyx_t_1 != 0))) {
16785       PyErr_SetNone(PyExc_AssertionError);
16786       __PYX_ERR(0, 999, __pyx_L1_error)
16787     }
16788   }
16789   #endif
16790 
16791   /* "lupa/_lupa.pyx":1000
16792  *         self._state = NULL
16793  *         assert obj._runtime is not None
16794  *         self._runtime = obj._runtime             # <<<<<<<<<<<<<<
16795  *         self._obj = obj
16796  *         self._state = obj._state
16797  */
16798   __pyx_t_2 = ((PyObject *)__pyx_v_obj->_runtime);
16799   __Pyx_INCREF(__pyx_t_2);
16800   __Pyx_GIVEREF(__pyx_t_2);
16801   __Pyx_GOTREF(__pyx_v_self->_runtime);
16802   __Pyx_DECREF(((PyObject *)__pyx_v_self->_runtime));
16803   __pyx_v_self->_runtime = ((struct __pyx_obj_4lupa_5_lupa_LuaRuntime *)__pyx_t_2);
16804   __pyx_t_2 = 0;
16805 
16806   /* "lupa/_lupa.pyx":1001
16807  *         assert obj._runtime is not None
16808  *         self._runtime = obj._runtime
16809  *         self._obj = obj             # <<<<<<<<<<<<<<
16810  *         self._state = obj._state
16811  *         self._refiter = 0
16812  */
16813   __Pyx_INCREF(((PyObject *)__pyx_v_obj));
16814   __Pyx_GIVEREF(((PyObject *)__pyx_v_obj));
16815   __Pyx_GOTREF(__pyx_v_self->_obj);
16816   __Pyx_DECREF(((PyObject *)__pyx_v_self->_obj));
16817   __pyx_v_self->_obj = __pyx_v_obj;
16818 
16819   /* "lupa/_lupa.pyx":1002
16820  *         self._runtime = obj._runtime
16821  *         self._obj = obj
16822  *         self._state = obj._state             # <<<<<<<<<<<<<<
16823  *         self._refiter = 0
16824  *         self._what = what
16825  */
16826   __pyx_t_3 = __pyx_v_obj->_state;
16827   __pyx_v_self->_state = __pyx_t_3;
16828 
16829   /* "lupa/_lupa.pyx":1003
16830  *         self._obj = obj
16831  *         self._state = obj._state
16832  *         self._refiter = 0             # <<<<<<<<<<<<<<
16833  *         self._what = what
16834  *
16835  */
16836   __pyx_v_self->_refiter = 0;
16837 
16838   /* "lupa/_lupa.pyx":1004
16839  *         self._state = obj._state
16840  *         self._refiter = 0
16841  *         self._what = what             # <<<<<<<<<<<<<<
16842  *
16843  *     def __dealloc__(self):
16844  */
16845   __pyx_v_self->_what = __pyx_v_what;
16846 
16847   /* "lupa/_lupa.pyx":997
16848  *     cdef char _what
16849  *
16850  *     def __cinit__(self, _LuaObject obj not None, int what):             # <<<<<<<<<<<<<<
16851  *         self._state = NULL
16852  *         assert obj._runtime is not None
16853  */
16854 
16855   /* function exit code */
16856   __pyx_r = 0;
16857   goto __pyx_L0;
16858   __pyx_L1_error:;
16859   __Pyx_XDECREF(__pyx_t_2);
16860   __Pyx_AddTraceback("lupa._lupa._LuaIter.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
16861   __pyx_r = -1;
16862   __pyx_L0:;
16863   __Pyx_RefNannyFinishContext();
16864   return __pyx_r;
16865 }
16866 
16867 /* "lupa/_lupa.pyx":1006
16868  *         self._what = what
16869  *
16870  *     def __dealloc__(self):             # <<<<<<<<<<<<<<
16871  *         if self._runtime is None:
16872  *             return
16873  */
16874 
16875 /* Python wrapper */
16876 static void __pyx_pw_4lupa_5_lupa_8_LuaIter_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_4lupa_5_lupa_8_LuaIter_3__dealloc__(PyObject * __pyx_v_self)16877 static void __pyx_pw_4lupa_5_lupa_8_LuaIter_3__dealloc__(PyObject *__pyx_v_self) {
16878   __Pyx_RefNannyDeclarations
16879   __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
16880   __pyx_pf_4lupa_5_lupa_8_LuaIter_2__dealloc__(((struct __pyx_obj_4lupa_5_lupa__LuaIter *)__pyx_v_self));
16881 
16882   /* function exit code */
16883   __Pyx_RefNannyFinishContext();
16884 }
16885 
__pyx_pf_4lupa_5_lupa_8_LuaIter_2__dealloc__(struct __pyx_obj_4lupa_5_lupa__LuaIter * __pyx_v_self)16886 static void __pyx_pf_4lupa_5_lupa_8_LuaIter_2__dealloc__(struct __pyx_obj_4lupa_5_lupa__LuaIter *__pyx_v_self) {
16887   lua_State *__pyx_v_L;
16888   int __pyx_v_locked;
16889   __Pyx_RefNannyDeclarations
16890   int __pyx_t_1;
16891   int __pyx_t_2;
16892   lua_State *__pyx_t_3;
16893   PyObject *__pyx_t_4 = NULL;
16894   PyObject *__pyx_t_5 = NULL;
16895   PyObject *__pyx_t_6 = NULL;
16896   PyObject *__pyx_t_7 = NULL;
16897   int __pyx_t_8;
16898   int __pyx_lineno = 0;
16899   const char *__pyx_filename = NULL;
16900   int __pyx_clineno = 0;
16901   __Pyx_RefNannySetupContext("__dealloc__", 0);
16902 
16903   /* "lupa/_lupa.pyx":1007
16904  *
16905  *     def __dealloc__(self):
16906  *         if self._runtime is None:             # <<<<<<<<<<<<<<
16907  *             return
16908  *         cdef lua_State* L = self._state
16909  */
16910   __pyx_t_1 = (((PyObject *)__pyx_v_self->_runtime) == Py_None);
16911   __pyx_t_2 = (__pyx_t_1 != 0);
16912   if (__pyx_t_2) {
16913 
16914     /* "lupa/_lupa.pyx":1008
16915  *     def __dealloc__(self):
16916  *         if self._runtime is None:
16917  *             return             # <<<<<<<<<<<<<<
16918  *         cdef lua_State* L = self._state
16919  *         if L is not NULL and self._refiter:
16920  */
16921     goto __pyx_L0;
16922 
16923     /* "lupa/_lupa.pyx":1007
16924  *
16925  *     def __dealloc__(self):
16926  *         if self._runtime is None:             # <<<<<<<<<<<<<<
16927  *             return
16928  *         cdef lua_State* L = self._state
16929  */
16930   }
16931 
16932   /* "lupa/_lupa.pyx":1009
16933  *         if self._runtime is None:
16934  *             return
16935  *         cdef lua_State* L = self._state             # <<<<<<<<<<<<<<
16936  *         if L is not NULL and self._refiter:
16937  *             locked = False
16938  */
16939   __pyx_t_3 = __pyx_v_self->_state;
16940   __pyx_v_L = __pyx_t_3;
16941 
16942   /* "lupa/_lupa.pyx":1010
16943  *             return
16944  *         cdef lua_State* L = self._state
16945  *         if L is not NULL and self._refiter:             # <<<<<<<<<<<<<<
16946  *             locked = False
16947  *             try:
16948  */
16949   __pyx_t_1 = ((__pyx_v_L != NULL) != 0);
16950   if (__pyx_t_1) {
16951   } else {
16952     __pyx_t_2 = __pyx_t_1;
16953     goto __pyx_L5_bool_binop_done;
16954   }
16955   __pyx_t_1 = (__pyx_v_self->_refiter != 0);
16956   __pyx_t_2 = __pyx_t_1;
16957   __pyx_L5_bool_binop_done:;
16958   if (__pyx_t_2) {
16959 
16960     /* "lupa/_lupa.pyx":1011
16961  *         cdef lua_State* L = self._state
16962  *         if L is not NULL and self._refiter:
16963  *             locked = False             # <<<<<<<<<<<<<<
16964  *             try:
16965  *                 lock_runtime(self._runtime)
16966  */
16967     __pyx_v_locked = 0;
16968 
16969     /* "lupa/_lupa.pyx":1012
16970  *         if L is not NULL and self._refiter:
16971  *             locked = False
16972  *             try:             # <<<<<<<<<<<<<<
16973  *                 lock_runtime(self._runtime)
16974  *                 locked = True
16975  */
16976     {
16977       __Pyx_PyThreadState_declare
16978       __Pyx_PyThreadState_assign
16979       __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6);
16980       __Pyx_XGOTREF(__pyx_t_4);
16981       __Pyx_XGOTREF(__pyx_t_5);
16982       __Pyx_XGOTREF(__pyx_t_6);
16983       /*try:*/ {
16984 
16985         /* "lupa/_lupa.pyx":1013
16986  *             locked = False
16987  *             try:
16988  *                 lock_runtime(self._runtime)             # <<<<<<<<<<<<<<
16989  *                 locked = True
16990  *             except:
16991  */
16992         __pyx_t_7 = ((PyObject *)__pyx_v_self->_runtime);
16993         __Pyx_INCREF(__pyx_t_7);
16994         __pyx_t_8 = __pyx_f_4lupa_5_lupa_lock_runtime(((struct __pyx_obj_4lupa_5_lupa_LuaRuntime *)__pyx_t_7)); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 1013, __pyx_L7_error)
16995         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
16996 
16997         /* "lupa/_lupa.pyx":1014
16998  *             try:
16999  *                 lock_runtime(self._runtime)
17000  *                 locked = True             # <<<<<<<<<<<<<<
17001  *             except:
17002  *                 pass
17003  */
17004         __pyx_v_locked = 1;
17005 
17006         /* "lupa/_lupa.pyx":1012
17007  *         if L is not NULL and self._refiter:
17008  *             locked = False
17009  *             try:             # <<<<<<<<<<<<<<
17010  *                 lock_runtime(self._runtime)
17011  *                 locked = True
17012  */
17013       }
17014       __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
17015       __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
17016       __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
17017       goto __pyx_L12_try_end;
17018       __pyx_L7_error:;
17019       __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
17020 
17021       /* "lupa/_lupa.pyx":1015
17022  *                 lock_runtime(self._runtime)
17023  *                 locked = True
17024  *             except:             # <<<<<<<<<<<<<<
17025  *                 pass
17026  *             lua.luaL_unref(L, lua.LUA_REGISTRYINDEX, self._refiter)
17027  */
17028       /*except:*/ {
17029         __Pyx_ErrRestore(0,0,0);
17030         goto __pyx_L8_exception_handled;
17031       }
17032       __pyx_L8_exception_handled:;
17033       __Pyx_XGIVEREF(__pyx_t_4);
17034       __Pyx_XGIVEREF(__pyx_t_5);
17035       __Pyx_XGIVEREF(__pyx_t_6);
17036       __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
17037       __pyx_L12_try_end:;
17038     }
17039 
17040     /* "lupa/_lupa.pyx":1017
17041  *             except:
17042  *                 pass
17043  *             lua.luaL_unref(L, lua.LUA_REGISTRYINDEX, self._refiter)             # <<<<<<<<<<<<<<
17044  *             if locked:
17045  *                 unlock_runtime(self._runtime)
17046  */
17047     luaL_unref(__pyx_v_L, LUA_REGISTRYINDEX, __pyx_v_self->_refiter);
17048 
17049     /* "lupa/_lupa.pyx":1018
17050  *                 pass
17051  *             lua.luaL_unref(L, lua.LUA_REGISTRYINDEX, self._refiter)
17052  *             if locked:             # <<<<<<<<<<<<<<
17053  *                 unlock_runtime(self._runtime)
17054  *
17055  */
17056     __pyx_t_2 = (__pyx_v_locked != 0);
17057     if (__pyx_t_2) {
17058 
17059       /* "lupa/_lupa.pyx":1019
17060  *             lua.luaL_unref(L, lua.LUA_REGISTRYINDEX, self._refiter)
17061  *             if locked:
17062  *                 unlock_runtime(self._runtime)             # <<<<<<<<<<<<<<
17063  *
17064  *     def __repr__(self):
17065  */
17066       __pyx_t_7 = ((PyObject *)__pyx_v_self->_runtime);
17067       __Pyx_INCREF(__pyx_t_7);
17068       __pyx_f_4lupa_5_lupa_unlock_runtime(((struct __pyx_obj_4lupa_5_lupa_LuaRuntime *)__pyx_t_7));
17069       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
17070 
17071       /* "lupa/_lupa.pyx":1018
17072  *                 pass
17073  *             lua.luaL_unref(L, lua.LUA_REGISTRYINDEX, self._refiter)
17074  *             if locked:             # <<<<<<<<<<<<<<
17075  *                 unlock_runtime(self._runtime)
17076  *
17077  */
17078     }
17079 
17080     /* "lupa/_lupa.pyx":1010
17081  *             return
17082  *         cdef lua_State* L = self._state
17083  *         if L is not NULL and self._refiter:             # <<<<<<<<<<<<<<
17084  *             locked = False
17085  *             try:
17086  */
17087   }
17088 
17089   /* "lupa/_lupa.pyx":1006
17090  *         self._what = what
17091  *
17092  *     def __dealloc__(self):             # <<<<<<<<<<<<<<
17093  *         if self._runtime is None:
17094  *             return
17095  */
17096 
17097   /* function exit code */
17098   __pyx_L0:;
17099   __Pyx_RefNannyFinishContext();
17100 }
17101 
17102 /* "lupa/_lupa.pyx":1021
17103  *                 unlock_runtime(self._runtime)
17104  *
17105  *     def __repr__(self):             # <<<<<<<<<<<<<<
17106  *         return u"LuaIter(%r)" % (self._obj)
17107  *
17108  */
17109 
17110 /* Python wrapper */
17111 static PyObject *__pyx_pw_4lupa_5_lupa_8_LuaIter_5__repr__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_4lupa_5_lupa_8_LuaIter_5__repr__(PyObject * __pyx_v_self)17112 static PyObject *__pyx_pw_4lupa_5_lupa_8_LuaIter_5__repr__(PyObject *__pyx_v_self) {
17113   PyObject *__pyx_r = 0;
17114   __Pyx_RefNannyDeclarations
17115   __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
17116   __pyx_r = __pyx_pf_4lupa_5_lupa_8_LuaIter_4__repr__(((struct __pyx_obj_4lupa_5_lupa__LuaIter *)__pyx_v_self));
17117 
17118   /* function exit code */
17119   __Pyx_RefNannyFinishContext();
17120   return __pyx_r;
17121 }
17122 
__pyx_pf_4lupa_5_lupa_8_LuaIter_4__repr__(struct __pyx_obj_4lupa_5_lupa__LuaIter * __pyx_v_self)17123 static PyObject *__pyx_pf_4lupa_5_lupa_8_LuaIter_4__repr__(struct __pyx_obj_4lupa_5_lupa__LuaIter *__pyx_v_self) {
17124   PyObject *__pyx_r = NULL;
17125   __Pyx_RefNannyDeclarations
17126   PyObject *__pyx_t_1 = NULL;
17127   int __pyx_lineno = 0;
17128   const char *__pyx_filename = NULL;
17129   int __pyx_clineno = 0;
17130   __Pyx_RefNannySetupContext("__repr__", 0);
17131 
17132   /* "lupa/_lupa.pyx":1022
17133  *
17134  *     def __repr__(self):
17135  *         return u"LuaIter(%r)" % (self._obj)             # <<<<<<<<<<<<<<
17136  *
17137  *     def __iter__(self):
17138  */
17139   __Pyx_XDECREF(__pyx_r);
17140   __pyx_t_1 = PyUnicode_Format(__pyx_kp_u_LuaIter_r, ((PyObject *)__pyx_v_self->_obj)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1022, __pyx_L1_error)
17141   __Pyx_GOTREF(__pyx_t_1);
17142   __pyx_r = __pyx_t_1;
17143   __pyx_t_1 = 0;
17144   goto __pyx_L0;
17145 
17146   /* "lupa/_lupa.pyx":1021
17147  *                 unlock_runtime(self._runtime)
17148  *
17149  *     def __repr__(self):             # <<<<<<<<<<<<<<
17150  *         return u"LuaIter(%r)" % (self._obj)
17151  *
17152  */
17153 
17154   /* function exit code */
17155   __pyx_L1_error:;
17156   __Pyx_XDECREF(__pyx_t_1);
17157   __Pyx_AddTraceback("lupa._lupa._LuaIter.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
17158   __pyx_r = NULL;
17159   __pyx_L0:;
17160   __Pyx_XGIVEREF(__pyx_r);
17161   __Pyx_RefNannyFinishContext();
17162   return __pyx_r;
17163 }
17164 
17165 /* "lupa/_lupa.pyx":1024
17166  *         return u"LuaIter(%r)" % (self._obj)
17167  *
17168  *     def __iter__(self):             # <<<<<<<<<<<<<<
17169  *         return self
17170  *
17171  */
17172 
17173 /* Python wrapper */
17174 static PyObject *__pyx_pw_4lupa_5_lupa_8_LuaIter_7__iter__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_4lupa_5_lupa_8_LuaIter_7__iter__(PyObject * __pyx_v_self)17175 static PyObject *__pyx_pw_4lupa_5_lupa_8_LuaIter_7__iter__(PyObject *__pyx_v_self) {
17176   PyObject *__pyx_r = 0;
17177   __Pyx_RefNannyDeclarations
17178   __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
17179   __pyx_r = __pyx_pf_4lupa_5_lupa_8_LuaIter_6__iter__(((struct __pyx_obj_4lupa_5_lupa__LuaIter *)__pyx_v_self));
17180 
17181   /* function exit code */
17182   __Pyx_RefNannyFinishContext();
17183   return __pyx_r;
17184 }
17185 
__pyx_pf_4lupa_5_lupa_8_LuaIter_6__iter__(struct __pyx_obj_4lupa_5_lupa__LuaIter * __pyx_v_self)17186 static PyObject *__pyx_pf_4lupa_5_lupa_8_LuaIter_6__iter__(struct __pyx_obj_4lupa_5_lupa__LuaIter *__pyx_v_self) {
17187   PyObject *__pyx_r = NULL;
17188   __Pyx_RefNannyDeclarations
17189   __Pyx_RefNannySetupContext("__iter__", 0);
17190 
17191   /* "lupa/_lupa.pyx":1025
17192  *
17193  *     def __iter__(self):
17194  *         return self             # <<<<<<<<<<<<<<
17195  *
17196  *     def __next__(self):
17197  */
17198   __Pyx_XDECREF(__pyx_r);
17199   __Pyx_INCREF(((PyObject *)__pyx_v_self));
17200   __pyx_r = ((PyObject *)__pyx_v_self);
17201   goto __pyx_L0;
17202 
17203   /* "lupa/_lupa.pyx":1024
17204  *         return u"LuaIter(%r)" % (self._obj)
17205  *
17206  *     def __iter__(self):             # <<<<<<<<<<<<<<
17207  *         return self
17208  *
17209  */
17210 
17211   /* function exit code */
17212   __pyx_L0:;
17213   __Pyx_XGIVEREF(__pyx_r);
17214   __Pyx_RefNannyFinishContext();
17215   return __pyx_r;
17216 }
17217 
17218 /* "lupa/_lupa.pyx":1027
17219  *         return self
17220  *
17221  *     def __next__(self):             # <<<<<<<<<<<<<<
17222  *         if self._obj is None:
17223  *             raise StopIteration
17224  */
17225 
17226 /* Python wrapper */
17227 static PyObject *__pyx_pw_4lupa_5_lupa_8_LuaIter_9__next__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_4lupa_5_lupa_8_LuaIter_9__next__(PyObject * __pyx_v_self)17228 static PyObject *__pyx_pw_4lupa_5_lupa_8_LuaIter_9__next__(PyObject *__pyx_v_self) {
17229   PyObject *__pyx_r = 0;
17230   __Pyx_RefNannyDeclarations
17231   __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
17232   __pyx_r = __pyx_pf_4lupa_5_lupa_8_LuaIter_8__next__(((struct __pyx_obj_4lupa_5_lupa__LuaIter *)__pyx_v_self));
17233 
17234   /* function exit code */
17235   __Pyx_RefNannyFinishContext();
17236   return __pyx_r;
17237 }
17238 
__pyx_pf_4lupa_5_lupa_8_LuaIter_8__next__(struct __pyx_obj_4lupa_5_lupa__LuaIter * __pyx_v_self)17239 static PyObject *__pyx_pf_4lupa_5_lupa_8_LuaIter_8__next__(struct __pyx_obj_4lupa_5_lupa__LuaIter *__pyx_v_self) {
17240   lua_State *__pyx_v_L;
17241   int __pyx_v_old_top;
17242   PyObject *__pyx_v_retval = NULL;
17243   PyObject *__pyx_r = NULL;
17244   __Pyx_RefNannyDeclarations
17245   int __pyx_t_1;
17246   int __pyx_t_2;
17247   lua_State *__pyx_t_3;
17248   PyObject *__pyx_t_4 = NULL;
17249   int __pyx_t_5;
17250   PyObject *__pyx_t_6 = NULL;
17251   PyObject *__pyx_t_7 = NULL;
17252   int __pyx_t_8;
17253   char const *__pyx_t_9;
17254   PyObject *__pyx_t_10 = NULL;
17255   PyObject *__pyx_t_11 = NULL;
17256   PyObject *__pyx_t_12 = NULL;
17257   PyObject *__pyx_t_13 = NULL;
17258   PyObject *__pyx_t_14 = NULL;
17259   PyObject *__pyx_t_15 = NULL;
17260   char const *__pyx_t_16;
17261   int __pyx_lineno = 0;
17262   const char *__pyx_filename = NULL;
17263   int __pyx_clineno = 0;
17264   __Pyx_RefNannySetupContext("__next__", 0);
17265 
17266   /* "lupa/_lupa.pyx":1028
17267  *
17268  *     def __next__(self):
17269  *         if self._obj is None:             # <<<<<<<<<<<<<<
17270  *             raise StopIteration
17271  *         cdef lua_State* L = self._obj._state
17272  */
17273   __pyx_t_1 = (((PyObject *)__pyx_v_self->_obj) == Py_None);
17274   __pyx_t_2 = (__pyx_t_1 != 0);
17275   if (unlikely(__pyx_t_2)) {
17276 
17277     /* "lupa/_lupa.pyx":1029
17278  *     def __next__(self):
17279  *         if self._obj is None:
17280  *             raise StopIteration             # <<<<<<<<<<<<<<
17281  *         cdef lua_State* L = self._obj._state
17282  *         lock_runtime(self._runtime)
17283  */
17284     __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0, 0);
17285     __PYX_ERR(0, 1029, __pyx_L1_error)
17286 
17287     /* "lupa/_lupa.pyx":1028
17288  *
17289  *     def __next__(self):
17290  *         if self._obj is None:             # <<<<<<<<<<<<<<
17291  *             raise StopIteration
17292  *         cdef lua_State* L = self._obj._state
17293  */
17294   }
17295 
17296   /* "lupa/_lupa.pyx":1030
17297  *         if self._obj is None:
17298  *             raise StopIteration
17299  *         cdef lua_State* L = self._obj._state             # <<<<<<<<<<<<<<
17300  *         lock_runtime(self._runtime)
17301  *         old_top = lua.lua_gettop(L)
17302  */
17303   __pyx_t_3 = __pyx_v_self->_obj->_state;
17304   __pyx_v_L = __pyx_t_3;
17305 
17306   /* "lupa/_lupa.pyx":1031
17307  *             raise StopIteration
17308  *         cdef lua_State* L = self._obj._state
17309  *         lock_runtime(self._runtime)             # <<<<<<<<<<<<<<
17310  *         old_top = lua.lua_gettop(L)
17311  *         try:
17312  */
17313   __pyx_t_4 = ((PyObject *)__pyx_v_self->_runtime);
17314   __Pyx_INCREF(__pyx_t_4);
17315   __pyx_t_5 = __pyx_f_4lupa_5_lupa_lock_runtime(((struct __pyx_obj_4lupa_5_lupa_LuaRuntime *)__pyx_t_4)); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 1031, __pyx_L1_error)
17316   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
17317 
17318   /* "lupa/_lupa.pyx":1032
17319  *         cdef lua_State* L = self._obj._state
17320  *         lock_runtime(self._runtime)
17321  *         old_top = lua.lua_gettop(L)             # <<<<<<<<<<<<<<
17322  *         try:
17323  *             if self._obj is None:
17324  */
17325   __pyx_v_old_top = lua_gettop(__pyx_v_L);
17326 
17327   /* "lupa/_lupa.pyx":1033
17328  *         lock_runtime(self._runtime)
17329  *         old_top = lua.lua_gettop(L)
17330  *         try:             # <<<<<<<<<<<<<<
17331  *             if self._obj is None:
17332  *                 raise StopIteration
17333  */
17334   /*try:*/ {
17335 
17336     /* "lupa/_lupa.pyx":1034
17337  *         old_top = lua.lua_gettop(L)
17338  *         try:
17339  *             if self._obj is None:             # <<<<<<<<<<<<<<
17340  *                 raise StopIteration
17341  *             # iterable object
17342  */
17343     __pyx_t_2 = (((PyObject *)__pyx_v_self->_obj) == Py_None);
17344     __pyx_t_1 = (__pyx_t_2 != 0);
17345     if (unlikely(__pyx_t_1)) {
17346 
17347       /* "lupa/_lupa.pyx":1035
17348  *         try:
17349  *             if self._obj is None:
17350  *                 raise StopIteration             # <<<<<<<<<<<<<<
17351  *             # iterable object
17352  *             lua.lua_rawgeti(L, lua.LUA_REGISTRYINDEX, self._obj._ref)
17353  */
17354       __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0, 0);
17355       __PYX_ERR(0, 1035, __pyx_L5_error)
17356 
17357       /* "lupa/_lupa.pyx":1034
17358  *         old_top = lua.lua_gettop(L)
17359  *         try:
17360  *             if self._obj is None:             # <<<<<<<<<<<<<<
17361  *                 raise StopIteration
17362  *             # iterable object
17363  */
17364     }
17365 
17366     /* "lupa/_lupa.pyx":1037
17367  *                 raise StopIteration
17368  *             # iterable object
17369  *             lua.lua_rawgeti(L, lua.LUA_REGISTRYINDEX, self._obj._ref)             # <<<<<<<<<<<<<<
17370  *             if not lua.lua_istable(L, -1):
17371  *                 if lua.lua_isnil(L, -1):
17372  */
17373     lua_rawgeti(__pyx_v_L, LUA_REGISTRYINDEX, __pyx_v_self->_obj->_ref);
17374 
17375     /* "lupa/_lupa.pyx":1038
17376  *             # iterable object
17377  *             lua.lua_rawgeti(L, lua.LUA_REGISTRYINDEX, self._obj._ref)
17378  *             if not lua.lua_istable(L, -1):             # <<<<<<<<<<<<<<
17379  *                 if lua.lua_isnil(L, -1):
17380  *                     lua.lua_pop(L, 1)
17381  */
17382     __pyx_t_1 = ((!(lua_istable(__pyx_v_L, -1) != 0)) != 0);
17383     if (__pyx_t_1) {
17384 
17385       /* "lupa/_lupa.pyx":1039
17386  *             lua.lua_rawgeti(L, lua.LUA_REGISTRYINDEX, self._obj._ref)
17387  *             if not lua.lua_istable(L, -1):
17388  *                 if lua.lua_isnil(L, -1):             # <<<<<<<<<<<<<<
17389  *                     lua.lua_pop(L, 1)
17390  *                     raise LuaError("lost reference")
17391  */
17392       __pyx_t_1 = (lua_isnil(__pyx_v_L, -1) != 0);
17393       if (unlikely(__pyx_t_1)) {
17394 
17395         /* "lupa/_lupa.pyx":1040
17396  *             if not lua.lua_istable(L, -1):
17397  *                 if lua.lua_isnil(L, -1):
17398  *                     lua.lua_pop(L, 1)             # <<<<<<<<<<<<<<
17399  *                     raise LuaError("lost reference")
17400  *                 raise TypeError("cannot iterate over non-table (found %r)" % self._obj)
17401  */
17402         lua_pop(__pyx_v_L, 1);
17403 
17404         /* "lupa/_lupa.pyx":1041
17405  *                 if lua.lua_isnil(L, -1):
17406  *                     lua.lua_pop(L, 1)
17407  *                     raise LuaError("lost reference")             # <<<<<<<<<<<<<<
17408  *                 raise TypeError("cannot iterate over non-table (found %r)" % self._obj)
17409  *             if not self._refiter:
17410  */
17411         __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_LuaError); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1041, __pyx_L5_error)
17412         __Pyx_GOTREF(__pyx_t_6);
17413         __pyx_t_7 = NULL;
17414         if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
17415           __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
17416           if (likely(__pyx_t_7)) {
17417             PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
17418             __Pyx_INCREF(__pyx_t_7);
17419             __Pyx_INCREF(function);
17420             __Pyx_DECREF_SET(__pyx_t_6, function);
17421           }
17422         }
17423         __pyx_t_4 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_kp_s_lost_reference) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_kp_s_lost_reference);
17424         __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
17425         if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1041, __pyx_L5_error)
17426         __Pyx_GOTREF(__pyx_t_4);
17427         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
17428         __Pyx_Raise(__pyx_t_4, 0, 0, 0);
17429         __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
17430         __PYX_ERR(0, 1041, __pyx_L5_error)
17431 
17432         /* "lupa/_lupa.pyx":1039
17433  *             lua.lua_rawgeti(L, lua.LUA_REGISTRYINDEX, self._obj._ref)
17434  *             if not lua.lua_istable(L, -1):
17435  *                 if lua.lua_isnil(L, -1):             # <<<<<<<<<<<<<<
17436  *                     lua.lua_pop(L, 1)
17437  *                     raise LuaError("lost reference")
17438  */
17439       }
17440 
17441       /* "lupa/_lupa.pyx":1042
17442  *                     lua.lua_pop(L, 1)
17443  *                     raise LuaError("lost reference")
17444  *                 raise TypeError("cannot iterate over non-table (found %r)" % self._obj)             # <<<<<<<<<<<<<<
17445  *             if not self._refiter:
17446  *                 # initial key
17447  */
17448       __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_cannot_iterate_over_non_table_fo, ((PyObject *)__pyx_v_self->_obj)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1042, __pyx_L5_error)
17449       __Pyx_GOTREF(__pyx_t_4);
17450       __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1042, __pyx_L5_error)
17451       __Pyx_GOTREF(__pyx_t_6);
17452       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
17453       __Pyx_Raise(__pyx_t_6, 0, 0, 0);
17454       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
17455       __PYX_ERR(0, 1042, __pyx_L5_error)
17456 
17457       /* "lupa/_lupa.pyx":1038
17458  *             # iterable object
17459  *             lua.lua_rawgeti(L, lua.LUA_REGISTRYINDEX, self._obj._ref)
17460  *             if not lua.lua_istable(L, -1):             # <<<<<<<<<<<<<<
17461  *                 if lua.lua_isnil(L, -1):
17462  *                     lua.lua_pop(L, 1)
17463  */
17464     }
17465 
17466     /* "lupa/_lupa.pyx":1043
17467  *                     raise LuaError("lost reference")
17468  *                 raise TypeError("cannot iterate over non-table (found %r)" % self._obj)
17469  *             if not self._refiter:             # <<<<<<<<<<<<<<
17470  *                 # initial key
17471  *                 lua.lua_pushnil(L)
17472  */
17473     __pyx_t_1 = ((!(__pyx_v_self->_refiter != 0)) != 0);
17474     if (__pyx_t_1) {
17475 
17476       /* "lupa/_lupa.pyx":1045
17477  *             if not self._refiter:
17478  *                 # initial key
17479  *                 lua.lua_pushnil(L)             # <<<<<<<<<<<<<<
17480  *             else:
17481  *                 # last key
17482  */
17483       lua_pushnil(__pyx_v_L);
17484 
17485       /* "lupa/_lupa.pyx":1043
17486  *                     raise LuaError("lost reference")
17487  *                 raise TypeError("cannot iterate over non-table (found %r)" % self._obj)
17488  *             if not self._refiter:             # <<<<<<<<<<<<<<
17489  *                 # initial key
17490  *                 lua.lua_pushnil(L)
17491  */
17492       goto __pyx_L10;
17493     }
17494 
17495     /* "lupa/_lupa.pyx":1048
17496  *             else:
17497  *                 # last key
17498  *                 lua.lua_rawgeti(L, lua.LUA_REGISTRYINDEX, self._refiter)             # <<<<<<<<<<<<<<
17499  *             if lua.lua_next(L, -2):
17500  *                 try:
17501  */
17502     /*else*/ {
17503       lua_rawgeti(__pyx_v_L, LUA_REGISTRYINDEX, __pyx_v_self->_refiter);
17504     }
17505     __pyx_L10:;
17506 
17507     /* "lupa/_lupa.pyx":1049
17508  *                 # last key
17509  *                 lua.lua_rawgeti(L, lua.LUA_REGISTRYINDEX, self._refiter)
17510  *             if lua.lua_next(L, -2):             # <<<<<<<<<<<<<<
17511  *                 try:
17512  *                     if self._what == KEYS:
17513  */
17514     __pyx_t_1 = (lua_next(__pyx_v_L, -2) != 0);
17515     if (__pyx_t_1) {
17516 
17517       /* "lupa/_lupa.pyx":1050
17518  *                 lua.lua_rawgeti(L, lua.LUA_REGISTRYINDEX, self._refiter)
17519  *             if lua.lua_next(L, -2):
17520  *                 try:             # <<<<<<<<<<<<<<
17521  *                     if self._what == KEYS:
17522  *                         retval = py_from_lua(self._runtime, L, -2)
17523  */
17524       /*try:*/ {
17525 
17526         /* "lupa/_lupa.pyx":1051
17527  *             if lua.lua_next(L, -2):
17528  *                 try:
17529  *                     if self._what == KEYS:             # <<<<<<<<<<<<<<
17530  *                         retval = py_from_lua(self._runtime, L, -2)
17531  *                     elif self._what == VALUES:
17532  */
17533         switch (__pyx_v_self->_what) {
17534           case __pyx_e_4lupa_5_lupa_KEYS:
17535 
17536           /* "lupa/_lupa.pyx":1052
17537  *                 try:
17538  *                     if self._what == KEYS:
17539  *                         retval = py_from_lua(self._runtime, L, -2)             # <<<<<<<<<<<<<<
17540  *                     elif self._what == VALUES:
17541  *                         retval = py_from_lua(self._runtime, L, -1)
17542  */
17543           __pyx_t_6 = ((PyObject *)__pyx_v_self->_runtime);
17544           __Pyx_INCREF(__pyx_t_6);
17545           __pyx_t_4 = __pyx_f_4lupa_5_lupa_py_from_lua(((struct __pyx_obj_4lupa_5_lupa_LuaRuntime *)__pyx_t_6), __pyx_v_L, -2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1052, __pyx_L13_error)
17546           __Pyx_GOTREF(__pyx_t_4);
17547           __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
17548           __pyx_v_retval = __pyx_t_4;
17549           __pyx_t_4 = 0;
17550 
17551           /* "lupa/_lupa.pyx":1051
17552  *             if lua.lua_next(L, -2):
17553  *                 try:
17554  *                     if self._what == KEYS:             # <<<<<<<<<<<<<<
17555  *                         retval = py_from_lua(self._runtime, L, -2)
17556  *                     elif self._what == VALUES:
17557  */
17558           break;
17559           case __pyx_e_4lupa_5_lupa_VALUES:
17560 
17561           /* "lupa/_lupa.pyx":1054
17562  *                         retval = py_from_lua(self._runtime, L, -2)
17563  *                     elif self._what == VALUES:
17564  *                         retval = py_from_lua(self._runtime, L, -1)             # <<<<<<<<<<<<<<
17565  *                     else: # ITEMS
17566  *                         retval = (py_from_lua(self._runtime, L, -2), py_from_lua(self._runtime, L, -1))
17567  */
17568           __pyx_t_4 = ((PyObject *)__pyx_v_self->_runtime);
17569           __Pyx_INCREF(__pyx_t_4);
17570           __pyx_t_6 = __pyx_f_4lupa_5_lupa_py_from_lua(((struct __pyx_obj_4lupa_5_lupa_LuaRuntime *)__pyx_t_4), __pyx_v_L, -1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1054, __pyx_L13_error)
17571           __Pyx_GOTREF(__pyx_t_6);
17572           __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
17573           __pyx_v_retval = __pyx_t_6;
17574           __pyx_t_6 = 0;
17575 
17576           /* "lupa/_lupa.pyx":1053
17577  *                     if self._what == KEYS:
17578  *                         retval = py_from_lua(self._runtime, L, -2)
17579  *                     elif self._what == VALUES:             # <<<<<<<<<<<<<<
17580  *                         retval = py_from_lua(self._runtime, L, -1)
17581  *                     else: # ITEMS
17582  */
17583           break;
17584           default:
17585 
17586           /* "lupa/_lupa.pyx":1056
17587  *                         retval = py_from_lua(self._runtime, L, -1)
17588  *                     else: # ITEMS
17589  *                         retval = (py_from_lua(self._runtime, L, -2), py_from_lua(self._runtime, L, -1))             # <<<<<<<<<<<<<<
17590  *                 finally:
17591  *                     # pop value
17592  */
17593           __pyx_t_6 = ((PyObject *)__pyx_v_self->_runtime);
17594           __Pyx_INCREF(__pyx_t_6);
17595           __pyx_t_4 = __pyx_f_4lupa_5_lupa_py_from_lua(((struct __pyx_obj_4lupa_5_lupa_LuaRuntime *)__pyx_t_6), __pyx_v_L, -2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1056, __pyx_L13_error)
17596           __Pyx_GOTREF(__pyx_t_4);
17597           __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
17598           __pyx_t_6 = ((PyObject *)__pyx_v_self->_runtime);
17599           __Pyx_INCREF(__pyx_t_6);
17600           __pyx_t_7 = __pyx_f_4lupa_5_lupa_py_from_lua(((struct __pyx_obj_4lupa_5_lupa_LuaRuntime *)__pyx_t_6), __pyx_v_L, -1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1056, __pyx_L13_error)
17601           __Pyx_GOTREF(__pyx_t_7);
17602           __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
17603           __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1056, __pyx_L13_error)
17604           __Pyx_GOTREF(__pyx_t_6);
17605           __Pyx_GIVEREF(__pyx_t_4);
17606           PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
17607           __Pyx_GIVEREF(__pyx_t_7);
17608           PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_7);
17609           __pyx_t_4 = 0;
17610           __pyx_t_7 = 0;
17611           __pyx_v_retval = __pyx_t_6;
17612           __pyx_t_6 = 0;
17613           break;
17614         }
17615       }
17616 
17617       /* "lupa/_lupa.pyx":1059
17618  *                 finally:
17619  *                     # pop value
17620  *                     lua.lua_pop(L, 1)             # <<<<<<<<<<<<<<
17621  *                     # pop and store key
17622  *                     if not self._refiter:
17623  */
17624       /*finally:*/ {
17625         /*normal exit:*/{
17626           lua_pop(__pyx_v_L, 1);
17627 
17628           /* "lupa/_lupa.pyx":1061
17629  *                     lua.lua_pop(L, 1)
17630  *                     # pop and store key
17631  *                     if not self._refiter:             # <<<<<<<<<<<<<<
17632  *                         self._refiter = lua.luaL_ref(L, lua.LUA_REGISTRYINDEX)
17633  *                     else:
17634  */
17635           __pyx_t_1 = ((!(__pyx_v_self->_refiter != 0)) != 0);
17636           if (__pyx_t_1) {
17637 
17638             /* "lupa/_lupa.pyx":1062
17639  *                     # pop and store key
17640  *                     if not self._refiter:
17641  *                         self._refiter = lua.luaL_ref(L, lua.LUA_REGISTRYINDEX)             # <<<<<<<<<<<<<<
17642  *                     else:
17643  *                         lua.lua_rawseti(L, lua.LUA_REGISTRYINDEX, self._refiter)
17644  */
17645             __pyx_v_self->_refiter = luaL_ref(__pyx_v_L, LUA_REGISTRYINDEX);
17646 
17647             /* "lupa/_lupa.pyx":1061
17648  *                     lua.lua_pop(L, 1)
17649  *                     # pop and store key
17650  *                     if not self._refiter:             # <<<<<<<<<<<<<<
17651  *                         self._refiter = lua.luaL_ref(L, lua.LUA_REGISTRYINDEX)
17652  *                     else:
17653  */
17654             goto __pyx_L15;
17655           }
17656 
17657           /* "lupa/_lupa.pyx":1064
17658  *                         self._refiter = lua.luaL_ref(L, lua.LUA_REGISTRYINDEX)
17659  *                     else:
17660  *                         lua.lua_rawseti(L, lua.LUA_REGISTRYINDEX, self._refiter)             # <<<<<<<<<<<<<<
17661  *                 return retval
17662  *             # iteration done, clean up
17663  */
17664           /*else*/ {
17665             lua_rawseti(__pyx_v_L, LUA_REGISTRYINDEX, __pyx_v_self->_refiter);
17666           }
17667           __pyx_L15:;
17668           goto __pyx_L14;
17669         }
17670         __pyx_L13_error:;
17671         /*exception exit:*/{
17672           __Pyx_PyThreadState_declare
17673           __Pyx_PyThreadState_assign
17674           __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0;
17675           __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
17676           __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
17677           __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
17678           if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15);
17679           if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12) < 0)) __Pyx_ErrFetch(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
17680           __Pyx_XGOTREF(__pyx_t_10);
17681           __Pyx_XGOTREF(__pyx_t_11);
17682           __Pyx_XGOTREF(__pyx_t_12);
17683           __Pyx_XGOTREF(__pyx_t_13);
17684           __Pyx_XGOTREF(__pyx_t_14);
17685           __Pyx_XGOTREF(__pyx_t_15);
17686           __pyx_t_5 = __pyx_lineno; __pyx_t_8 = __pyx_clineno; __pyx_t_9 = __pyx_filename;
17687           {
17688 
17689             /* "lupa/_lupa.pyx":1059
17690  *                 finally:
17691  *                     # pop value
17692  *                     lua.lua_pop(L, 1)             # <<<<<<<<<<<<<<
17693  *                     # pop and store key
17694  *                     if not self._refiter:
17695  */
17696             lua_pop(__pyx_v_L, 1);
17697 
17698             /* "lupa/_lupa.pyx":1061
17699  *                     lua.lua_pop(L, 1)
17700  *                     # pop and store key
17701  *                     if not self._refiter:             # <<<<<<<<<<<<<<
17702  *                         self._refiter = lua.luaL_ref(L, lua.LUA_REGISTRYINDEX)
17703  *                     else:
17704  */
17705             __pyx_t_1 = ((!(__pyx_v_self->_refiter != 0)) != 0);
17706             if (__pyx_t_1) {
17707 
17708               /* "lupa/_lupa.pyx":1062
17709  *                     # pop and store key
17710  *                     if not self._refiter:
17711  *                         self._refiter = lua.luaL_ref(L, lua.LUA_REGISTRYINDEX)             # <<<<<<<<<<<<<<
17712  *                     else:
17713  *                         lua.lua_rawseti(L, lua.LUA_REGISTRYINDEX, self._refiter)
17714  */
17715               __pyx_v_self->_refiter = luaL_ref(__pyx_v_L, LUA_REGISTRYINDEX);
17716 
17717               /* "lupa/_lupa.pyx":1061
17718  *                     lua.lua_pop(L, 1)
17719  *                     # pop and store key
17720  *                     if not self._refiter:             # <<<<<<<<<<<<<<
17721  *                         self._refiter = lua.luaL_ref(L, lua.LUA_REGISTRYINDEX)
17722  *                     else:
17723  */
17724               goto __pyx_L18;
17725             }
17726 
17727             /* "lupa/_lupa.pyx":1064
17728  *                         self._refiter = lua.luaL_ref(L, lua.LUA_REGISTRYINDEX)
17729  *                     else:
17730  *                         lua.lua_rawseti(L, lua.LUA_REGISTRYINDEX, self._refiter)             # <<<<<<<<<<<<<<
17731  *                 return retval
17732  *             # iteration done, clean up
17733  */
17734             /*else*/ {
17735               lua_rawseti(__pyx_v_L, LUA_REGISTRYINDEX, __pyx_v_self->_refiter);
17736             }
17737             __pyx_L18:;
17738           }
17739           if (PY_MAJOR_VERSION >= 3) {
17740             __Pyx_XGIVEREF(__pyx_t_13);
17741             __Pyx_XGIVEREF(__pyx_t_14);
17742             __Pyx_XGIVEREF(__pyx_t_15);
17743             __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_14, __pyx_t_15);
17744           }
17745           __Pyx_XGIVEREF(__pyx_t_10);
17746           __Pyx_XGIVEREF(__pyx_t_11);
17747           __Pyx_XGIVEREF(__pyx_t_12);
17748           __Pyx_ErrRestore(__pyx_t_10, __pyx_t_11, __pyx_t_12);
17749           __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0;
17750           __pyx_lineno = __pyx_t_5; __pyx_clineno = __pyx_t_8; __pyx_filename = __pyx_t_9;
17751           goto __pyx_L5_error;
17752         }
17753         __pyx_L14:;
17754       }
17755 
17756       /* "lupa/_lupa.pyx":1065
17757  *                     else:
17758  *                         lua.lua_rawseti(L, lua.LUA_REGISTRYINDEX, self._refiter)
17759  *                 return retval             # <<<<<<<<<<<<<<
17760  *             # iteration done, clean up
17761  *             if self._refiter:
17762  */
17763       __Pyx_XDECREF(__pyx_r);
17764       __Pyx_INCREF(__pyx_v_retval);
17765       __pyx_r = __pyx_v_retval;
17766       goto __pyx_L4_return;
17767 
17768       /* "lupa/_lupa.pyx":1049
17769  *                 # last key
17770  *                 lua.lua_rawgeti(L, lua.LUA_REGISTRYINDEX, self._refiter)
17771  *             if lua.lua_next(L, -2):             # <<<<<<<<<<<<<<
17772  *                 try:
17773  *                     if self._what == KEYS:
17774  */
17775     }
17776 
17777     /* "lupa/_lupa.pyx":1067
17778  *                 return retval
17779  *             # iteration done, clean up
17780  *             if self._refiter:             # <<<<<<<<<<<<<<
17781  *                 lua.luaL_unref(L, lua.LUA_REGISTRYINDEX, self._refiter)
17782  *                 self._refiter = 0
17783  */
17784     __pyx_t_1 = (__pyx_v_self->_refiter != 0);
17785     if (__pyx_t_1) {
17786 
17787       /* "lupa/_lupa.pyx":1068
17788  *             # iteration done, clean up
17789  *             if self._refiter:
17790  *                 lua.luaL_unref(L, lua.LUA_REGISTRYINDEX, self._refiter)             # <<<<<<<<<<<<<<
17791  *                 self._refiter = 0
17792  *             self._obj = None
17793  */
17794       luaL_unref(__pyx_v_L, LUA_REGISTRYINDEX, __pyx_v_self->_refiter);
17795 
17796       /* "lupa/_lupa.pyx":1069
17797  *             if self._refiter:
17798  *                 lua.luaL_unref(L, lua.LUA_REGISTRYINDEX, self._refiter)
17799  *                 self._refiter = 0             # <<<<<<<<<<<<<<
17800  *             self._obj = None
17801  *         finally:
17802  */
17803       __pyx_v_self->_refiter = 0;
17804 
17805       /* "lupa/_lupa.pyx":1067
17806  *                 return retval
17807  *             # iteration done, clean up
17808  *             if self._refiter:             # <<<<<<<<<<<<<<
17809  *                 lua.luaL_unref(L, lua.LUA_REGISTRYINDEX, self._refiter)
17810  *                 self._refiter = 0
17811  */
17812     }
17813 
17814     /* "lupa/_lupa.pyx":1070
17815  *                 lua.luaL_unref(L, lua.LUA_REGISTRYINDEX, self._refiter)
17816  *                 self._refiter = 0
17817  *             self._obj = None             # <<<<<<<<<<<<<<
17818  *         finally:
17819  *             lua.lua_settop(L, old_top)
17820  */
17821     __Pyx_INCREF(Py_None);
17822     __Pyx_GIVEREF(Py_None);
17823     __Pyx_GOTREF(__pyx_v_self->_obj);
17824     __Pyx_DECREF(((PyObject *)__pyx_v_self->_obj));
17825     __pyx_v_self->_obj = ((struct __pyx_obj_4lupa_5_lupa__LuaObject *)Py_None);
17826   }
17827 
17828   /* "lupa/_lupa.pyx":1072
17829  *             self._obj = None
17830  *         finally:
17831  *             lua.lua_settop(L, old_top)             # <<<<<<<<<<<<<<
17832  *             unlock_runtime(self._runtime)
17833  *         raise StopIteration
17834  */
17835   /*finally:*/ {
17836     /*normal exit:*/{
17837       lua_settop(__pyx_v_L, __pyx_v_old_top);
17838 
17839       /* "lupa/_lupa.pyx":1073
17840  *         finally:
17841  *             lua.lua_settop(L, old_top)
17842  *             unlock_runtime(self._runtime)             # <<<<<<<<<<<<<<
17843  *         raise StopIteration
17844  *
17845  */
17846       __pyx_t_6 = ((PyObject *)__pyx_v_self->_runtime);
17847       __Pyx_INCREF(__pyx_t_6);
17848       __pyx_f_4lupa_5_lupa_unlock_runtime(((struct __pyx_obj_4lupa_5_lupa_LuaRuntime *)__pyx_t_6));
17849       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
17850       goto __pyx_L6;
17851     }
17852     __pyx_L5_error:;
17853     /*exception exit:*/{
17854       __Pyx_PyThreadState_declare
17855       __Pyx_PyThreadState_assign
17856       __pyx_t_15 = 0; __pyx_t_14 = 0; __pyx_t_13 = 0; __pyx_t_12 = 0; __pyx_t_11 = 0; __pyx_t_10 = 0;
17857       __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
17858       __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
17859       __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
17860       if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_12, &__pyx_t_11, &__pyx_t_10);
17861       if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_15, &__pyx_t_14, &__pyx_t_13) < 0)) __Pyx_ErrFetch(&__pyx_t_15, &__pyx_t_14, &__pyx_t_13);
17862       __Pyx_XGOTREF(__pyx_t_15);
17863       __Pyx_XGOTREF(__pyx_t_14);
17864       __Pyx_XGOTREF(__pyx_t_13);
17865       __Pyx_XGOTREF(__pyx_t_12);
17866       __Pyx_XGOTREF(__pyx_t_11);
17867       __Pyx_XGOTREF(__pyx_t_10);
17868       __pyx_t_8 = __pyx_lineno; __pyx_t_5 = __pyx_clineno; __pyx_t_16 = __pyx_filename;
17869       {
17870 
17871         /* "lupa/_lupa.pyx":1072
17872  *             self._obj = None
17873  *         finally:
17874  *             lua.lua_settop(L, old_top)             # <<<<<<<<<<<<<<
17875  *             unlock_runtime(self._runtime)
17876  *         raise StopIteration
17877  */
17878         lua_settop(__pyx_v_L, __pyx_v_old_top);
17879 
17880         /* "lupa/_lupa.pyx":1073
17881  *         finally:
17882  *             lua.lua_settop(L, old_top)
17883  *             unlock_runtime(self._runtime)             # <<<<<<<<<<<<<<
17884  *         raise StopIteration
17885  *
17886  */
17887         __pyx_t_6 = ((PyObject *)__pyx_v_self->_runtime);
17888         __Pyx_INCREF(__pyx_t_6);
17889         __pyx_f_4lupa_5_lupa_unlock_runtime(((struct __pyx_obj_4lupa_5_lupa_LuaRuntime *)__pyx_t_6));
17890         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
17891       }
17892       if (PY_MAJOR_VERSION >= 3) {
17893         __Pyx_XGIVEREF(__pyx_t_12);
17894         __Pyx_XGIVEREF(__pyx_t_11);
17895         __Pyx_XGIVEREF(__pyx_t_10);
17896         __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_11, __pyx_t_10);
17897       }
17898       __Pyx_XGIVEREF(__pyx_t_15);
17899       __Pyx_XGIVEREF(__pyx_t_14);
17900       __Pyx_XGIVEREF(__pyx_t_13);
17901       __Pyx_ErrRestore(__pyx_t_15, __pyx_t_14, __pyx_t_13);
17902       __pyx_t_15 = 0; __pyx_t_14 = 0; __pyx_t_13 = 0; __pyx_t_12 = 0; __pyx_t_11 = 0; __pyx_t_10 = 0;
17903       __pyx_lineno = __pyx_t_8; __pyx_clineno = __pyx_t_5; __pyx_filename = __pyx_t_16;
17904       goto __pyx_L1_error;
17905     }
17906     __pyx_L4_return: {
17907       __pyx_t_10 = __pyx_r;
17908       __pyx_r = 0;
17909 
17910       /* "lupa/_lupa.pyx":1072
17911  *             self._obj = None
17912  *         finally:
17913  *             lua.lua_settop(L, old_top)             # <<<<<<<<<<<<<<
17914  *             unlock_runtime(self._runtime)
17915  *         raise StopIteration
17916  */
17917       lua_settop(__pyx_v_L, __pyx_v_old_top);
17918 
17919       /* "lupa/_lupa.pyx":1073
17920  *         finally:
17921  *             lua.lua_settop(L, old_top)
17922  *             unlock_runtime(self._runtime)             # <<<<<<<<<<<<<<
17923  *         raise StopIteration
17924  *
17925  */
17926       __pyx_t_6 = ((PyObject *)__pyx_v_self->_runtime);
17927       __Pyx_INCREF(__pyx_t_6);
17928       __pyx_f_4lupa_5_lupa_unlock_runtime(((struct __pyx_obj_4lupa_5_lupa_LuaRuntime *)__pyx_t_6));
17929       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
17930       __pyx_r = __pyx_t_10;
17931       __pyx_t_10 = 0;
17932       goto __pyx_L0;
17933     }
17934     __pyx_L6:;
17935   }
17936 
17937   /* "lupa/_lupa.pyx":1074
17938  *             lua.lua_settop(L, old_top)
17939  *             unlock_runtime(self._runtime)
17940  *         raise StopIteration             # <<<<<<<<<<<<<<
17941  *
17942  * # type conversions and protocol adaptations
17943  */
17944   __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0, 0);
17945   __PYX_ERR(0, 1074, __pyx_L1_error)
17946 
17947   /* "lupa/_lupa.pyx":1027
17948  *         return self
17949  *
17950  *     def __next__(self):             # <<<<<<<<<<<<<<
17951  *         if self._obj is None:
17952  *             raise StopIteration
17953  */
17954 
17955   /* function exit code */
17956   __pyx_L1_error:;
17957   __Pyx_XDECREF(__pyx_t_4);
17958   __Pyx_XDECREF(__pyx_t_6);
17959   __Pyx_XDECREF(__pyx_t_7);
17960   __Pyx_AddTraceback("lupa._lupa._LuaIter.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
17961   __pyx_r = NULL;
17962   __pyx_L0:;
17963   __Pyx_XDECREF(__pyx_v_retval);
17964   __Pyx_XGIVEREF(__pyx_r);
17965   __Pyx_RefNannyFinishContext();
17966   return __pyx_r;
17967 }
17968 
17969 /* "(tree fragment)":1
17970  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
17971  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
17972  * def __setstate_cython__(self, __pyx_state):
17973  */
17974 
17975 /* Python wrapper */
17976 static PyObject *__pyx_pw_4lupa_5_lupa_8_LuaIter_11__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
17977 static char __pyx_doc_4lupa_5_lupa_8_LuaIter_10__reduce_cython__[] = "_LuaIter.__reduce_cython__(self)";
17978 static PyMethodDef __pyx_mdef_4lupa_5_lupa_8_LuaIter_11__reduce_cython__ = {"__reduce_cython__", (PyCFunction)__pyx_pw_4lupa_5_lupa_8_LuaIter_11__reduce_cython__, METH_NOARGS, __pyx_doc_4lupa_5_lupa_8_LuaIter_10__reduce_cython__};
__pyx_pw_4lupa_5_lupa_8_LuaIter_11__reduce_cython__(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)17979 static PyObject *__pyx_pw_4lupa_5_lupa_8_LuaIter_11__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
17980   PyObject *__pyx_r = 0;
17981   __Pyx_RefNannyDeclarations
17982   __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
17983   __pyx_r = __pyx_pf_4lupa_5_lupa_8_LuaIter_10__reduce_cython__(((struct __pyx_obj_4lupa_5_lupa__LuaIter *)__pyx_v_self));
17984 
17985   /* function exit code */
17986   __Pyx_RefNannyFinishContext();
17987   return __pyx_r;
17988 }
17989 
__pyx_pf_4lupa_5_lupa_8_LuaIter_10__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_4lupa_5_lupa__LuaIter * __pyx_v_self)17990 static PyObject *__pyx_pf_4lupa_5_lupa_8_LuaIter_10__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_4lupa_5_lupa__LuaIter *__pyx_v_self) {
17991   PyObject *__pyx_r = NULL;
17992   __Pyx_RefNannyDeclarations
17993   PyObject *__pyx_t_1 = NULL;
17994   int __pyx_lineno = 0;
17995   const char *__pyx_filename = NULL;
17996   int __pyx_clineno = 0;
17997   __Pyx_RefNannySetupContext("__reduce_cython__", 0);
17998 
17999   /* "(tree fragment)":2
18000  * def __reduce_cython__(self):
18001  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
18002  * def __setstate_cython__(self, __pyx_state):
18003  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
18004  */
18005   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__29, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error)
18006   __Pyx_GOTREF(__pyx_t_1);
18007   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
18008   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
18009   __PYX_ERR(2, 2, __pyx_L1_error)
18010 
18011   /* "(tree fragment)":1
18012  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
18013  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
18014  * def __setstate_cython__(self, __pyx_state):
18015  */
18016 
18017   /* function exit code */
18018   __pyx_L1_error:;
18019   __Pyx_XDECREF(__pyx_t_1);
18020   __Pyx_AddTraceback("lupa._lupa._LuaIter.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
18021   __pyx_r = NULL;
18022   __Pyx_XGIVEREF(__pyx_r);
18023   __Pyx_RefNannyFinishContext();
18024   return __pyx_r;
18025 }
18026 
18027 /* "(tree fragment)":3
18028  * def __reduce_cython__(self):
18029  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
18030  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
18031  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
18032  */
18033 
18034 /* Python wrapper */
18035 static PyObject *__pyx_pw_4lupa_5_lupa_8_LuaIter_13__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
18036 static char __pyx_doc_4lupa_5_lupa_8_LuaIter_12__setstate_cython__[] = "_LuaIter.__setstate_cython__(self, __pyx_state)";
18037 static PyMethodDef __pyx_mdef_4lupa_5_lupa_8_LuaIter_13__setstate_cython__ = {"__setstate_cython__", (PyCFunction)__pyx_pw_4lupa_5_lupa_8_LuaIter_13__setstate_cython__, METH_O, __pyx_doc_4lupa_5_lupa_8_LuaIter_12__setstate_cython__};
__pyx_pw_4lupa_5_lupa_8_LuaIter_13__setstate_cython__(PyObject * __pyx_v_self,PyObject * __pyx_v___pyx_state)18038 static PyObject *__pyx_pw_4lupa_5_lupa_8_LuaIter_13__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
18039   PyObject *__pyx_r = 0;
18040   __Pyx_RefNannyDeclarations
18041   __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
18042   __pyx_r = __pyx_pf_4lupa_5_lupa_8_LuaIter_12__setstate_cython__(((struct __pyx_obj_4lupa_5_lupa__LuaIter *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
18043 
18044   /* function exit code */
18045   __Pyx_RefNannyFinishContext();
18046   return __pyx_r;
18047 }
18048 
__pyx_pf_4lupa_5_lupa_8_LuaIter_12__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_4lupa_5_lupa__LuaIter * __pyx_v_self,CYTHON_UNUSED PyObject * __pyx_v___pyx_state)18049 static PyObject *__pyx_pf_4lupa_5_lupa_8_LuaIter_12__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_4lupa_5_lupa__LuaIter *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
18050   PyObject *__pyx_r = NULL;
18051   __Pyx_RefNannyDeclarations
18052   PyObject *__pyx_t_1 = NULL;
18053   int __pyx_lineno = 0;
18054   const char *__pyx_filename = NULL;
18055   int __pyx_clineno = 0;
18056   __Pyx_RefNannySetupContext("__setstate_cython__", 0);
18057 
18058   /* "(tree fragment)":4
18059  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
18060  * def __setstate_cython__(self, __pyx_state):
18061  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
18062  */
18063   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__30, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error)
18064   __Pyx_GOTREF(__pyx_t_1);
18065   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
18066   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
18067   __PYX_ERR(2, 4, __pyx_L1_error)
18068 
18069   /* "(tree fragment)":3
18070  * def __reduce_cython__(self):
18071  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
18072  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
18073  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
18074  */
18075 
18076   /* function exit code */
18077   __pyx_L1_error:;
18078   __Pyx_XDECREF(__pyx_t_1);
18079   __Pyx_AddTraceback("lupa._lupa._LuaIter.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
18080   __pyx_r = NULL;
18081   __Pyx_XGIVEREF(__pyx_r);
18082   __Pyx_RefNannyFinishContext();
18083   return __pyx_r;
18084 }
18085 
18086 /* "lupa/_lupa.pyx":1078
18087  * # type conversions and protocol adaptations
18088  *
18089  * cdef int py_asfunc_call(lua_State *L) nogil:             # <<<<<<<<<<<<<<
18090  *     if (lua.lua_gettop(L) == 1 and lua.lua_islightuserdata(L, 1)
18091  *             and lua.lua_topointer(L, 1) == <void*>unpack_wrapped_pyfunction):
18092  */
18093 
__pyx_f_4lupa_5_lupa_py_asfunc_call(lua_State * __pyx_v_L)18094 static int __pyx_f_4lupa_5_lupa_py_asfunc_call(lua_State *__pyx_v_L) {
18095   int __pyx_r;
18096   int __pyx_t_1;
18097   int __pyx_t_2;
18098 
18099   /* "lupa/_lupa.pyx":1079
18100  *
18101  * cdef int py_asfunc_call(lua_State *L) nogil:
18102  *     if (lua.lua_gettop(L) == 1 and lua.lua_islightuserdata(L, 1)             # <<<<<<<<<<<<<<
18103  *             and lua.lua_topointer(L, 1) == <void*>unpack_wrapped_pyfunction):
18104  *         # special case: unwrap_lua_object() calls this to find out the Python object
18105  */
18106   __pyx_t_2 = ((lua_gettop(__pyx_v_L) == 1) != 0);
18107   if (__pyx_t_2) {
18108   } else {
18109     __pyx_t_1 = __pyx_t_2;
18110     goto __pyx_L4_bool_binop_done;
18111   }
18112 
18113   /* "lupa/_lupa.pyx":1080
18114  * cdef int py_asfunc_call(lua_State *L) nogil:
18115  *     if (lua.lua_gettop(L) == 1 and lua.lua_islightuserdata(L, 1)
18116  *             and lua.lua_topointer(L, 1) == <void*>unpack_wrapped_pyfunction):             # <<<<<<<<<<<<<<
18117  *         # special case: unwrap_lua_object() calls this to find out the Python object
18118  *         lua.lua_pushvalue(L, lua.lua_upvalueindex(1))
18119  */
18120   __pyx_t_2 = (lua_islightuserdata(__pyx_v_L, 1) != 0);
18121   if (__pyx_t_2) {
18122   } else {
18123     __pyx_t_1 = __pyx_t_2;
18124     goto __pyx_L4_bool_binop_done;
18125   }
18126   __pyx_t_2 = ((lua_topointer(__pyx_v_L, 1) == ((void *)__pyx_f_4lupa_5_lupa_unpack_wrapped_pyfunction)) != 0);
18127   __pyx_t_1 = __pyx_t_2;
18128   __pyx_L4_bool_binop_done:;
18129 
18130   /* "lupa/_lupa.pyx":1079
18131  *
18132  * cdef int py_asfunc_call(lua_State *L) nogil:
18133  *     if (lua.lua_gettop(L) == 1 and lua.lua_islightuserdata(L, 1)             # <<<<<<<<<<<<<<
18134  *             and lua.lua_topointer(L, 1) == <void*>unpack_wrapped_pyfunction):
18135  *         # special case: unwrap_lua_object() calls this to find out the Python object
18136  */
18137   if (__pyx_t_1) {
18138 
18139     /* "lupa/_lupa.pyx":1082
18140  *             and lua.lua_topointer(L, 1) == <void*>unpack_wrapped_pyfunction):
18141  *         # special case: unwrap_lua_object() calls this to find out the Python object
18142  *         lua.lua_pushvalue(L, lua.lua_upvalueindex(1))             # <<<<<<<<<<<<<<
18143  *         return 1
18144  *     lua.lua_pushvalue(L, lua.lua_upvalueindex(1))
18145  */
18146     lua_pushvalue(__pyx_v_L, lua_upvalueindex(1));
18147 
18148     /* "lupa/_lupa.pyx":1083
18149  *         # special case: unwrap_lua_object() calls this to find out the Python object
18150  *         lua.lua_pushvalue(L, lua.lua_upvalueindex(1))
18151  *         return 1             # <<<<<<<<<<<<<<
18152  *     lua.lua_pushvalue(L, lua.lua_upvalueindex(1))
18153  *     lua.lua_insert(L, 1)
18154  */
18155     __pyx_r = 1;
18156     goto __pyx_L0;
18157 
18158     /* "lupa/_lupa.pyx":1079
18159  *
18160  * cdef int py_asfunc_call(lua_State *L) nogil:
18161  *     if (lua.lua_gettop(L) == 1 and lua.lua_islightuserdata(L, 1)             # <<<<<<<<<<<<<<
18162  *             and lua.lua_topointer(L, 1) == <void*>unpack_wrapped_pyfunction):
18163  *         # special case: unwrap_lua_object() calls this to find out the Python object
18164  */
18165   }
18166 
18167   /* "lupa/_lupa.pyx":1084
18168  *         lua.lua_pushvalue(L, lua.lua_upvalueindex(1))
18169  *         return 1
18170  *     lua.lua_pushvalue(L, lua.lua_upvalueindex(1))             # <<<<<<<<<<<<<<
18171  *     lua.lua_insert(L, 1)
18172  *     return py_object_call(L)
18173  */
18174   lua_pushvalue(__pyx_v_L, lua_upvalueindex(1));
18175 
18176   /* "lupa/_lupa.pyx":1085
18177  *         return 1
18178  *     lua.lua_pushvalue(L, lua.lua_upvalueindex(1))
18179  *     lua.lua_insert(L, 1)             # <<<<<<<<<<<<<<
18180  *     return py_object_call(L)
18181  *
18182  */
18183   lua_insert(__pyx_v_L, 1);
18184 
18185   /* "lupa/_lupa.pyx":1086
18186  *     lua.lua_pushvalue(L, lua.lua_upvalueindex(1))
18187  *     lua.lua_insert(L, 1)
18188  *     return py_object_call(L)             # <<<<<<<<<<<<<<
18189  *
18190  * cdef py_object* unpack_wrapped_pyfunction(lua_State* L, int n) nogil:
18191  */
18192   __pyx_r = __pyx_f_4lupa_5_lupa_py_object_call(__pyx_v_L);
18193   goto __pyx_L0;
18194 
18195   /* "lupa/_lupa.pyx":1078
18196  * # type conversions and protocol adaptations
18197  *
18198  * cdef int py_asfunc_call(lua_State *L) nogil:             # <<<<<<<<<<<<<<
18199  *     if (lua.lua_gettop(L) == 1 and lua.lua_islightuserdata(L, 1)
18200  *             and lua.lua_topointer(L, 1) == <void*>unpack_wrapped_pyfunction):
18201  */
18202 
18203   /* function exit code */
18204   __pyx_L0:;
18205   return __pyx_r;
18206 }
18207 
18208 /* "lupa/_lupa.pyx":1088
18209  *     return py_object_call(L)
18210  *
18211  * cdef py_object* unpack_wrapped_pyfunction(lua_State* L, int n) nogil:             # <<<<<<<<<<<<<<
18212  *     cdef lua.lua_CFunction cfunction = lua.lua_tocfunction(L, n)
18213  *     if cfunction is <lua.lua_CFunction>py_asfunc_call:
18214  */
18215 
__pyx_f_4lupa_5_lupa_unpack_wrapped_pyfunction(lua_State * __pyx_v_L,int __pyx_v_n)18216 static struct __pyx_t_4lupa_5_lupa_py_object *__pyx_f_4lupa_5_lupa_unpack_wrapped_pyfunction(lua_State *__pyx_v_L, int __pyx_v_n) {
18217   lua_CFunction __pyx_v_cfunction;
18218   struct __pyx_t_4lupa_5_lupa_py_object *__pyx_r;
18219   int __pyx_t_1;
18220 
18221   /* "lupa/_lupa.pyx":1089
18222  *
18223  * cdef py_object* unpack_wrapped_pyfunction(lua_State* L, int n) nogil:
18224  *     cdef lua.lua_CFunction cfunction = lua.lua_tocfunction(L, n)             # <<<<<<<<<<<<<<
18225  *     if cfunction is <lua.lua_CFunction>py_asfunc_call:
18226  *         lua.lua_pushvalue(L, n)
18227  */
18228   __pyx_v_cfunction = lua_tocfunction(__pyx_v_L, __pyx_v_n);
18229 
18230   /* "lupa/_lupa.pyx":1090
18231  * cdef py_object* unpack_wrapped_pyfunction(lua_State* L, int n) nogil:
18232  *     cdef lua.lua_CFunction cfunction = lua.lua_tocfunction(L, n)
18233  *     if cfunction is <lua.lua_CFunction>py_asfunc_call:             # <<<<<<<<<<<<<<
18234  *         lua.lua_pushvalue(L, n)
18235  *         lua.lua_pushlightuserdata(L, <void*>unpack_wrapped_pyfunction)
18236  */
18237   __pyx_t_1 = ((__pyx_v_cfunction == ((lua_CFunction)__pyx_f_4lupa_5_lupa_py_asfunc_call)) != 0);
18238   if (__pyx_t_1) {
18239 
18240     /* "lupa/_lupa.pyx":1091
18241  *     cdef lua.lua_CFunction cfunction = lua.lua_tocfunction(L, n)
18242  *     if cfunction is <lua.lua_CFunction>py_asfunc_call:
18243  *         lua.lua_pushvalue(L, n)             # <<<<<<<<<<<<<<
18244  *         lua.lua_pushlightuserdata(L, <void*>unpack_wrapped_pyfunction)
18245  *         if lua.lua_pcall(L, 1, 1, 0) == 0:
18246  */
18247     lua_pushvalue(__pyx_v_L, __pyx_v_n);
18248 
18249     /* "lupa/_lupa.pyx":1092
18250  *     if cfunction is <lua.lua_CFunction>py_asfunc_call:
18251  *         lua.lua_pushvalue(L, n)
18252  *         lua.lua_pushlightuserdata(L, <void*>unpack_wrapped_pyfunction)             # <<<<<<<<<<<<<<
18253  *         if lua.lua_pcall(L, 1, 1, 0) == 0:
18254  *             return unpack_userdata(L, -1)
18255  */
18256     lua_pushlightuserdata(__pyx_v_L, ((void *)__pyx_f_4lupa_5_lupa_unpack_wrapped_pyfunction));
18257 
18258     /* "lupa/_lupa.pyx":1093
18259  *         lua.lua_pushvalue(L, n)
18260  *         lua.lua_pushlightuserdata(L, <void*>unpack_wrapped_pyfunction)
18261  *         if lua.lua_pcall(L, 1, 1, 0) == 0:             # <<<<<<<<<<<<<<
18262  *             return unpack_userdata(L, -1)
18263  *     return NULL
18264  */
18265     __pyx_t_1 = ((lua_pcall(__pyx_v_L, 1, 1, 0) == 0) != 0);
18266     if (__pyx_t_1) {
18267 
18268       /* "lupa/_lupa.pyx":1094
18269  *         lua.lua_pushlightuserdata(L, <void*>unpack_wrapped_pyfunction)
18270  *         if lua.lua_pcall(L, 1, 1, 0) == 0:
18271  *             return unpack_userdata(L, -1)             # <<<<<<<<<<<<<<
18272  *     return NULL
18273  *
18274  */
18275       __pyx_r = __pyx_f_4lupa_5_lupa_unpack_userdata(__pyx_v_L, -1);
18276       goto __pyx_L0;
18277 
18278       /* "lupa/_lupa.pyx":1093
18279  *         lua.lua_pushvalue(L, n)
18280  *         lua.lua_pushlightuserdata(L, <void*>unpack_wrapped_pyfunction)
18281  *         if lua.lua_pcall(L, 1, 1, 0) == 0:             # <<<<<<<<<<<<<<
18282  *             return unpack_userdata(L, -1)
18283  *     return NULL
18284  */
18285     }
18286 
18287     /* "lupa/_lupa.pyx":1090
18288  * cdef py_object* unpack_wrapped_pyfunction(lua_State* L, int n) nogil:
18289  *     cdef lua.lua_CFunction cfunction = lua.lua_tocfunction(L, n)
18290  *     if cfunction is <lua.lua_CFunction>py_asfunc_call:             # <<<<<<<<<<<<<<
18291  *         lua.lua_pushvalue(L, n)
18292  *         lua.lua_pushlightuserdata(L, <void*>unpack_wrapped_pyfunction)
18293  */
18294   }
18295 
18296   /* "lupa/_lupa.pyx":1095
18297  *         if lua.lua_pcall(L, 1, 1, 0) == 0:
18298  *             return unpack_userdata(L, -1)
18299  *     return NULL             # <<<<<<<<<<<<<<
18300  *
18301  *
18302  */
18303   __pyx_r = NULL;
18304   goto __pyx_L0;
18305 
18306   /* "lupa/_lupa.pyx":1088
18307  *     return py_object_call(L)
18308  *
18309  * cdef py_object* unpack_wrapped_pyfunction(lua_State* L, int n) nogil:             # <<<<<<<<<<<<<<
18310  *     cdef lua.lua_CFunction cfunction = lua.lua_tocfunction(L, n)
18311  *     if cfunction is <lua.lua_CFunction>py_asfunc_call:
18312  */
18313 
18314   /* function exit code */
18315   __pyx_L0:;
18316   return __pyx_r;
18317 }
18318 
18319 /* "lupa/_lupa.pyx":1104
18320  *     cdef object _obj
18321  *     cdef int _type_flags
18322  *     def __cinit__(self):             # <<<<<<<<<<<<<<
18323  *         self._type_flags = 0
18324  *     def __init__(self):
18325  */
18326 
18327 /* Python wrapper */
18328 static int __pyx_pw_4lupa_5_lupa_18_PyProtocolWrapper_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_pw_4lupa_5_lupa_18_PyProtocolWrapper_1__cinit__(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)18329 static int __pyx_pw_4lupa_5_lupa_18_PyProtocolWrapper_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
18330   int __pyx_r;
18331   __Pyx_RefNannyDeclarations
18332   __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
18333   if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
18334     __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
18335   if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;
18336   __pyx_r = __pyx_pf_4lupa_5_lupa_18_PyProtocolWrapper___cinit__(((struct __pyx_obj_4lupa_5_lupa__PyProtocolWrapper *)__pyx_v_self));
18337 
18338   /* function exit code */
18339   __Pyx_RefNannyFinishContext();
18340   return __pyx_r;
18341 }
18342 
__pyx_pf_4lupa_5_lupa_18_PyProtocolWrapper___cinit__(struct __pyx_obj_4lupa_5_lupa__PyProtocolWrapper * __pyx_v_self)18343 static int __pyx_pf_4lupa_5_lupa_18_PyProtocolWrapper___cinit__(struct __pyx_obj_4lupa_5_lupa__PyProtocolWrapper *__pyx_v_self) {
18344   int __pyx_r;
18345   __Pyx_RefNannyDeclarations
18346   __Pyx_RefNannySetupContext("__cinit__", 0);
18347 
18348   /* "lupa/_lupa.pyx":1105
18349  *     cdef int _type_flags
18350  *     def __cinit__(self):
18351  *         self._type_flags = 0             # <<<<<<<<<<<<<<
18352  *     def __init__(self):
18353  *         raise TypeError("Type cannot be instantiated from Python")
18354  */
18355   __pyx_v_self->_type_flags = 0;
18356 
18357   /* "lupa/_lupa.pyx":1104
18358  *     cdef object _obj
18359  *     cdef int _type_flags
18360  *     def __cinit__(self):             # <<<<<<<<<<<<<<
18361  *         self._type_flags = 0
18362  *     def __init__(self):
18363  */
18364 
18365   /* function exit code */
18366   __pyx_r = 0;
18367   __Pyx_RefNannyFinishContext();
18368   return __pyx_r;
18369 }
18370 
18371 /* "lupa/_lupa.pyx":1106
18372  *     def __cinit__(self):
18373  *         self._type_flags = 0
18374  *     def __init__(self):             # <<<<<<<<<<<<<<
18375  *         raise TypeError("Type cannot be instantiated from Python")
18376  *
18377  */
18378 
18379 /* Python wrapper */
18380 static int __pyx_pw_4lupa_5_lupa_18_PyProtocolWrapper_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_pw_4lupa_5_lupa_18_PyProtocolWrapper_3__init__(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)18381 static int __pyx_pw_4lupa_5_lupa_18_PyProtocolWrapper_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
18382   int __pyx_r;
18383   __Pyx_RefNannyDeclarations
18384   __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
18385   if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
18386     __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
18387   if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1;
18388   __pyx_r = __pyx_pf_4lupa_5_lupa_18_PyProtocolWrapper_2__init__(((struct __pyx_obj_4lupa_5_lupa__PyProtocolWrapper *)__pyx_v_self));
18389 
18390   /* function exit code */
18391   __Pyx_RefNannyFinishContext();
18392   return __pyx_r;
18393 }
18394 
__pyx_pf_4lupa_5_lupa_18_PyProtocolWrapper_2__init__(CYTHON_UNUSED struct __pyx_obj_4lupa_5_lupa__PyProtocolWrapper * __pyx_v_self)18395 static int __pyx_pf_4lupa_5_lupa_18_PyProtocolWrapper_2__init__(CYTHON_UNUSED struct __pyx_obj_4lupa_5_lupa__PyProtocolWrapper *__pyx_v_self) {
18396   int __pyx_r;
18397   __Pyx_RefNannyDeclarations
18398   PyObject *__pyx_t_1 = NULL;
18399   int __pyx_lineno = 0;
18400   const char *__pyx_filename = NULL;
18401   int __pyx_clineno = 0;
18402   __Pyx_RefNannySetupContext("__init__", 0);
18403 
18404   /* "lupa/_lupa.pyx":1107
18405  *         self._type_flags = 0
18406  *     def __init__(self):
18407  *         raise TypeError("Type cannot be instantiated from Python")             # <<<<<<<<<<<<<<
18408  *
18409  *
18410  */
18411   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__31, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1107, __pyx_L1_error)
18412   __Pyx_GOTREF(__pyx_t_1);
18413   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
18414   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
18415   __PYX_ERR(0, 1107, __pyx_L1_error)
18416 
18417   /* "lupa/_lupa.pyx":1106
18418  *     def __cinit__(self):
18419  *         self._type_flags = 0
18420  *     def __init__(self):             # <<<<<<<<<<<<<<
18421  *         raise TypeError("Type cannot be instantiated from Python")
18422  *
18423  */
18424 
18425   /* function exit code */
18426   __pyx_L1_error:;
18427   __Pyx_XDECREF(__pyx_t_1);
18428   __Pyx_AddTraceback("lupa._lupa._PyProtocolWrapper.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
18429   __pyx_r = -1;
18430   __Pyx_RefNannyFinishContext();
18431   return __pyx_r;
18432 }
18433 
18434 /* "(tree fragment)":1
18435  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
18436  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
18437  * def __setstate_cython__(self, __pyx_state):
18438  */
18439 
18440 /* Python wrapper */
18441 static PyObject *__pyx_pw_4lupa_5_lupa_18_PyProtocolWrapper_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
18442 static char __pyx_doc_4lupa_5_lupa_18_PyProtocolWrapper_4__reduce_cython__[] = "_PyProtocolWrapper.__reduce_cython__(self)";
18443 static PyMethodDef __pyx_mdef_4lupa_5_lupa_18_PyProtocolWrapper_5__reduce_cython__ = {"__reduce_cython__", (PyCFunction)__pyx_pw_4lupa_5_lupa_18_PyProtocolWrapper_5__reduce_cython__, METH_NOARGS, __pyx_doc_4lupa_5_lupa_18_PyProtocolWrapper_4__reduce_cython__};
__pyx_pw_4lupa_5_lupa_18_PyProtocolWrapper_5__reduce_cython__(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)18444 static PyObject *__pyx_pw_4lupa_5_lupa_18_PyProtocolWrapper_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
18445   PyObject *__pyx_r = 0;
18446   __Pyx_RefNannyDeclarations
18447   __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
18448   __pyx_r = __pyx_pf_4lupa_5_lupa_18_PyProtocolWrapper_4__reduce_cython__(((struct __pyx_obj_4lupa_5_lupa__PyProtocolWrapper *)__pyx_v_self));
18449 
18450   /* function exit code */
18451   __Pyx_RefNannyFinishContext();
18452   return __pyx_r;
18453 }
18454 
__pyx_pf_4lupa_5_lupa_18_PyProtocolWrapper_4__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_4lupa_5_lupa__PyProtocolWrapper * __pyx_v_self)18455 static PyObject *__pyx_pf_4lupa_5_lupa_18_PyProtocolWrapper_4__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_4lupa_5_lupa__PyProtocolWrapper *__pyx_v_self) {
18456   PyObject *__pyx_r = NULL;
18457   __Pyx_RefNannyDeclarations
18458   PyObject *__pyx_t_1 = NULL;
18459   int __pyx_lineno = 0;
18460   const char *__pyx_filename = NULL;
18461   int __pyx_clineno = 0;
18462   __Pyx_RefNannySetupContext("__reduce_cython__", 0);
18463 
18464   /* "(tree fragment)":2
18465  * def __reduce_cython__(self):
18466  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
18467  * def __setstate_cython__(self, __pyx_state):
18468  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
18469  */
18470   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__32, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error)
18471   __Pyx_GOTREF(__pyx_t_1);
18472   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
18473   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
18474   __PYX_ERR(2, 2, __pyx_L1_error)
18475 
18476   /* "(tree fragment)":1
18477  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
18478  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
18479  * def __setstate_cython__(self, __pyx_state):
18480  */
18481 
18482   /* function exit code */
18483   __pyx_L1_error:;
18484   __Pyx_XDECREF(__pyx_t_1);
18485   __Pyx_AddTraceback("lupa._lupa._PyProtocolWrapper.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
18486   __pyx_r = NULL;
18487   __Pyx_XGIVEREF(__pyx_r);
18488   __Pyx_RefNannyFinishContext();
18489   return __pyx_r;
18490 }
18491 
18492 /* "(tree fragment)":3
18493  * def __reduce_cython__(self):
18494  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
18495  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
18496  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
18497  */
18498 
18499 /* Python wrapper */
18500 static PyObject *__pyx_pw_4lupa_5_lupa_18_PyProtocolWrapper_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
18501 static char __pyx_doc_4lupa_5_lupa_18_PyProtocolWrapper_6__setstate_cython__[] = "_PyProtocolWrapper.__setstate_cython__(self, __pyx_state)";
18502 static PyMethodDef __pyx_mdef_4lupa_5_lupa_18_PyProtocolWrapper_7__setstate_cython__ = {"__setstate_cython__", (PyCFunction)__pyx_pw_4lupa_5_lupa_18_PyProtocolWrapper_7__setstate_cython__, METH_O, __pyx_doc_4lupa_5_lupa_18_PyProtocolWrapper_6__setstate_cython__};
__pyx_pw_4lupa_5_lupa_18_PyProtocolWrapper_7__setstate_cython__(PyObject * __pyx_v_self,PyObject * __pyx_v___pyx_state)18503 static PyObject *__pyx_pw_4lupa_5_lupa_18_PyProtocolWrapper_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
18504   PyObject *__pyx_r = 0;
18505   __Pyx_RefNannyDeclarations
18506   __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
18507   __pyx_r = __pyx_pf_4lupa_5_lupa_18_PyProtocolWrapper_6__setstate_cython__(((struct __pyx_obj_4lupa_5_lupa__PyProtocolWrapper *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
18508 
18509   /* function exit code */
18510   __Pyx_RefNannyFinishContext();
18511   return __pyx_r;
18512 }
18513 
__pyx_pf_4lupa_5_lupa_18_PyProtocolWrapper_6__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_4lupa_5_lupa__PyProtocolWrapper * __pyx_v_self,CYTHON_UNUSED PyObject * __pyx_v___pyx_state)18514 static PyObject *__pyx_pf_4lupa_5_lupa_18_PyProtocolWrapper_6__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_4lupa_5_lupa__PyProtocolWrapper *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
18515   PyObject *__pyx_r = NULL;
18516   __Pyx_RefNannyDeclarations
18517   PyObject *__pyx_t_1 = NULL;
18518   int __pyx_lineno = 0;
18519   const char *__pyx_filename = NULL;
18520   int __pyx_clineno = 0;
18521   __Pyx_RefNannySetupContext("__setstate_cython__", 0);
18522 
18523   /* "(tree fragment)":4
18524  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
18525  * def __setstate_cython__(self, __pyx_state):
18526  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
18527  */
18528   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__33, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error)
18529   __Pyx_GOTREF(__pyx_t_1);
18530   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
18531   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
18532   __PYX_ERR(2, 4, __pyx_L1_error)
18533 
18534   /* "(tree fragment)":3
18535  * def __reduce_cython__(self):
18536  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
18537  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
18538  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
18539  */
18540 
18541   /* function exit code */
18542   __pyx_L1_error:;
18543   __Pyx_XDECREF(__pyx_t_1);
18544   __Pyx_AddTraceback("lupa._lupa._PyProtocolWrapper.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
18545   __pyx_r = NULL;
18546   __Pyx_XGIVEREF(__pyx_r);
18547   __Pyx_RefNannyFinishContext();
18548   return __pyx_r;
18549 }
18550 
18551 /* "lupa/_lupa.pyx":1110
18552  *
18553  *
18554  * def as_attrgetter(obj):             # <<<<<<<<<<<<<<
18555  *     cdef _PyProtocolWrapper wrap = _PyProtocolWrapper.__new__(_PyProtocolWrapper)
18556  *     wrap._obj = obj
18557  */
18558 
18559 /* Python wrapper */
18560 static PyObject *__pyx_pw_4lupa_5_lupa_7as_attrgetter(PyObject *__pyx_self, PyObject *__pyx_v_obj); /*proto*/
18561 static char __pyx_doc_4lupa_5_lupa_6as_attrgetter[] = "as_attrgetter(obj)";
18562 static PyMethodDef __pyx_mdef_4lupa_5_lupa_7as_attrgetter = {"as_attrgetter", (PyCFunction)__pyx_pw_4lupa_5_lupa_7as_attrgetter, METH_O, __pyx_doc_4lupa_5_lupa_6as_attrgetter};
__pyx_pw_4lupa_5_lupa_7as_attrgetter(PyObject * __pyx_self,PyObject * __pyx_v_obj)18563 static PyObject *__pyx_pw_4lupa_5_lupa_7as_attrgetter(PyObject *__pyx_self, PyObject *__pyx_v_obj) {
18564   PyObject *__pyx_r = 0;
18565   __Pyx_RefNannyDeclarations
18566   __Pyx_RefNannySetupContext("as_attrgetter (wrapper)", 0);
18567   __pyx_r = __pyx_pf_4lupa_5_lupa_6as_attrgetter(__pyx_self, ((PyObject *)__pyx_v_obj));
18568 
18569   /* function exit code */
18570   __Pyx_RefNannyFinishContext();
18571   return __pyx_r;
18572 }
18573 
__pyx_pf_4lupa_5_lupa_6as_attrgetter(CYTHON_UNUSED PyObject * __pyx_self,PyObject * __pyx_v_obj)18574 static PyObject *__pyx_pf_4lupa_5_lupa_6as_attrgetter(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_obj) {
18575   struct __pyx_obj_4lupa_5_lupa__PyProtocolWrapper *__pyx_v_wrap = 0;
18576   PyObject *__pyx_r = NULL;
18577   __Pyx_RefNannyDeclarations
18578   PyObject *__pyx_t_1 = NULL;
18579   int __pyx_lineno = 0;
18580   const char *__pyx_filename = NULL;
18581   int __pyx_clineno = 0;
18582   __Pyx_RefNannySetupContext("as_attrgetter", 0);
18583 
18584   /* "lupa/_lupa.pyx":1111
18585  *
18586  * def as_attrgetter(obj):
18587  *     cdef _PyProtocolWrapper wrap = _PyProtocolWrapper.__new__(_PyProtocolWrapper)             # <<<<<<<<<<<<<<
18588  *     wrap._obj = obj
18589  *     wrap._type_flags = 0
18590  */
18591   __pyx_t_1 = ((PyObject *)__pyx_tp_new_4lupa_5_lupa__PyProtocolWrapper(((PyTypeObject *)__pyx_ptype_4lupa_5_lupa__PyProtocolWrapper), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1111, __pyx_L1_error)
18592   __Pyx_GOTREF(((PyObject *)__pyx_t_1));
18593   __pyx_v_wrap = ((struct __pyx_obj_4lupa_5_lupa__PyProtocolWrapper *)__pyx_t_1);
18594   __pyx_t_1 = 0;
18595 
18596   /* "lupa/_lupa.pyx":1112
18597  * def as_attrgetter(obj):
18598  *     cdef _PyProtocolWrapper wrap = _PyProtocolWrapper.__new__(_PyProtocolWrapper)
18599  *     wrap._obj = obj             # <<<<<<<<<<<<<<
18600  *     wrap._type_flags = 0
18601  *     return wrap
18602  */
18603   __Pyx_INCREF(__pyx_v_obj);
18604   __Pyx_GIVEREF(__pyx_v_obj);
18605   __Pyx_GOTREF(__pyx_v_wrap->_obj);
18606   __Pyx_DECREF(__pyx_v_wrap->_obj);
18607   __pyx_v_wrap->_obj = __pyx_v_obj;
18608 
18609   /* "lupa/_lupa.pyx":1113
18610  *     cdef _PyProtocolWrapper wrap = _PyProtocolWrapper.__new__(_PyProtocolWrapper)
18611  *     wrap._obj = obj
18612  *     wrap._type_flags = 0             # <<<<<<<<<<<<<<
18613  *     return wrap
18614  *
18615  */
18616   __pyx_v_wrap->_type_flags = 0;
18617 
18618   /* "lupa/_lupa.pyx":1114
18619  *     wrap._obj = obj
18620  *     wrap._type_flags = 0
18621  *     return wrap             # <<<<<<<<<<<<<<
18622  *
18623  * def as_itemgetter(obj):
18624  */
18625   __Pyx_XDECREF(__pyx_r);
18626   __Pyx_INCREF(((PyObject *)__pyx_v_wrap));
18627   __pyx_r = ((PyObject *)__pyx_v_wrap);
18628   goto __pyx_L0;
18629 
18630   /* "lupa/_lupa.pyx":1110
18631  *
18632  *
18633  * def as_attrgetter(obj):             # <<<<<<<<<<<<<<
18634  *     cdef _PyProtocolWrapper wrap = _PyProtocolWrapper.__new__(_PyProtocolWrapper)
18635  *     wrap._obj = obj
18636  */
18637 
18638   /* function exit code */
18639   __pyx_L1_error:;
18640   __Pyx_XDECREF(__pyx_t_1);
18641   __Pyx_AddTraceback("lupa._lupa.as_attrgetter", __pyx_clineno, __pyx_lineno, __pyx_filename);
18642   __pyx_r = NULL;
18643   __pyx_L0:;
18644   __Pyx_XDECREF((PyObject *)__pyx_v_wrap);
18645   __Pyx_XGIVEREF(__pyx_r);
18646   __Pyx_RefNannyFinishContext();
18647   return __pyx_r;
18648 }
18649 
18650 /* "lupa/_lupa.pyx":1116
18651  *     return wrap
18652  *
18653  * def as_itemgetter(obj):             # <<<<<<<<<<<<<<
18654  *     cdef _PyProtocolWrapper wrap = _PyProtocolWrapper.__new__(_PyProtocolWrapper)
18655  *     wrap._obj = obj
18656  */
18657 
18658 /* Python wrapper */
18659 static PyObject *__pyx_pw_4lupa_5_lupa_9as_itemgetter(PyObject *__pyx_self, PyObject *__pyx_v_obj); /*proto*/
18660 static char __pyx_doc_4lupa_5_lupa_8as_itemgetter[] = "as_itemgetter(obj)";
18661 static PyMethodDef __pyx_mdef_4lupa_5_lupa_9as_itemgetter = {"as_itemgetter", (PyCFunction)__pyx_pw_4lupa_5_lupa_9as_itemgetter, METH_O, __pyx_doc_4lupa_5_lupa_8as_itemgetter};
__pyx_pw_4lupa_5_lupa_9as_itemgetter(PyObject * __pyx_self,PyObject * __pyx_v_obj)18662 static PyObject *__pyx_pw_4lupa_5_lupa_9as_itemgetter(PyObject *__pyx_self, PyObject *__pyx_v_obj) {
18663   PyObject *__pyx_r = 0;
18664   __Pyx_RefNannyDeclarations
18665   __Pyx_RefNannySetupContext("as_itemgetter (wrapper)", 0);
18666   __pyx_r = __pyx_pf_4lupa_5_lupa_8as_itemgetter(__pyx_self, ((PyObject *)__pyx_v_obj));
18667 
18668   /* function exit code */
18669   __Pyx_RefNannyFinishContext();
18670   return __pyx_r;
18671 }
18672 
__pyx_pf_4lupa_5_lupa_8as_itemgetter(CYTHON_UNUSED PyObject * __pyx_self,PyObject * __pyx_v_obj)18673 static PyObject *__pyx_pf_4lupa_5_lupa_8as_itemgetter(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_obj) {
18674   struct __pyx_obj_4lupa_5_lupa__PyProtocolWrapper *__pyx_v_wrap = 0;
18675   PyObject *__pyx_r = NULL;
18676   __Pyx_RefNannyDeclarations
18677   PyObject *__pyx_t_1 = NULL;
18678   int __pyx_lineno = 0;
18679   const char *__pyx_filename = NULL;
18680   int __pyx_clineno = 0;
18681   __Pyx_RefNannySetupContext("as_itemgetter", 0);
18682 
18683   /* "lupa/_lupa.pyx":1117
18684  *
18685  * def as_itemgetter(obj):
18686  *     cdef _PyProtocolWrapper wrap = _PyProtocolWrapper.__new__(_PyProtocolWrapper)             # <<<<<<<<<<<<<<
18687  *     wrap._obj = obj
18688  *     wrap._type_flags = OBJ_AS_INDEX
18689  */
18690   __pyx_t_1 = ((PyObject *)__pyx_tp_new_4lupa_5_lupa__PyProtocolWrapper(((PyTypeObject *)__pyx_ptype_4lupa_5_lupa__PyProtocolWrapper), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1117, __pyx_L1_error)
18691   __Pyx_GOTREF(((PyObject *)__pyx_t_1));
18692   __pyx_v_wrap = ((struct __pyx_obj_4lupa_5_lupa__PyProtocolWrapper *)__pyx_t_1);
18693   __pyx_t_1 = 0;
18694 
18695   /* "lupa/_lupa.pyx":1118
18696  * def as_itemgetter(obj):
18697  *     cdef _PyProtocolWrapper wrap = _PyProtocolWrapper.__new__(_PyProtocolWrapper)
18698  *     wrap._obj = obj             # <<<<<<<<<<<<<<
18699  *     wrap._type_flags = OBJ_AS_INDEX
18700  *     return wrap
18701  */
18702   __Pyx_INCREF(__pyx_v_obj);
18703   __Pyx_GIVEREF(__pyx_v_obj);
18704   __Pyx_GOTREF(__pyx_v_wrap->_obj);
18705   __Pyx_DECREF(__pyx_v_wrap->_obj);
18706   __pyx_v_wrap->_obj = __pyx_v_obj;
18707 
18708   /* "lupa/_lupa.pyx":1119
18709  *     cdef _PyProtocolWrapper wrap = _PyProtocolWrapper.__new__(_PyProtocolWrapper)
18710  *     wrap._obj = obj
18711  *     wrap._type_flags = OBJ_AS_INDEX             # <<<<<<<<<<<<<<
18712  *     return wrap
18713  *
18714  */
18715   __pyx_v_wrap->_type_flags = __pyx_e_4lupa_5_lupa_OBJ_AS_INDEX;
18716 
18717   /* "lupa/_lupa.pyx":1120
18718  *     wrap._obj = obj
18719  *     wrap._type_flags = OBJ_AS_INDEX
18720  *     return wrap             # <<<<<<<<<<<<<<
18721  *
18722  * cdef object py_from_lua(LuaRuntime runtime, lua_State *L, int n):
18723  */
18724   __Pyx_XDECREF(__pyx_r);
18725   __Pyx_INCREF(((PyObject *)__pyx_v_wrap));
18726   __pyx_r = ((PyObject *)__pyx_v_wrap);
18727   goto __pyx_L0;
18728 
18729   /* "lupa/_lupa.pyx":1116
18730  *     return wrap
18731  *
18732  * def as_itemgetter(obj):             # <<<<<<<<<<<<<<
18733  *     cdef _PyProtocolWrapper wrap = _PyProtocolWrapper.__new__(_PyProtocolWrapper)
18734  *     wrap._obj = obj
18735  */
18736 
18737   /* function exit code */
18738   __pyx_L1_error:;
18739   __Pyx_XDECREF(__pyx_t_1);
18740   __Pyx_AddTraceback("lupa._lupa.as_itemgetter", __pyx_clineno, __pyx_lineno, __pyx_filename);
18741   __pyx_r = NULL;
18742   __pyx_L0:;
18743   __Pyx_XDECREF((PyObject *)__pyx_v_wrap);
18744   __Pyx_XGIVEREF(__pyx_r);
18745   __Pyx_RefNannyFinishContext();
18746   return __pyx_r;
18747 }
18748 
18749 /* "lupa/_lupa.pyx":1122
18750  *     return wrap
18751  *
18752  * cdef object py_from_lua(LuaRuntime runtime, lua_State *L, int n):             # <<<<<<<<<<<<<<
18753  *     """
18754  *     Convert a Lua object to a Python object by either mapping, wrapping
18755  */
18756 
__pyx_f_4lupa_5_lupa_py_from_lua(struct __pyx_obj_4lupa_5_lupa_LuaRuntime * __pyx_v_runtime,lua_State * __pyx_v_L,int __pyx_v_n)18757 static PyObject *__pyx_f_4lupa_5_lupa_py_from_lua(struct __pyx_obj_4lupa_5_lupa_LuaRuntime *__pyx_v_runtime, lua_State *__pyx_v_L, int __pyx_v_n) {
18758   size_t __pyx_v_size;
18759   char const *__pyx_v_s;
18760   lua_Number __pyx_v_number;
18761   struct __pyx_t_4lupa_5_lupa_py_object *__pyx_v_py_obj;
18762   int __pyx_v_lua_type;
18763   PyObject *__pyx_r = NULL;
18764   __Pyx_RefNannyDeclarations
18765   int __pyx_t_1;
18766   PyObject *__pyx_t_2 = NULL;
18767   int __pyx_t_3;
18768   char const *__pyx_t_4;
18769   int __pyx_lineno = 0;
18770   const char *__pyx_filename = NULL;
18771   int __pyx_clineno = 0;
18772   __Pyx_RefNannySetupContext("py_from_lua", 0);
18773 
18774   /* "lupa/_lupa.pyx":1127
18775  *     or unwrapping it.
18776  *     """
18777  *     cdef size_t size = 0             # <<<<<<<<<<<<<<
18778  *     cdef const char *s
18779  *     cdef lua.lua_Number number
18780  */
18781   __pyx_v_size = 0;
18782 
18783   /* "lupa/_lupa.pyx":1131
18784  *     cdef lua.lua_Number number
18785  *     cdef py_object* py_obj
18786  *     cdef int lua_type = lua.lua_type(L, n)             # <<<<<<<<<<<<<<
18787  *
18788  *     if lua_type == lua.LUA_TNIL:
18789  */
18790   __pyx_v_lua_type = lua_type(__pyx_v_L, __pyx_v_n);
18791 
18792   /* "lupa/_lupa.pyx":1133
18793  *     cdef int lua_type = lua.lua_type(L, n)
18794  *
18795  *     if lua_type == lua.LUA_TNIL:             # <<<<<<<<<<<<<<
18796  *         return None
18797  *     elif lua_type == lua.LUA_TNUMBER:
18798  */
18799   switch (__pyx_v_lua_type) {
18800     case LUA_TNIL:
18801 
18802     /* "lupa/_lupa.pyx":1134
18803  *
18804  *     if lua_type == lua.LUA_TNIL:
18805  *         return None             # <<<<<<<<<<<<<<
18806  *     elif lua_type == lua.LUA_TNUMBER:
18807  *         number = lua.lua_tonumber(L, n)
18808  */
18809     __Pyx_XDECREF(__pyx_r);
18810     __pyx_r = Py_None; __Pyx_INCREF(Py_None);
18811     goto __pyx_L0;
18812 
18813     /* "lupa/_lupa.pyx":1133
18814  *     cdef int lua_type = lua.lua_type(L, n)
18815  *
18816  *     if lua_type == lua.LUA_TNIL:             # <<<<<<<<<<<<<<
18817  *         return None
18818  *     elif lua_type == lua.LUA_TNUMBER:
18819  */
18820     break;
18821     case LUA_TNUMBER:
18822 
18823     /* "lupa/_lupa.pyx":1136
18824  *         return None
18825  *     elif lua_type == lua.LUA_TNUMBER:
18826  *         number = lua.lua_tonumber(L, n)             # <<<<<<<<<<<<<<
18827  *         if number != <long>number:
18828  *             return <double>number
18829  */
18830     __pyx_v_number = lua_tonumber(__pyx_v_L, __pyx_v_n);
18831 
18832     /* "lupa/_lupa.pyx":1137
18833  *     elif lua_type == lua.LUA_TNUMBER:
18834  *         number = lua.lua_tonumber(L, n)
18835  *         if number != <long>number:             # <<<<<<<<<<<<<<
18836  *             return <double>number
18837  *         else:
18838  */
18839     __pyx_t_1 = ((__pyx_v_number != ((long)__pyx_v_number)) != 0);
18840     if (__pyx_t_1) {
18841 
18842       /* "lupa/_lupa.pyx":1138
18843  *         number = lua.lua_tonumber(L, n)
18844  *         if number != <long>number:
18845  *             return <double>number             # <<<<<<<<<<<<<<
18846  *         else:
18847  *             return <long>number
18848  */
18849       __Pyx_XDECREF(__pyx_r);
18850       __pyx_t_2 = PyFloat_FromDouble(((double)__pyx_v_number)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1138, __pyx_L1_error)
18851       __Pyx_GOTREF(__pyx_t_2);
18852       __pyx_r = __pyx_t_2;
18853       __pyx_t_2 = 0;
18854       goto __pyx_L0;
18855 
18856       /* "lupa/_lupa.pyx":1137
18857  *     elif lua_type == lua.LUA_TNUMBER:
18858  *         number = lua.lua_tonumber(L, n)
18859  *         if number != <long>number:             # <<<<<<<<<<<<<<
18860  *             return <double>number
18861  *         else:
18862  */
18863     }
18864 
18865     /* "lupa/_lupa.pyx":1140
18866  *             return <double>number
18867  *         else:
18868  *             return <long>number             # <<<<<<<<<<<<<<
18869  *     elif lua_type == lua.LUA_TSTRING:
18870  *         s = lua.lua_tolstring(L, n, &size)
18871  */
18872     /*else*/ {
18873       __Pyx_XDECREF(__pyx_r);
18874       __pyx_t_2 = __Pyx_PyInt_From_long(((long)__pyx_v_number)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1140, __pyx_L1_error)
18875       __Pyx_GOTREF(__pyx_t_2);
18876       __pyx_r = __pyx_t_2;
18877       __pyx_t_2 = 0;
18878       goto __pyx_L0;
18879     }
18880 
18881     /* "lupa/_lupa.pyx":1135
18882  *     if lua_type == lua.LUA_TNIL:
18883  *         return None
18884  *     elif lua_type == lua.LUA_TNUMBER:             # <<<<<<<<<<<<<<
18885  *         number = lua.lua_tonumber(L, n)
18886  *         if number != <long>number:
18887  */
18888     break;
18889     case LUA_TSTRING:
18890 
18891     /* "lupa/_lupa.pyx":1142
18892  *             return <long>number
18893  *     elif lua_type == lua.LUA_TSTRING:
18894  *         s = lua.lua_tolstring(L, n, &size)             # <<<<<<<<<<<<<<
18895  *         if runtime._encoding is not None:
18896  *             return s[:size].decode(runtime._encoding)
18897  */
18898     __pyx_v_s = lua_tolstring(__pyx_v_L, __pyx_v_n, (&__pyx_v_size));
18899 
18900     /* "lupa/_lupa.pyx":1143
18901  *     elif lua_type == lua.LUA_TSTRING:
18902  *         s = lua.lua_tolstring(L, n, &size)
18903  *         if runtime._encoding is not None:             # <<<<<<<<<<<<<<
18904  *             return s[:size].decode(runtime._encoding)
18905  *         else:
18906  */
18907     __pyx_t_1 = (__pyx_v_runtime->_encoding != ((PyObject*)Py_None));
18908     __pyx_t_3 = (__pyx_t_1 != 0);
18909     if (__pyx_t_3) {
18910 
18911       /* "lupa/_lupa.pyx":1144
18912  *         s = lua.lua_tolstring(L, n, &size)
18913  *         if runtime._encoding is not None:
18914  *             return s[:size].decode(runtime._encoding)             # <<<<<<<<<<<<<<
18915  *         else:
18916  *             return s[:size]
18917  */
18918       __Pyx_XDECREF(__pyx_r);
18919       if (unlikely(__pyx_v_runtime->_encoding == Py_None)) {
18920         PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
18921         __PYX_ERR(0, 1144, __pyx_L1_error)
18922       }
18923       __pyx_t_4 = __Pyx_PyBytes_AsString(__pyx_v_runtime->_encoding); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 1144, __pyx_L1_error)
18924       __pyx_t_2 = __Pyx_decode_c_string(__pyx_v_s, 0, __pyx_v_size, __pyx_t_4, NULL, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1144, __pyx_L1_error)
18925       __Pyx_GOTREF(__pyx_t_2);
18926       __pyx_r = __pyx_t_2;
18927       __pyx_t_2 = 0;
18928       goto __pyx_L0;
18929 
18930       /* "lupa/_lupa.pyx":1143
18931  *     elif lua_type == lua.LUA_TSTRING:
18932  *         s = lua.lua_tolstring(L, n, &size)
18933  *         if runtime._encoding is not None:             # <<<<<<<<<<<<<<
18934  *             return s[:size].decode(runtime._encoding)
18935  *         else:
18936  */
18937     }
18938 
18939     /* "lupa/_lupa.pyx":1146
18940  *             return s[:size].decode(runtime._encoding)
18941  *         else:
18942  *             return s[:size]             # <<<<<<<<<<<<<<
18943  *     elif lua_type == lua.LUA_TBOOLEAN:
18944  *         return lua.lua_toboolean(L, n)
18945  */
18946     /*else*/ {
18947       __Pyx_XDECREF(__pyx_r);
18948       __pyx_t_2 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_s + 0, __pyx_v_size - 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1146, __pyx_L1_error)
18949       __Pyx_GOTREF(__pyx_t_2);
18950       __pyx_r = __pyx_t_2;
18951       __pyx_t_2 = 0;
18952       goto __pyx_L0;
18953     }
18954 
18955     /* "lupa/_lupa.pyx":1141
18956  *         else:
18957  *             return <long>number
18958  *     elif lua_type == lua.LUA_TSTRING:             # <<<<<<<<<<<<<<
18959  *         s = lua.lua_tolstring(L, n, &size)
18960  *         if runtime._encoding is not None:
18961  */
18962     break;
18963     case LUA_TBOOLEAN:
18964 
18965     /* "lupa/_lupa.pyx":1148
18966  *             return s[:size]
18967  *     elif lua_type == lua.LUA_TBOOLEAN:
18968  *         return lua.lua_toboolean(L, n)             # <<<<<<<<<<<<<<
18969  *     elif lua_type == lua.LUA_TUSERDATA:
18970  *         py_obj = unpack_userdata(L, n)
18971  */
18972     __Pyx_XDECREF(__pyx_r);
18973     __pyx_t_2 = __Pyx_PyBool_FromLong(lua_toboolean(__pyx_v_L, __pyx_v_n)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1148, __pyx_L1_error)
18974     __Pyx_GOTREF(__pyx_t_2);
18975     __pyx_r = __pyx_t_2;
18976     __pyx_t_2 = 0;
18977     goto __pyx_L0;
18978 
18979     /* "lupa/_lupa.pyx":1147
18980  *         else:
18981  *             return s[:size]
18982  *     elif lua_type == lua.LUA_TBOOLEAN:             # <<<<<<<<<<<<<<
18983  *         return lua.lua_toboolean(L, n)
18984  *     elif lua_type == lua.LUA_TUSERDATA:
18985  */
18986     break;
18987     case LUA_TUSERDATA:
18988 
18989     /* "lupa/_lupa.pyx":1150
18990  *         return lua.lua_toboolean(L, n)
18991  *     elif lua_type == lua.LUA_TUSERDATA:
18992  *         py_obj = unpack_userdata(L, n)             # <<<<<<<<<<<<<<
18993  *         if py_obj:
18994  *             return <object>py_obj.obj
18995  */
18996     __pyx_v_py_obj = __pyx_f_4lupa_5_lupa_unpack_userdata(__pyx_v_L, __pyx_v_n);
18997 
18998     /* "lupa/_lupa.pyx":1151
18999  *     elif lua_type == lua.LUA_TUSERDATA:
19000  *         py_obj = unpack_userdata(L, n)
19001  *         if py_obj:             # <<<<<<<<<<<<<<
19002  *             return <object>py_obj.obj
19003  *     elif lua_type == lua.LUA_TTABLE:
19004  */
19005     __pyx_t_3 = (__pyx_v_py_obj != 0);
19006     if (__pyx_t_3) {
19007 
19008       /* "lupa/_lupa.pyx":1152
19009  *         py_obj = unpack_userdata(L, n)
19010  *         if py_obj:
19011  *             return <object>py_obj.obj             # <<<<<<<<<<<<<<
19012  *     elif lua_type == lua.LUA_TTABLE:
19013  *         return new_lua_table(runtime, L, n)
19014  */
19015       __Pyx_XDECREF(__pyx_r);
19016       __Pyx_INCREF(((PyObject *)__pyx_v_py_obj->obj));
19017       __pyx_r = ((PyObject *)__pyx_v_py_obj->obj);
19018       goto __pyx_L0;
19019 
19020       /* "lupa/_lupa.pyx":1151
19021  *     elif lua_type == lua.LUA_TUSERDATA:
19022  *         py_obj = unpack_userdata(L, n)
19023  *         if py_obj:             # <<<<<<<<<<<<<<
19024  *             return <object>py_obj.obj
19025  *     elif lua_type == lua.LUA_TTABLE:
19026  */
19027     }
19028 
19029     /* "lupa/_lupa.pyx":1149
19030  *     elif lua_type == lua.LUA_TBOOLEAN:
19031  *         return lua.lua_toboolean(L, n)
19032  *     elif lua_type == lua.LUA_TUSERDATA:             # <<<<<<<<<<<<<<
19033  *         py_obj = unpack_userdata(L, n)
19034  *         if py_obj:
19035  */
19036     break;
19037     case LUA_TTABLE:
19038 
19039     /* "lupa/_lupa.pyx":1154
19040  *             return <object>py_obj.obj
19041  *     elif lua_type == lua.LUA_TTABLE:
19042  *         return new_lua_table(runtime, L, n)             # <<<<<<<<<<<<<<
19043  *     elif lua_type == lua.LUA_TTHREAD:
19044  *         return new_lua_thread_or_function(runtime, L, n)
19045  */
19046     __Pyx_XDECREF(__pyx_r);
19047     __pyx_t_2 = ((PyObject *)__pyx_f_4lupa_5_lupa_new_lua_table(__pyx_v_runtime, __pyx_v_L, __pyx_v_n)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1154, __pyx_L1_error)
19048     __Pyx_GOTREF(__pyx_t_2);
19049     __pyx_r = __pyx_t_2;
19050     __pyx_t_2 = 0;
19051     goto __pyx_L0;
19052 
19053     /* "lupa/_lupa.pyx":1153
19054  *         if py_obj:
19055  *             return <object>py_obj.obj
19056  *     elif lua_type == lua.LUA_TTABLE:             # <<<<<<<<<<<<<<
19057  *         return new_lua_table(runtime, L, n)
19058  *     elif lua_type == lua.LUA_TTHREAD:
19059  */
19060     break;
19061     case LUA_TTHREAD:
19062 
19063     /* "lupa/_lupa.pyx":1156
19064  *         return new_lua_table(runtime, L, n)
19065  *     elif lua_type == lua.LUA_TTHREAD:
19066  *         return new_lua_thread_or_function(runtime, L, n)             # <<<<<<<<<<<<<<
19067  *     elif lua_type == lua.LUA_TFUNCTION:
19068  *         py_obj = unpack_wrapped_pyfunction(L, n)
19069  */
19070     __Pyx_XDECREF(__pyx_r);
19071     __pyx_t_2 = ((PyObject *)__pyx_f_4lupa_5_lupa_new_lua_thread_or_function(__pyx_v_runtime, __pyx_v_L, __pyx_v_n)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1156, __pyx_L1_error)
19072     __Pyx_GOTREF(__pyx_t_2);
19073     __pyx_r = __pyx_t_2;
19074     __pyx_t_2 = 0;
19075     goto __pyx_L0;
19076 
19077     /* "lupa/_lupa.pyx":1155
19078  *     elif lua_type == lua.LUA_TTABLE:
19079  *         return new_lua_table(runtime, L, n)
19080  *     elif lua_type == lua.LUA_TTHREAD:             # <<<<<<<<<<<<<<
19081  *         return new_lua_thread_or_function(runtime, L, n)
19082  *     elif lua_type == lua.LUA_TFUNCTION:
19083  */
19084     break;
19085     case LUA_TFUNCTION:
19086 
19087     /* "lupa/_lupa.pyx":1158
19088  *         return new_lua_thread_or_function(runtime, L, n)
19089  *     elif lua_type == lua.LUA_TFUNCTION:
19090  *         py_obj = unpack_wrapped_pyfunction(L, n)             # <<<<<<<<<<<<<<
19091  *         if py_obj:
19092  *             return <object>py_obj.obj
19093  */
19094     __pyx_v_py_obj = __pyx_f_4lupa_5_lupa_unpack_wrapped_pyfunction(__pyx_v_L, __pyx_v_n);
19095 
19096     /* "lupa/_lupa.pyx":1159
19097  *     elif lua_type == lua.LUA_TFUNCTION:
19098  *         py_obj = unpack_wrapped_pyfunction(L, n)
19099  *         if py_obj:             # <<<<<<<<<<<<<<
19100  *             return <object>py_obj.obj
19101  *         return new_lua_function(runtime, L, n)
19102  */
19103     __pyx_t_3 = (__pyx_v_py_obj != 0);
19104     if (__pyx_t_3) {
19105 
19106       /* "lupa/_lupa.pyx":1160
19107  *         py_obj = unpack_wrapped_pyfunction(L, n)
19108  *         if py_obj:
19109  *             return <object>py_obj.obj             # <<<<<<<<<<<<<<
19110  *         return new_lua_function(runtime, L, n)
19111  *     return new_lua_object(runtime, L, n)
19112  */
19113       __Pyx_XDECREF(__pyx_r);
19114       __Pyx_INCREF(((PyObject *)__pyx_v_py_obj->obj));
19115       __pyx_r = ((PyObject *)__pyx_v_py_obj->obj);
19116       goto __pyx_L0;
19117 
19118       /* "lupa/_lupa.pyx":1159
19119  *     elif lua_type == lua.LUA_TFUNCTION:
19120  *         py_obj = unpack_wrapped_pyfunction(L, n)
19121  *         if py_obj:             # <<<<<<<<<<<<<<
19122  *             return <object>py_obj.obj
19123  *         return new_lua_function(runtime, L, n)
19124  */
19125     }
19126 
19127     /* "lupa/_lupa.pyx":1161
19128  *         if py_obj:
19129  *             return <object>py_obj.obj
19130  *         return new_lua_function(runtime, L, n)             # <<<<<<<<<<<<<<
19131  *     return new_lua_object(runtime, L, n)
19132  *
19133  */
19134     __Pyx_XDECREF(__pyx_r);
19135     __pyx_t_2 = ((PyObject *)__pyx_f_4lupa_5_lupa_new_lua_function(__pyx_v_runtime, __pyx_v_L, __pyx_v_n)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1161, __pyx_L1_error)
19136     __Pyx_GOTREF(__pyx_t_2);
19137     __pyx_r = __pyx_t_2;
19138     __pyx_t_2 = 0;
19139     goto __pyx_L0;
19140 
19141     /* "lupa/_lupa.pyx":1157
19142  *     elif lua_type == lua.LUA_TTHREAD:
19143  *         return new_lua_thread_or_function(runtime, L, n)
19144  *     elif lua_type == lua.LUA_TFUNCTION:             # <<<<<<<<<<<<<<
19145  *         py_obj = unpack_wrapped_pyfunction(L, n)
19146  *         if py_obj:
19147  */
19148     break;
19149     default: break;
19150   }
19151 
19152   /* "lupa/_lupa.pyx":1162
19153  *             return <object>py_obj.obj
19154  *         return new_lua_function(runtime, L, n)
19155  *     return new_lua_object(runtime, L, n)             # <<<<<<<<<<<<<<
19156  *
19157  * cdef py_object* unpack_userdata(lua_State *L, int n) nogil:
19158  */
19159   __Pyx_XDECREF(__pyx_r);
19160   __pyx_t_2 = ((PyObject *)__pyx_f_4lupa_5_lupa_new_lua_object(__pyx_v_runtime, __pyx_v_L, __pyx_v_n)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1162, __pyx_L1_error)
19161   __Pyx_GOTREF(__pyx_t_2);
19162   __pyx_r = __pyx_t_2;
19163   __pyx_t_2 = 0;
19164   goto __pyx_L0;
19165 
19166   /* "lupa/_lupa.pyx":1122
19167  *     return wrap
19168  *
19169  * cdef object py_from_lua(LuaRuntime runtime, lua_State *L, int n):             # <<<<<<<<<<<<<<
19170  *     """
19171  *     Convert a Lua object to a Python object by either mapping, wrapping
19172  */
19173 
19174   /* function exit code */
19175   __pyx_L1_error:;
19176   __Pyx_XDECREF(__pyx_t_2);
19177   __Pyx_AddTraceback("lupa._lupa.py_from_lua", __pyx_clineno, __pyx_lineno, __pyx_filename);
19178   __pyx_r = 0;
19179   __pyx_L0:;
19180   __Pyx_XGIVEREF(__pyx_r);
19181   __Pyx_RefNannyFinishContext();
19182   return __pyx_r;
19183 }
19184 
19185 /* "lupa/_lupa.pyx":1164
19186  *     return new_lua_object(runtime, L, n)
19187  *
19188  * cdef py_object* unpack_userdata(lua_State *L, int n) nogil:             # <<<<<<<<<<<<<<
19189  *     """
19190  *     Like luaL_checkudata(), unpacks a userdata object and validates that
19191  */
19192 
__pyx_f_4lupa_5_lupa_unpack_userdata(lua_State * __pyx_v_L,int __pyx_v_n)19193 static struct __pyx_t_4lupa_5_lupa_py_object *__pyx_f_4lupa_5_lupa_unpack_userdata(lua_State *__pyx_v_L, int __pyx_v_n) {
19194   void *__pyx_v_p;
19195   struct __pyx_t_4lupa_5_lupa_py_object *__pyx_r;
19196   int __pyx_t_1;
19197   int __pyx_t_2;
19198 
19199   /* "lupa/_lupa.pyx":1169
19200  *     it's a wrapped Python object.  Returns NULL on failure.
19201  *     """
19202  *     p = lua.lua_touserdata(L, n)             # <<<<<<<<<<<<<<
19203  *     if p and lua.lua_getmetatable(L, n):
19204  *         # found userdata with metatable - the one we expect?
19205  */
19206   __pyx_v_p = lua_touserdata(__pyx_v_L, __pyx_v_n);
19207 
19208   /* "lupa/_lupa.pyx":1170
19209  *     """
19210  *     p = lua.lua_touserdata(L, n)
19211  *     if p and lua.lua_getmetatable(L, n):             # <<<<<<<<<<<<<<
19212  *         # found userdata with metatable - the one we expect?
19213  *         lua.luaL_getmetatable(L, POBJECT)
19214  */
19215   __pyx_t_2 = (__pyx_v_p != 0);
19216   if (__pyx_t_2) {
19217   } else {
19218     __pyx_t_1 = __pyx_t_2;
19219     goto __pyx_L4_bool_binop_done;
19220   }
19221   __pyx_t_2 = (lua_getmetatable(__pyx_v_L, __pyx_v_n) != 0);
19222   __pyx_t_1 = __pyx_t_2;
19223   __pyx_L4_bool_binop_done:;
19224   if (__pyx_t_1) {
19225 
19226     /* "lupa/_lupa.pyx":1172
19227  *     if p and lua.lua_getmetatable(L, n):
19228  *         # found userdata with metatable - the one we expect?
19229  *         lua.luaL_getmetatable(L, POBJECT)             # <<<<<<<<<<<<<<
19230  *         if lua.lua_rawequal(L, -1, -2):
19231  *             lua.lua_pop(L, 2)
19232  */
19233     luaL_getmetatable(__pyx_v_L, ((char *)"POBJECT"));
19234 
19235     /* "lupa/_lupa.pyx":1173
19236  *         # found userdata with metatable - the one we expect?
19237  *         lua.luaL_getmetatable(L, POBJECT)
19238  *         if lua.lua_rawequal(L, -1, -2):             # <<<<<<<<<<<<<<
19239  *             lua.lua_pop(L, 2)
19240  *             return <py_object*>p
19241  */
19242     __pyx_t_1 = (lua_rawequal(__pyx_v_L, -1, -2) != 0);
19243     if (__pyx_t_1) {
19244 
19245       /* "lupa/_lupa.pyx":1174
19246  *         lua.luaL_getmetatable(L, POBJECT)
19247  *         if lua.lua_rawequal(L, -1, -2):
19248  *             lua.lua_pop(L, 2)             # <<<<<<<<<<<<<<
19249  *             return <py_object*>p
19250  *         lua.lua_pop(L, 2)
19251  */
19252       lua_pop(__pyx_v_L, 2);
19253 
19254       /* "lupa/_lupa.pyx":1175
19255  *         if lua.lua_rawequal(L, -1, -2):
19256  *             lua.lua_pop(L, 2)
19257  *             return <py_object*>p             # <<<<<<<<<<<<<<
19258  *         lua.lua_pop(L, 2)
19259  *     return NULL
19260  */
19261       __pyx_r = ((struct __pyx_t_4lupa_5_lupa_py_object *)__pyx_v_p);
19262       goto __pyx_L0;
19263 
19264       /* "lupa/_lupa.pyx":1173
19265  *         # found userdata with metatable - the one we expect?
19266  *         lua.luaL_getmetatable(L, POBJECT)
19267  *         if lua.lua_rawequal(L, -1, -2):             # <<<<<<<<<<<<<<
19268  *             lua.lua_pop(L, 2)
19269  *             return <py_object*>p
19270  */
19271     }
19272 
19273     /* "lupa/_lupa.pyx":1176
19274  *             lua.lua_pop(L, 2)
19275  *             return <py_object*>p
19276  *         lua.lua_pop(L, 2)             # <<<<<<<<<<<<<<
19277  *     return NULL
19278  *
19279  */
19280     lua_pop(__pyx_v_L, 2);
19281 
19282     /* "lupa/_lupa.pyx":1170
19283  *     """
19284  *     p = lua.lua_touserdata(L, n)
19285  *     if p and lua.lua_getmetatable(L, n):             # <<<<<<<<<<<<<<
19286  *         # found userdata with metatable - the one we expect?
19287  *         lua.luaL_getmetatable(L, POBJECT)
19288  */
19289   }
19290 
19291   /* "lupa/_lupa.pyx":1177
19292  *             return <py_object*>p
19293  *         lua.lua_pop(L, 2)
19294  *     return NULL             # <<<<<<<<<<<<<<
19295  *
19296  * cdef int py_function_result_to_lua(LuaRuntime runtime, lua_State *L, object o) except -1:
19297  */
19298   __pyx_r = NULL;
19299   goto __pyx_L0;
19300 
19301   /* "lupa/_lupa.pyx":1164
19302  *     return new_lua_object(runtime, L, n)
19303  *
19304  * cdef py_object* unpack_userdata(lua_State *L, int n) nogil:             # <<<<<<<<<<<<<<
19305  *     """
19306  *     Like luaL_checkudata(), unpacks a userdata object and validates that
19307  */
19308 
19309   /* function exit code */
19310   __pyx_L0:;
19311   return __pyx_r;
19312 }
19313 
19314 /* "lupa/_lupa.pyx":1179
19315  *     return NULL
19316  *
19317  * cdef int py_function_result_to_lua(LuaRuntime runtime, lua_State *L, object o) except -1:             # <<<<<<<<<<<<<<
19318  *      if runtime._unpack_returned_tuples and isinstance(o, tuple):
19319  *          push_lua_arguments(runtime, L, <tuple>o)
19320  */
19321 
__pyx_f_4lupa_5_lupa_py_function_result_to_lua(struct __pyx_obj_4lupa_5_lupa_LuaRuntime * __pyx_v_runtime,lua_State * __pyx_v_L,PyObject * __pyx_v_o)19322 static int __pyx_f_4lupa_5_lupa_py_function_result_to_lua(struct __pyx_obj_4lupa_5_lupa_LuaRuntime *__pyx_v_runtime, lua_State *__pyx_v_L, PyObject *__pyx_v_o) {
19323   int __pyx_r;
19324   __Pyx_RefNannyDeclarations
19325   int __pyx_t_1;
19326   int __pyx_t_2;
19327   int __pyx_t_3;
19328   int __pyx_t_4;
19329   Py_ssize_t __pyx_t_5;
19330   int __pyx_lineno = 0;
19331   const char *__pyx_filename = NULL;
19332   int __pyx_clineno = 0;
19333   __Pyx_RefNannySetupContext("py_function_result_to_lua", 0);
19334 
19335   /* "lupa/_lupa.pyx":1180
19336  *
19337  * cdef int py_function_result_to_lua(LuaRuntime runtime, lua_State *L, object o) except -1:
19338  *      if runtime._unpack_returned_tuples and isinstance(o, tuple):             # <<<<<<<<<<<<<<
19339  *          push_lua_arguments(runtime, L, <tuple>o)
19340  *          return len(<tuple>o)
19341  */
19342   __pyx_t_2 = (__pyx_v_runtime->_unpack_returned_tuples != 0);
19343   if (__pyx_t_2) {
19344   } else {
19345     __pyx_t_1 = __pyx_t_2;
19346     goto __pyx_L4_bool_binop_done;
19347   }
19348   __pyx_t_2 = PyTuple_Check(__pyx_v_o);
19349   __pyx_t_3 = (__pyx_t_2 != 0);
19350   __pyx_t_1 = __pyx_t_3;
19351   __pyx_L4_bool_binop_done:;
19352   if (__pyx_t_1) {
19353 
19354     /* "lupa/_lupa.pyx":1181
19355  * cdef int py_function_result_to_lua(LuaRuntime runtime, lua_State *L, object o) except -1:
19356  *      if runtime._unpack_returned_tuples and isinstance(o, tuple):
19357  *          push_lua_arguments(runtime, L, <tuple>o)             # <<<<<<<<<<<<<<
19358  *          return len(<tuple>o)
19359  *      return py_to_lua(runtime, L, o)
19360  */
19361     __pyx_t_4 = __pyx_f_4lupa_5_lupa_push_lua_arguments(__pyx_v_runtime, __pyx_v_L, ((PyObject*)__pyx_v_o), NULL); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 1181, __pyx_L1_error)
19362 
19363     /* "lupa/_lupa.pyx":1182
19364  *      if runtime._unpack_returned_tuples and isinstance(o, tuple):
19365  *          push_lua_arguments(runtime, L, <tuple>o)
19366  *          return len(<tuple>o)             # <<<<<<<<<<<<<<
19367  *      return py_to_lua(runtime, L, o)
19368  *
19369  */
19370     if (unlikely(__pyx_v_o == Py_None)) {
19371       PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
19372       __PYX_ERR(0, 1182, __pyx_L1_error)
19373     }
19374     __pyx_t_5 = PyTuple_GET_SIZE(((PyObject*)__pyx_v_o)); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1182, __pyx_L1_error)
19375     __pyx_r = __pyx_t_5;
19376     goto __pyx_L0;
19377 
19378     /* "lupa/_lupa.pyx":1180
19379  *
19380  * cdef int py_function_result_to_lua(LuaRuntime runtime, lua_State *L, object o) except -1:
19381  *      if runtime._unpack_returned_tuples and isinstance(o, tuple):             # <<<<<<<<<<<<<<
19382  *          push_lua_arguments(runtime, L, <tuple>o)
19383  *          return len(<tuple>o)
19384  */
19385   }
19386 
19387   /* "lupa/_lupa.pyx":1183
19388  *          push_lua_arguments(runtime, L, <tuple>o)
19389  *          return len(<tuple>o)
19390  *      return py_to_lua(runtime, L, o)             # <<<<<<<<<<<<<<
19391  *
19392  * cdef int py_to_lua(LuaRuntime runtime, lua_State *L, object o, bint wrap_none=False) except -1:
19393  */
19394   __pyx_t_4 = __pyx_f_4lupa_5_lupa_py_to_lua(__pyx_v_runtime, __pyx_v_L, __pyx_v_o, NULL); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 1183, __pyx_L1_error)
19395   __pyx_r = __pyx_t_4;
19396   goto __pyx_L0;
19397 
19398   /* "lupa/_lupa.pyx":1179
19399  *     return NULL
19400  *
19401  * cdef int py_function_result_to_lua(LuaRuntime runtime, lua_State *L, object o) except -1:             # <<<<<<<<<<<<<<
19402  *      if runtime._unpack_returned_tuples and isinstance(o, tuple):
19403  *          push_lua_arguments(runtime, L, <tuple>o)
19404  */
19405 
19406   /* function exit code */
19407   __pyx_L1_error:;
19408   __Pyx_AddTraceback("lupa._lupa.py_function_result_to_lua", __pyx_clineno, __pyx_lineno, __pyx_filename);
19409   __pyx_r = -1;
19410   __pyx_L0:;
19411   __Pyx_RefNannyFinishContext();
19412   return __pyx_r;
19413 }
19414 
19415 /* "lupa/_lupa.pyx":1185
19416  *      return py_to_lua(runtime, L, o)
19417  *
19418  * cdef int py_to_lua(LuaRuntime runtime, lua_State *L, object o, bint wrap_none=False) except -1:             # <<<<<<<<<<<<<<
19419  *     cdef int pushed_values_count = 0
19420  *     cdef int type_flags = 0
19421  */
19422 
__pyx_f_4lupa_5_lupa_py_to_lua(struct __pyx_obj_4lupa_5_lupa_LuaRuntime * __pyx_v_runtime,lua_State * __pyx_v_L,PyObject * __pyx_v_o,struct __pyx_opt_args_4lupa_5_lupa_py_to_lua * __pyx_optional_args)19423 static int __pyx_f_4lupa_5_lupa_py_to_lua(struct __pyx_obj_4lupa_5_lupa_LuaRuntime *__pyx_v_runtime, lua_State *__pyx_v_L, PyObject *__pyx_v_o, struct __pyx_opt_args_4lupa_5_lupa_py_to_lua *__pyx_optional_args) {
19424   int __pyx_v_wrap_none = ((int)0);
19425   int __pyx_v_pushed_values_count;
19426   int __pyx_v_type_flags;
19427   int __pyx_r;
19428   __Pyx_RefNannyDeclarations
19429   int __pyx_t_1;
19430   int __pyx_t_2;
19431   int __pyx_t_3;
19432   double __pyx_t_4;
19433   long __pyx_t_5;
19434   char *__pyx_t_6;
19435   Py_ssize_t __pyx_t_7;
19436   int __pyx_t_8;
19437   PyObject *__pyx_t_9 = NULL;
19438   PyObject *__pyx_t_10 = NULL;
19439   PyObject *__pyx_t_11 = NULL;
19440   int __pyx_lineno = 0;
19441   const char *__pyx_filename = NULL;
19442   int __pyx_clineno = 0;
19443   __Pyx_RefNannySetupContext("py_to_lua", 0);
19444   if (__pyx_optional_args) {
19445     if (__pyx_optional_args->__pyx_n > 0) {
19446       __pyx_v_wrap_none = __pyx_optional_args->wrap_none;
19447     }
19448   }
19449   __Pyx_INCREF(__pyx_v_o);
19450 
19451   /* "lupa/_lupa.pyx":1186
19452  *
19453  * cdef int py_to_lua(LuaRuntime runtime, lua_State *L, object o, bint wrap_none=False) except -1:
19454  *     cdef int pushed_values_count = 0             # <<<<<<<<<<<<<<
19455  *     cdef int type_flags = 0
19456  *
19457  */
19458   __pyx_v_pushed_values_count = 0;
19459 
19460   /* "lupa/_lupa.pyx":1187
19461  * cdef int py_to_lua(LuaRuntime runtime, lua_State *L, object o, bint wrap_none=False) except -1:
19462  *     cdef int pushed_values_count = 0
19463  *     cdef int type_flags = 0             # <<<<<<<<<<<<<<
19464  *
19465  *     if o is None:
19466  */
19467   __pyx_v_type_flags = 0;
19468 
19469   /* "lupa/_lupa.pyx":1189
19470  *     cdef int type_flags = 0
19471  *
19472  *     if o is None:             # <<<<<<<<<<<<<<
19473  *         if wrap_none:
19474  *             lua.lua_pushlstring(L, "Py_None", 7)
19475  */
19476   __pyx_t_1 = (__pyx_v_o == Py_None);
19477   __pyx_t_2 = (__pyx_t_1 != 0);
19478   if (__pyx_t_2) {
19479 
19480     /* "lupa/_lupa.pyx":1190
19481  *
19482  *     if o is None:
19483  *         if wrap_none:             # <<<<<<<<<<<<<<
19484  *             lua.lua_pushlstring(L, "Py_None", 7)
19485  *             lua.lua_rawget(L, lua.LUA_REGISTRYINDEX)
19486  */
19487     __pyx_t_2 = (__pyx_v_wrap_none != 0);
19488     if (__pyx_t_2) {
19489 
19490       /* "lupa/_lupa.pyx":1191
19491  *     if o is None:
19492  *         if wrap_none:
19493  *             lua.lua_pushlstring(L, "Py_None", 7)             # <<<<<<<<<<<<<<
19494  *             lua.lua_rawget(L, lua.LUA_REGISTRYINDEX)
19495  *             if lua.lua_isnil(L, -1):
19496  */
19497       lua_pushlstring(__pyx_v_L, ((char *)"Py_None"), 7);
19498 
19499       /* "lupa/_lupa.pyx":1192
19500  *         if wrap_none:
19501  *             lua.lua_pushlstring(L, "Py_None", 7)
19502  *             lua.lua_rawget(L, lua.LUA_REGISTRYINDEX)             # <<<<<<<<<<<<<<
19503  *             if lua.lua_isnil(L, -1):
19504  *                 lua.lua_pop(L, 1)
19505  */
19506       lua_rawget(__pyx_v_L, LUA_REGISTRYINDEX);
19507 
19508       /* "lupa/_lupa.pyx":1193
19509  *             lua.lua_pushlstring(L, "Py_None", 7)
19510  *             lua.lua_rawget(L, lua.LUA_REGISTRYINDEX)
19511  *             if lua.lua_isnil(L, -1):             # <<<<<<<<<<<<<<
19512  *                 lua.lua_pop(L, 1)
19513  *                 return 0
19514  */
19515       __pyx_t_2 = (lua_isnil(__pyx_v_L, -1) != 0);
19516       if (__pyx_t_2) {
19517 
19518         /* "lupa/_lupa.pyx":1194
19519  *             lua.lua_rawget(L, lua.LUA_REGISTRYINDEX)
19520  *             if lua.lua_isnil(L, -1):
19521  *                 lua.lua_pop(L, 1)             # <<<<<<<<<<<<<<
19522  *                 return 0
19523  *             pushed_values_count = 1
19524  */
19525         lua_pop(__pyx_v_L, 1);
19526 
19527         /* "lupa/_lupa.pyx":1195
19528  *             if lua.lua_isnil(L, -1):
19529  *                 lua.lua_pop(L, 1)
19530  *                 return 0             # <<<<<<<<<<<<<<
19531  *             pushed_values_count = 1
19532  *         else:
19533  */
19534         __pyx_r = 0;
19535         goto __pyx_L0;
19536 
19537         /* "lupa/_lupa.pyx":1193
19538  *             lua.lua_pushlstring(L, "Py_None", 7)
19539  *             lua.lua_rawget(L, lua.LUA_REGISTRYINDEX)
19540  *             if lua.lua_isnil(L, -1):             # <<<<<<<<<<<<<<
19541  *                 lua.lua_pop(L, 1)
19542  *                 return 0
19543  */
19544       }
19545 
19546       /* "lupa/_lupa.pyx":1196
19547  *                 lua.lua_pop(L, 1)
19548  *                 return 0
19549  *             pushed_values_count = 1             # <<<<<<<<<<<<<<
19550  *         else:
19551  *             # Not really needed, but this way we may check for errors
19552  */
19553       __pyx_v_pushed_values_count = 1;
19554 
19555       /* "lupa/_lupa.pyx":1190
19556  *
19557  *     if o is None:
19558  *         if wrap_none:             # <<<<<<<<<<<<<<
19559  *             lua.lua_pushlstring(L, "Py_None", 7)
19560  *             lua.lua_rawget(L, lua.LUA_REGISTRYINDEX)
19561  */
19562       goto __pyx_L4;
19563     }
19564 
19565     /* "lupa/_lupa.pyx":1200
19566  *             # Not really needed, but this way we may check for errors
19567  *             # with pushed_values_count == 0.
19568  *             lua.lua_pushnil(L)             # <<<<<<<<<<<<<<
19569  *             pushed_values_count = 1
19570  *     elif o is True or o is False:
19571  */
19572     /*else*/ {
19573       lua_pushnil(__pyx_v_L);
19574 
19575       /* "lupa/_lupa.pyx":1201
19576  *             # with pushed_values_count == 0.
19577  *             lua.lua_pushnil(L)
19578  *             pushed_values_count = 1             # <<<<<<<<<<<<<<
19579  *     elif o is True or o is False:
19580  *         lua.lua_pushboolean(L, <bint>o)
19581  */
19582       __pyx_v_pushed_values_count = 1;
19583     }
19584     __pyx_L4:;
19585 
19586     /* "lupa/_lupa.pyx":1189
19587  *     cdef int type_flags = 0
19588  *
19589  *     if o is None:             # <<<<<<<<<<<<<<
19590  *         if wrap_none:
19591  *             lua.lua_pushlstring(L, "Py_None", 7)
19592  */
19593     goto __pyx_L3;
19594   }
19595 
19596   /* "lupa/_lupa.pyx":1202
19597  *             lua.lua_pushnil(L)
19598  *             pushed_values_count = 1
19599  *     elif o is True or o is False:             # <<<<<<<<<<<<<<
19600  *         lua.lua_pushboolean(L, <bint>o)
19601  *         pushed_values_count = 1
19602  */
19603   __pyx_t_1 = (__pyx_v_o == Py_True);
19604   __pyx_t_3 = (__pyx_t_1 != 0);
19605   if (!__pyx_t_3) {
19606   } else {
19607     __pyx_t_2 = __pyx_t_3;
19608     goto __pyx_L6_bool_binop_done;
19609   }
19610   __pyx_t_3 = (__pyx_v_o == Py_False);
19611   __pyx_t_1 = (__pyx_t_3 != 0);
19612   __pyx_t_2 = __pyx_t_1;
19613   __pyx_L6_bool_binop_done:;
19614   if (__pyx_t_2) {
19615 
19616     /* "lupa/_lupa.pyx":1203
19617  *             pushed_values_count = 1
19618  *     elif o is True or o is False:
19619  *         lua.lua_pushboolean(L, <bint>o)             # <<<<<<<<<<<<<<
19620  *         pushed_values_count = 1
19621  *     elif type(o) is float:
19622  */
19623     __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_o); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1203, __pyx_L1_error)
19624     lua_pushboolean(__pyx_v_L, __pyx_t_2);
19625 
19626     /* "lupa/_lupa.pyx":1204
19627  *     elif o is True or o is False:
19628  *         lua.lua_pushboolean(L, <bint>o)
19629  *         pushed_values_count = 1             # <<<<<<<<<<<<<<
19630  *     elif type(o) is float:
19631  *         lua.lua_pushnumber(L, <lua.lua_Number>cpython.float.PyFloat_AS_DOUBLE(o))
19632  */
19633     __pyx_v_pushed_values_count = 1;
19634 
19635     /* "lupa/_lupa.pyx":1202
19636  *             lua.lua_pushnil(L)
19637  *             pushed_values_count = 1
19638  *     elif o is True or o is False:             # <<<<<<<<<<<<<<
19639  *         lua.lua_pushboolean(L, <bint>o)
19640  *         pushed_values_count = 1
19641  */
19642     goto __pyx_L3;
19643   }
19644 
19645   /* "lupa/_lupa.pyx":1205
19646  *         lua.lua_pushboolean(L, <bint>o)
19647  *         pushed_values_count = 1
19648  *     elif type(o) is float:             # <<<<<<<<<<<<<<
19649  *         lua.lua_pushnumber(L, <lua.lua_Number>cpython.float.PyFloat_AS_DOUBLE(o))
19650  *         pushed_values_count = 1
19651  */
19652   __pyx_t_2 = (((PyObject *)Py_TYPE(__pyx_v_o)) == ((PyObject *)(&PyFloat_Type)));
19653   __pyx_t_1 = (__pyx_t_2 != 0);
19654   if (__pyx_t_1) {
19655 
19656     /* "lupa/_lupa.pyx":1206
19657  *         pushed_values_count = 1
19658  *     elif type(o) is float:
19659  *         lua.lua_pushnumber(L, <lua.lua_Number>cpython.float.PyFloat_AS_DOUBLE(o))             # <<<<<<<<<<<<<<
19660  *         pushed_values_count = 1
19661  *     elif isinstance(o, long):
19662  */
19663     lua_pushnumber(__pyx_v_L, ((lua_Number)PyFloat_AS_DOUBLE(__pyx_v_o)));
19664 
19665     /* "lupa/_lupa.pyx":1207
19666  *     elif type(o) is float:
19667  *         lua.lua_pushnumber(L, <lua.lua_Number>cpython.float.PyFloat_AS_DOUBLE(o))
19668  *         pushed_values_count = 1             # <<<<<<<<<<<<<<
19669  *     elif isinstance(o, long):
19670  *         lua.lua_pushnumber(L, <lua.lua_Number>cpython.long.PyLong_AsDouble(o))
19671  */
19672     __pyx_v_pushed_values_count = 1;
19673 
19674     /* "lupa/_lupa.pyx":1205
19675  *         lua.lua_pushboolean(L, <bint>o)
19676  *         pushed_values_count = 1
19677  *     elif type(o) is float:             # <<<<<<<<<<<<<<
19678  *         lua.lua_pushnumber(L, <lua.lua_Number>cpython.float.PyFloat_AS_DOUBLE(o))
19679  *         pushed_values_count = 1
19680  */
19681     goto __pyx_L3;
19682   }
19683 
19684   /* "lupa/_lupa.pyx":1208
19685  *         lua.lua_pushnumber(L, <lua.lua_Number>cpython.float.PyFloat_AS_DOUBLE(o))
19686  *         pushed_values_count = 1
19687  *     elif isinstance(o, long):             # <<<<<<<<<<<<<<
19688  *         lua.lua_pushnumber(L, <lua.lua_Number>cpython.long.PyLong_AsDouble(o))
19689  *         pushed_values_count = 1
19690  */
19691   __pyx_t_1 = PyLong_Check(__pyx_v_o);
19692   __pyx_t_2 = (__pyx_t_1 != 0);
19693   if (__pyx_t_2) {
19694 
19695     /* "lupa/_lupa.pyx":1209
19696  *         pushed_values_count = 1
19697  *     elif isinstance(o, long):
19698  *         lua.lua_pushnumber(L, <lua.lua_Number>cpython.long.PyLong_AsDouble(o))             # <<<<<<<<<<<<<<
19699  *         pushed_values_count = 1
19700  *     elif IS_PY2 and isinstance(o, int):
19701  */
19702     __pyx_t_4 = PyLong_AsDouble(__pyx_v_o); if (unlikely(__pyx_t_4 == ((double)(-1.0)) && PyErr_Occurred())) __PYX_ERR(0, 1209, __pyx_L1_error)
19703     lua_pushnumber(__pyx_v_L, ((lua_Number)__pyx_t_4));
19704 
19705     /* "lupa/_lupa.pyx":1210
19706  *     elif isinstance(o, long):
19707  *         lua.lua_pushnumber(L, <lua.lua_Number>cpython.long.PyLong_AsDouble(o))
19708  *         pushed_values_count = 1             # <<<<<<<<<<<<<<
19709  *     elif IS_PY2 and isinstance(o, int):
19710  *         lua.lua_pushnumber(L, <lua.lua_Number><long>o)
19711  */
19712     __pyx_v_pushed_values_count = 1;
19713 
19714     /* "lupa/_lupa.pyx":1208
19715  *         lua.lua_pushnumber(L, <lua.lua_Number>cpython.float.PyFloat_AS_DOUBLE(o))
19716  *         pushed_values_count = 1
19717  *     elif isinstance(o, long):             # <<<<<<<<<<<<<<
19718  *         lua.lua_pushnumber(L, <lua.lua_Number>cpython.long.PyLong_AsDouble(o))
19719  *         pushed_values_count = 1
19720  */
19721     goto __pyx_L3;
19722   }
19723 
19724   /* "lupa/_lupa.pyx":1211
19725  *         lua.lua_pushnumber(L, <lua.lua_Number>cpython.long.PyLong_AsDouble(o))
19726  *         pushed_values_count = 1
19727  *     elif IS_PY2 and isinstance(o, int):             # <<<<<<<<<<<<<<
19728  *         lua.lua_pushnumber(L, <lua.lua_Number><long>o)
19729  *         pushed_values_count = 1
19730  */
19731   __pyx_t_1 = (IS_PY2 != 0);
19732   if (__pyx_t_1) {
19733   } else {
19734     __pyx_t_2 = __pyx_t_1;
19735     goto __pyx_L8_bool_binop_done;
19736   }
19737   __pyx_t_1 = PyInt_Check(__pyx_v_o);
19738   __pyx_t_3 = (__pyx_t_1 != 0);
19739   __pyx_t_2 = __pyx_t_3;
19740   __pyx_L8_bool_binop_done:;
19741   if (__pyx_t_2) {
19742 
19743     /* "lupa/_lupa.pyx":1212
19744  *         pushed_values_count = 1
19745  *     elif IS_PY2 and isinstance(o, int):
19746  *         lua.lua_pushnumber(L, <lua.lua_Number><long>o)             # <<<<<<<<<<<<<<
19747  *         pushed_values_count = 1
19748  *     elif isinstance(o, bytes):
19749  */
19750     __pyx_t_5 = __Pyx_PyInt_As_long(__pyx_v_o); if (unlikely((__pyx_t_5 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 1212, __pyx_L1_error)
19751     lua_pushnumber(__pyx_v_L, ((lua_Number)((long)__pyx_t_5)));
19752 
19753     /* "lupa/_lupa.pyx":1213
19754  *     elif IS_PY2 and isinstance(o, int):
19755  *         lua.lua_pushnumber(L, <lua.lua_Number><long>o)
19756  *         pushed_values_count = 1             # <<<<<<<<<<<<<<
19757  *     elif isinstance(o, bytes):
19758  *         lua.lua_pushlstring(L, <char*>(<bytes>o), len(<bytes>o))
19759  */
19760     __pyx_v_pushed_values_count = 1;
19761 
19762     /* "lupa/_lupa.pyx":1211
19763  *         lua.lua_pushnumber(L, <lua.lua_Number>cpython.long.PyLong_AsDouble(o))
19764  *         pushed_values_count = 1
19765  *     elif IS_PY2 and isinstance(o, int):             # <<<<<<<<<<<<<<
19766  *         lua.lua_pushnumber(L, <lua.lua_Number><long>o)
19767  *         pushed_values_count = 1
19768  */
19769     goto __pyx_L3;
19770   }
19771 
19772   /* "lupa/_lupa.pyx":1214
19773  *         lua.lua_pushnumber(L, <lua.lua_Number><long>o)
19774  *         pushed_values_count = 1
19775  *     elif isinstance(o, bytes):             # <<<<<<<<<<<<<<
19776  *         lua.lua_pushlstring(L, <char*>(<bytes>o), len(<bytes>o))
19777  *         pushed_values_count = 1
19778  */
19779   __pyx_t_2 = PyBytes_Check(__pyx_v_o);
19780   __pyx_t_3 = (__pyx_t_2 != 0);
19781   if (__pyx_t_3) {
19782 
19783     /* "lupa/_lupa.pyx":1215
19784  *         pushed_values_count = 1
19785  *     elif isinstance(o, bytes):
19786  *         lua.lua_pushlstring(L, <char*>(<bytes>o), len(<bytes>o))             # <<<<<<<<<<<<<<
19787  *         pushed_values_count = 1
19788  *     elif isinstance(o, unicode) and runtime._encoding is not None:
19789  */
19790     if (unlikely(__pyx_v_o == Py_None)) {
19791       PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
19792       __PYX_ERR(0, 1215, __pyx_L1_error)
19793     }
19794     __pyx_t_6 = __Pyx_PyBytes_AsWritableString(__pyx_v_o); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) __PYX_ERR(0, 1215, __pyx_L1_error)
19795     if (unlikely(__pyx_v_o == Py_None)) {
19796       PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
19797       __PYX_ERR(0, 1215, __pyx_L1_error)
19798     }
19799     __pyx_t_7 = PyBytes_GET_SIZE(((PyObject*)__pyx_v_o)); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1215, __pyx_L1_error)
19800     lua_pushlstring(__pyx_v_L, ((char *)__pyx_t_6), __pyx_t_7);
19801 
19802     /* "lupa/_lupa.pyx":1216
19803  *     elif isinstance(o, bytes):
19804  *         lua.lua_pushlstring(L, <char*>(<bytes>o), len(<bytes>o))
19805  *         pushed_values_count = 1             # <<<<<<<<<<<<<<
19806  *     elif isinstance(o, unicode) and runtime._encoding is not None:
19807  *         pushed_values_count = push_encoded_unicode_string(runtime, L, <unicode>o)
19808  */
19809     __pyx_v_pushed_values_count = 1;
19810 
19811     /* "lupa/_lupa.pyx":1214
19812  *         lua.lua_pushnumber(L, <lua.lua_Number><long>o)
19813  *         pushed_values_count = 1
19814  *     elif isinstance(o, bytes):             # <<<<<<<<<<<<<<
19815  *         lua.lua_pushlstring(L, <char*>(<bytes>o), len(<bytes>o))
19816  *         pushed_values_count = 1
19817  */
19818     goto __pyx_L3;
19819   }
19820 
19821   /* "lupa/_lupa.pyx":1217
19822  *         lua.lua_pushlstring(L, <char*>(<bytes>o), len(<bytes>o))
19823  *         pushed_values_count = 1
19824  *     elif isinstance(o, unicode) and runtime._encoding is not None:             # <<<<<<<<<<<<<<
19825  *         pushed_values_count = push_encoded_unicode_string(runtime, L, <unicode>o)
19826  *     elif isinstance(o, _LuaObject):
19827  */
19828   __pyx_t_2 = PyUnicode_Check(__pyx_v_o);
19829   __pyx_t_1 = (__pyx_t_2 != 0);
19830   if (__pyx_t_1) {
19831   } else {
19832     __pyx_t_3 = __pyx_t_1;
19833     goto __pyx_L10_bool_binop_done;
19834   }
19835   __pyx_t_1 = (__pyx_v_runtime->_encoding != ((PyObject*)Py_None));
19836   __pyx_t_2 = (__pyx_t_1 != 0);
19837   __pyx_t_3 = __pyx_t_2;
19838   __pyx_L10_bool_binop_done:;
19839   if (__pyx_t_3) {
19840 
19841     /* "lupa/_lupa.pyx":1218
19842  *         pushed_values_count = 1
19843  *     elif isinstance(o, unicode) and runtime._encoding is not None:
19844  *         pushed_values_count = push_encoded_unicode_string(runtime, L, <unicode>o)             # <<<<<<<<<<<<<<
19845  *     elif isinstance(o, _LuaObject):
19846  *         if (<_LuaObject>o)._runtime is not runtime:
19847  */
19848     __pyx_t_8 = __pyx_f_4lupa_5_lupa_push_encoded_unicode_string(__pyx_v_runtime, __pyx_v_L, ((PyObject*)__pyx_v_o)); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 1218, __pyx_L1_error)
19849     __pyx_v_pushed_values_count = __pyx_t_8;
19850 
19851     /* "lupa/_lupa.pyx":1217
19852  *         lua.lua_pushlstring(L, <char*>(<bytes>o), len(<bytes>o))
19853  *         pushed_values_count = 1
19854  *     elif isinstance(o, unicode) and runtime._encoding is not None:             # <<<<<<<<<<<<<<
19855  *         pushed_values_count = push_encoded_unicode_string(runtime, L, <unicode>o)
19856  *     elif isinstance(o, _LuaObject):
19857  */
19858     goto __pyx_L3;
19859   }
19860 
19861   /* "lupa/_lupa.pyx":1219
19862  *     elif isinstance(o, unicode) and runtime._encoding is not None:
19863  *         pushed_values_count = push_encoded_unicode_string(runtime, L, <unicode>o)
19864  *     elif isinstance(o, _LuaObject):             # <<<<<<<<<<<<<<
19865  *         if (<_LuaObject>o)._runtime is not runtime:
19866  *             raise LuaError("cannot mix objects from different Lua runtimes")
19867  */
19868   __pyx_t_3 = __Pyx_TypeCheck(__pyx_v_o, __pyx_ptype_4lupa_5_lupa__LuaObject);
19869   __pyx_t_2 = (__pyx_t_3 != 0);
19870   if (__pyx_t_2) {
19871 
19872     /* "lupa/_lupa.pyx":1220
19873  *         pushed_values_count = push_encoded_unicode_string(runtime, L, <unicode>o)
19874  *     elif isinstance(o, _LuaObject):
19875  *         if (<_LuaObject>o)._runtime is not runtime:             # <<<<<<<<<<<<<<
19876  *             raise LuaError("cannot mix objects from different Lua runtimes")
19877  *         lua.lua_rawgeti(L, lua.LUA_REGISTRYINDEX, (<_LuaObject>o)._ref)
19878  */
19879     __pyx_t_2 = (((struct __pyx_obj_4lupa_5_lupa__LuaObject *)__pyx_v_o)->_runtime != __pyx_v_runtime);
19880     __pyx_t_3 = (__pyx_t_2 != 0);
19881     if (unlikely(__pyx_t_3)) {
19882 
19883       /* "lupa/_lupa.pyx":1221
19884  *     elif isinstance(o, _LuaObject):
19885  *         if (<_LuaObject>o)._runtime is not runtime:
19886  *             raise LuaError("cannot mix objects from different Lua runtimes")             # <<<<<<<<<<<<<<
19887  *         lua.lua_rawgeti(L, lua.LUA_REGISTRYINDEX, (<_LuaObject>o)._ref)
19888  *         pushed_values_count = 1
19889  */
19890       __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_LuaError); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1221, __pyx_L1_error)
19891       __Pyx_GOTREF(__pyx_t_10);
19892       __pyx_t_11 = NULL;
19893       if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
19894         __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_10);
19895         if (likely(__pyx_t_11)) {
19896           PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
19897           __Pyx_INCREF(__pyx_t_11);
19898           __Pyx_INCREF(function);
19899           __Pyx_DECREF_SET(__pyx_t_10, function);
19900         }
19901       }
19902       __pyx_t_9 = (__pyx_t_11) ? __Pyx_PyObject_Call2Args(__pyx_t_10, __pyx_t_11, __pyx_kp_s_cannot_mix_objects_from_differen) : __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_kp_s_cannot_mix_objects_from_differen);
19903       __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
19904       if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1221, __pyx_L1_error)
19905       __Pyx_GOTREF(__pyx_t_9);
19906       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
19907       __Pyx_Raise(__pyx_t_9, 0, 0, 0);
19908       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
19909       __PYX_ERR(0, 1221, __pyx_L1_error)
19910 
19911       /* "lupa/_lupa.pyx":1220
19912  *         pushed_values_count = push_encoded_unicode_string(runtime, L, <unicode>o)
19913  *     elif isinstance(o, _LuaObject):
19914  *         if (<_LuaObject>o)._runtime is not runtime:             # <<<<<<<<<<<<<<
19915  *             raise LuaError("cannot mix objects from different Lua runtimes")
19916  *         lua.lua_rawgeti(L, lua.LUA_REGISTRYINDEX, (<_LuaObject>o)._ref)
19917  */
19918     }
19919 
19920     /* "lupa/_lupa.pyx":1222
19921  *         if (<_LuaObject>o)._runtime is not runtime:
19922  *             raise LuaError("cannot mix objects from different Lua runtimes")
19923  *         lua.lua_rawgeti(L, lua.LUA_REGISTRYINDEX, (<_LuaObject>o)._ref)             # <<<<<<<<<<<<<<
19924  *         pushed_values_count = 1
19925  *     elif isinstance(o, float):
19926  */
19927     lua_rawgeti(__pyx_v_L, LUA_REGISTRYINDEX, ((struct __pyx_obj_4lupa_5_lupa__LuaObject *)__pyx_v_o)->_ref);
19928 
19929     /* "lupa/_lupa.pyx":1223
19930  *             raise LuaError("cannot mix objects from different Lua runtimes")
19931  *         lua.lua_rawgeti(L, lua.LUA_REGISTRYINDEX, (<_LuaObject>o)._ref)
19932  *         pushed_values_count = 1             # <<<<<<<<<<<<<<
19933  *     elif isinstance(o, float):
19934  *         lua.lua_pushnumber(L, <lua.lua_Number><double>o)
19935  */
19936     __pyx_v_pushed_values_count = 1;
19937 
19938     /* "lupa/_lupa.pyx":1219
19939  *     elif isinstance(o, unicode) and runtime._encoding is not None:
19940  *         pushed_values_count = push_encoded_unicode_string(runtime, L, <unicode>o)
19941  *     elif isinstance(o, _LuaObject):             # <<<<<<<<<<<<<<
19942  *         if (<_LuaObject>o)._runtime is not runtime:
19943  *             raise LuaError("cannot mix objects from different Lua runtimes")
19944  */
19945     goto __pyx_L3;
19946   }
19947 
19948   /* "lupa/_lupa.pyx":1224
19949  *         lua.lua_rawgeti(L, lua.LUA_REGISTRYINDEX, (<_LuaObject>o)._ref)
19950  *         pushed_values_count = 1
19951  *     elif isinstance(o, float):             # <<<<<<<<<<<<<<
19952  *         lua.lua_pushnumber(L, <lua.lua_Number><double>o)
19953  *         pushed_values_count = 1
19954  */
19955   __pyx_t_3 = PyFloat_Check(__pyx_v_o);
19956   __pyx_t_2 = (__pyx_t_3 != 0);
19957   if (__pyx_t_2) {
19958 
19959     /* "lupa/_lupa.pyx":1225
19960  *         pushed_values_count = 1
19961  *     elif isinstance(o, float):
19962  *         lua.lua_pushnumber(L, <lua.lua_Number><double>o)             # <<<<<<<<<<<<<<
19963  *         pushed_values_count = 1
19964  *     else:
19965  */
19966     __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_v_o); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1225, __pyx_L1_error)
19967     lua_pushnumber(__pyx_v_L, ((lua_Number)((double)__pyx_t_4)));
19968 
19969     /* "lupa/_lupa.pyx":1226
19970  *     elif isinstance(o, float):
19971  *         lua.lua_pushnumber(L, <lua.lua_Number><double>o)
19972  *         pushed_values_count = 1             # <<<<<<<<<<<<<<
19973  *     else:
19974  *         if isinstance(o, _PyProtocolWrapper):
19975  */
19976     __pyx_v_pushed_values_count = 1;
19977 
19978     /* "lupa/_lupa.pyx":1224
19979  *         lua.lua_rawgeti(L, lua.LUA_REGISTRYINDEX, (<_LuaObject>o)._ref)
19980  *         pushed_values_count = 1
19981  *     elif isinstance(o, float):             # <<<<<<<<<<<<<<
19982  *         lua.lua_pushnumber(L, <lua.lua_Number><double>o)
19983  *         pushed_values_count = 1
19984  */
19985     goto __pyx_L3;
19986   }
19987 
19988   /* "lupa/_lupa.pyx":1228
19989  *         pushed_values_count = 1
19990  *     else:
19991  *         if isinstance(o, _PyProtocolWrapper):             # <<<<<<<<<<<<<<
19992  *             type_flags = (<_PyProtocolWrapper>o)._type_flags
19993  *             o = (<_PyProtocolWrapper>o)._obj
19994  */
19995   /*else*/ {
19996     __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_o, __pyx_ptype_4lupa_5_lupa__PyProtocolWrapper);
19997     __pyx_t_3 = (__pyx_t_2 != 0);
19998     if (__pyx_t_3) {
19999 
20000       /* "lupa/_lupa.pyx":1229
20001  *     else:
20002  *         if isinstance(o, _PyProtocolWrapper):
20003  *             type_flags = (<_PyProtocolWrapper>o)._type_flags             # <<<<<<<<<<<<<<
20004  *             o = (<_PyProtocolWrapper>o)._obj
20005  *         else:
20006  */
20007       __pyx_t_8 = ((struct __pyx_obj_4lupa_5_lupa__PyProtocolWrapper *)__pyx_v_o)->_type_flags;
20008       __pyx_v_type_flags = __pyx_t_8;
20009 
20010       /* "lupa/_lupa.pyx":1230
20011  *         if isinstance(o, _PyProtocolWrapper):
20012  *             type_flags = (<_PyProtocolWrapper>o)._type_flags
20013  *             o = (<_PyProtocolWrapper>o)._obj             # <<<<<<<<<<<<<<
20014  *         else:
20015  *             # prefer __getitem__ over __getattr__ by default
20016  */
20017       __pyx_t_9 = ((struct __pyx_obj_4lupa_5_lupa__PyProtocolWrapper *)__pyx_v_o)->_obj;
20018       __Pyx_INCREF(__pyx_t_9);
20019       __Pyx_DECREF_SET(__pyx_v_o, __pyx_t_9);
20020       __pyx_t_9 = 0;
20021 
20022       /* "lupa/_lupa.pyx":1228
20023  *         pushed_values_count = 1
20024  *     else:
20025  *         if isinstance(o, _PyProtocolWrapper):             # <<<<<<<<<<<<<<
20026  *             type_flags = (<_PyProtocolWrapper>o)._type_flags
20027  *             o = (<_PyProtocolWrapper>o)._obj
20028  */
20029       goto __pyx_L13;
20030     }
20031 
20032     /* "lupa/_lupa.pyx":1233
20033  *         else:
20034  *             # prefer __getitem__ over __getattr__ by default
20035  *             type_flags = OBJ_AS_INDEX if hasattr(o, '__getitem__') else 0             # <<<<<<<<<<<<<<
20036  *         pushed_values_count = py_to_lua_custom(runtime, L, o, type_flags)
20037  *     return pushed_values_count
20038  */
20039     /*else*/ {
20040       __pyx_t_3 = __Pyx_HasAttr(__pyx_v_o, __pyx_n_s_getitem); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 1233, __pyx_L1_error)
20041       if ((__pyx_t_3 != 0)) {
20042         __pyx_t_8 = __pyx_e_4lupa_5_lupa_OBJ_AS_INDEX;
20043       } else {
20044         __pyx_t_8 = 0;
20045       }
20046       __pyx_v_type_flags = __pyx_t_8;
20047     }
20048     __pyx_L13:;
20049 
20050     /* "lupa/_lupa.pyx":1234
20051  *             # prefer __getitem__ over __getattr__ by default
20052  *             type_flags = OBJ_AS_INDEX if hasattr(o, '__getitem__') else 0
20053  *         pushed_values_count = py_to_lua_custom(runtime, L, o, type_flags)             # <<<<<<<<<<<<<<
20054  *     return pushed_values_count
20055  *
20056  */
20057     __pyx_v_pushed_values_count = __pyx_f_4lupa_5_lupa_py_to_lua_custom(__pyx_v_runtime, __pyx_v_L, __pyx_v_o, __pyx_v_type_flags);
20058   }
20059   __pyx_L3:;
20060 
20061   /* "lupa/_lupa.pyx":1235
20062  *             type_flags = OBJ_AS_INDEX if hasattr(o, '__getitem__') else 0
20063  *         pushed_values_count = py_to_lua_custom(runtime, L, o, type_flags)
20064  *     return pushed_values_count             # <<<<<<<<<<<<<<
20065  *
20066  * cdef int push_encoded_unicode_string(LuaRuntime runtime, lua_State *L, unicode ustring) except -1:
20067  */
20068   __pyx_r = __pyx_v_pushed_values_count;
20069   goto __pyx_L0;
20070 
20071   /* "lupa/_lupa.pyx":1185
20072  *      return py_to_lua(runtime, L, o)
20073  *
20074  * cdef int py_to_lua(LuaRuntime runtime, lua_State *L, object o, bint wrap_none=False) except -1:             # <<<<<<<<<<<<<<
20075  *     cdef int pushed_values_count = 0
20076  *     cdef int type_flags = 0
20077  */
20078 
20079   /* function exit code */
20080   __pyx_L1_error:;
20081   __Pyx_XDECREF(__pyx_t_9);
20082   __Pyx_XDECREF(__pyx_t_10);
20083   __Pyx_XDECREF(__pyx_t_11);
20084   __Pyx_AddTraceback("lupa._lupa.py_to_lua", __pyx_clineno, __pyx_lineno, __pyx_filename);
20085   __pyx_r = -1;
20086   __pyx_L0:;
20087   __Pyx_XDECREF(__pyx_v_o);
20088   __Pyx_RefNannyFinishContext();
20089   return __pyx_r;
20090 }
20091 
20092 /* "lupa/_lupa.pyx":1237
20093  *     return pushed_values_count
20094  *
20095  * cdef int push_encoded_unicode_string(LuaRuntime runtime, lua_State *L, unicode ustring) except -1:             # <<<<<<<<<<<<<<
20096  *     cdef bytes bytes_string = ustring.encode(runtime._encoding)
20097  *     lua.lua_pushlstring(L, <char*>bytes_string, len(bytes_string))
20098  */
20099 
__pyx_f_4lupa_5_lupa_push_encoded_unicode_string(struct __pyx_obj_4lupa_5_lupa_LuaRuntime * __pyx_v_runtime,lua_State * __pyx_v_L,PyObject * __pyx_v_ustring)20100 static int __pyx_f_4lupa_5_lupa_push_encoded_unicode_string(struct __pyx_obj_4lupa_5_lupa_LuaRuntime *__pyx_v_runtime, lua_State *__pyx_v_L, PyObject *__pyx_v_ustring) {
20101   PyObject *__pyx_v_bytes_string = 0;
20102   int __pyx_r;
20103   __Pyx_RefNannyDeclarations
20104   char const *__pyx_t_1;
20105   PyObject *__pyx_t_2 = NULL;
20106   char *__pyx_t_3;
20107   Py_ssize_t __pyx_t_4;
20108   int __pyx_lineno = 0;
20109   const char *__pyx_filename = NULL;
20110   int __pyx_clineno = 0;
20111   __Pyx_RefNannySetupContext("push_encoded_unicode_string", 0);
20112 
20113   /* "lupa/_lupa.pyx":1238
20114  *
20115  * cdef int push_encoded_unicode_string(LuaRuntime runtime, lua_State *L, unicode ustring) except -1:
20116  *     cdef bytes bytes_string = ustring.encode(runtime._encoding)             # <<<<<<<<<<<<<<
20117  *     lua.lua_pushlstring(L, <char*>bytes_string, len(bytes_string))
20118  *     return 1
20119  */
20120   if (unlikely(__pyx_v_ustring == Py_None)) {
20121     PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode");
20122     __PYX_ERR(0, 1238, __pyx_L1_error)
20123   }
20124   if (unlikely(__pyx_v_runtime->_encoding == Py_None)) {
20125     PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
20126     __PYX_ERR(0, 1238, __pyx_L1_error)
20127   }
20128   __pyx_t_1 = __Pyx_PyBytes_AsString(__pyx_v_runtime->_encoding); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) __PYX_ERR(0, 1238, __pyx_L1_error)
20129   __pyx_t_2 = PyUnicode_AsEncodedString(__pyx_v_ustring, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1238, __pyx_L1_error)
20130   __Pyx_GOTREF(__pyx_t_2);
20131   __pyx_v_bytes_string = ((PyObject*)__pyx_t_2);
20132   __pyx_t_2 = 0;
20133 
20134   /* "lupa/_lupa.pyx":1239
20135  * cdef int push_encoded_unicode_string(LuaRuntime runtime, lua_State *L, unicode ustring) except -1:
20136  *     cdef bytes bytes_string = ustring.encode(runtime._encoding)
20137  *     lua.lua_pushlstring(L, <char*>bytes_string, len(bytes_string))             # <<<<<<<<<<<<<<
20138  *     return 1
20139  *
20140  */
20141   if (unlikely(__pyx_v_bytes_string == Py_None)) {
20142     PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
20143     __PYX_ERR(0, 1239, __pyx_L1_error)
20144   }
20145   __pyx_t_3 = __Pyx_PyBytes_AsWritableString(__pyx_v_bytes_string); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) __PYX_ERR(0, 1239, __pyx_L1_error)
20146   if (unlikely(__pyx_v_bytes_string == Py_None)) {
20147     PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
20148     __PYX_ERR(0, 1239, __pyx_L1_error)
20149   }
20150   __pyx_t_4 = PyBytes_GET_SIZE(__pyx_v_bytes_string); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1239, __pyx_L1_error)
20151   lua_pushlstring(__pyx_v_L, ((char *)__pyx_t_3), __pyx_t_4);
20152 
20153   /* "lupa/_lupa.pyx":1240
20154  *     cdef bytes bytes_string = ustring.encode(runtime._encoding)
20155  *     lua.lua_pushlstring(L, <char*>bytes_string, len(bytes_string))
20156  *     return 1             # <<<<<<<<<<<<<<
20157  *
20158  * cdef bint py_to_lua_custom(LuaRuntime runtime, lua_State *L, object o, int type_flags):
20159  */
20160   __pyx_r = 1;
20161   goto __pyx_L0;
20162 
20163   /* "lupa/_lupa.pyx":1237
20164  *     return pushed_values_count
20165  *
20166  * cdef int push_encoded_unicode_string(LuaRuntime runtime, lua_State *L, unicode ustring) except -1:             # <<<<<<<<<<<<<<
20167  *     cdef bytes bytes_string = ustring.encode(runtime._encoding)
20168  *     lua.lua_pushlstring(L, <char*>bytes_string, len(bytes_string))
20169  */
20170 
20171   /* function exit code */
20172   __pyx_L1_error:;
20173   __Pyx_XDECREF(__pyx_t_2);
20174   __Pyx_AddTraceback("lupa._lupa.push_encoded_unicode_string", __pyx_clineno, __pyx_lineno, __pyx_filename);
20175   __pyx_r = -1;
20176   __pyx_L0:;
20177   __Pyx_XDECREF(__pyx_v_bytes_string);
20178   __Pyx_RefNannyFinishContext();
20179   return __pyx_r;
20180 }
20181 
20182 /* "lupa/_lupa.pyx":1242
20183  *     return 1
20184  *
20185  * cdef bint py_to_lua_custom(LuaRuntime runtime, lua_State *L, object o, int type_flags):             # <<<<<<<<<<<<<<
20186  *     cdef py_object *py_obj = <py_object*> lua.lua_newuserdata(L, sizeof(py_object))
20187  *     if not py_obj:
20188  */
20189 
__pyx_f_4lupa_5_lupa_py_to_lua_custom(struct __pyx_obj_4lupa_5_lupa_LuaRuntime * __pyx_v_runtime,lua_State * __pyx_v_L,PyObject * __pyx_v_o,int __pyx_v_type_flags)20190 static int __pyx_f_4lupa_5_lupa_py_to_lua_custom(struct __pyx_obj_4lupa_5_lupa_LuaRuntime *__pyx_v_runtime, lua_State *__pyx_v_L, PyObject *__pyx_v_o, int __pyx_v_type_flags) {
20191   struct __pyx_t_4lupa_5_lupa_py_object *__pyx_v_py_obj;
20192   PyObject *__pyx_v_obj_id = NULL;
20193   int __pyx_r;
20194   __Pyx_RefNannyDeclarations
20195   int __pyx_t_1;
20196   PyObject *__pyx_t_2 = NULL;
20197   PyObject *__pyx_t_3 = NULL;
20198   int __pyx_t_4;
20199   int __pyx_t_5;
20200   int __pyx_lineno = 0;
20201   const char *__pyx_filename = NULL;
20202   int __pyx_clineno = 0;
20203   __Pyx_RefNannySetupContext("py_to_lua_custom", 0);
20204 
20205   /* "lupa/_lupa.pyx":1243
20206  *
20207  * cdef bint py_to_lua_custom(LuaRuntime runtime, lua_State *L, object o, int type_flags):
20208  *     cdef py_object *py_obj = <py_object*> lua.lua_newuserdata(L, sizeof(py_object))             # <<<<<<<<<<<<<<
20209  *     if not py_obj:
20210  *         return 0 # values pushed
20211  */
20212   __pyx_v_py_obj = ((struct __pyx_t_4lupa_5_lupa_py_object *)lua_newuserdata(__pyx_v_L, (sizeof(struct __pyx_t_4lupa_5_lupa_py_object))));
20213 
20214   /* "lupa/_lupa.pyx":1244
20215  * cdef bint py_to_lua_custom(LuaRuntime runtime, lua_State *L, object o, int type_flags):
20216  *     cdef py_object *py_obj = <py_object*> lua.lua_newuserdata(L, sizeof(py_object))
20217  *     if not py_obj:             # <<<<<<<<<<<<<<
20218  *         return 0 # values pushed
20219  *
20220  */
20221   __pyx_t_1 = ((!(__pyx_v_py_obj != 0)) != 0);
20222   if (__pyx_t_1) {
20223 
20224     /* "lupa/_lupa.pyx":1245
20225  *     cdef py_object *py_obj = <py_object*> lua.lua_newuserdata(L, sizeof(py_object))
20226  *     if not py_obj:
20227  *         return 0 # values pushed             # <<<<<<<<<<<<<<
20228  *
20229  *     # originally, we just used:
20230  */
20231     __pyx_r = 0;
20232     goto __pyx_L0;
20233 
20234     /* "lupa/_lupa.pyx":1244
20235  * cdef bint py_to_lua_custom(LuaRuntime runtime, lua_State *L, object o, int type_flags):
20236  *     cdef py_object *py_obj = <py_object*> lua.lua_newuserdata(L, sizeof(py_object))
20237  *     if not py_obj:             # <<<<<<<<<<<<<<
20238  *         return 0 # values pushed
20239  *
20240  */
20241   }
20242 
20243   /* "lupa/_lupa.pyx":1251
20244  *     # now, we store an owned reference in "runtime._pyrefs_in_lua" to keep it visible to Python
20245  *     # and a borrowed reference in "py_obj.obj" for access from Lua
20246  *     obj_id = <object><uintptr_t><PyObject*>(o)             # <<<<<<<<<<<<<<
20247  *     if obj_id in runtime._pyrefs_in_lua:
20248  *         runtime._pyrefs_in_lua[obj_id].append(o)
20249  */
20250   __pyx_t_2 = __Pyx_PyInt_FromSize_t(((uintptr_t)((PyObject *)__pyx_v_o))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1251, __pyx_L1_error)
20251   __Pyx_GOTREF(__pyx_t_2);
20252   __pyx_t_3 = __pyx_t_2;
20253   __Pyx_INCREF(__pyx_t_3);
20254   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
20255   __pyx_v_obj_id = __pyx_t_3;
20256   __pyx_t_3 = 0;
20257 
20258   /* "lupa/_lupa.pyx":1252
20259  *     # and a borrowed reference in "py_obj.obj" for access from Lua
20260  *     obj_id = <object><uintptr_t><PyObject*>(o)
20261  *     if obj_id in runtime._pyrefs_in_lua:             # <<<<<<<<<<<<<<
20262  *         runtime._pyrefs_in_lua[obj_id].append(o)
20263  *     else:
20264  */
20265   if (unlikely(__pyx_v_runtime->_pyrefs_in_lua == Py_None)) {
20266     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
20267     __PYX_ERR(0, 1252, __pyx_L1_error)
20268   }
20269   __pyx_t_1 = (__Pyx_PyDict_ContainsTF(__pyx_v_obj_id, __pyx_v_runtime->_pyrefs_in_lua, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1252, __pyx_L1_error)
20270   __pyx_t_4 = (__pyx_t_1 != 0);
20271   if (__pyx_t_4) {
20272 
20273     /* "lupa/_lupa.pyx":1253
20274  *     obj_id = <object><uintptr_t><PyObject*>(o)
20275  *     if obj_id in runtime._pyrefs_in_lua:
20276  *         runtime._pyrefs_in_lua[obj_id].append(o)             # <<<<<<<<<<<<<<
20277  *     else:
20278  *         runtime._pyrefs_in_lua[obj_id] = [o]
20279  */
20280     if (unlikely(__pyx_v_runtime->_pyrefs_in_lua == Py_None)) {
20281       PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
20282       __PYX_ERR(0, 1253, __pyx_L1_error)
20283     }
20284     __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_v_runtime->_pyrefs_in_lua, __pyx_v_obj_id); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1253, __pyx_L1_error)
20285     __Pyx_GOTREF(__pyx_t_3);
20286     __pyx_t_5 = __Pyx_PyObject_Append(__pyx_t_3, __pyx_v_o); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 1253, __pyx_L1_error)
20287     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
20288 
20289     /* "lupa/_lupa.pyx":1252
20290  *     # and a borrowed reference in "py_obj.obj" for access from Lua
20291  *     obj_id = <object><uintptr_t><PyObject*>(o)
20292  *     if obj_id in runtime._pyrefs_in_lua:             # <<<<<<<<<<<<<<
20293  *         runtime._pyrefs_in_lua[obj_id].append(o)
20294  *     else:
20295  */
20296     goto __pyx_L4;
20297   }
20298 
20299   /* "lupa/_lupa.pyx":1255
20300  *         runtime._pyrefs_in_lua[obj_id].append(o)
20301  *     else:
20302  *         runtime._pyrefs_in_lua[obj_id] = [o]             # <<<<<<<<<<<<<<
20303  *
20304  *     py_obj.obj = <PyObject*>o
20305  */
20306   /*else*/ {
20307     __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1255, __pyx_L1_error)
20308     __Pyx_GOTREF(__pyx_t_3);
20309     __Pyx_INCREF(__pyx_v_o);
20310     __Pyx_GIVEREF(__pyx_v_o);
20311     PyList_SET_ITEM(__pyx_t_3, 0, __pyx_v_o);
20312     if (unlikely(__pyx_v_runtime->_pyrefs_in_lua == Py_None)) {
20313       PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
20314       __PYX_ERR(0, 1255, __pyx_L1_error)
20315     }
20316     if (unlikely(PyDict_SetItem(__pyx_v_runtime->_pyrefs_in_lua, __pyx_v_obj_id, __pyx_t_3) < 0)) __PYX_ERR(0, 1255, __pyx_L1_error)
20317     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
20318   }
20319   __pyx_L4:;
20320 
20321   /* "lupa/_lupa.pyx":1257
20322  *         runtime._pyrefs_in_lua[obj_id] = [o]
20323  *
20324  *     py_obj.obj = <PyObject*>o             # <<<<<<<<<<<<<<
20325  *     py_obj.runtime = <PyObject*>runtime
20326  *     py_obj.type_flags = type_flags
20327  */
20328   __pyx_v_py_obj->obj = ((PyObject *)__pyx_v_o);
20329 
20330   /* "lupa/_lupa.pyx":1258
20331  *
20332  *     py_obj.obj = <PyObject*>o
20333  *     py_obj.runtime = <PyObject*>runtime             # <<<<<<<<<<<<<<
20334  *     py_obj.type_flags = type_flags
20335  *     lua.luaL_getmetatable(L, POBJECT)
20336  */
20337   __pyx_v_py_obj->runtime = ((PyObject *)__pyx_v_runtime);
20338 
20339   /* "lupa/_lupa.pyx":1259
20340  *     py_obj.obj = <PyObject*>o
20341  *     py_obj.runtime = <PyObject*>runtime
20342  *     py_obj.type_flags = type_flags             # <<<<<<<<<<<<<<
20343  *     lua.luaL_getmetatable(L, POBJECT)
20344  *     lua.lua_setmetatable(L, -2)
20345  */
20346   __pyx_v_py_obj->type_flags = __pyx_v_type_flags;
20347 
20348   /* "lupa/_lupa.pyx":1260
20349  *     py_obj.runtime = <PyObject*>runtime
20350  *     py_obj.type_flags = type_flags
20351  *     lua.luaL_getmetatable(L, POBJECT)             # <<<<<<<<<<<<<<
20352  *     lua.lua_setmetatable(L, -2)
20353  *     return 1 # values pushed
20354  */
20355   luaL_getmetatable(__pyx_v_L, ((char *)"POBJECT"));
20356 
20357   /* "lupa/_lupa.pyx":1261
20358  *     py_obj.type_flags = type_flags
20359  *     lua.luaL_getmetatable(L, POBJECT)
20360  *     lua.lua_setmetatable(L, -2)             # <<<<<<<<<<<<<<
20361  *     return 1 # values pushed
20362  *
20363  */
20364   (void)(lua_setmetatable(__pyx_v_L, -2));
20365 
20366   /* "lupa/_lupa.pyx":1262
20367  *     lua.luaL_getmetatable(L, POBJECT)
20368  *     lua.lua_setmetatable(L, -2)
20369  *     return 1 # values pushed             # <<<<<<<<<<<<<<
20370  *
20371  *
20372  */
20373   __pyx_r = 1;
20374   goto __pyx_L0;
20375 
20376   /* "lupa/_lupa.pyx":1242
20377  *     return 1
20378  *
20379  * cdef bint py_to_lua_custom(LuaRuntime runtime, lua_State *L, object o, int type_flags):             # <<<<<<<<<<<<<<
20380  *     cdef py_object *py_obj = <py_object*> lua.lua_newuserdata(L, sizeof(py_object))
20381  *     if not py_obj:
20382  */
20383 
20384   /* function exit code */
20385   __pyx_L1_error:;
20386   __Pyx_XDECREF(__pyx_t_2);
20387   __Pyx_XDECREF(__pyx_t_3);
20388   __Pyx_WriteUnraisable("lupa._lupa.py_to_lua_custom", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
20389   __pyx_r = 0;
20390   __pyx_L0:;
20391   __Pyx_XDECREF(__pyx_v_obj_id);
20392   __Pyx_RefNannyFinishContext();
20393   return __pyx_r;
20394 }
20395 
20396 /* "lupa/_lupa.pyx":1265
20397  *
20398  *
20399  * cdef inline int _isascii(unsigned char* s):             # <<<<<<<<<<<<<<
20400  *     cdef unsigned char c = 0
20401  *     while s[0]:
20402  */
20403 
__pyx_f_4lupa_5_lupa__isascii(unsigned char * __pyx_v_s)20404 static CYTHON_INLINE int __pyx_f_4lupa_5_lupa__isascii(unsigned char *__pyx_v_s) {
20405   unsigned char __pyx_v_c;
20406   int __pyx_r;
20407   __Pyx_RefNannyDeclarations
20408   int __pyx_t_1;
20409   __Pyx_RefNannySetupContext("_isascii", 0);
20410 
20411   /* "lupa/_lupa.pyx":1266
20412  *
20413  * cdef inline int _isascii(unsigned char* s):
20414  *     cdef unsigned char c = 0             # <<<<<<<<<<<<<<
20415  *     while s[0]:
20416  *         c |= s[0]
20417  */
20418   __pyx_v_c = 0;
20419 
20420   /* "lupa/_lupa.pyx":1267
20421  * cdef inline int _isascii(unsigned char* s):
20422  *     cdef unsigned char c = 0
20423  *     while s[0]:             # <<<<<<<<<<<<<<
20424  *         c |= s[0]
20425  *         s += 1
20426  */
20427   while (1) {
20428     __pyx_t_1 = ((__pyx_v_s[0]) != 0);
20429     if (!__pyx_t_1) break;
20430 
20431     /* "lupa/_lupa.pyx":1268
20432  *     cdef unsigned char c = 0
20433  *     while s[0]:
20434  *         c |= s[0]             # <<<<<<<<<<<<<<
20435  *         s += 1
20436  *     return c & 0x80 == 0
20437  */
20438     __pyx_v_c = (__pyx_v_c | (__pyx_v_s[0]));
20439 
20440     /* "lupa/_lupa.pyx":1269
20441  *     while s[0]:
20442  *         c |= s[0]
20443  *         s += 1             # <<<<<<<<<<<<<<
20444  *     return c & 0x80 == 0
20445  *
20446  */
20447     __pyx_v_s = (__pyx_v_s + 1);
20448   }
20449 
20450   /* "lupa/_lupa.pyx":1270
20451  *         c |= s[0]
20452  *         s += 1
20453  *     return c & 0x80 == 0             # <<<<<<<<<<<<<<
20454  *
20455  *
20456  */
20457   __pyx_r = ((__pyx_v_c & 0x80) == 0);
20458   goto __pyx_L0;
20459 
20460   /* "lupa/_lupa.pyx":1265
20461  *
20462  *
20463  * cdef inline int _isascii(unsigned char* s):             # <<<<<<<<<<<<<<
20464  *     cdef unsigned char c = 0
20465  *     while s[0]:
20466  */
20467 
20468   /* function exit code */
20469   __pyx_L0:;
20470   __Pyx_RefNannyFinishContext();
20471   return __pyx_r;
20472 }
20473 
20474 /* "lupa/_lupa.pyx":1273
20475  *
20476  *
20477  * cdef bytes _asciiOrNone(s):             # <<<<<<<<<<<<<<
20478  *     if s is None:
20479  *         return s
20480  */
20481 
__pyx_f_4lupa_5_lupa__asciiOrNone(PyObject * __pyx_v_s)20482 static PyObject *__pyx_f_4lupa_5_lupa__asciiOrNone(PyObject *__pyx_v_s) {
20483   PyObject *__pyx_r = NULL;
20484   __Pyx_RefNannyDeclarations
20485   int __pyx_t_1;
20486   int __pyx_t_2;
20487   PyObject *__pyx_t_3 = NULL;
20488   PyObject *__pyx_t_4 = NULL;
20489   unsigned char *__pyx_t_5;
20490   int __pyx_lineno = 0;
20491   const char *__pyx_filename = NULL;
20492   int __pyx_clineno = 0;
20493   __Pyx_RefNannySetupContext("_asciiOrNone", 0);
20494   __Pyx_INCREF(__pyx_v_s);
20495 
20496   /* "lupa/_lupa.pyx":1274
20497  *
20498  * cdef bytes _asciiOrNone(s):
20499  *     if s is None:             # <<<<<<<<<<<<<<
20500  *         return s
20501  *     elif isinstance(s, unicode):
20502  */
20503   __pyx_t_1 = (__pyx_v_s == Py_None);
20504   __pyx_t_2 = (__pyx_t_1 != 0);
20505   if (__pyx_t_2) {
20506 
20507     /* "lupa/_lupa.pyx":1275
20508  * cdef bytes _asciiOrNone(s):
20509  *     if s is None:
20510  *         return s             # <<<<<<<<<<<<<<
20511  *     elif isinstance(s, unicode):
20512  *         return (<unicode>s).encode('ascii')
20513  */
20514     __Pyx_XDECREF(__pyx_r);
20515     if (!(likely(PyBytes_CheckExact(__pyx_v_s))||((__pyx_v_s) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_v_s)->tp_name), 0))) __PYX_ERR(0, 1275, __pyx_L1_error)
20516     __Pyx_INCREF(__pyx_v_s);
20517     __pyx_r = ((PyObject*)__pyx_v_s);
20518     goto __pyx_L0;
20519 
20520     /* "lupa/_lupa.pyx":1274
20521  *
20522  * cdef bytes _asciiOrNone(s):
20523  *     if s is None:             # <<<<<<<<<<<<<<
20524  *         return s
20525  *     elif isinstance(s, unicode):
20526  */
20527   }
20528 
20529   /* "lupa/_lupa.pyx":1276
20530  *     if s is None:
20531  *         return s
20532  *     elif isinstance(s, unicode):             # <<<<<<<<<<<<<<
20533  *         return (<unicode>s).encode('ascii')
20534  *     elif isinstance(s, bytearray):
20535  */
20536   __pyx_t_2 = PyUnicode_Check(__pyx_v_s);
20537   __pyx_t_1 = (__pyx_t_2 != 0);
20538   if (__pyx_t_1) {
20539 
20540     /* "lupa/_lupa.pyx":1277
20541  *         return s
20542  *     elif isinstance(s, unicode):
20543  *         return (<unicode>s).encode('ascii')             # <<<<<<<<<<<<<<
20544  *     elif isinstance(s, bytearray):
20545  *         s = bytes(s)
20546  */
20547     __Pyx_XDECREF(__pyx_r);
20548     if (unlikely(__pyx_v_s == Py_None)) {
20549       PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode");
20550       __PYX_ERR(0, 1277, __pyx_L1_error)
20551     }
20552     __pyx_t_3 = PyUnicode_AsASCIIString(((PyObject*)__pyx_v_s)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1277, __pyx_L1_error)
20553     __Pyx_GOTREF(__pyx_t_3);
20554     __pyx_r = ((PyObject*)__pyx_t_3);
20555     __pyx_t_3 = 0;
20556     goto __pyx_L0;
20557 
20558     /* "lupa/_lupa.pyx":1276
20559  *     if s is None:
20560  *         return s
20561  *     elif isinstance(s, unicode):             # <<<<<<<<<<<<<<
20562  *         return (<unicode>s).encode('ascii')
20563  *     elif isinstance(s, bytearray):
20564  */
20565   }
20566 
20567   /* "lupa/_lupa.pyx":1278
20568  *     elif isinstance(s, unicode):
20569  *         return (<unicode>s).encode('ascii')
20570  *     elif isinstance(s, bytearray):             # <<<<<<<<<<<<<<
20571  *         s = bytes(s)
20572  *     elif not isinstance(s, bytes):
20573  */
20574   __pyx_t_1 = PyByteArray_Check(__pyx_v_s);
20575   __pyx_t_2 = (__pyx_t_1 != 0);
20576   if (__pyx_t_2) {
20577 
20578     /* "lupa/_lupa.pyx":1279
20579  *         return (<unicode>s).encode('ascii')
20580  *     elif isinstance(s, bytearray):
20581  *         s = bytes(s)             # <<<<<<<<<<<<<<
20582  *     elif not isinstance(s, bytes):
20583  *         raise ValueError("expected string, got %s" % type(s))
20584  */
20585     __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyBytes_Type)), __pyx_v_s); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1279, __pyx_L1_error)
20586     __Pyx_GOTREF(__pyx_t_3);
20587     __Pyx_DECREF_SET(__pyx_v_s, __pyx_t_3);
20588     __pyx_t_3 = 0;
20589 
20590     /* "lupa/_lupa.pyx":1278
20591  *     elif isinstance(s, unicode):
20592  *         return (<unicode>s).encode('ascii')
20593  *     elif isinstance(s, bytearray):             # <<<<<<<<<<<<<<
20594  *         s = bytes(s)
20595  *     elif not isinstance(s, bytes):
20596  */
20597     goto __pyx_L3;
20598   }
20599 
20600   /* "lupa/_lupa.pyx":1280
20601  *     elif isinstance(s, bytearray):
20602  *         s = bytes(s)
20603  *     elif not isinstance(s, bytes):             # <<<<<<<<<<<<<<
20604  *         raise ValueError("expected string, got %s" % type(s))
20605  *     if not _isascii(<bytes>s):
20606  */
20607   __pyx_t_2 = PyBytes_Check(__pyx_v_s);
20608   __pyx_t_1 = ((!(__pyx_t_2 != 0)) != 0);
20609   if (unlikely(__pyx_t_1)) {
20610 
20611     /* "lupa/_lupa.pyx":1281
20612  *         s = bytes(s)
20613  *     elif not isinstance(s, bytes):
20614  *         raise ValueError("expected string, got %s" % type(s))             # <<<<<<<<<<<<<<
20615  *     if not _isascii(<bytes>s):
20616  *         raise ValueError("byte string input has unknown encoding, only ASCII is allowed")
20617  */
20618     __pyx_t_3 = __Pyx_PyString_FormatSafe(__pyx_kp_s_expected_string_got_s, ((PyObject *)Py_TYPE(__pyx_v_s))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1281, __pyx_L1_error)
20619     __Pyx_GOTREF(__pyx_t_3);
20620     __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1281, __pyx_L1_error)
20621     __Pyx_GOTREF(__pyx_t_4);
20622     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
20623     __Pyx_Raise(__pyx_t_4, 0, 0, 0);
20624     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
20625     __PYX_ERR(0, 1281, __pyx_L1_error)
20626 
20627     /* "lupa/_lupa.pyx":1280
20628  *     elif isinstance(s, bytearray):
20629  *         s = bytes(s)
20630  *     elif not isinstance(s, bytes):             # <<<<<<<<<<<<<<
20631  *         raise ValueError("expected string, got %s" % type(s))
20632  *     if not _isascii(<bytes>s):
20633  */
20634   }
20635   __pyx_L3:;
20636 
20637   /* "lupa/_lupa.pyx":1282
20638  *     elif not isinstance(s, bytes):
20639  *         raise ValueError("expected string, got %s" % type(s))
20640  *     if not _isascii(<bytes>s):             # <<<<<<<<<<<<<<
20641  *         raise ValueError("byte string input has unknown encoding, only ASCII is allowed")
20642  *     return <bytes>s
20643  */
20644   if (unlikely(__pyx_v_s == Py_None)) {
20645     PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
20646     __PYX_ERR(0, 1282, __pyx_L1_error)
20647   }
20648   __pyx_t_5 = __Pyx_PyBytes_AsWritableUString(__pyx_v_s); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) __PYX_ERR(0, 1282, __pyx_L1_error)
20649   __pyx_t_1 = ((!(__pyx_f_4lupa_5_lupa__isascii(__pyx_t_5) != 0)) != 0);
20650   if (unlikely(__pyx_t_1)) {
20651 
20652     /* "lupa/_lupa.pyx":1283
20653  *         raise ValueError("expected string, got %s" % type(s))
20654  *     if not _isascii(<bytes>s):
20655  *         raise ValueError("byte string input has unknown encoding, only ASCII is allowed")             # <<<<<<<<<<<<<<
20656  *     return <bytes>s
20657  *
20658  */
20659     __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__34, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1283, __pyx_L1_error)
20660     __Pyx_GOTREF(__pyx_t_4);
20661     __Pyx_Raise(__pyx_t_4, 0, 0, 0);
20662     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
20663     __PYX_ERR(0, 1283, __pyx_L1_error)
20664 
20665     /* "lupa/_lupa.pyx":1282
20666  *     elif not isinstance(s, bytes):
20667  *         raise ValueError("expected string, got %s" % type(s))
20668  *     if not _isascii(<bytes>s):             # <<<<<<<<<<<<<<
20669  *         raise ValueError("byte string input has unknown encoding, only ASCII is allowed")
20670  *     return <bytes>s
20671  */
20672   }
20673 
20674   /* "lupa/_lupa.pyx":1284
20675  *     if not _isascii(<bytes>s):
20676  *         raise ValueError("byte string input has unknown encoding, only ASCII is allowed")
20677  *     return <bytes>s             # <<<<<<<<<<<<<<
20678  *
20679  *
20680  */
20681   __Pyx_XDECREF(__pyx_r);
20682   __Pyx_INCREF(((PyObject*)__pyx_v_s));
20683   __pyx_r = ((PyObject*)__pyx_v_s);
20684   goto __pyx_L0;
20685 
20686   /* "lupa/_lupa.pyx":1273
20687  *
20688  *
20689  * cdef bytes _asciiOrNone(s):             # <<<<<<<<<<<<<<
20690  *     if s is None:
20691  *         return s
20692  */
20693 
20694   /* function exit code */
20695   __pyx_L1_error:;
20696   __Pyx_XDECREF(__pyx_t_3);
20697   __Pyx_XDECREF(__pyx_t_4);
20698   __Pyx_AddTraceback("lupa._lupa._asciiOrNone", __pyx_clineno, __pyx_lineno, __pyx_filename);
20699   __pyx_r = 0;
20700   __pyx_L0:;
20701   __Pyx_XDECREF(__pyx_v_s);
20702   __Pyx_XGIVEREF(__pyx_r);
20703   __Pyx_RefNannyFinishContext();
20704   return __pyx_r;
20705 }
20706 
20707 /* "lupa/_lupa.pyx":1289
20708  * # error handling
20709  *
20710  * cdef int raise_lua_error(LuaRuntime runtime, lua_State* L, int result) except -1:             # <<<<<<<<<<<<<<
20711  *     if result == 0:
20712  *         return 0
20713  */
20714 
__pyx_f_4lupa_5_lupa_raise_lua_error(struct __pyx_obj_4lupa_5_lupa_LuaRuntime * __pyx_v_runtime,lua_State * __pyx_v_L,int __pyx_v_result)20715 static int __pyx_f_4lupa_5_lupa_raise_lua_error(struct __pyx_obj_4lupa_5_lupa_LuaRuntime *__pyx_v_runtime, lua_State *__pyx_v_L, int __pyx_v_result) {
20716   int __pyx_r;
20717   __Pyx_RefNannyDeclarations
20718   PyObject *__pyx_t_1 = NULL;
20719   PyObject *__pyx_t_2 = NULL;
20720   PyObject *__pyx_t_3 = NULL;
20721   PyObject *__pyx_t_4 = NULL;
20722   int __pyx_lineno = 0;
20723   const char *__pyx_filename = NULL;
20724   int __pyx_clineno = 0;
20725   __Pyx_RefNannySetupContext("raise_lua_error", 0);
20726 
20727   /* "lupa/_lupa.pyx":1290
20728  *
20729  * cdef int raise_lua_error(LuaRuntime runtime, lua_State* L, int result) except -1:
20730  *     if result == 0:             # <<<<<<<<<<<<<<
20731  *         return 0
20732  *     elif result == lua.LUA_ERRMEM:
20733  */
20734   switch (__pyx_v_result) {
20735     case 0:
20736 
20737     /* "lupa/_lupa.pyx":1291
20738  * cdef int raise_lua_error(LuaRuntime runtime, lua_State* L, int result) except -1:
20739  *     if result == 0:
20740  *         return 0             # <<<<<<<<<<<<<<
20741  *     elif result == lua.LUA_ERRMEM:
20742  *         raise MemoryError()
20743  */
20744     __pyx_r = 0;
20745     goto __pyx_L0;
20746 
20747     /* "lupa/_lupa.pyx":1290
20748  *
20749  * cdef int raise_lua_error(LuaRuntime runtime, lua_State* L, int result) except -1:
20750  *     if result == 0:             # <<<<<<<<<<<<<<
20751  *         return 0
20752  *     elif result == lua.LUA_ERRMEM:
20753  */
20754     break;
20755     case LUA_ERRMEM:
20756 
20757     /* "lupa/_lupa.pyx":1293
20758  *         return 0
20759  *     elif result == lua.LUA_ERRMEM:
20760  *         raise MemoryError()             # <<<<<<<<<<<<<<
20761  *     else:
20762  *         raise LuaError( build_lua_error_message(runtime, L, None, -1) )
20763  */
20764     PyErr_NoMemory(); __PYX_ERR(0, 1293, __pyx_L1_error)
20765 
20766     /* "lupa/_lupa.pyx":1292
20767  *     if result == 0:
20768  *         return 0
20769  *     elif result == lua.LUA_ERRMEM:             # <<<<<<<<<<<<<<
20770  *         raise MemoryError()
20771  *     else:
20772  */
20773     break;
20774     default:
20775 
20776     /* "lupa/_lupa.pyx":1295
20777  *         raise MemoryError()
20778  *     else:
20779  *         raise LuaError( build_lua_error_message(runtime, L, None, -1) )             # <<<<<<<<<<<<<<
20780  *
20781  * cdef build_lua_error_message(LuaRuntime runtime, lua_State* L, unicode err_message, int n):
20782  */
20783     __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_LuaError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1295, __pyx_L1_error)
20784     __Pyx_GOTREF(__pyx_t_2);
20785     __pyx_t_3 = __pyx_f_4lupa_5_lupa_build_lua_error_message(__pyx_v_runtime, __pyx_v_L, ((PyObject*)Py_None), -1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1295, __pyx_L1_error)
20786     __Pyx_GOTREF(__pyx_t_3);
20787     __pyx_t_4 = NULL;
20788     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
20789       __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
20790       if (likely(__pyx_t_4)) {
20791         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
20792         __Pyx_INCREF(__pyx_t_4);
20793         __Pyx_INCREF(function);
20794         __Pyx_DECREF_SET(__pyx_t_2, function);
20795       }
20796     }
20797     __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
20798     __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
20799     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
20800     if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1295, __pyx_L1_error)
20801     __Pyx_GOTREF(__pyx_t_1);
20802     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
20803     __Pyx_Raise(__pyx_t_1, 0, 0, 0);
20804     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
20805     __PYX_ERR(0, 1295, __pyx_L1_error)
20806     break;
20807   }
20808 
20809   /* "lupa/_lupa.pyx":1289
20810  * # error handling
20811  *
20812  * cdef int raise_lua_error(LuaRuntime runtime, lua_State* L, int result) except -1:             # <<<<<<<<<<<<<<
20813  *     if result == 0:
20814  *         return 0
20815  */
20816 
20817   /* function exit code */
20818   __pyx_L1_error:;
20819   __Pyx_XDECREF(__pyx_t_1);
20820   __Pyx_XDECREF(__pyx_t_2);
20821   __Pyx_XDECREF(__pyx_t_3);
20822   __Pyx_XDECREF(__pyx_t_4);
20823   __Pyx_AddTraceback("lupa._lupa.raise_lua_error", __pyx_clineno, __pyx_lineno, __pyx_filename);
20824   __pyx_r = -1;
20825   __pyx_L0:;
20826   __Pyx_RefNannyFinishContext();
20827   return __pyx_r;
20828 }
20829 
20830 /* "lupa/_lupa.pyx":1297
20831  *         raise LuaError( build_lua_error_message(runtime, L, None, -1) )
20832  *
20833  * cdef build_lua_error_message(LuaRuntime runtime, lua_State* L, unicode err_message, int n):             # <<<<<<<<<<<<<<
20834  *     cdef size_t size = 0
20835  *     cdef const char *s = lua.lua_tolstring(L, n, &size)
20836  */
20837 
__pyx_f_4lupa_5_lupa_build_lua_error_message(struct __pyx_obj_4lupa_5_lupa_LuaRuntime * __pyx_v_runtime,lua_State * __pyx_v_L,PyObject * __pyx_v_err_message,int __pyx_v_n)20838 static PyObject *__pyx_f_4lupa_5_lupa_build_lua_error_message(struct __pyx_obj_4lupa_5_lupa_LuaRuntime *__pyx_v_runtime, lua_State *__pyx_v_L, PyObject *__pyx_v_err_message, int __pyx_v_n) {
20839   size_t __pyx_v_size;
20840   char const *__pyx_v_s;
20841   PyObject *__pyx_v_py_ustring = NULL;
20842   PyObject *__pyx_r = NULL;
20843   __Pyx_RefNannyDeclarations
20844   int __pyx_t_1;
20845   int __pyx_t_2;
20846   PyObject *__pyx_t_3 = NULL;
20847   PyObject *__pyx_t_4 = NULL;
20848   PyObject *__pyx_t_5 = NULL;
20849   char const *__pyx_t_6;
20850   PyObject *__pyx_t_7 = NULL;
20851   int __pyx_t_8;
20852   PyObject *__pyx_t_9 = NULL;
20853   PyObject *__pyx_t_10 = NULL;
20854   PyObject *__pyx_t_11 = NULL;
20855   int __pyx_lineno = 0;
20856   const char *__pyx_filename = NULL;
20857   int __pyx_clineno = 0;
20858   __Pyx_RefNannySetupContext("build_lua_error_message", 0);
20859 
20860   /* "lupa/_lupa.pyx":1298
20861  *
20862  * cdef build_lua_error_message(LuaRuntime runtime, lua_State* L, unicode err_message, int n):
20863  *     cdef size_t size = 0             # <<<<<<<<<<<<<<
20864  *     cdef const char *s = lua.lua_tolstring(L, n, &size)
20865  *     if runtime._encoding is not None:
20866  */
20867   __pyx_v_size = 0;
20868 
20869   /* "lupa/_lupa.pyx":1299
20870  * cdef build_lua_error_message(LuaRuntime runtime, lua_State* L, unicode err_message, int n):
20871  *     cdef size_t size = 0
20872  *     cdef const char *s = lua.lua_tolstring(L, n, &size)             # <<<<<<<<<<<<<<
20873  *     if runtime._encoding is not None:
20874  *         try:
20875  */
20876   __pyx_v_s = lua_tolstring(__pyx_v_L, __pyx_v_n, (&__pyx_v_size));
20877 
20878   /* "lupa/_lupa.pyx":1300
20879  *     cdef size_t size = 0
20880  *     cdef const char *s = lua.lua_tolstring(L, n, &size)
20881  *     if runtime._encoding is not None:             # <<<<<<<<<<<<<<
20882  *         try:
20883  *             py_ustring = s[:size].decode(runtime._encoding)
20884  */
20885   __pyx_t_1 = (__pyx_v_runtime->_encoding != ((PyObject*)Py_None));
20886   __pyx_t_2 = (__pyx_t_1 != 0);
20887   if (__pyx_t_2) {
20888 
20889     /* "lupa/_lupa.pyx":1301
20890  *     cdef const char *s = lua.lua_tolstring(L, n, &size)
20891  *     if runtime._encoding is not None:
20892  *         try:             # <<<<<<<<<<<<<<
20893  *             py_ustring = s[:size].decode(runtime._encoding)
20894  *         except UnicodeDecodeError:
20895  */
20896     {
20897       __Pyx_PyThreadState_declare
20898       __Pyx_PyThreadState_assign
20899       __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
20900       __Pyx_XGOTREF(__pyx_t_3);
20901       __Pyx_XGOTREF(__pyx_t_4);
20902       __Pyx_XGOTREF(__pyx_t_5);
20903       /*try:*/ {
20904 
20905         /* "lupa/_lupa.pyx":1302
20906  *     if runtime._encoding is not None:
20907  *         try:
20908  *             py_ustring = s[:size].decode(runtime._encoding)             # <<<<<<<<<<<<<<
20909  *         except UnicodeDecodeError:
20910  *             py_ustring = s[:size].decode('ISO-8859-1') # safe 'fake' decoding
20911  */
20912         if (unlikely(__pyx_v_runtime->_encoding == Py_None)) {
20913           PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
20914           __PYX_ERR(0, 1302, __pyx_L4_error)
20915         }
20916         __pyx_t_6 = __Pyx_PyBytes_AsString(__pyx_v_runtime->_encoding); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) __PYX_ERR(0, 1302, __pyx_L4_error)
20917         __pyx_t_7 = __Pyx_decode_c_string(__pyx_v_s, 0, __pyx_v_size, __pyx_t_6, NULL, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1302, __pyx_L4_error)
20918         __Pyx_GOTREF(__pyx_t_7);
20919         __pyx_v_py_ustring = __pyx_t_7;
20920         __pyx_t_7 = 0;
20921 
20922         /* "lupa/_lupa.pyx":1301
20923  *     cdef const char *s = lua.lua_tolstring(L, n, &size)
20924  *     if runtime._encoding is not None:
20925  *         try:             # <<<<<<<<<<<<<<
20926  *             py_ustring = s[:size].decode(runtime._encoding)
20927  *         except UnicodeDecodeError:
20928  */
20929       }
20930       __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
20931       __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
20932       __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
20933       goto __pyx_L9_try_end;
20934       __pyx_L4_error:;
20935       __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
20936 
20937       /* "lupa/_lupa.pyx":1303
20938  *         try:
20939  *             py_ustring = s[:size].decode(runtime._encoding)
20940  *         except UnicodeDecodeError:             # <<<<<<<<<<<<<<
20941  *             py_ustring = s[:size].decode('ISO-8859-1') # safe 'fake' decoding
20942  *     else:
20943  */
20944       __pyx_t_8 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_UnicodeDecodeError);
20945       if (__pyx_t_8) {
20946         __Pyx_AddTraceback("lupa._lupa.build_lua_error_message", __pyx_clineno, __pyx_lineno, __pyx_filename);
20947         if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_9, &__pyx_t_10) < 0) __PYX_ERR(0, 1303, __pyx_L6_except_error)
20948         __Pyx_GOTREF(__pyx_t_7);
20949         __Pyx_GOTREF(__pyx_t_9);
20950         __Pyx_GOTREF(__pyx_t_10);
20951 
20952         /* "lupa/_lupa.pyx":1304
20953  *             py_ustring = s[:size].decode(runtime._encoding)
20954  *         except UnicodeDecodeError:
20955  *             py_ustring = s[:size].decode('ISO-8859-1') # safe 'fake' decoding             # <<<<<<<<<<<<<<
20956  *     else:
20957  *         py_ustring = s[:size].decode('ISO-8859-1')
20958  */
20959         __pyx_t_11 = __Pyx_decode_c_string(__pyx_v_s, 0, __pyx_v_size, NULL, NULL, PyUnicode_DecodeLatin1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1304, __pyx_L6_except_error)
20960         __Pyx_GOTREF(__pyx_t_11);
20961         __Pyx_XDECREF_SET(__pyx_v_py_ustring, __pyx_t_11);
20962         __pyx_t_11 = 0;
20963         __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
20964         __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
20965         __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
20966         goto __pyx_L5_exception_handled;
20967       }
20968       goto __pyx_L6_except_error;
20969       __pyx_L6_except_error:;
20970 
20971       /* "lupa/_lupa.pyx":1301
20972  *     cdef const char *s = lua.lua_tolstring(L, n, &size)
20973  *     if runtime._encoding is not None:
20974  *         try:             # <<<<<<<<<<<<<<
20975  *             py_ustring = s[:size].decode(runtime._encoding)
20976  *         except UnicodeDecodeError:
20977  */
20978       __Pyx_XGIVEREF(__pyx_t_3);
20979       __Pyx_XGIVEREF(__pyx_t_4);
20980       __Pyx_XGIVEREF(__pyx_t_5);
20981       __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
20982       goto __pyx_L1_error;
20983       __pyx_L5_exception_handled:;
20984       __Pyx_XGIVEREF(__pyx_t_3);
20985       __Pyx_XGIVEREF(__pyx_t_4);
20986       __Pyx_XGIVEREF(__pyx_t_5);
20987       __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
20988       __pyx_L9_try_end:;
20989     }
20990 
20991     /* "lupa/_lupa.pyx":1300
20992  *     cdef size_t size = 0
20993  *     cdef const char *s = lua.lua_tolstring(L, n, &size)
20994  *     if runtime._encoding is not None:             # <<<<<<<<<<<<<<
20995  *         try:
20996  *             py_ustring = s[:size].decode(runtime._encoding)
20997  */
20998     goto __pyx_L3;
20999   }
21000 
21001   /* "lupa/_lupa.pyx":1306
21002  *             py_ustring = s[:size].decode('ISO-8859-1') # safe 'fake' decoding
21003  *     else:
21004  *         py_ustring = s[:size].decode('ISO-8859-1')             # <<<<<<<<<<<<<<
21005  *     if err_message is None:
21006  *         return py_ustring
21007  */
21008   /*else*/ {
21009     __pyx_t_10 = __Pyx_decode_c_string(__pyx_v_s, 0, __pyx_v_size, NULL, NULL, PyUnicode_DecodeLatin1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1306, __pyx_L1_error)
21010     __Pyx_GOTREF(__pyx_t_10);
21011     __pyx_v_py_ustring = __pyx_t_10;
21012     __pyx_t_10 = 0;
21013   }
21014   __pyx_L3:;
21015 
21016   /* "lupa/_lupa.pyx":1307
21017  *     else:
21018  *         py_ustring = s[:size].decode('ISO-8859-1')
21019  *     if err_message is None:             # <<<<<<<<<<<<<<
21020  *         return py_ustring
21021  *     else:
21022  */
21023   __pyx_t_2 = (__pyx_v_err_message == ((PyObject*)Py_None));
21024   __pyx_t_1 = (__pyx_t_2 != 0);
21025   if (__pyx_t_1) {
21026 
21027     /* "lupa/_lupa.pyx":1308
21028  *         py_ustring = s[:size].decode('ISO-8859-1')
21029  *     if err_message is None:
21030  *         return py_ustring             # <<<<<<<<<<<<<<
21031  *     else:
21032  *         return err_message % py_ustring
21033  */
21034     __Pyx_XDECREF(__pyx_r);
21035     __Pyx_INCREF(__pyx_v_py_ustring);
21036     __pyx_r = __pyx_v_py_ustring;
21037     goto __pyx_L0;
21038 
21039     /* "lupa/_lupa.pyx":1307
21040  *     else:
21041  *         py_ustring = s[:size].decode('ISO-8859-1')
21042  *     if err_message is None:             # <<<<<<<<<<<<<<
21043  *         return py_ustring
21044  *     else:
21045  */
21046   }
21047 
21048   /* "lupa/_lupa.pyx":1310
21049  *         return py_ustring
21050  *     else:
21051  *         return err_message % py_ustring             # <<<<<<<<<<<<<<
21052  *
21053  * # calling into Lua
21054  */
21055   /*else*/ {
21056     __Pyx_XDECREF(__pyx_r);
21057     __pyx_t_10 = __Pyx_PyUnicode_FormatSafe(__pyx_v_err_message, __pyx_v_py_ustring); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1310, __pyx_L1_error)
21058     __Pyx_GOTREF(__pyx_t_10);
21059     __pyx_r = __pyx_t_10;
21060     __pyx_t_10 = 0;
21061     goto __pyx_L0;
21062   }
21063 
21064   /* "lupa/_lupa.pyx":1297
21065  *         raise LuaError( build_lua_error_message(runtime, L, None, -1) )
21066  *
21067  * cdef build_lua_error_message(LuaRuntime runtime, lua_State* L, unicode err_message, int n):             # <<<<<<<<<<<<<<
21068  *     cdef size_t size = 0
21069  *     cdef const char *s = lua.lua_tolstring(L, n, &size)
21070  */
21071 
21072   /* function exit code */
21073   __pyx_L1_error:;
21074   __Pyx_XDECREF(__pyx_t_7);
21075   __Pyx_XDECREF(__pyx_t_9);
21076   __Pyx_XDECREF(__pyx_t_10);
21077   __Pyx_XDECREF(__pyx_t_11);
21078   __Pyx_AddTraceback("lupa._lupa.build_lua_error_message", __pyx_clineno, __pyx_lineno, __pyx_filename);
21079   __pyx_r = 0;
21080   __pyx_L0:;
21081   __Pyx_XDECREF(__pyx_v_py_ustring);
21082   __Pyx_XGIVEREF(__pyx_r);
21083   __Pyx_RefNannyFinishContext();
21084   return __pyx_r;
21085 }
21086 
21087 /* "lupa/_lupa.pyx":1314
21088  * # calling into Lua
21089  *
21090  * cdef run_lua(LuaRuntime runtime, bytes lua_code, tuple args):             # <<<<<<<<<<<<<<
21091  *     # locks the runtime
21092  *     cdef lua_State* L = runtime._state
21093  */
21094 
__pyx_f_4lupa_5_lupa_run_lua(struct __pyx_obj_4lupa_5_lupa_LuaRuntime * __pyx_v_runtime,PyObject * __pyx_v_lua_code,PyObject * __pyx_v_args)21095 static PyObject *__pyx_f_4lupa_5_lupa_run_lua(struct __pyx_obj_4lupa_5_lupa_LuaRuntime *__pyx_v_runtime, PyObject *__pyx_v_lua_code, PyObject *__pyx_v_args) {
21096   lua_State *__pyx_v_L;
21097   int __pyx_v_old_top;
21098   PyObject *__pyx_r = NULL;
21099   __Pyx_RefNannyDeclarations
21100   lua_State *__pyx_t_1;
21101   int __pyx_t_2;
21102   char *__pyx_t_3;
21103   Py_ssize_t __pyx_t_4;
21104   int __pyx_t_5;
21105   PyObject *__pyx_t_6 = NULL;
21106   PyObject *__pyx_t_7 = NULL;
21107   PyObject *__pyx_t_8 = NULL;
21108   PyObject *__pyx_t_9 = NULL;
21109   int __pyx_t_10;
21110   char const *__pyx_t_11;
21111   PyObject *__pyx_t_12 = NULL;
21112   PyObject *__pyx_t_13 = NULL;
21113   PyObject *__pyx_t_14 = NULL;
21114   PyObject *__pyx_t_15 = NULL;
21115   PyObject *__pyx_t_16 = NULL;
21116   PyObject *__pyx_t_17 = NULL;
21117   int __pyx_lineno = 0;
21118   const char *__pyx_filename = NULL;
21119   int __pyx_clineno = 0;
21120   __Pyx_RefNannySetupContext("run_lua", 0);
21121 
21122   /* "lupa/_lupa.pyx":1316
21123  * cdef run_lua(LuaRuntime runtime, bytes lua_code, tuple args):
21124  *     # locks the runtime
21125  *     cdef lua_State* L = runtime._state             # <<<<<<<<<<<<<<
21126  *     cdef bint result
21127  *     lock_runtime(runtime)
21128  */
21129   __pyx_t_1 = __pyx_v_runtime->_state;
21130   __pyx_v_L = __pyx_t_1;
21131 
21132   /* "lupa/_lupa.pyx":1318
21133  *     cdef lua_State* L = runtime._state
21134  *     cdef bint result
21135  *     lock_runtime(runtime)             # <<<<<<<<<<<<<<
21136  *     old_top = lua.lua_gettop(L)
21137  *     try:
21138  */
21139   __pyx_t_2 = __pyx_f_4lupa_5_lupa_lock_runtime(__pyx_v_runtime); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 1318, __pyx_L1_error)
21140 
21141   /* "lupa/_lupa.pyx":1319
21142  *     cdef bint result
21143  *     lock_runtime(runtime)
21144  *     old_top = lua.lua_gettop(L)             # <<<<<<<<<<<<<<
21145  *     try:
21146  *         if lua.luaL_loadbuffer(L, lua_code, len(lua_code), '<python>'):
21147  */
21148   __pyx_v_old_top = lua_gettop(__pyx_v_L);
21149 
21150   /* "lupa/_lupa.pyx":1320
21151  *     lock_runtime(runtime)
21152  *     old_top = lua.lua_gettop(L)
21153  *     try:             # <<<<<<<<<<<<<<
21154  *         if lua.luaL_loadbuffer(L, lua_code, len(lua_code), '<python>'):
21155  *             raise LuaSyntaxError(build_lua_error_message(
21156  */
21157   /*try:*/ {
21158 
21159     /* "lupa/_lupa.pyx":1321
21160  *     old_top = lua.lua_gettop(L)
21161  *     try:
21162  *         if lua.luaL_loadbuffer(L, lua_code, len(lua_code), '<python>'):             # <<<<<<<<<<<<<<
21163  *             raise LuaSyntaxError(build_lua_error_message(
21164  *                 runtime, L, u"error loading code: %s", -1))
21165  */
21166     if (unlikely(__pyx_v_lua_code == Py_None)) {
21167       PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
21168       __PYX_ERR(0, 1321, __pyx_L4_error)
21169     }
21170     __pyx_t_3 = __Pyx_PyBytes_AsWritableString(__pyx_v_lua_code); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) __PYX_ERR(0, 1321, __pyx_L4_error)
21171     if (unlikely(__pyx_v_lua_code == Py_None)) {
21172       PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
21173       __PYX_ERR(0, 1321, __pyx_L4_error)
21174     }
21175     __pyx_t_4 = PyBytes_GET_SIZE(__pyx_v_lua_code); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1321, __pyx_L4_error)
21176     __pyx_t_5 = (luaL_loadbuffer(__pyx_v_L, __pyx_t_3, __pyx_t_4, ((char *)"<python>")) != 0);
21177     if (unlikely(__pyx_t_5)) {
21178 
21179       /* "lupa/_lupa.pyx":1322
21180  *     try:
21181  *         if lua.luaL_loadbuffer(L, lua_code, len(lua_code), '<python>'):
21182  *             raise LuaSyntaxError(build_lua_error_message(             # <<<<<<<<<<<<<<
21183  *                 runtime, L, u"error loading code: %s", -1))
21184  *         return call_lua(runtime, L, args)
21185  */
21186       __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_LuaSyntaxError); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1322, __pyx_L4_error)
21187       __Pyx_GOTREF(__pyx_t_7);
21188 
21189       /* "lupa/_lupa.pyx":1323
21190  *         if lua.luaL_loadbuffer(L, lua_code, len(lua_code), '<python>'):
21191  *             raise LuaSyntaxError(build_lua_error_message(
21192  *                 runtime, L, u"error loading code: %s", -1))             # <<<<<<<<<<<<<<
21193  *         return call_lua(runtime, L, args)
21194  *     finally:
21195  */
21196       __pyx_t_8 = __pyx_f_4lupa_5_lupa_build_lua_error_message(__pyx_v_runtime, __pyx_v_L, __pyx_kp_u_error_loading_code_s, -1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1322, __pyx_L4_error)
21197       __Pyx_GOTREF(__pyx_t_8);
21198       __pyx_t_9 = NULL;
21199       if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
21200         __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_7);
21201         if (likely(__pyx_t_9)) {
21202           PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
21203           __Pyx_INCREF(__pyx_t_9);
21204           __Pyx_INCREF(function);
21205           __Pyx_DECREF_SET(__pyx_t_7, function);
21206         }
21207       }
21208       __pyx_t_6 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_9, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_8);
21209       __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
21210       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
21211       if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1322, __pyx_L4_error)
21212       __Pyx_GOTREF(__pyx_t_6);
21213       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
21214       __Pyx_Raise(__pyx_t_6, 0, 0, 0);
21215       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
21216       __PYX_ERR(0, 1322, __pyx_L4_error)
21217 
21218       /* "lupa/_lupa.pyx":1321
21219  *     old_top = lua.lua_gettop(L)
21220  *     try:
21221  *         if lua.luaL_loadbuffer(L, lua_code, len(lua_code), '<python>'):             # <<<<<<<<<<<<<<
21222  *             raise LuaSyntaxError(build_lua_error_message(
21223  *                 runtime, L, u"error loading code: %s", -1))
21224  */
21225     }
21226 
21227     /* "lupa/_lupa.pyx":1324
21228  *             raise LuaSyntaxError(build_lua_error_message(
21229  *                 runtime, L, u"error loading code: %s", -1))
21230  *         return call_lua(runtime, L, args)             # <<<<<<<<<<<<<<
21231  *     finally:
21232  *         lua.lua_settop(L, old_top)
21233  */
21234     __Pyx_XDECREF(__pyx_r);
21235     __pyx_t_6 = __pyx_f_4lupa_5_lupa_call_lua(__pyx_v_runtime, __pyx_v_L, __pyx_v_args); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1324, __pyx_L4_error)
21236     __Pyx_GOTREF(__pyx_t_6);
21237     __pyx_r = __pyx_t_6;
21238     __pyx_t_6 = 0;
21239     goto __pyx_L3_return;
21240   }
21241 
21242   /* "lupa/_lupa.pyx":1326
21243  *         return call_lua(runtime, L, args)
21244  *     finally:
21245  *         lua.lua_settop(L, old_top)             # <<<<<<<<<<<<<<
21246  *         unlock_runtime(runtime)
21247  *
21248  */
21249   /*finally:*/ {
21250     __pyx_L4_error:;
21251     /*exception exit:*/{
21252       __Pyx_PyThreadState_declare
21253       __Pyx_PyThreadState_assign
21254       __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0;
21255       __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
21256       __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
21257       __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
21258       __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
21259       if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_15, &__pyx_t_16, &__pyx_t_17);
21260       if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14) < 0)) __Pyx_ErrFetch(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14);
21261       __Pyx_XGOTREF(__pyx_t_12);
21262       __Pyx_XGOTREF(__pyx_t_13);
21263       __Pyx_XGOTREF(__pyx_t_14);
21264       __Pyx_XGOTREF(__pyx_t_15);
21265       __Pyx_XGOTREF(__pyx_t_16);
21266       __Pyx_XGOTREF(__pyx_t_17);
21267       __pyx_t_2 = __pyx_lineno; __pyx_t_10 = __pyx_clineno; __pyx_t_11 = __pyx_filename;
21268       {
21269         lua_settop(__pyx_v_L, __pyx_v_old_top);
21270 
21271         /* "lupa/_lupa.pyx":1327
21272  *     finally:
21273  *         lua.lua_settop(L, old_top)
21274  *         unlock_runtime(runtime)             # <<<<<<<<<<<<<<
21275  *
21276  * cdef call_lua(LuaRuntime runtime, lua_State *L, tuple args):
21277  */
21278         __pyx_f_4lupa_5_lupa_unlock_runtime(__pyx_v_runtime);
21279       }
21280       if (PY_MAJOR_VERSION >= 3) {
21281         __Pyx_XGIVEREF(__pyx_t_15);
21282         __Pyx_XGIVEREF(__pyx_t_16);
21283         __Pyx_XGIVEREF(__pyx_t_17);
21284         __Pyx_ExceptionReset(__pyx_t_15, __pyx_t_16, __pyx_t_17);
21285       }
21286       __Pyx_XGIVEREF(__pyx_t_12);
21287       __Pyx_XGIVEREF(__pyx_t_13);
21288       __Pyx_XGIVEREF(__pyx_t_14);
21289       __Pyx_ErrRestore(__pyx_t_12, __pyx_t_13, __pyx_t_14);
21290       __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0;
21291       __pyx_lineno = __pyx_t_2; __pyx_clineno = __pyx_t_10; __pyx_filename = __pyx_t_11;
21292       goto __pyx_L1_error;
21293     }
21294     __pyx_L3_return: {
21295       __pyx_t_17 = __pyx_r;
21296       __pyx_r = 0;
21297 
21298       /* "lupa/_lupa.pyx":1326
21299  *         return call_lua(runtime, L, args)
21300  *     finally:
21301  *         lua.lua_settop(L, old_top)             # <<<<<<<<<<<<<<
21302  *         unlock_runtime(runtime)
21303  *
21304  */
21305       lua_settop(__pyx_v_L, __pyx_v_old_top);
21306 
21307       /* "lupa/_lupa.pyx":1327
21308  *     finally:
21309  *         lua.lua_settop(L, old_top)
21310  *         unlock_runtime(runtime)             # <<<<<<<<<<<<<<
21311  *
21312  * cdef call_lua(LuaRuntime runtime, lua_State *L, tuple args):
21313  */
21314       __pyx_f_4lupa_5_lupa_unlock_runtime(__pyx_v_runtime);
21315       __pyx_r = __pyx_t_17;
21316       __pyx_t_17 = 0;
21317       goto __pyx_L0;
21318     }
21319   }
21320 
21321   /* "lupa/_lupa.pyx":1314
21322  * # calling into Lua
21323  *
21324  * cdef run_lua(LuaRuntime runtime, bytes lua_code, tuple args):             # <<<<<<<<<<<<<<
21325  *     # locks the runtime
21326  *     cdef lua_State* L = runtime._state
21327  */
21328 
21329   /* function exit code */
21330   __pyx_L1_error:;
21331   __Pyx_XDECREF(__pyx_t_6);
21332   __Pyx_XDECREF(__pyx_t_7);
21333   __Pyx_XDECREF(__pyx_t_8);
21334   __Pyx_XDECREF(__pyx_t_9);
21335   __Pyx_AddTraceback("lupa._lupa.run_lua", __pyx_clineno, __pyx_lineno, __pyx_filename);
21336   __pyx_r = 0;
21337   __pyx_L0:;
21338   __Pyx_XGIVEREF(__pyx_r);
21339   __Pyx_RefNannyFinishContext();
21340   return __pyx_r;
21341 }
21342 
21343 /* "lupa/_lupa.pyx":1329
21344  *         unlock_runtime(runtime)
21345  *
21346  * cdef call_lua(LuaRuntime runtime, lua_State *L, tuple args):             # <<<<<<<<<<<<<<
21347  *     # does not lock the runtime!
21348  *     # does not clean up the stack!
21349  */
21350 
__pyx_f_4lupa_5_lupa_call_lua(struct __pyx_obj_4lupa_5_lupa_LuaRuntime * __pyx_v_runtime,lua_State * __pyx_v_L,PyObject * __pyx_v_args)21351 static PyObject *__pyx_f_4lupa_5_lupa_call_lua(struct __pyx_obj_4lupa_5_lupa_LuaRuntime *__pyx_v_runtime, lua_State *__pyx_v_L, PyObject *__pyx_v_args) {
21352   PyObject *__pyx_r = NULL;
21353   __Pyx_RefNannyDeclarations
21354   int __pyx_t_1;
21355   Py_ssize_t __pyx_t_2;
21356   PyObject *__pyx_t_3 = NULL;
21357   int __pyx_lineno = 0;
21358   const char *__pyx_filename = NULL;
21359   int __pyx_clineno = 0;
21360   __Pyx_RefNannySetupContext("call_lua", 0);
21361 
21362   /* "lupa/_lupa.pyx":1332
21363  *     # does not lock the runtime!
21364  *     # does not clean up the stack!
21365  *     push_lua_arguments(runtime, L, args)             # <<<<<<<<<<<<<<
21366  *     return execute_lua_call(runtime, L, len(args))
21367  *
21368  */
21369   __pyx_t_1 = __pyx_f_4lupa_5_lupa_push_lua_arguments(__pyx_v_runtime, __pyx_v_L, __pyx_v_args, NULL); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 1332, __pyx_L1_error)
21370 
21371   /* "lupa/_lupa.pyx":1333
21372  *     # does not clean up the stack!
21373  *     push_lua_arguments(runtime, L, args)
21374  *     return execute_lua_call(runtime, L, len(args))             # <<<<<<<<<<<<<<
21375  *
21376  * cdef object execute_lua_call(LuaRuntime runtime, lua_State *L, Py_ssize_t nargs):
21377  */
21378   __Pyx_XDECREF(__pyx_r);
21379   if (unlikely(__pyx_v_args == Py_None)) {
21380     PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
21381     __PYX_ERR(0, 1333, __pyx_L1_error)
21382   }
21383   __pyx_t_2 = PyTuple_GET_SIZE(__pyx_v_args); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1333, __pyx_L1_error)
21384   __pyx_t_3 = __pyx_f_4lupa_5_lupa_execute_lua_call(__pyx_v_runtime, __pyx_v_L, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1333, __pyx_L1_error)
21385   __Pyx_GOTREF(__pyx_t_3);
21386   __pyx_r = __pyx_t_3;
21387   __pyx_t_3 = 0;
21388   goto __pyx_L0;
21389 
21390   /* "lupa/_lupa.pyx":1329
21391  *         unlock_runtime(runtime)
21392  *
21393  * cdef call_lua(LuaRuntime runtime, lua_State *L, tuple args):             # <<<<<<<<<<<<<<
21394  *     # does not lock the runtime!
21395  *     # does not clean up the stack!
21396  */
21397 
21398   /* function exit code */
21399   __pyx_L1_error:;
21400   __Pyx_XDECREF(__pyx_t_3);
21401   __Pyx_AddTraceback("lupa._lupa.call_lua", __pyx_clineno, __pyx_lineno, __pyx_filename);
21402   __pyx_r = 0;
21403   __pyx_L0:;
21404   __Pyx_XGIVEREF(__pyx_r);
21405   __Pyx_RefNannyFinishContext();
21406   return __pyx_r;
21407 }
21408 
21409 /* "lupa/_lupa.pyx":1335
21410  *     return execute_lua_call(runtime, L, len(args))
21411  *
21412  * cdef object execute_lua_call(LuaRuntime runtime, lua_State *L, Py_ssize_t nargs):             # <<<<<<<<<<<<<<
21413  *     cdef int result_status
21414  *     cdef object result
21415  */
21416 
__pyx_f_4lupa_5_lupa_execute_lua_call(struct __pyx_obj_4lupa_5_lupa_LuaRuntime * __pyx_v_runtime,lua_State * __pyx_v_L,Py_ssize_t __pyx_v_nargs)21417 static PyObject *__pyx_f_4lupa_5_lupa_execute_lua_call(struct __pyx_obj_4lupa_5_lupa_LuaRuntime *__pyx_v_runtime, lua_State *__pyx_v_L, Py_ssize_t __pyx_v_nargs) {
21418   int __pyx_v_result_status;
21419   int __pyx_v_errfunc;
21420   PyObject *__pyx_v_results = NULL;
21421   PyObject *__pyx_r = NULL;
21422   __Pyx_RefNannyDeclarations
21423   int __pyx_t_1;
21424   PyObject *__pyx_t_2 = NULL;
21425   int __pyx_t_3;
21426   int __pyx_t_4;
21427   int __pyx_lineno = 0;
21428   const char *__pyx_filename = NULL;
21429   int __pyx_clineno = 0;
21430   __Pyx_RefNannySetupContext("execute_lua_call", 0);
21431 
21432   /* "lupa/_lupa.pyx":1339
21433  *     cdef object result
21434  *     # call into Lua
21435  *     cdef int errfunc = 0             # <<<<<<<<<<<<<<
21436  *     with nogil:
21437  *         lua.lua_getglobal(L, "debug")
21438  */
21439   __pyx_v_errfunc = 0;
21440 
21441   /* "lupa/_lupa.pyx":1340
21442  *     # call into Lua
21443  *     cdef int errfunc = 0
21444  *     with nogil:             # <<<<<<<<<<<<<<
21445  *         lua.lua_getglobal(L, "debug")
21446  *         if not lua.lua_istable(L, -1):
21447  */
21448   {
21449       #ifdef WITH_THREAD
21450       PyThreadState *_save;
21451       Py_UNBLOCK_THREADS
21452       __Pyx_FastGIL_Remember();
21453       #endif
21454       /*try:*/ {
21455 
21456         /* "lupa/_lupa.pyx":1341
21457  *     cdef int errfunc = 0
21458  *     with nogil:
21459  *         lua.lua_getglobal(L, "debug")             # <<<<<<<<<<<<<<
21460  *         if not lua.lua_istable(L, -1):
21461  *             lua.lua_pop(L, 1)
21462  */
21463         lua_getglobal(__pyx_v_L, ((char *)"debug"));
21464 
21465         /* "lupa/_lupa.pyx":1342
21466  *     with nogil:
21467  *         lua.lua_getglobal(L, "debug")
21468  *         if not lua.lua_istable(L, -1):             # <<<<<<<<<<<<<<
21469  *             lua.lua_pop(L, 1)
21470  *         else:
21471  */
21472         __pyx_t_1 = ((!(lua_istable(__pyx_v_L, -1) != 0)) != 0);
21473         if (__pyx_t_1) {
21474 
21475           /* "lupa/_lupa.pyx":1343
21476  *         lua.lua_getglobal(L, "debug")
21477  *         if not lua.lua_istable(L, -1):
21478  *             lua.lua_pop(L, 1)             # <<<<<<<<<<<<<<
21479  *         else:
21480  *             lua.lua_getfield(L, -1, "traceback")
21481  */
21482           lua_pop(__pyx_v_L, 1);
21483 
21484           /* "lupa/_lupa.pyx":1342
21485  *     with nogil:
21486  *         lua.lua_getglobal(L, "debug")
21487  *         if not lua.lua_istable(L, -1):             # <<<<<<<<<<<<<<
21488  *             lua.lua_pop(L, 1)
21489  *         else:
21490  */
21491           goto __pyx_L6;
21492         }
21493 
21494         /* "lupa/_lupa.pyx":1345
21495  *             lua.lua_pop(L, 1)
21496  *         else:
21497  *             lua.lua_getfield(L, -1, "traceback")             # <<<<<<<<<<<<<<
21498  *             if not lua.lua_isfunction(L, -1):
21499  *                 lua.lua_pop(L, 2)
21500  */
21501         /*else*/ {
21502           lua_getfield(__pyx_v_L, -1, ((char *)"traceback"));
21503 
21504           /* "lupa/_lupa.pyx":1346
21505  *         else:
21506  *             lua.lua_getfield(L, -1, "traceback")
21507  *             if not lua.lua_isfunction(L, -1):             # <<<<<<<<<<<<<<
21508  *                 lua.lua_pop(L, 2)
21509  *             else:
21510  */
21511           __pyx_t_1 = ((!(lua_isfunction(__pyx_v_L, -1) != 0)) != 0);
21512           if (__pyx_t_1) {
21513 
21514             /* "lupa/_lupa.pyx":1347
21515  *             lua.lua_getfield(L, -1, "traceback")
21516  *             if not lua.lua_isfunction(L, -1):
21517  *                 lua.lua_pop(L, 2)             # <<<<<<<<<<<<<<
21518  *             else:
21519  *                 lua.lua_replace(L, -2)
21520  */
21521             lua_pop(__pyx_v_L, 2);
21522 
21523             /* "lupa/_lupa.pyx":1346
21524  *         else:
21525  *             lua.lua_getfield(L, -1, "traceback")
21526  *             if not lua.lua_isfunction(L, -1):             # <<<<<<<<<<<<<<
21527  *                 lua.lua_pop(L, 2)
21528  *             else:
21529  */
21530             goto __pyx_L7;
21531           }
21532 
21533           /* "lupa/_lupa.pyx":1349
21534  *                 lua.lua_pop(L, 2)
21535  *             else:
21536  *                 lua.lua_replace(L, -2)             # <<<<<<<<<<<<<<
21537  *                 lua.lua_insert(L, 1)
21538  *                 errfunc = 1
21539  */
21540           /*else*/ {
21541             lua_replace(__pyx_v_L, -2);
21542 
21543             /* "lupa/_lupa.pyx":1350
21544  *             else:
21545  *                 lua.lua_replace(L, -2)
21546  *                 lua.lua_insert(L, 1)             # <<<<<<<<<<<<<<
21547  *                 errfunc = 1
21548  *         result_status = lua.lua_pcall(L, nargs, lua.LUA_MULTRET, errfunc)
21549  */
21550             lua_insert(__pyx_v_L, 1);
21551 
21552             /* "lupa/_lupa.pyx":1351
21553  *                 lua.lua_replace(L, -2)
21554  *                 lua.lua_insert(L, 1)
21555  *                 errfunc = 1             # <<<<<<<<<<<<<<
21556  *         result_status = lua.lua_pcall(L, nargs, lua.LUA_MULTRET, errfunc)
21557  *         if errfunc:
21558  */
21559             __pyx_v_errfunc = 1;
21560           }
21561           __pyx_L7:;
21562         }
21563         __pyx_L6:;
21564 
21565         /* "lupa/_lupa.pyx":1352
21566  *                 lua.lua_insert(L, 1)
21567  *                 errfunc = 1
21568  *         result_status = lua.lua_pcall(L, nargs, lua.LUA_MULTRET, errfunc)             # <<<<<<<<<<<<<<
21569  *         if errfunc:
21570  *             lua.lua_remove(L, 1)
21571  */
21572         __pyx_v_result_status = lua_pcall(__pyx_v_L, __pyx_v_nargs, LUA_MULTRET, __pyx_v_errfunc);
21573 
21574         /* "lupa/_lupa.pyx":1353
21575  *                 errfunc = 1
21576  *         result_status = lua.lua_pcall(L, nargs, lua.LUA_MULTRET, errfunc)
21577  *         if errfunc:             # <<<<<<<<<<<<<<
21578  *             lua.lua_remove(L, 1)
21579  *     results = unpack_lua_results(runtime, L)
21580  */
21581         __pyx_t_1 = (__pyx_v_errfunc != 0);
21582         if (__pyx_t_1) {
21583 
21584           /* "lupa/_lupa.pyx":1354
21585  *         result_status = lua.lua_pcall(L, nargs, lua.LUA_MULTRET, errfunc)
21586  *         if errfunc:
21587  *             lua.lua_remove(L, 1)             # <<<<<<<<<<<<<<
21588  *     results = unpack_lua_results(runtime, L)
21589  *     if result_status:
21590  */
21591           lua_remove(__pyx_v_L, 1);
21592 
21593           /* "lupa/_lupa.pyx":1353
21594  *                 errfunc = 1
21595  *         result_status = lua.lua_pcall(L, nargs, lua.LUA_MULTRET, errfunc)
21596  *         if errfunc:             # <<<<<<<<<<<<<<
21597  *             lua.lua_remove(L, 1)
21598  *     results = unpack_lua_results(runtime, L)
21599  */
21600         }
21601       }
21602 
21603       /* "lupa/_lupa.pyx":1340
21604  *     # call into Lua
21605  *     cdef int errfunc = 0
21606  *     with nogil:             # <<<<<<<<<<<<<<
21607  *         lua.lua_getglobal(L, "debug")
21608  *         if not lua.lua_istable(L, -1):
21609  */
21610       /*finally:*/ {
21611         /*normal exit:*/{
21612           #ifdef WITH_THREAD
21613           __Pyx_FastGIL_Forget();
21614           Py_BLOCK_THREADS
21615           #endif
21616           goto __pyx_L5;
21617         }
21618         __pyx_L5:;
21619       }
21620   }
21621 
21622   /* "lupa/_lupa.pyx":1355
21623  *         if errfunc:
21624  *             lua.lua_remove(L, 1)
21625  *     results = unpack_lua_results(runtime, L)             # <<<<<<<<<<<<<<
21626  *     if result_status:
21627  *         if isinstance(results, BaseException):
21628  */
21629   __pyx_t_2 = __pyx_f_4lupa_5_lupa_unpack_lua_results(__pyx_v_runtime, __pyx_v_L); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1355, __pyx_L1_error)
21630   __Pyx_GOTREF(__pyx_t_2);
21631   __pyx_v_results = __pyx_t_2;
21632   __pyx_t_2 = 0;
21633 
21634   /* "lupa/_lupa.pyx":1356
21635  *             lua.lua_remove(L, 1)
21636  *     results = unpack_lua_results(runtime, L)
21637  *     if result_status:             # <<<<<<<<<<<<<<
21638  *         if isinstance(results, BaseException):
21639  *             runtime.reraise_on_exception()
21640  */
21641   __pyx_t_1 = (__pyx_v_result_status != 0);
21642   if (__pyx_t_1) {
21643 
21644     /* "lupa/_lupa.pyx":1357
21645  *     results = unpack_lua_results(runtime, L)
21646  *     if result_status:
21647  *         if isinstance(results, BaseException):             # <<<<<<<<<<<<<<
21648  *             runtime.reraise_on_exception()
21649  *         raise_lua_error(runtime, L, result_status)
21650  */
21651     __pyx_t_1 = PyObject_IsInstance(__pyx_v_results, __pyx_builtin_BaseException); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 1357, __pyx_L1_error)
21652     __pyx_t_3 = (__pyx_t_1 != 0);
21653     if (__pyx_t_3) {
21654 
21655       /* "lupa/_lupa.pyx":1358
21656  *     if result_status:
21657  *         if isinstance(results, BaseException):
21658  *             runtime.reraise_on_exception()             # <<<<<<<<<<<<<<
21659  *         raise_lua_error(runtime, L, result_status)
21660  *     return results
21661  */
21662       __pyx_t_4 = __pyx_f_4lupa_5_lupa_10LuaRuntime_reraise_on_exception(__pyx_v_runtime); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 1358, __pyx_L1_error)
21663 
21664       /* "lupa/_lupa.pyx":1357
21665  *     results = unpack_lua_results(runtime, L)
21666  *     if result_status:
21667  *         if isinstance(results, BaseException):             # <<<<<<<<<<<<<<
21668  *             runtime.reraise_on_exception()
21669  *         raise_lua_error(runtime, L, result_status)
21670  */
21671     }
21672 
21673     /* "lupa/_lupa.pyx":1359
21674  *         if isinstance(results, BaseException):
21675  *             runtime.reraise_on_exception()
21676  *         raise_lua_error(runtime, L, result_status)             # <<<<<<<<<<<<<<
21677  *     return results
21678  *
21679  */
21680     __pyx_t_4 = __pyx_f_4lupa_5_lupa_raise_lua_error(__pyx_v_runtime, __pyx_v_L, __pyx_v_result_status); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 1359, __pyx_L1_error)
21681 
21682     /* "lupa/_lupa.pyx":1356
21683  *             lua.lua_remove(L, 1)
21684  *     results = unpack_lua_results(runtime, L)
21685  *     if result_status:             # <<<<<<<<<<<<<<
21686  *         if isinstance(results, BaseException):
21687  *             runtime.reraise_on_exception()
21688  */
21689   }
21690 
21691   /* "lupa/_lupa.pyx":1360
21692  *             runtime.reraise_on_exception()
21693  *         raise_lua_error(runtime, L, result_status)
21694  *     return results             # <<<<<<<<<<<<<<
21695  *
21696  * cdef int push_lua_arguments(LuaRuntime runtime, lua_State *L,
21697  */
21698   __Pyx_XDECREF(__pyx_r);
21699   __Pyx_INCREF(__pyx_v_results);
21700   __pyx_r = __pyx_v_results;
21701   goto __pyx_L0;
21702 
21703   /* "lupa/_lupa.pyx":1335
21704  *     return execute_lua_call(runtime, L, len(args))
21705  *
21706  * cdef object execute_lua_call(LuaRuntime runtime, lua_State *L, Py_ssize_t nargs):             # <<<<<<<<<<<<<<
21707  *     cdef int result_status
21708  *     cdef object result
21709  */
21710 
21711   /* function exit code */
21712   __pyx_L1_error:;
21713   __Pyx_XDECREF(__pyx_t_2);
21714   __Pyx_AddTraceback("lupa._lupa.execute_lua_call", __pyx_clineno, __pyx_lineno, __pyx_filename);
21715   __pyx_r = 0;
21716   __pyx_L0:;
21717   __Pyx_XDECREF(__pyx_v_results);
21718   __Pyx_XGIVEREF(__pyx_r);
21719   __Pyx_RefNannyFinishContext();
21720   return __pyx_r;
21721 }
21722 
21723 /* "lupa/_lupa.pyx":1362
21724  *     return results
21725  *
21726  * cdef int push_lua_arguments(LuaRuntime runtime, lua_State *L,             # <<<<<<<<<<<<<<
21727  *                             tuple args, bint first_may_be_nil=True) except -1:
21728  *     cdef int i
21729  */
21730 
__pyx_f_4lupa_5_lupa_push_lua_arguments(struct __pyx_obj_4lupa_5_lupa_LuaRuntime * __pyx_v_runtime,lua_State * __pyx_v_L,PyObject * __pyx_v_args,struct __pyx_opt_args_4lupa_5_lupa_push_lua_arguments * __pyx_optional_args)21731 static int __pyx_f_4lupa_5_lupa_push_lua_arguments(struct __pyx_obj_4lupa_5_lupa_LuaRuntime *__pyx_v_runtime, lua_State *__pyx_v_L, PyObject *__pyx_v_args, struct __pyx_opt_args_4lupa_5_lupa_push_lua_arguments *__pyx_optional_args) {
21732 
21733   /* "lupa/_lupa.pyx":1363
21734  *
21735  * cdef int push_lua_arguments(LuaRuntime runtime, lua_State *L,
21736  *                             tuple args, bint first_may_be_nil=True) except -1:             # <<<<<<<<<<<<<<
21737  *     cdef int i
21738  *     if args:
21739  */
21740   int __pyx_v_first_may_be_nil = ((int)1);
21741   int __pyx_v_i;
21742   int __pyx_v_old_top;
21743   PyObject *__pyx_v_arg = NULL;
21744   int __pyx_r;
21745   __Pyx_RefNannyDeclarations
21746   int __pyx_t_1;
21747   int __pyx_t_2;
21748   PyObject *__pyx_t_3 = NULL;
21749   Py_ssize_t __pyx_t_4;
21750   PyObject *__pyx_t_5 = NULL;
21751   int __pyx_t_6;
21752   struct __pyx_opt_args_4lupa_5_lupa_py_to_lua __pyx_t_7;
21753   PyObject *__pyx_t_8 = NULL;
21754   int __pyx_lineno = 0;
21755   const char *__pyx_filename = NULL;
21756   int __pyx_clineno = 0;
21757   __Pyx_RefNannySetupContext("push_lua_arguments", 0);
21758   if (__pyx_optional_args) {
21759     if (__pyx_optional_args->__pyx_n > 0) {
21760       __pyx_v_first_may_be_nil = __pyx_optional_args->first_may_be_nil;
21761     }
21762   }
21763 
21764   /* "lupa/_lupa.pyx":1365
21765  *                             tuple args, bint first_may_be_nil=True) except -1:
21766  *     cdef int i
21767  *     if args:             # <<<<<<<<<<<<<<
21768  *         old_top = lua.lua_gettop(L)
21769  *         for i, arg in enumerate(args):
21770  */
21771   __pyx_t_1 = (__pyx_v_args != Py_None)&&(PyTuple_GET_SIZE(__pyx_v_args) != 0);
21772   if (__pyx_t_1) {
21773 
21774     /* "lupa/_lupa.pyx":1366
21775  *     cdef int i
21776  *     if args:
21777  *         old_top = lua.lua_gettop(L)             # <<<<<<<<<<<<<<
21778  *         for i, arg in enumerate(args):
21779  *             if not py_to_lua(runtime, L, arg, wrap_none=not first_may_be_nil):
21780  */
21781     __pyx_v_old_top = lua_gettop(__pyx_v_L);
21782 
21783     /* "lupa/_lupa.pyx":1367
21784  *     if args:
21785  *         old_top = lua.lua_gettop(L)
21786  *         for i, arg in enumerate(args):             # <<<<<<<<<<<<<<
21787  *             if not py_to_lua(runtime, L, arg, wrap_none=not first_may_be_nil):
21788  *                 lua.lua_settop(L, old_top)
21789  */
21790     __pyx_t_2 = 0;
21791     __pyx_t_3 = __pyx_v_args; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0;
21792     for (;;) {
21793       if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
21794       #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
21795       __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_5); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 1367, __pyx_L1_error)
21796       #else
21797       __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1367, __pyx_L1_error)
21798       __Pyx_GOTREF(__pyx_t_5);
21799       #endif
21800       __Pyx_XDECREF_SET(__pyx_v_arg, __pyx_t_5);
21801       __pyx_t_5 = 0;
21802       __pyx_v_i = __pyx_t_2;
21803       __pyx_t_2 = (__pyx_t_2 + 1);
21804 
21805       /* "lupa/_lupa.pyx":1368
21806  *         old_top = lua.lua_gettop(L)
21807  *         for i, arg in enumerate(args):
21808  *             if not py_to_lua(runtime, L, arg, wrap_none=not first_may_be_nil):             # <<<<<<<<<<<<<<
21809  *                 lua.lua_settop(L, old_top)
21810  *                 raise TypeError("failed to convert argument at index %d" % i)
21811  */
21812       __pyx_t_7.__pyx_n = 1;
21813       __pyx_t_7.wrap_none = (!(__pyx_v_first_may_be_nil != 0));
21814       __pyx_t_6 = __pyx_f_4lupa_5_lupa_py_to_lua(__pyx_v_runtime, __pyx_v_L, __pyx_v_arg, &__pyx_t_7); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 1368, __pyx_L1_error)
21815       __pyx_t_1 = ((!(__pyx_t_6 != 0)) != 0);
21816       if (unlikely(__pyx_t_1)) {
21817 
21818         /* "lupa/_lupa.pyx":1369
21819  *         for i, arg in enumerate(args):
21820  *             if not py_to_lua(runtime, L, arg, wrap_none=not first_may_be_nil):
21821  *                 lua.lua_settop(L, old_top)             # <<<<<<<<<<<<<<
21822  *                 raise TypeError("failed to convert argument at index %d" % i)
21823  *             first_may_be_nil = True
21824  */
21825         lua_settop(__pyx_v_L, __pyx_v_old_top);
21826 
21827         /* "lupa/_lupa.pyx":1370
21828  *             if not py_to_lua(runtime, L, arg, wrap_none=not first_may_be_nil):
21829  *                 lua.lua_settop(L, old_top)
21830  *                 raise TypeError("failed to convert argument at index %d" % i)             # <<<<<<<<<<<<<<
21831  *             first_may_be_nil = True
21832  *     return 0
21833  */
21834         __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1370, __pyx_L1_error)
21835         __Pyx_GOTREF(__pyx_t_5);
21836         __pyx_t_8 = __Pyx_PyString_Format(__pyx_kp_s_failed_to_convert_argument_at_in, __pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1370, __pyx_L1_error)
21837         __Pyx_GOTREF(__pyx_t_8);
21838         __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
21839         __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1370, __pyx_L1_error)
21840         __Pyx_GOTREF(__pyx_t_5);
21841         __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
21842         __Pyx_Raise(__pyx_t_5, 0, 0, 0);
21843         __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
21844         __PYX_ERR(0, 1370, __pyx_L1_error)
21845 
21846         /* "lupa/_lupa.pyx":1368
21847  *         old_top = lua.lua_gettop(L)
21848  *         for i, arg in enumerate(args):
21849  *             if not py_to_lua(runtime, L, arg, wrap_none=not first_may_be_nil):             # <<<<<<<<<<<<<<
21850  *                 lua.lua_settop(L, old_top)
21851  *                 raise TypeError("failed to convert argument at index %d" % i)
21852  */
21853       }
21854 
21855       /* "lupa/_lupa.pyx":1371
21856  *                 lua.lua_settop(L, old_top)
21857  *                 raise TypeError("failed to convert argument at index %d" % i)
21858  *             first_may_be_nil = True             # <<<<<<<<<<<<<<
21859  *     return 0
21860  *
21861  */
21862       __pyx_v_first_may_be_nil = 1;
21863 
21864       /* "lupa/_lupa.pyx":1367
21865  *     if args:
21866  *         old_top = lua.lua_gettop(L)
21867  *         for i, arg in enumerate(args):             # <<<<<<<<<<<<<<
21868  *             if not py_to_lua(runtime, L, arg, wrap_none=not first_may_be_nil):
21869  *                 lua.lua_settop(L, old_top)
21870  */
21871     }
21872     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
21873 
21874     /* "lupa/_lupa.pyx":1365
21875  *                             tuple args, bint first_may_be_nil=True) except -1:
21876  *     cdef int i
21877  *     if args:             # <<<<<<<<<<<<<<
21878  *         old_top = lua.lua_gettop(L)
21879  *         for i, arg in enumerate(args):
21880  */
21881   }
21882 
21883   /* "lupa/_lupa.pyx":1372
21884  *                 raise TypeError("failed to convert argument at index %d" % i)
21885  *             first_may_be_nil = True
21886  *     return 0             # <<<<<<<<<<<<<<
21887  *
21888  * cdef inline object unpack_lua_results(LuaRuntime runtime, lua_State *L):
21889  */
21890   __pyx_r = 0;
21891   goto __pyx_L0;
21892 
21893   /* "lupa/_lupa.pyx":1362
21894  *     return results
21895  *
21896  * cdef int push_lua_arguments(LuaRuntime runtime, lua_State *L,             # <<<<<<<<<<<<<<
21897  *                             tuple args, bint first_may_be_nil=True) except -1:
21898  *     cdef int i
21899  */
21900 
21901   /* function exit code */
21902   __pyx_L1_error:;
21903   __Pyx_XDECREF(__pyx_t_3);
21904   __Pyx_XDECREF(__pyx_t_5);
21905   __Pyx_XDECREF(__pyx_t_8);
21906   __Pyx_AddTraceback("lupa._lupa.push_lua_arguments", __pyx_clineno, __pyx_lineno, __pyx_filename);
21907   __pyx_r = -1;
21908   __pyx_L0:;
21909   __Pyx_XDECREF(__pyx_v_arg);
21910   __Pyx_RefNannyFinishContext();
21911   return __pyx_r;
21912 }
21913 
21914 /* "lupa/_lupa.pyx":1374
21915  *     return 0
21916  *
21917  * cdef inline object unpack_lua_results(LuaRuntime runtime, lua_State *L):             # <<<<<<<<<<<<<<
21918  *     cdef int nargs = lua.lua_gettop(L)
21919  *     if nargs == 1:
21920  */
21921 
__pyx_f_4lupa_5_lupa_unpack_lua_results(struct __pyx_obj_4lupa_5_lupa_LuaRuntime * __pyx_v_runtime,lua_State * __pyx_v_L)21922 static CYTHON_INLINE PyObject *__pyx_f_4lupa_5_lupa_unpack_lua_results(struct __pyx_obj_4lupa_5_lupa_LuaRuntime *__pyx_v_runtime, lua_State *__pyx_v_L) {
21923   int __pyx_v_nargs;
21924   PyObject *__pyx_r = NULL;
21925   __Pyx_RefNannyDeclarations
21926   int __pyx_t_1;
21927   PyObject *__pyx_t_2 = NULL;
21928   int __pyx_lineno = 0;
21929   const char *__pyx_filename = NULL;
21930   int __pyx_clineno = 0;
21931   __Pyx_RefNannySetupContext("unpack_lua_results", 0);
21932 
21933   /* "lupa/_lupa.pyx":1375
21934  *
21935  * cdef inline object unpack_lua_results(LuaRuntime runtime, lua_State *L):
21936  *     cdef int nargs = lua.lua_gettop(L)             # <<<<<<<<<<<<<<
21937  *     if nargs == 1:
21938  *         return py_from_lua(runtime, L, 1)
21939  */
21940   __pyx_v_nargs = lua_gettop(__pyx_v_L);
21941 
21942   /* "lupa/_lupa.pyx":1376
21943  * cdef inline object unpack_lua_results(LuaRuntime runtime, lua_State *L):
21944  *     cdef int nargs = lua.lua_gettop(L)
21945  *     if nargs == 1:             # <<<<<<<<<<<<<<
21946  *         return py_from_lua(runtime, L, 1)
21947  *     if nargs == 0:
21948  */
21949   __pyx_t_1 = ((__pyx_v_nargs == 1) != 0);
21950   if (__pyx_t_1) {
21951 
21952     /* "lupa/_lupa.pyx":1377
21953  *     cdef int nargs = lua.lua_gettop(L)
21954  *     if nargs == 1:
21955  *         return py_from_lua(runtime, L, 1)             # <<<<<<<<<<<<<<
21956  *     if nargs == 0:
21957  *         return None
21958  */
21959     __Pyx_XDECREF(__pyx_r);
21960     __pyx_t_2 = __pyx_f_4lupa_5_lupa_py_from_lua(__pyx_v_runtime, __pyx_v_L, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1377, __pyx_L1_error)
21961     __Pyx_GOTREF(__pyx_t_2);
21962     __pyx_r = __pyx_t_2;
21963     __pyx_t_2 = 0;
21964     goto __pyx_L0;
21965 
21966     /* "lupa/_lupa.pyx":1376
21967  * cdef inline object unpack_lua_results(LuaRuntime runtime, lua_State *L):
21968  *     cdef int nargs = lua.lua_gettop(L)
21969  *     if nargs == 1:             # <<<<<<<<<<<<<<
21970  *         return py_from_lua(runtime, L, 1)
21971  *     if nargs == 0:
21972  */
21973   }
21974 
21975   /* "lupa/_lupa.pyx":1378
21976  *     if nargs == 1:
21977  *         return py_from_lua(runtime, L, 1)
21978  *     if nargs == 0:             # <<<<<<<<<<<<<<
21979  *         return None
21980  *     return unpack_multiple_lua_results(runtime, L, nargs)
21981  */
21982   __pyx_t_1 = ((__pyx_v_nargs == 0) != 0);
21983   if (__pyx_t_1) {
21984 
21985     /* "lupa/_lupa.pyx":1379
21986  *         return py_from_lua(runtime, L, 1)
21987  *     if nargs == 0:
21988  *         return None             # <<<<<<<<<<<<<<
21989  *     return unpack_multiple_lua_results(runtime, L, nargs)
21990  *
21991  */
21992     __Pyx_XDECREF(__pyx_r);
21993     __pyx_r = Py_None; __Pyx_INCREF(Py_None);
21994     goto __pyx_L0;
21995 
21996     /* "lupa/_lupa.pyx":1378
21997  *     if nargs == 1:
21998  *         return py_from_lua(runtime, L, 1)
21999  *     if nargs == 0:             # <<<<<<<<<<<<<<
22000  *         return None
22001  *     return unpack_multiple_lua_results(runtime, L, nargs)
22002  */
22003   }
22004 
22005   /* "lupa/_lupa.pyx":1380
22006  *     if nargs == 0:
22007  *         return None
22008  *     return unpack_multiple_lua_results(runtime, L, nargs)             # <<<<<<<<<<<<<<
22009  *
22010  * cdef tuple unpack_multiple_lua_results(LuaRuntime runtime, lua_State *L, int nargs):
22011  */
22012   __Pyx_XDECREF(__pyx_r);
22013   __pyx_t_2 = __pyx_f_4lupa_5_lupa_unpack_multiple_lua_results(__pyx_v_runtime, __pyx_v_L, __pyx_v_nargs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1380, __pyx_L1_error)
22014   __Pyx_GOTREF(__pyx_t_2);
22015   __pyx_r = __pyx_t_2;
22016   __pyx_t_2 = 0;
22017   goto __pyx_L0;
22018 
22019   /* "lupa/_lupa.pyx":1374
22020  *     return 0
22021  *
22022  * cdef inline object unpack_lua_results(LuaRuntime runtime, lua_State *L):             # <<<<<<<<<<<<<<
22023  *     cdef int nargs = lua.lua_gettop(L)
22024  *     if nargs == 1:
22025  */
22026 
22027   /* function exit code */
22028   __pyx_L1_error:;
22029   __Pyx_XDECREF(__pyx_t_2);
22030   __Pyx_AddTraceback("lupa._lupa.unpack_lua_results", __pyx_clineno, __pyx_lineno, __pyx_filename);
22031   __pyx_r = 0;
22032   __pyx_L0:;
22033   __Pyx_XGIVEREF(__pyx_r);
22034   __Pyx_RefNannyFinishContext();
22035   return __pyx_r;
22036 }
22037 
22038 /* "lupa/_lupa.pyx":1382
22039  *     return unpack_multiple_lua_results(runtime, L, nargs)
22040  *
22041  * cdef tuple unpack_multiple_lua_results(LuaRuntime runtime, lua_State *L, int nargs):             # <<<<<<<<<<<<<<
22042  *     cdef tuple args = cpython.tuple.PyTuple_New(nargs)
22043  *     cdef int i
22044  */
22045 
__pyx_f_4lupa_5_lupa_unpack_multiple_lua_results(struct __pyx_obj_4lupa_5_lupa_LuaRuntime * __pyx_v_runtime,lua_State * __pyx_v_L,int __pyx_v_nargs)22046 static PyObject *__pyx_f_4lupa_5_lupa_unpack_multiple_lua_results(struct __pyx_obj_4lupa_5_lupa_LuaRuntime *__pyx_v_runtime, lua_State *__pyx_v_L, int __pyx_v_nargs) {
22047   PyObject *__pyx_v_args = 0;
22048   int __pyx_v_i;
22049   PyObject *__pyx_v_arg = NULL;
22050   PyObject *__pyx_r = NULL;
22051   __Pyx_RefNannyDeclarations
22052   PyObject *__pyx_t_1 = NULL;
22053   int __pyx_t_2;
22054   int __pyx_t_3;
22055   int __pyx_t_4;
22056   int __pyx_lineno = 0;
22057   const char *__pyx_filename = NULL;
22058   int __pyx_clineno = 0;
22059   __Pyx_RefNannySetupContext("unpack_multiple_lua_results", 0);
22060 
22061   /* "lupa/_lupa.pyx":1383
22062  *
22063  * cdef tuple unpack_multiple_lua_results(LuaRuntime runtime, lua_State *L, int nargs):
22064  *     cdef tuple args = cpython.tuple.PyTuple_New(nargs)             # <<<<<<<<<<<<<<
22065  *     cdef int i
22066  *     for i in range(nargs):
22067  */
22068   __pyx_t_1 = PyTuple_New(__pyx_v_nargs); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1383, __pyx_L1_error)
22069   __Pyx_GOTREF(__pyx_t_1);
22070   __pyx_v_args = ((PyObject*)__pyx_t_1);
22071   __pyx_t_1 = 0;
22072 
22073   /* "lupa/_lupa.pyx":1385
22074  *     cdef tuple args = cpython.tuple.PyTuple_New(nargs)
22075  *     cdef int i
22076  *     for i in range(nargs):             # <<<<<<<<<<<<<<
22077  *         arg = py_from_lua(runtime, L, i+1)
22078  *         cpython.ref.Py_INCREF(arg)
22079  */
22080   __pyx_t_2 = __pyx_v_nargs;
22081   __pyx_t_3 = __pyx_t_2;
22082   for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
22083     __pyx_v_i = __pyx_t_4;
22084 
22085     /* "lupa/_lupa.pyx":1386
22086  *     cdef int i
22087  *     for i in range(nargs):
22088  *         arg = py_from_lua(runtime, L, i+1)             # <<<<<<<<<<<<<<
22089  *         cpython.ref.Py_INCREF(arg)
22090  *         cpython.tuple.PyTuple_SET_ITEM(args, i, arg)
22091  */
22092     __pyx_t_1 = __pyx_f_4lupa_5_lupa_py_from_lua(__pyx_v_runtime, __pyx_v_L, (__pyx_v_i + 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1386, __pyx_L1_error)
22093     __Pyx_GOTREF(__pyx_t_1);
22094     __Pyx_XDECREF_SET(__pyx_v_arg, __pyx_t_1);
22095     __pyx_t_1 = 0;
22096 
22097     /* "lupa/_lupa.pyx":1387
22098  *     for i in range(nargs):
22099  *         arg = py_from_lua(runtime, L, i+1)
22100  *         cpython.ref.Py_INCREF(arg)             # <<<<<<<<<<<<<<
22101  *         cpython.tuple.PyTuple_SET_ITEM(args, i, arg)
22102  *     return args
22103  */
22104     Py_INCREF(__pyx_v_arg);
22105 
22106     /* "lupa/_lupa.pyx":1388
22107  *         arg = py_from_lua(runtime, L, i+1)
22108  *         cpython.ref.Py_INCREF(arg)
22109  *         cpython.tuple.PyTuple_SET_ITEM(args, i, arg)             # <<<<<<<<<<<<<<
22110  *     return args
22111  *
22112  */
22113     PyTuple_SET_ITEM(__pyx_v_args, __pyx_v_i, __pyx_v_arg);
22114   }
22115 
22116   /* "lupa/_lupa.pyx":1389
22117  *         cpython.ref.Py_INCREF(arg)
22118  *         cpython.tuple.PyTuple_SET_ITEM(args, i, arg)
22119  *     return args             # <<<<<<<<<<<<<<
22120  *
22121  *
22122  */
22123   __Pyx_XDECREF(__pyx_r);
22124   __Pyx_INCREF(__pyx_v_args);
22125   __pyx_r = __pyx_v_args;
22126   goto __pyx_L0;
22127 
22128   /* "lupa/_lupa.pyx":1382
22129  *     return unpack_multiple_lua_results(runtime, L, nargs)
22130  *
22131  * cdef tuple unpack_multiple_lua_results(LuaRuntime runtime, lua_State *L, int nargs):             # <<<<<<<<<<<<<<
22132  *     cdef tuple args = cpython.tuple.PyTuple_New(nargs)
22133  *     cdef int i
22134  */
22135 
22136   /* function exit code */
22137   __pyx_L1_error:;
22138   __Pyx_XDECREF(__pyx_t_1);
22139   __Pyx_AddTraceback("lupa._lupa.unpack_multiple_lua_results", __pyx_clineno, __pyx_lineno, __pyx_filename);
22140   __pyx_r = 0;
22141   __pyx_L0:;
22142   __Pyx_XDECREF(__pyx_v_args);
22143   __Pyx_XDECREF(__pyx_v_arg);
22144   __Pyx_XGIVEREF(__pyx_r);
22145   __Pyx_RefNannyFinishContext();
22146   return __pyx_r;
22147 }
22148 
22149 /* "lupa/_lupa.pyx":1415
22150  * # ref-counting support for Python objects
22151  *
22152  * cdef int decref_with_gil(py_object *py_obj, lua_State* L) with gil:             # <<<<<<<<<<<<<<
22153  *     # originally, we just used:
22154  *     #cpython.ref.Py_XDECREF(py_obj.obj)
22155  */
22156 
__pyx_f_4lupa_5_lupa_decref_with_gil(struct __pyx_t_4lupa_5_lupa_py_object * __pyx_v_py_obj,lua_State * __pyx_v_L)22157 static int __pyx_f_4lupa_5_lupa_decref_with_gil(struct __pyx_t_4lupa_5_lupa_py_object *__pyx_v_py_obj, lua_State *__pyx_v_L) {
22158   struct __pyx_obj_4lupa_5_lupa_LuaRuntime *__pyx_v_runtime = NULL;
22159   PyObject *__pyx_v_obj_id = NULL;
22160   PyObject *__pyx_v_refs = NULL;
22161   int __pyx_r;
22162   __Pyx_RefNannyDeclarations
22163   PyObject *__pyx_t_1 = NULL;
22164   PyObject *__pyx_t_2 = NULL;
22165   PyObject *__pyx_t_3 = NULL;
22166   PyObject *__pyx_t_4 = NULL;
22167   PyObject *__pyx_t_5 = NULL;
22168   PyObject *__pyx_t_6 = NULL;
22169   PyObject *__pyx_t_7 = NULL;
22170   PyObject *__pyx_t_8 = NULL;
22171   int __pyx_t_9;
22172   PyObject *__pyx_t_10 = NULL;
22173   Py_ssize_t __pyx_t_11;
22174   int __pyx_t_12;
22175   PyObject *__pyx_t_13 = NULL;
22176   PyObject *__pyx_t_14 = NULL;
22177   PyObject *__pyx_t_15 = NULL;
22178   int __pyx_lineno = 0;
22179   const char *__pyx_filename = NULL;
22180   int __pyx_clineno = 0;
22181   #ifdef WITH_THREAD
22182   PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
22183   #endif
22184   __Pyx_RefNannySetupContext("decref_with_gil", 0);
22185 
22186   /* "lupa/_lupa.pyx":1419
22187  *     #cpython.ref.Py_XDECREF(py_obj.obj)
22188  *     # now, we keep Python object references in Lua visible to Python in a dict of lists:
22189  *     runtime = <LuaRuntime>py_obj.runtime             # <<<<<<<<<<<<<<
22190  *     try:
22191  *         obj_id = <object><uintptr_t>py_obj.obj
22192  */
22193   __pyx_t_1 = ((PyObject *)__pyx_v_py_obj->runtime);
22194   __Pyx_INCREF(__pyx_t_1);
22195   __pyx_v_runtime = ((struct __pyx_obj_4lupa_5_lupa_LuaRuntime *)__pyx_t_1);
22196   __pyx_t_1 = 0;
22197 
22198   /* "lupa/_lupa.pyx":1420
22199  *     # now, we keep Python object references in Lua visible to Python in a dict of lists:
22200  *     runtime = <LuaRuntime>py_obj.runtime
22201  *     try:             # <<<<<<<<<<<<<<
22202  *         obj_id = <object><uintptr_t>py_obj.obj
22203  *         try:
22204  */
22205   {
22206     __Pyx_PyThreadState_declare
22207     __Pyx_PyThreadState_assign
22208     __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
22209     __Pyx_XGOTREF(__pyx_t_2);
22210     __Pyx_XGOTREF(__pyx_t_3);
22211     __Pyx_XGOTREF(__pyx_t_4);
22212     /*try:*/ {
22213 
22214       /* "lupa/_lupa.pyx":1421
22215  *     runtime = <LuaRuntime>py_obj.runtime
22216  *     try:
22217  *         obj_id = <object><uintptr_t>py_obj.obj             # <<<<<<<<<<<<<<
22218  *         try:
22219  *             refs = <list>runtime._pyrefs_in_lua[obj_id]
22220  */
22221       __pyx_t_1 = __Pyx_PyInt_FromSize_t(((uintptr_t)__pyx_v_py_obj->obj)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1421, __pyx_L3_error)
22222       __Pyx_GOTREF(__pyx_t_1);
22223       __pyx_t_5 = __pyx_t_1;
22224       __Pyx_INCREF(__pyx_t_5);
22225       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22226       __pyx_v_obj_id = __pyx_t_5;
22227       __pyx_t_5 = 0;
22228 
22229       /* "lupa/_lupa.pyx":1422
22230  *     try:
22231  *         obj_id = <object><uintptr_t>py_obj.obj
22232  *         try:             # <<<<<<<<<<<<<<
22233  *             refs = <list>runtime._pyrefs_in_lua[obj_id]
22234  *         except (TypeError, KeyError):
22235  */
22236       {
22237         __Pyx_PyThreadState_declare
22238         __Pyx_PyThreadState_assign
22239         __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
22240         __Pyx_XGOTREF(__pyx_t_6);
22241         __Pyx_XGOTREF(__pyx_t_7);
22242         __Pyx_XGOTREF(__pyx_t_8);
22243         /*try:*/ {
22244 
22245           /* "lupa/_lupa.pyx":1423
22246  *         obj_id = <object><uintptr_t>py_obj.obj
22247  *         try:
22248  *             refs = <list>runtime._pyrefs_in_lua[obj_id]             # <<<<<<<<<<<<<<
22249  *         except (TypeError, KeyError):
22250  *             return 0  # runtime was already cleared during GC, nothing left to do
22251  */
22252           if (unlikely(__pyx_v_runtime->_pyrefs_in_lua == Py_None)) {
22253             PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
22254             __PYX_ERR(0, 1423, __pyx_L9_error)
22255           }
22256           __pyx_t_5 = __Pyx_PyDict_GetItem(__pyx_v_runtime->_pyrefs_in_lua, __pyx_v_obj_id); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1423, __pyx_L9_error)
22257           __Pyx_GOTREF(__pyx_t_5);
22258           __pyx_t_1 = __pyx_t_5;
22259           __Pyx_INCREF(__pyx_t_1);
22260           __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
22261           __pyx_v_refs = ((PyObject*)__pyx_t_1);
22262           __pyx_t_1 = 0;
22263 
22264           /* "lupa/_lupa.pyx":1422
22265  *     try:
22266  *         obj_id = <object><uintptr_t>py_obj.obj
22267  *         try:             # <<<<<<<<<<<<<<
22268  *             refs = <list>runtime._pyrefs_in_lua[obj_id]
22269  *         except (TypeError, KeyError):
22270  */
22271         }
22272         __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
22273         __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
22274         __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
22275         goto __pyx_L14_try_end;
22276         __pyx_L9_error:;
22277         __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
22278         __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
22279 
22280         /* "lupa/_lupa.pyx":1424
22281  *         try:
22282  *             refs = <list>runtime._pyrefs_in_lua[obj_id]
22283  *         except (TypeError, KeyError):             # <<<<<<<<<<<<<<
22284  *             return 0  # runtime was already cleared during GC, nothing left to do
22285  *         if len(refs) == 1:
22286  */
22287         __pyx_t_9 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_TypeError) || __Pyx_PyErr_ExceptionMatches(__pyx_builtin_KeyError);
22288         if (__pyx_t_9) {
22289           __Pyx_AddTraceback("lupa._lupa.decref_with_gil", __pyx_clineno, __pyx_lineno, __pyx_filename);
22290           if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_5, &__pyx_t_10) < 0) __PYX_ERR(0, 1424, __pyx_L11_except_error)
22291           __Pyx_GOTREF(__pyx_t_1);
22292           __Pyx_GOTREF(__pyx_t_5);
22293           __Pyx_GOTREF(__pyx_t_10);
22294 
22295           /* "lupa/_lupa.pyx":1425
22296  *             refs = <list>runtime._pyrefs_in_lua[obj_id]
22297  *         except (TypeError, KeyError):
22298  *             return 0  # runtime was already cleared during GC, nothing left to do             # <<<<<<<<<<<<<<
22299  *         if len(refs) == 1:
22300  *             del runtime._pyrefs_in_lua[obj_id]
22301  */
22302           __pyx_r = 0;
22303           __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22304           __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
22305           __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
22306           goto __pyx_L12_except_return;
22307         }
22308         goto __pyx_L11_except_error;
22309         __pyx_L11_except_error:;
22310 
22311         /* "lupa/_lupa.pyx":1422
22312  *     try:
22313  *         obj_id = <object><uintptr_t>py_obj.obj
22314  *         try:             # <<<<<<<<<<<<<<
22315  *             refs = <list>runtime._pyrefs_in_lua[obj_id]
22316  *         except (TypeError, KeyError):
22317  */
22318         __Pyx_XGIVEREF(__pyx_t_6);
22319         __Pyx_XGIVEREF(__pyx_t_7);
22320         __Pyx_XGIVEREF(__pyx_t_8);
22321         __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
22322         goto __pyx_L3_error;
22323         __pyx_L12_except_return:;
22324         __Pyx_XGIVEREF(__pyx_t_6);
22325         __Pyx_XGIVEREF(__pyx_t_7);
22326         __Pyx_XGIVEREF(__pyx_t_8);
22327         __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
22328         goto __pyx_L7_try_return;
22329         __pyx_L14_try_end:;
22330       }
22331 
22332       /* "lupa/_lupa.pyx":1426
22333  *         except (TypeError, KeyError):
22334  *             return 0  # runtime was already cleared during GC, nothing left to do
22335  *         if len(refs) == 1:             # <<<<<<<<<<<<<<
22336  *             del runtime._pyrefs_in_lua[obj_id]
22337  *         else:
22338  */
22339       if (unlikely(__pyx_v_refs == Py_None)) {
22340         PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
22341         __PYX_ERR(0, 1426, __pyx_L3_error)
22342       }
22343       __pyx_t_11 = PyList_GET_SIZE(__pyx_v_refs); if (unlikely(__pyx_t_11 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1426, __pyx_L3_error)
22344       __pyx_t_12 = ((__pyx_t_11 == 1) != 0);
22345       if (__pyx_t_12) {
22346 
22347         /* "lupa/_lupa.pyx":1427
22348  *             return 0  # runtime was already cleared during GC, nothing left to do
22349  *         if len(refs) == 1:
22350  *             del runtime._pyrefs_in_lua[obj_id]             # <<<<<<<<<<<<<<
22351  *         else:
22352  *             refs.pop()  # any, really
22353  */
22354         if (unlikely(__pyx_v_runtime->_pyrefs_in_lua == Py_None)) {
22355           PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
22356           __PYX_ERR(0, 1427, __pyx_L3_error)
22357         }
22358         if (unlikely(PyDict_DelItem(__pyx_v_runtime->_pyrefs_in_lua, __pyx_v_obj_id) < 0)) __PYX_ERR(0, 1427, __pyx_L3_error)
22359 
22360         /* "lupa/_lupa.pyx":1426
22361  *         except (TypeError, KeyError):
22362  *             return 0  # runtime was already cleared during GC, nothing left to do
22363  *         if len(refs) == 1:             # <<<<<<<<<<<<<<
22364  *             del runtime._pyrefs_in_lua[obj_id]
22365  *         else:
22366  */
22367         goto __pyx_L17;
22368       }
22369 
22370       /* "lupa/_lupa.pyx":1429
22371  *             del runtime._pyrefs_in_lua[obj_id]
22372  *         else:
22373  *             refs.pop()  # any, really             # <<<<<<<<<<<<<<
22374  *         return 0
22375  *     except:
22376  */
22377       /*else*/ {
22378         if (unlikely(__pyx_v_refs == Py_None)) {
22379           PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "pop");
22380           __PYX_ERR(0, 1429, __pyx_L3_error)
22381         }
22382         __pyx_t_10 = __Pyx_PyList_Pop(__pyx_v_refs); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1429, __pyx_L3_error)
22383         __Pyx_GOTREF(__pyx_t_10);
22384         __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
22385       }
22386       __pyx_L17:;
22387 
22388       /* "lupa/_lupa.pyx":1430
22389  *         else:
22390  *             refs.pop()  # any, really
22391  *         return 0             # <<<<<<<<<<<<<<
22392  *     except:
22393  *         try: runtime.store_raised_exception(L, b'error while cleaning up a Python object')
22394  */
22395       __pyx_r = 0;
22396       goto __pyx_L7_try_return;
22397 
22398       /* "lupa/_lupa.pyx":1420
22399  *     # now, we keep Python object references in Lua visible to Python in a dict of lists:
22400  *     runtime = <LuaRuntime>py_obj.runtime
22401  *     try:             # <<<<<<<<<<<<<<
22402  *         obj_id = <object><uintptr_t>py_obj.obj
22403  *         try:
22404  */
22405     }
22406     __pyx_L3_error:;
22407     __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
22408     __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
22409     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
22410 
22411     /* "lupa/_lupa.pyx":1431
22412  *             refs.pop()  # any, really
22413  *         return 0
22414  *     except:             # <<<<<<<<<<<<<<
22415  *         try: runtime.store_raised_exception(L, b'error while cleaning up a Python object')
22416  *         finally: return -1
22417  */
22418     /*except:*/ {
22419       __Pyx_AddTraceback("lupa._lupa.decref_with_gil", __pyx_clineno, __pyx_lineno, __pyx_filename);
22420       if (__Pyx_GetException(&__pyx_t_10, &__pyx_t_5, &__pyx_t_1) < 0) __PYX_ERR(0, 1431, __pyx_L5_except_error)
22421       __Pyx_GOTREF(__pyx_t_10);
22422       __Pyx_GOTREF(__pyx_t_5);
22423       __Pyx_GOTREF(__pyx_t_1);
22424 
22425       /* "lupa/_lupa.pyx":1432
22426  *         return 0
22427  *     except:
22428  *         try: runtime.store_raised_exception(L, b'error while cleaning up a Python object')             # <<<<<<<<<<<<<<
22429  *         finally: return -1
22430  *
22431  */
22432       /*try:*/ {
22433         __pyx_t_9 = __pyx_f_4lupa_5_lupa_10LuaRuntime_store_raised_exception(__pyx_v_runtime, __pyx_v_L, __pyx_kp_b_error_while_cleaning_up_a_Python); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 1432, __pyx_L23_error)
22434       }
22435 
22436       /* "lupa/_lupa.pyx":1433
22437  *     except:
22438  *         try: runtime.store_raised_exception(L, b'error while cleaning up a Python object')
22439  *         finally: return -1             # <<<<<<<<<<<<<<
22440  *
22441  * cdef int py_object_gc(lua_State* L) nogil:
22442  */
22443       /*finally:*/ {
22444         /*normal exit:*/{
22445           __pyx_r = -1;
22446           __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22447           __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
22448           __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
22449           goto __pyx_L6_except_return;
22450         }
22451         __pyx_L23_error:;
22452         /*exception exit:*/{
22453           __Pyx_PyThreadState_declare
22454           __Pyx_PyThreadState_assign
22455           __pyx_t_8 = 0; __pyx_t_7 = 0; __pyx_t_6 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0;
22456           if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15);
22457           if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6) < 0)) __Pyx_ErrFetch(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6);
22458           __Pyx_XGOTREF(__pyx_t_8);
22459           __Pyx_XGOTREF(__pyx_t_7);
22460           __Pyx_XGOTREF(__pyx_t_6);
22461           __Pyx_XGOTREF(__pyx_t_13);
22462           __Pyx_XGOTREF(__pyx_t_14);
22463           __Pyx_XGOTREF(__pyx_t_15);
22464           {
22465             __pyx_r = -1;
22466             __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22467             __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
22468             __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
22469             goto __pyx_L27_return;
22470           }
22471           __pyx_L27_return:;
22472           if (PY_MAJOR_VERSION >= 3) {
22473             __Pyx_XGIVEREF(__pyx_t_13);
22474             __Pyx_XGIVEREF(__pyx_t_14);
22475             __Pyx_XGIVEREF(__pyx_t_15);
22476             __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_14, __pyx_t_15);
22477           }
22478           __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
22479           __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
22480           __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
22481           __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0;
22482           goto __pyx_L6_except_return;
22483         }
22484       }
22485     }
22486     __pyx_L5_except_error:;
22487 
22488     /* "lupa/_lupa.pyx":1420
22489  *     # now, we keep Python object references in Lua visible to Python in a dict of lists:
22490  *     runtime = <LuaRuntime>py_obj.runtime
22491  *     try:             # <<<<<<<<<<<<<<
22492  *         obj_id = <object><uintptr_t>py_obj.obj
22493  *         try:
22494  */
22495     __Pyx_XGIVEREF(__pyx_t_2);
22496     __Pyx_XGIVEREF(__pyx_t_3);
22497     __Pyx_XGIVEREF(__pyx_t_4);
22498     __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
22499     goto __pyx_L1_error;
22500     __pyx_L7_try_return:;
22501     __Pyx_XGIVEREF(__pyx_t_2);
22502     __Pyx_XGIVEREF(__pyx_t_3);
22503     __Pyx_XGIVEREF(__pyx_t_4);
22504     __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
22505     goto __pyx_L0;
22506     __pyx_L6_except_return:;
22507     __Pyx_XGIVEREF(__pyx_t_2);
22508     __Pyx_XGIVEREF(__pyx_t_3);
22509     __Pyx_XGIVEREF(__pyx_t_4);
22510     __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
22511     goto __pyx_L0;
22512   }
22513 
22514   /* "lupa/_lupa.pyx":1415
22515  * # ref-counting support for Python objects
22516  *
22517  * cdef int decref_with_gil(py_object *py_obj, lua_State* L) with gil:             # <<<<<<<<<<<<<<
22518  *     # originally, we just used:
22519  *     #cpython.ref.Py_XDECREF(py_obj.obj)
22520  */
22521 
22522   /* function exit code */
22523   __pyx_L1_error:;
22524   __Pyx_XDECREF(__pyx_t_1);
22525   __Pyx_XDECREF(__pyx_t_5);
22526   __Pyx_XDECREF(__pyx_t_10);
22527   __Pyx_WriteUnraisable("lupa._lupa.decref_with_gil", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
22528   __pyx_r = 0;
22529   __pyx_L0:;
22530   __Pyx_XDECREF((PyObject *)__pyx_v_runtime);
22531   __Pyx_XDECREF(__pyx_v_obj_id);
22532   __Pyx_XDECREF(__pyx_v_refs);
22533   __Pyx_RefNannyFinishContext();
22534   #ifdef WITH_THREAD
22535   __Pyx_PyGILState_Release(__pyx_gilstate_save);
22536   #endif
22537   return __pyx_r;
22538 }
22539 
22540 /* "lupa/_lupa.pyx":1435
22541  *         finally: return -1
22542  *
22543  * cdef int py_object_gc(lua_State* L) nogil:             # <<<<<<<<<<<<<<
22544  *     if not lua.lua_isuserdata(L, 1):
22545  *         return 0
22546  */
22547 
__pyx_f_4lupa_5_lupa_py_object_gc(lua_State * __pyx_v_L)22548 static int __pyx_f_4lupa_5_lupa_py_object_gc(lua_State *__pyx_v_L) {
22549   struct __pyx_t_4lupa_5_lupa_py_object *__pyx_v_py_obj;
22550   int __pyx_r;
22551   int __pyx_t_1;
22552   int __pyx_t_2;
22553 
22554   /* "lupa/_lupa.pyx":1436
22555  *
22556  * cdef int py_object_gc(lua_State* L) nogil:
22557  *     if not lua.lua_isuserdata(L, 1):             # <<<<<<<<<<<<<<
22558  *         return 0
22559  *     py_obj = unpack_userdata(L, 1)
22560  */
22561   __pyx_t_1 = ((!(lua_isuserdata(__pyx_v_L, 1) != 0)) != 0);
22562   if (__pyx_t_1) {
22563 
22564     /* "lupa/_lupa.pyx":1437
22565  * cdef int py_object_gc(lua_State* L) nogil:
22566  *     if not lua.lua_isuserdata(L, 1):
22567  *         return 0             # <<<<<<<<<<<<<<
22568  *     py_obj = unpack_userdata(L, 1)
22569  *     if py_obj is not NULL and py_obj.obj is not NULL:
22570  */
22571     __pyx_r = 0;
22572     goto __pyx_L0;
22573 
22574     /* "lupa/_lupa.pyx":1436
22575  *
22576  * cdef int py_object_gc(lua_State* L) nogil:
22577  *     if not lua.lua_isuserdata(L, 1):             # <<<<<<<<<<<<<<
22578  *         return 0
22579  *     py_obj = unpack_userdata(L, 1)
22580  */
22581   }
22582 
22583   /* "lupa/_lupa.pyx":1438
22584  *     if not lua.lua_isuserdata(L, 1):
22585  *         return 0
22586  *     py_obj = unpack_userdata(L, 1)             # <<<<<<<<<<<<<<
22587  *     if py_obj is not NULL and py_obj.obj is not NULL:
22588  *         if decref_with_gil(py_obj, L):
22589  */
22590   __pyx_v_py_obj = __pyx_f_4lupa_5_lupa_unpack_userdata(__pyx_v_L, 1);
22591 
22592   /* "lupa/_lupa.pyx":1439
22593  *         return 0
22594  *     py_obj = unpack_userdata(L, 1)
22595  *     if py_obj is not NULL and py_obj.obj is not NULL:             # <<<<<<<<<<<<<<
22596  *         if decref_with_gil(py_obj, L):
22597  *             return lua.lua_error(L)  # never returns!
22598  */
22599   __pyx_t_2 = ((__pyx_v_py_obj != NULL) != 0);
22600   if (__pyx_t_2) {
22601   } else {
22602     __pyx_t_1 = __pyx_t_2;
22603     goto __pyx_L5_bool_binop_done;
22604   }
22605   __pyx_t_2 = ((__pyx_v_py_obj->obj != NULL) != 0);
22606   __pyx_t_1 = __pyx_t_2;
22607   __pyx_L5_bool_binop_done:;
22608   if (__pyx_t_1) {
22609 
22610     /* "lupa/_lupa.pyx":1440
22611  *     py_obj = unpack_userdata(L, 1)
22612  *     if py_obj is not NULL and py_obj.obj is not NULL:
22613  *         if decref_with_gil(py_obj, L):             # <<<<<<<<<<<<<<
22614  *             return lua.lua_error(L)  # never returns!
22615  *     return 0
22616  */
22617     __pyx_t_1 = (__pyx_f_4lupa_5_lupa_decref_with_gil(__pyx_v_py_obj, __pyx_v_L) != 0);
22618     if (__pyx_t_1) {
22619 
22620       /* "lupa/_lupa.pyx":1441
22621  *     if py_obj is not NULL and py_obj.obj is not NULL:
22622  *         if decref_with_gil(py_obj, L):
22623  *             return lua.lua_error(L)  # never returns!             # <<<<<<<<<<<<<<
22624  *     return 0
22625  *
22626  */
22627       __pyx_r = lua_error(__pyx_v_L);
22628       goto __pyx_L0;
22629 
22630       /* "lupa/_lupa.pyx":1440
22631  *     py_obj = unpack_userdata(L, 1)
22632  *     if py_obj is not NULL and py_obj.obj is not NULL:
22633  *         if decref_with_gil(py_obj, L):             # <<<<<<<<<<<<<<
22634  *             return lua.lua_error(L)  # never returns!
22635  *     return 0
22636  */
22637     }
22638 
22639     /* "lupa/_lupa.pyx":1439
22640  *         return 0
22641  *     py_obj = unpack_userdata(L, 1)
22642  *     if py_obj is not NULL and py_obj.obj is not NULL:             # <<<<<<<<<<<<<<
22643  *         if decref_with_gil(py_obj, L):
22644  *             return lua.lua_error(L)  # never returns!
22645  */
22646   }
22647 
22648   /* "lupa/_lupa.pyx":1442
22649  *         if decref_with_gil(py_obj, L):
22650  *             return lua.lua_error(L)  # never returns!
22651  *     return 0             # <<<<<<<<<<<<<<
22652  *
22653  * # calling Python objects
22654  */
22655   __pyx_r = 0;
22656   goto __pyx_L0;
22657 
22658   /* "lupa/_lupa.pyx":1435
22659  *         finally: return -1
22660  *
22661  * cdef int py_object_gc(lua_State* L) nogil:             # <<<<<<<<<<<<<<
22662  *     if not lua.lua_isuserdata(L, 1):
22663  *         return 0
22664  */
22665 
22666   /* function exit code */
22667   __pyx_L0:;
22668   return __pyx_r;
22669 }
22670 
22671 /* "lupa/_lupa.pyx":1446
22672  * # calling Python objects
22673  *
22674  * cdef bint call_python(LuaRuntime runtime, lua_State *L, py_object* py_obj) except -1:             # <<<<<<<<<<<<<<
22675  *     cdef int i, nargs = lua.lua_gettop(L) - 1
22676  *     cdef tuple args
22677  */
22678 
__pyx_f_4lupa_5_lupa_call_python(struct __pyx_obj_4lupa_5_lupa_LuaRuntime * __pyx_v_runtime,lua_State * __pyx_v_L,struct __pyx_t_4lupa_5_lupa_py_object * __pyx_v_py_obj)22679 static int __pyx_f_4lupa_5_lupa_call_python(struct __pyx_obj_4lupa_5_lupa_LuaRuntime *__pyx_v_runtime, lua_State *__pyx_v_L, struct __pyx_t_4lupa_5_lupa_py_object *__pyx_v_py_obj) {
22680   int __pyx_v_i;
22681   int __pyx_v_nargs;
22682   PyObject *__pyx_v_args = 0;
22683   PyObject *__pyx_v_f = NULL;
22684   PyObject *__pyx_v_result = NULL;
22685   PyObject *__pyx_v_arg = NULL;
22686   int __pyx_r;
22687   __Pyx_RefNannyDeclarations
22688   int __pyx_t_1;
22689   PyObject *__pyx_t_2 = NULL;
22690   PyObject *__pyx_t_3 = NULL;
22691   PyObject *__pyx_t_4 = NULL;
22692   int __pyx_t_5;
22693   PyObject *__pyx_t_6;
22694   int __pyx_t_7;
22695   int __pyx_t_8;
22696   int __pyx_t_9;
22697   int __pyx_lineno = 0;
22698   const char *__pyx_filename = NULL;
22699   int __pyx_clineno = 0;
22700   __Pyx_RefNannySetupContext("call_python", 0);
22701 
22702   /* "lupa/_lupa.pyx":1447
22703  *
22704  * cdef bint call_python(LuaRuntime runtime, lua_State *L, py_object* py_obj) except -1:
22705  *     cdef int i, nargs = lua.lua_gettop(L) - 1             # <<<<<<<<<<<<<<
22706  *     cdef tuple args
22707  *
22708  */
22709   __pyx_v_nargs = (lua_gettop(__pyx_v_L) - 1);
22710 
22711   /* "lupa/_lupa.pyx":1450
22712  *     cdef tuple args
22713  *
22714  *     if not py_obj:             # <<<<<<<<<<<<<<
22715  *         raise TypeError("not a python object")
22716  *
22717  */
22718   __pyx_t_1 = ((!(__pyx_v_py_obj != 0)) != 0);
22719   if (unlikely(__pyx_t_1)) {
22720 
22721     /* "lupa/_lupa.pyx":1451
22722  *
22723  *     if not py_obj:
22724  *         raise TypeError("not a python object")             # <<<<<<<<<<<<<<
22725  *
22726  *     f = <object>py_obj.obj
22727  */
22728     __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__35, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1451, __pyx_L1_error)
22729     __Pyx_GOTREF(__pyx_t_2);
22730     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
22731     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
22732     __PYX_ERR(0, 1451, __pyx_L1_error)
22733 
22734     /* "lupa/_lupa.pyx":1450
22735  *     cdef tuple args
22736  *
22737  *     if not py_obj:             # <<<<<<<<<<<<<<
22738  *         raise TypeError("not a python object")
22739  *
22740  */
22741   }
22742 
22743   /* "lupa/_lupa.pyx":1453
22744  *         raise TypeError("not a python object")
22745  *
22746  *     f = <object>py_obj.obj             # <<<<<<<<<<<<<<
22747  *
22748  *     if not nargs:
22749  */
22750   __pyx_t_2 = ((PyObject *)__pyx_v_py_obj->obj);
22751   __Pyx_INCREF(__pyx_t_2);
22752   __pyx_v_f = __pyx_t_2;
22753   __pyx_t_2 = 0;
22754 
22755   /* "lupa/_lupa.pyx":1455
22756  *     f = <object>py_obj.obj
22757  *
22758  *     if not nargs:             # <<<<<<<<<<<<<<
22759  *         lua.lua_settop(L, 0)  # FIXME
22760  *         result = f()
22761  */
22762   __pyx_t_1 = ((!(__pyx_v_nargs != 0)) != 0);
22763   if (__pyx_t_1) {
22764 
22765     /* "lupa/_lupa.pyx":1456
22766  *
22767  *     if not nargs:
22768  *         lua.lua_settop(L, 0)  # FIXME             # <<<<<<<<<<<<<<
22769  *         result = f()
22770  *     else:
22771  */
22772     lua_settop(__pyx_v_L, 0);
22773 
22774     /* "lupa/_lupa.pyx":1457
22775  *     if not nargs:
22776  *         lua.lua_settop(L, 0)  # FIXME
22777  *         result = f()             # <<<<<<<<<<<<<<
22778  *     else:
22779  *         arg = py_from_lua(runtime, L, 2)
22780  */
22781     __Pyx_INCREF(__pyx_v_f);
22782     __pyx_t_3 = __pyx_v_f; __pyx_t_4 = NULL;
22783     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
22784       __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
22785       if (likely(__pyx_t_4)) {
22786         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
22787         __Pyx_INCREF(__pyx_t_4);
22788         __Pyx_INCREF(function);
22789         __Pyx_DECREF_SET(__pyx_t_3, function);
22790       }
22791     }
22792     __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
22793     __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
22794     if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1457, __pyx_L1_error)
22795     __Pyx_GOTREF(__pyx_t_2);
22796     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22797     __pyx_v_result = __pyx_t_2;
22798     __pyx_t_2 = 0;
22799 
22800     /* "lupa/_lupa.pyx":1455
22801  *     f = <object>py_obj.obj
22802  *
22803  *     if not nargs:             # <<<<<<<<<<<<<<
22804  *         lua.lua_settop(L, 0)  # FIXME
22805  *         result = f()
22806  */
22807     goto __pyx_L4;
22808   }
22809 
22810   /* "lupa/_lupa.pyx":1459
22811  *         result = f()
22812  *     else:
22813  *         arg = py_from_lua(runtime, L, 2)             # <<<<<<<<<<<<<<
22814  *
22815  *         if PyMethod_Check(f) and (<PyObject*>arg) is PyMethod_GET_SELF(f):
22816  */
22817   /*else*/ {
22818     __pyx_t_2 = __pyx_f_4lupa_5_lupa_py_from_lua(__pyx_v_runtime, __pyx_v_L, 2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1459, __pyx_L1_error)
22819     __Pyx_GOTREF(__pyx_t_2);
22820     __pyx_v_arg = __pyx_t_2;
22821     __pyx_t_2 = 0;
22822 
22823     /* "lupa/_lupa.pyx":1461
22824  *         arg = py_from_lua(runtime, L, 2)
22825  *
22826  *         if PyMethod_Check(f) and (<PyObject*>arg) is PyMethod_GET_SELF(f):             # <<<<<<<<<<<<<<
22827  *             # Calling a bound method and self is already the first argument.
22828  *             # Lua x:m(a, b) => Python as x.m(x, a, b) but should be x.m(a, b)
22829  */
22830     __pyx_t_5 = (PyMethod_Check(__pyx_v_f) != 0);
22831     if (__pyx_t_5) {
22832     } else {
22833       __pyx_t_1 = __pyx_t_5;
22834       goto __pyx_L6_bool_binop_done;
22835     }
22836     __pyx_t_5 = ((((PyObject *)__pyx_v_arg) == PyMethod_GET_SELF(__pyx_v_f)) != 0);
22837     __pyx_t_1 = __pyx_t_5;
22838     __pyx_L6_bool_binop_done:;
22839     if (__pyx_t_1) {
22840 
22841       /* "lupa/_lupa.pyx":1471
22842  *             # The method wrapper would only prepend self to the tuple again,
22843  *             # so we just call the underlying function directly instead.
22844  *             f = <object>PyMethod_GET_FUNCTION(f)             # <<<<<<<<<<<<<<
22845  *
22846  *         args = cpython.tuple.PyTuple_New(nargs)
22847  */
22848       __pyx_t_6 = PyMethod_GET_FUNCTION(__pyx_v_f);
22849       __pyx_t_2 = ((PyObject *)__pyx_t_6);
22850       __Pyx_INCREF(__pyx_t_2);
22851       __Pyx_DECREF_SET(__pyx_v_f, __pyx_t_2);
22852       __pyx_t_2 = 0;
22853 
22854       /* "lupa/_lupa.pyx":1461
22855  *         arg = py_from_lua(runtime, L, 2)
22856  *
22857  *         if PyMethod_Check(f) and (<PyObject*>arg) is PyMethod_GET_SELF(f):             # <<<<<<<<<<<<<<
22858  *             # Calling a bound method and self is already the first argument.
22859  *             # Lua x:m(a, b) => Python as x.m(x, a, b) but should be x.m(a, b)
22860  */
22861     }
22862 
22863     /* "lupa/_lupa.pyx":1473
22864  *             f = <object>PyMethod_GET_FUNCTION(f)
22865  *
22866  *         args = cpython.tuple.PyTuple_New(nargs)             # <<<<<<<<<<<<<<
22867  *         cpython.ref.Py_INCREF(arg)
22868  *         cpython.tuple.PyTuple_SET_ITEM(args, 0, arg)
22869  */
22870     __pyx_t_2 = PyTuple_New(__pyx_v_nargs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1473, __pyx_L1_error)
22871     __Pyx_GOTREF(__pyx_t_2);
22872     __pyx_v_args = ((PyObject*)__pyx_t_2);
22873     __pyx_t_2 = 0;
22874 
22875     /* "lupa/_lupa.pyx":1474
22876  *
22877  *         args = cpython.tuple.PyTuple_New(nargs)
22878  *         cpython.ref.Py_INCREF(arg)             # <<<<<<<<<<<<<<
22879  *         cpython.tuple.PyTuple_SET_ITEM(args, 0, arg)
22880  *
22881  */
22882     Py_INCREF(__pyx_v_arg);
22883 
22884     /* "lupa/_lupa.pyx":1475
22885  *         args = cpython.tuple.PyTuple_New(nargs)
22886  *         cpython.ref.Py_INCREF(arg)
22887  *         cpython.tuple.PyTuple_SET_ITEM(args, 0, arg)             # <<<<<<<<<<<<<<
22888  *
22889  *         for i in range(1, nargs):
22890  */
22891     PyTuple_SET_ITEM(__pyx_v_args, 0, __pyx_v_arg);
22892 
22893     /* "lupa/_lupa.pyx":1477
22894  *         cpython.tuple.PyTuple_SET_ITEM(args, 0, arg)
22895  *
22896  *         for i in range(1, nargs):             # <<<<<<<<<<<<<<
22897  *             arg = py_from_lua(runtime, L, i+2)
22898  *             cpython.ref.Py_INCREF(arg)
22899  */
22900     __pyx_t_7 = __pyx_v_nargs;
22901     __pyx_t_8 = __pyx_t_7;
22902     for (__pyx_t_9 = 1; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
22903       __pyx_v_i = __pyx_t_9;
22904 
22905       /* "lupa/_lupa.pyx":1478
22906  *
22907  *         for i in range(1, nargs):
22908  *             arg = py_from_lua(runtime, L, i+2)             # <<<<<<<<<<<<<<
22909  *             cpython.ref.Py_INCREF(arg)
22910  *             cpython.tuple.PyTuple_SET_ITEM(args, i, arg)
22911  */
22912       __pyx_t_2 = __pyx_f_4lupa_5_lupa_py_from_lua(__pyx_v_runtime, __pyx_v_L, (__pyx_v_i + 2)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1478, __pyx_L1_error)
22913       __Pyx_GOTREF(__pyx_t_2);
22914       __Pyx_DECREF_SET(__pyx_v_arg, __pyx_t_2);
22915       __pyx_t_2 = 0;
22916 
22917       /* "lupa/_lupa.pyx":1479
22918  *         for i in range(1, nargs):
22919  *             arg = py_from_lua(runtime, L, i+2)
22920  *             cpython.ref.Py_INCREF(arg)             # <<<<<<<<<<<<<<
22921  *             cpython.tuple.PyTuple_SET_ITEM(args, i, arg)
22922  *
22923  */
22924       Py_INCREF(__pyx_v_arg);
22925 
22926       /* "lupa/_lupa.pyx":1480
22927  *             arg = py_from_lua(runtime, L, i+2)
22928  *             cpython.ref.Py_INCREF(arg)
22929  *             cpython.tuple.PyTuple_SET_ITEM(args, i, arg)             # <<<<<<<<<<<<<<
22930  *
22931  *         lua.lua_settop(L, 0)  # FIXME
22932  */
22933       PyTuple_SET_ITEM(__pyx_v_args, __pyx_v_i, __pyx_v_arg);
22934     }
22935 
22936     /* "lupa/_lupa.pyx":1482
22937  *             cpython.tuple.PyTuple_SET_ITEM(args, i, arg)
22938  *
22939  *         lua.lua_settop(L, 0)  # FIXME             # <<<<<<<<<<<<<<
22940  *         result = f(*args)
22941  *
22942  */
22943     lua_settop(__pyx_v_L, 0);
22944 
22945     /* "lupa/_lupa.pyx":1483
22946  *
22947  *         lua.lua_settop(L, 0)  # FIXME
22948  *         result = f(*args)             # <<<<<<<<<<<<<<
22949  *
22950  *     return py_function_result_to_lua(runtime, L, result)
22951  */
22952     if (unlikely(__pyx_v_args == Py_None)) {
22953       PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
22954       __PYX_ERR(0, 1483, __pyx_L1_error)
22955     }
22956     __pyx_t_2 = __Pyx_PyObject_Call(__pyx_v_f, __pyx_v_args, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1483, __pyx_L1_error)
22957     __Pyx_GOTREF(__pyx_t_2);
22958     __pyx_v_result = __pyx_t_2;
22959     __pyx_t_2 = 0;
22960   }
22961   __pyx_L4:;
22962 
22963   /* "lupa/_lupa.pyx":1485
22964  *         result = f(*args)
22965  *
22966  *     return py_function_result_to_lua(runtime, L, result)             # <<<<<<<<<<<<<<
22967  *
22968  * cdef int py_call_with_gil(lua_State* L, py_object *py_obj) with gil:
22969  */
22970   __pyx_t_7 = __pyx_f_4lupa_5_lupa_py_function_result_to_lua(__pyx_v_runtime, __pyx_v_L, __pyx_v_result); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 1485, __pyx_L1_error)
22971   __pyx_r = __pyx_t_7;
22972   goto __pyx_L0;
22973 
22974   /* "lupa/_lupa.pyx":1446
22975  * # calling Python objects
22976  *
22977  * cdef bint call_python(LuaRuntime runtime, lua_State *L, py_object* py_obj) except -1:             # <<<<<<<<<<<<<<
22978  *     cdef int i, nargs = lua.lua_gettop(L) - 1
22979  *     cdef tuple args
22980  */
22981 
22982   /* function exit code */
22983   __pyx_L1_error:;
22984   __Pyx_XDECREF(__pyx_t_2);
22985   __Pyx_XDECREF(__pyx_t_3);
22986   __Pyx_XDECREF(__pyx_t_4);
22987   __Pyx_AddTraceback("lupa._lupa.call_python", __pyx_clineno, __pyx_lineno, __pyx_filename);
22988   __pyx_r = -1;
22989   __pyx_L0:;
22990   __Pyx_XDECREF(__pyx_v_args);
22991   __Pyx_XDECREF(__pyx_v_f);
22992   __Pyx_XDECREF(__pyx_v_result);
22993   __Pyx_XDECREF(__pyx_v_arg);
22994   __Pyx_RefNannyFinishContext();
22995   return __pyx_r;
22996 }
22997 
22998 /* "lupa/_lupa.pyx":1487
22999  *     return py_function_result_to_lua(runtime, L, result)
23000  *
23001  * cdef int py_call_with_gil(lua_State* L, py_object *py_obj) with gil:             # <<<<<<<<<<<<<<
23002  *     cdef LuaRuntime runtime = None
23003  *     cdef lua_State* stored_state = NULL
23004  */
23005 
__pyx_f_4lupa_5_lupa_py_call_with_gil(lua_State * __pyx_v_L,struct __pyx_t_4lupa_5_lupa_py_object * __pyx_v_py_obj)23006 static int __pyx_f_4lupa_5_lupa_py_call_with_gil(lua_State *__pyx_v_L, struct __pyx_t_4lupa_5_lupa_py_object *__pyx_v_py_obj) {
23007   struct __pyx_obj_4lupa_5_lupa_LuaRuntime *__pyx_v_runtime = 0;
23008   lua_State *__pyx_v_stored_state;
23009   int __pyx_r;
23010   __Pyx_RefNannyDeclarations
23011   PyObject *__pyx_t_1 = NULL;
23012   PyObject *__pyx_t_2 = NULL;
23013   PyObject *__pyx_t_3 = NULL;
23014   PyObject *__pyx_t_4 = NULL;
23015   int __pyx_t_5;
23016   lua_State *__pyx_t_6;
23017   PyObject *__pyx_t_7 = NULL;
23018   PyObject *__pyx_t_8 = NULL;
23019   int __pyx_t_9;
23020   int __pyx_t_10;
23021   char const *__pyx_t_11;
23022   PyObject *__pyx_t_12 = NULL;
23023   PyObject *__pyx_t_13 = NULL;
23024   PyObject *__pyx_t_14 = NULL;
23025   int __pyx_lineno = 0;
23026   const char *__pyx_filename = NULL;
23027   int __pyx_clineno = 0;
23028   #ifdef WITH_THREAD
23029   PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
23030   #endif
23031   __Pyx_RefNannySetupContext("py_call_with_gil", 0);
23032 
23033   /* "lupa/_lupa.pyx":1488
23034  *
23035  * cdef int py_call_with_gil(lua_State* L, py_object *py_obj) with gil:
23036  *     cdef LuaRuntime runtime = None             # <<<<<<<<<<<<<<
23037  *     cdef lua_State* stored_state = NULL
23038  *
23039  */
23040   __Pyx_INCREF(Py_None);
23041   __pyx_v_runtime = ((struct __pyx_obj_4lupa_5_lupa_LuaRuntime *)Py_None);
23042 
23043   /* "lupa/_lupa.pyx":1489
23044  * cdef int py_call_with_gil(lua_State* L, py_object *py_obj) with gil:
23045  *     cdef LuaRuntime runtime = None
23046  *     cdef lua_State* stored_state = NULL             # <<<<<<<<<<<<<<
23047  *
23048  *     try:
23049  */
23050   __pyx_v_stored_state = NULL;
23051 
23052   /* "lupa/_lupa.pyx":1491
23053  *     cdef lua_State* stored_state = NULL
23054  *
23055  *     try:             # <<<<<<<<<<<<<<
23056  *         runtime = <LuaRuntime?>py_obj.runtime
23057  *         if runtime._state is not L:
23058  */
23059   /*try:*/ {
23060     {
23061       __Pyx_PyThreadState_declare
23062       __Pyx_PyThreadState_assign
23063       __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
23064       __Pyx_XGOTREF(__pyx_t_1);
23065       __Pyx_XGOTREF(__pyx_t_2);
23066       __Pyx_XGOTREF(__pyx_t_3);
23067       /*try:*/ {
23068 
23069         /* "lupa/_lupa.pyx":1492
23070  *
23071  *     try:
23072  *         runtime = <LuaRuntime?>py_obj.runtime             # <<<<<<<<<<<<<<
23073  *         if runtime._state is not L:
23074  *             stored_state = runtime._state
23075  */
23076         __pyx_t_4 = ((PyObject *)__pyx_v_py_obj->runtime);
23077         __Pyx_INCREF(__pyx_t_4);
23078         __Pyx_DECREF_SET(__pyx_v_runtime, ((struct __pyx_obj_4lupa_5_lupa_LuaRuntime *)__pyx_t_4));
23079         __pyx_t_4 = 0;
23080 
23081         /* "lupa/_lupa.pyx":1493
23082  *     try:
23083  *         runtime = <LuaRuntime?>py_obj.runtime
23084  *         if runtime._state is not L:             # <<<<<<<<<<<<<<
23085  *             stored_state = runtime._state
23086  *             runtime._state = L
23087  */
23088         __pyx_t_5 = ((__pyx_v_runtime->_state != __pyx_v_L) != 0);
23089         if (__pyx_t_5) {
23090 
23091           /* "lupa/_lupa.pyx":1494
23092  *         runtime = <LuaRuntime?>py_obj.runtime
23093  *         if runtime._state is not L:
23094  *             stored_state = runtime._state             # <<<<<<<<<<<<<<
23095  *             runtime._state = L
23096  *         return call_python(runtime, L, py_obj)
23097  */
23098           __pyx_t_6 = __pyx_v_runtime->_state;
23099           __pyx_v_stored_state = __pyx_t_6;
23100 
23101           /* "lupa/_lupa.pyx":1495
23102  *         if runtime._state is not L:
23103  *             stored_state = runtime._state
23104  *             runtime._state = L             # <<<<<<<<<<<<<<
23105  *         return call_python(runtime, L, py_obj)
23106  *     except:
23107  */
23108           __pyx_v_runtime->_state = __pyx_v_L;
23109 
23110           /* "lupa/_lupa.pyx":1493
23111  *     try:
23112  *         runtime = <LuaRuntime?>py_obj.runtime
23113  *         if runtime._state is not L:             # <<<<<<<<<<<<<<
23114  *             stored_state = runtime._state
23115  *             runtime._state = L
23116  */
23117         }
23118 
23119         /* "lupa/_lupa.pyx":1496
23120  *             stored_state = runtime._state
23121  *             runtime._state = L
23122  *         return call_python(runtime, L, py_obj)             # <<<<<<<<<<<<<<
23123  *     except:
23124  *         runtime.store_raised_exception(L, b'error during Python call')
23125  */
23126         __pyx_t_5 = __pyx_f_4lupa_5_lupa_call_python(__pyx_v_runtime, __pyx_v_L, __pyx_v_py_obj); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 1496, __pyx_L6_error)
23127         __pyx_r = __pyx_t_5;
23128         goto __pyx_L10_try_return;
23129 
23130         /* "lupa/_lupa.pyx":1491
23131  *     cdef lua_State* stored_state = NULL
23132  *
23133  *     try:             # <<<<<<<<<<<<<<
23134  *         runtime = <LuaRuntime?>py_obj.runtime
23135  *         if runtime._state is not L:
23136  */
23137       }
23138       __pyx_L6_error:;
23139       __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
23140 
23141       /* "lupa/_lupa.pyx":1497
23142  *             runtime._state = L
23143  *         return call_python(runtime, L, py_obj)
23144  *     except:             # <<<<<<<<<<<<<<
23145  *         runtime.store_raised_exception(L, b'error during Python call')
23146  *         return -1
23147  */
23148       /*except:*/ {
23149         __Pyx_AddTraceback("lupa._lupa.py_call_with_gil", __pyx_clineno, __pyx_lineno, __pyx_filename);
23150         if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_7, &__pyx_t_8) < 0) __PYX_ERR(0, 1497, __pyx_L8_except_error)
23151         __Pyx_GOTREF(__pyx_t_4);
23152         __Pyx_GOTREF(__pyx_t_7);
23153         __Pyx_GOTREF(__pyx_t_8);
23154 
23155         /* "lupa/_lupa.pyx":1498
23156  *         return call_python(runtime, L, py_obj)
23157  *     except:
23158  *         runtime.store_raised_exception(L, b'error during Python call')             # <<<<<<<<<<<<<<
23159  *         return -1
23160  *     finally:
23161  */
23162         __pyx_t_9 = __pyx_f_4lupa_5_lupa_10LuaRuntime_store_raised_exception(__pyx_v_runtime, __pyx_v_L, __pyx_kp_b_error_during_Python_call); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 1498, __pyx_L8_except_error)
23163 
23164         /* "lupa/_lupa.pyx":1499
23165  *     except:
23166  *         runtime.store_raised_exception(L, b'error during Python call')
23167  *         return -1             # <<<<<<<<<<<<<<
23168  *     finally:
23169  *         if stored_state is not NULL:
23170  */
23171         __pyx_r = -1;
23172         __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
23173         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
23174         __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
23175         goto __pyx_L9_except_return;
23176       }
23177       __pyx_L8_except_error:;
23178 
23179       /* "lupa/_lupa.pyx":1491
23180  *     cdef lua_State* stored_state = NULL
23181  *
23182  *     try:             # <<<<<<<<<<<<<<
23183  *         runtime = <LuaRuntime?>py_obj.runtime
23184  *         if runtime._state is not L:
23185  */
23186       __Pyx_XGIVEREF(__pyx_t_1);
23187       __Pyx_XGIVEREF(__pyx_t_2);
23188       __Pyx_XGIVEREF(__pyx_t_3);
23189       __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
23190       goto __pyx_L4_error;
23191       __pyx_L10_try_return:;
23192       __Pyx_XGIVEREF(__pyx_t_1);
23193       __Pyx_XGIVEREF(__pyx_t_2);
23194       __Pyx_XGIVEREF(__pyx_t_3);
23195       __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
23196       goto __pyx_L3_return;
23197       __pyx_L9_except_return:;
23198       __Pyx_XGIVEREF(__pyx_t_1);
23199       __Pyx_XGIVEREF(__pyx_t_2);
23200       __Pyx_XGIVEREF(__pyx_t_3);
23201       __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
23202       goto __pyx_L3_return;
23203     }
23204   }
23205 
23206   /* "lupa/_lupa.pyx":1501
23207  *         return -1
23208  *     finally:
23209  *         if stored_state is not NULL:             # <<<<<<<<<<<<<<
23210  *             runtime._state = stored_state
23211  *
23212  */
23213   /*finally:*/ {
23214     __pyx_L4_error:;
23215     /*exception exit:*/{
23216       __Pyx_PyThreadState_declare
23217       __Pyx_PyThreadState_assign
23218       __pyx_t_3 = 0; __pyx_t_2 = 0; __pyx_t_1 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0;
23219       __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
23220       __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
23221       __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
23222       if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14);
23223       if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1) < 0)) __Pyx_ErrFetch(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1);
23224       __Pyx_XGOTREF(__pyx_t_3);
23225       __Pyx_XGOTREF(__pyx_t_2);
23226       __Pyx_XGOTREF(__pyx_t_1);
23227       __Pyx_XGOTREF(__pyx_t_12);
23228       __Pyx_XGOTREF(__pyx_t_13);
23229       __Pyx_XGOTREF(__pyx_t_14);
23230       __pyx_t_9 = __pyx_lineno; __pyx_t_10 = __pyx_clineno; __pyx_t_11 = __pyx_filename;
23231       {
23232         __pyx_t_5 = ((__pyx_v_stored_state != NULL) != 0);
23233         if (__pyx_t_5) {
23234 
23235           /* "lupa/_lupa.pyx":1502
23236  *     finally:
23237  *         if stored_state is not NULL:
23238  *             runtime._state = stored_state             # <<<<<<<<<<<<<<
23239  *
23240  * cdef int py_object_call(lua_State* L) nogil:
23241  */
23242           __pyx_v_runtime->_state = __pyx_v_stored_state;
23243 
23244           /* "lupa/_lupa.pyx":1501
23245  *         return -1
23246  *     finally:
23247  *         if stored_state is not NULL:             # <<<<<<<<<<<<<<
23248  *             runtime._state = stored_state
23249  *
23250  */
23251         }
23252       }
23253       if (PY_MAJOR_VERSION >= 3) {
23254         __Pyx_XGIVEREF(__pyx_t_12);
23255         __Pyx_XGIVEREF(__pyx_t_13);
23256         __Pyx_XGIVEREF(__pyx_t_14);
23257         __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_13, __pyx_t_14);
23258       }
23259       __Pyx_XGIVEREF(__pyx_t_3);
23260       __Pyx_XGIVEREF(__pyx_t_2);
23261       __Pyx_XGIVEREF(__pyx_t_1);
23262       __Pyx_ErrRestore(__pyx_t_3, __pyx_t_2, __pyx_t_1);
23263       __pyx_t_3 = 0; __pyx_t_2 = 0; __pyx_t_1 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0;
23264       __pyx_lineno = __pyx_t_9; __pyx_clineno = __pyx_t_10; __pyx_filename = __pyx_t_11;
23265       goto __pyx_L1_error;
23266     }
23267     __pyx_L3_return: {
23268       __pyx_t_10 = __pyx_r;
23269       __pyx_t_5 = ((__pyx_v_stored_state != NULL) != 0);
23270       if (__pyx_t_5) {
23271 
23272         /* "lupa/_lupa.pyx":1502
23273  *     finally:
23274  *         if stored_state is not NULL:
23275  *             runtime._state = stored_state             # <<<<<<<<<<<<<<
23276  *
23277  * cdef int py_object_call(lua_State* L) nogil:
23278  */
23279         __pyx_v_runtime->_state = __pyx_v_stored_state;
23280 
23281         /* "lupa/_lupa.pyx":1501
23282  *         return -1
23283  *     finally:
23284  *         if stored_state is not NULL:             # <<<<<<<<<<<<<<
23285  *             runtime._state = stored_state
23286  *
23287  */
23288       }
23289       __pyx_r = __pyx_t_10;
23290       goto __pyx_L0;
23291     }
23292   }
23293 
23294   /* "lupa/_lupa.pyx":1487
23295  *     return py_function_result_to_lua(runtime, L, result)
23296  *
23297  * cdef int py_call_with_gil(lua_State* L, py_object *py_obj) with gil:             # <<<<<<<<<<<<<<
23298  *     cdef LuaRuntime runtime = None
23299  *     cdef lua_State* stored_state = NULL
23300  */
23301 
23302   /* function exit code */
23303   __pyx_L1_error:;
23304   __Pyx_XDECREF(__pyx_t_4);
23305   __Pyx_XDECREF(__pyx_t_7);
23306   __Pyx_XDECREF(__pyx_t_8);
23307   __Pyx_WriteUnraisable("lupa._lupa.py_call_with_gil", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
23308   __pyx_r = 0;
23309   __pyx_L0:;
23310   __Pyx_XDECREF((PyObject *)__pyx_v_runtime);
23311   __Pyx_RefNannyFinishContext();
23312   #ifdef WITH_THREAD
23313   __Pyx_PyGILState_Release(__pyx_gilstate_save);
23314   #endif
23315   return __pyx_r;
23316 }
23317 
23318 /* "lupa/_lupa.pyx":1504
23319  *             runtime._state = stored_state
23320  *
23321  * cdef int py_object_call(lua_State* L) nogil:             # <<<<<<<<<<<<<<
23322  *     cdef py_object* py_obj = unwrap_lua_object(L, 1) # may not return on error!
23323  *     if not py_obj:
23324  */
23325 
__pyx_f_4lupa_5_lupa_py_object_call(lua_State * __pyx_v_L)23326 static int __pyx_f_4lupa_5_lupa_py_object_call(lua_State *__pyx_v_L) {
23327   struct __pyx_t_4lupa_5_lupa_py_object *__pyx_v_py_obj;
23328   int __pyx_v_result;
23329   int __pyx_r;
23330   int __pyx_t_1;
23331 
23332   /* "lupa/_lupa.pyx":1505
23333  *
23334  * cdef int py_object_call(lua_State* L) nogil:
23335  *     cdef py_object* py_obj = unwrap_lua_object(L, 1) # may not return on error!             # <<<<<<<<<<<<<<
23336  *     if not py_obj:
23337  *         return lua.luaL_argerror(L, 1, "not a python object")  # never returns!
23338  */
23339   __pyx_v_py_obj = __pyx_f_4lupa_5_lupa_unwrap_lua_object(__pyx_v_L, 1);
23340 
23341   /* "lupa/_lupa.pyx":1506
23342  * cdef int py_object_call(lua_State* L) nogil:
23343  *     cdef py_object* py_obj = unwrap_lua_object(L, 1) # may not return on error!
23344  *     if not py_obj:             # <<<<<<<<<<<<<<
23345  *         return lua.luaL_argerror(L, 1, "not a python object")  # never returns!
23346  *
23347  */
23348   __pyx_t_1 = ((!(__pyx_v_py_obj != 0)) != 0);
23349   if (__pyx_t_1) {
23350 
23351     /* "lupa/_lupa.pyx":1507
23352  *     cdef py_object* py_obj = unwrap_lua_object(L, 1) # may not return on error!
23353  *     if not py_obj:
23354  *         return lua.luaL_argerror(L, 1, "not a python object")  # never returns!             # <<<<<<<<<<<<<<
23355  *
23356  *     result = py_call_with_gil(L, py_obj)
23357  */
23358     __pyx_r = luaL_argerror(__pyx_v_L, 1, ((char *)"not a python object"));
23359     goto __pyx_L0;
23360 
23361     /* "lupa/_lupa.pyx":1506
23362  * cdef int py_object_call(lua_State* L) nogil:
23363  *     cdef py_object* py_obj = unwrap_lua_object(L, 1) # may not return on error!
23364  *     if not py_obj:             # <<<<<<<<<<<<<<
23365  *         return lua.luaL_argerror(L, 1, "not a python object")  # never returns!
23366  *
23367  */
23368   }
23369 
23370   /* "lupa/_lupa.pyx":1509
23371  *         return lua.luaL_argerror(L, 1, "not a python object")  # never returns!
23372  *
23373  *     result = py_call_with_gil(L, py_obj)             # <<<<<<<<<<<<<<
23374  *     if result < 0:
23375  *         return lua.lua_error(L)  # never returns!
23376  */
23377   __pyx_v_result = __pyx_f_4lupa_5_lupa_py_call_with_gil(__pyx_v_L, __pyx_v_py_obj);
23378 
23379   /* "lupa/_lupa.pyx":1510
23380  *
23381  *     result = py_call_with_gil(L, py_obj)
23382  *     if result < 0:             # <<<<<<<<<<<<<<
23383  *         return lua.lua_error(L)  # never returns!
23384  *     return result
23385  */
23386   __pyx_t_1 = ((__pyx_v_result < 0) != 0);
23387   if (__pyx_t_1) {
23388 
23389     /* "lupa/_lupa.pyx":1511
23390  *     result = py_call_with_gil(L, py_obj)
23391  *     if result < 0:
23392  *         return lua.lua_error(L)  # never returns!             # <<<<<<<<<<<<<<
23393  *     return result
23394  *
23395  */
23396     __pyx_r = lua_error(__pyx_v_L);
23397     goto __pyx_L0;
23398 
23399     /* "lupa/_lupa.pyx":1510
23400  *
23401  *     result = py_call_with_gil(L, py_obj)
23402  *     if result < 0:             # <<<<<<<<<<<<<<
23403  *         return lua.lua_error(L)  # never returns!
23404  *     return result
23405  */
23406   }
23407 
23408   /* "lupa/_lupa.pyx":1512
23409  *     if result < 0:
23410  *         return lua.lua_error(L)  # never returns!
23411  *     return result             # <<<<<<<<<<<<<<
23412  *
23413  * # str() support for Python objects
23414  */
23415   __pyx_r = __pyx_v_result;
23416   goto __pyx_L0;
23417 
23418   /* "lupa/_lupa.pyx":1504
23419  *             runtime._state = stored_state
23420  *
23421  * cdef int py_object_call(lua_State* L) nogil:             # <<<<<<<<<<<<<<
23422  *     cdef py_object* py_obj = unwrap_lua_object(L, 1) # may not return on error!
23423  *     if not py_obj:
23424  */
23425 
23426   /* function exit code */
23427   __pyx_L0:;
23428   return __pyx_r;
23429 }
23430 
23431 /* "lupa/_lupa.pyx":1516
23432  * # str() support for Python objects
23433  *
23434  * cdef int py_str_with_gil(lua_State* L, py_object* py_obj) with gil:             # <<<<<<<<<<<<<<
23435  *     cdef LuaRuntime runtime
23436  *     try:
23437  */
23438 
__pyx_f_4lupa_5_lupa_py_str_with_gil(lua_State * __pyx_v_L,struct __pyx_t_4lupa_5_lupa_py_object * __pyx_v_py_obj)23439 static int __pyx_f_4lupa_5_lupa_py_str_with_gil(lua_State *__pyx_v_L, struct __pyx_t_4lupa_5_lupa_py_object *__pyx_v_py_obj) {
23440   struct __pyx_obj_4lupa_5_lupa_LuaRuntime *__pyx_v_runtime = 0;
23441   PyObject *__pyx_v_s = NULL;
23442   int __pyx_r;
23443   __Pyx_RefNannyDeclarations
23444   PyObject *__pyx_t_1 = NULL;
23445   PyObject *__pyx_t_2 = NULL;
23446   PyObject *__pyx_t_3 = NULL;
23447   PyObject *__pyx_t_4 = NULL;
23448   int __pyx_t_5;
23449   int __pyx_t_6;
23450   char const *__pyx_t_7;
23451   char *__pyx_t_8;
23452   Py_ssize_t __pyx_t_9;
23453   PyObject *__pyx_t_10 = NULL;
23454   PyObject *__pyx_t_11 = NULL;
23455   int __pyx_t_12;
23456   PyObject *__pyx_t_13 = NULL;
23457   PyObject *__pyx_t_14 = NULL;
23458   PyObject *__pyx_t_15 = NULL;
23459   PyObject *__pyx_t_16 = NULL;
23460   PyObject *__pyx_t_17 = NULL;
23461   PyObject *__pyx_t_18 = NULL;
23462   int __pyx_lineno = 0;
23463   const char *__pyx_filename = NULL;
23464   int __pyx_clineno = 0;
23465   #ifdef WITH_THREAD
23466   PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
23467   #endif
23468   __Pyx_RefNannySetupContext("py_str_with_gil", 0);
23469 
23470   /* "lupa/_lupa.pyx":1518
23471  * cdef int py_str_with_gil(lua_State* L, py_object* py_obj) with gil:
23472  *     cdef LuaRuntime runtime
23473  *     try:             # <<<<<<<<<<<<<<
23474  *         runtime = <LuaRuntime?>py_obj.runtime
23475  *         s = str(<object>py_obj.obj)
23476  */
23477   {
23478     __Pyx_PyThreadState_declare
23479     __Pyx_PyThreadState_assign
23480     __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
23481     __Pyx_XGOTREF(__pyx_t_1);
23482     __Pyx_XGOTREF(__pyx_t_2);
23483     __Pyx_XGOTREF(__pyx_t_3);
23484     /*try:*/ {
23485 
23486       /* "lupa/_lupa.pyx":1519
23487  *     cdef LuaRuntime runtime
23488  *     try:
23489  *         runtime = <LuaRuntime?>py_obj.runtime             # <<<<<<<<<<<<<<
23490  *         s = str(<object>py_obj.obj)
23491  *         if isinstance(s, unicode):
23492  */
23493       __pyx_t_4 = ((PyObject *)__pyx_v_py_obj->runtime);
23494       __Pyx_INCREF(__pyx_t_4);
23495       __pyx_v_runtime = ((struct __pyx_obj_4lupa_5_lupa_LuaRuntime *)__pyx_t_4);
23496       __pyx_t_4 = 0;
23497 
23498       /* "lupa/_lupa.pyx":1520
23499  *     try:
23500  *         runtime = <LuaRuntime?>py_obj.runtime
23501  *         s = str(<object>py_obj.obj)             # <<<<<<<<<<<<<<
23502  *         if isinstance(s, unicode):
23503  *             if runtime._encoding is None:
23504  */
23505       __pyx_t_4 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), ((PyObject *)__pyx_v_py_obj->obj)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1520, __pyx_L3_error)
23506       __Pyx_GOTREF(__pyx_t_4);
23507       __pyx_v_s = __pyx_t_4;
23508       __pyx_t_4 = 0;
23509 
23510       /* "lupa/_lupa.pyx":1521
23511  *         runtime = <LuaRuntime?>py_obj.runtime
23512  *         s = str(<object>py_obj.obj)
23513  *         if isinstance(s, unicode):             # <<<<<<<<<<<<<<
23514  *             if runtime._encoding is None:
23515  *                 s = (<unicode>s).encode('UTF-8')
23516  */
23517       __pyx_t_5 = PyUnicode_Check(__pyx_v_s);
23518       __pyx_t_6 = (__pyx_t_5 != 0);
23519       if (__pyx_t_6) {
23520 
23521         /* "lupa/_lupa.pyx":1522
23522  *         s = str(<object>py_obj.obj)
23523  *         if isinstance(s, unicode):
23524  *             if runtime._encoding is None:             # <<<<<<<<<<<<<<
23525  *                 s = (<unicode>s).encode('UTF-8')
23526  *             else:
23527  */
23528         __pyx_t_6 = (__pyx_v_runtime->_encoding == ((PyObject*)Py_None));
23529         __pyx_t_5 = (__pyx_t_6 != 0);
23530         if (__pyx_t_5) {
23531 
23532           /* "lupa/_lupa.pyx":1523
23533  *         if isinstance(s, unicode):
23534  *             if runtime._encoding is None:
23535  *                 s = (<unicode>s).encode('UTF-8')             # <<<<<<<<<<<<<<
23536  *             else:
23537  *                 s = (<unicode>s).encode(runtime._encoding)
23538  */
23539           if (unlikely(__pyx_v_s == Py_None)) {
23540             PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode");
23541             __PYX_ERR(0, 1523, __pyx_L3_error)
23542           }
23543           __pyx_t_4 = PyUnicode_AsUTF8String(((PyObject*)__pyx_v_s)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1523, __pyx_L3_error)
23544           __Pyx_GOTREF(__pyx_t_4);
23545           __Pyx_DECREF_SET(__pyx_v_s, __pyx_t_4);
23546           __pyx_t_4 = 0;
23547 
23548           /* "lupa/_lupa.pyx":1522
23549  *         s = str(<object>py_obj.obj)
23550  *         if isinstance(s, unicode):
23551  *             if runtime._encoding is None:             # <<<<<<<<<<<<<<
23552  *                 s = (<unicode>s).encode('UTF-8')
23553  *             else:
23554  */
23555           goto __pyx_L10;
23556         }
23557 
23558         /* "lupa/_lupa.pyx":1525
23559  *                 s = (<unicode>s).encode('UTF-8')
23560  *             else:
23561  *                 s = (<unicode>s).encode(runtime._encoding)             # <<<<<<<<<<<<<<
23562  *         else:
23563  *             assert isinstance(s, bytes)
23564  */
23565         /*else*/ {
23566           if (unlikely(__pyx_v_s == Py_None)) {
23567             PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode");
23568             __PYX_ERR(0, 1525, __pyx_L3_error)
23569           }
23570           if (unlikely(__pyx_v_runtime->_encoding == Py_None)) {
23571             PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
23572             __PYX_ERR(0, 1525, __pyx_L3_error)
23573           }
23574           __pyx_t_7 = __Pyx_PyBytes_AsString(__pyx_v_runtime->_encoding); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(0, 1525, __pyx_L3_error)
23575           __pyx_t_4 = PyUnicode_AsEncodedString(((PyObject*)__pyx_v_s), __pyx_t_7, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1525, __pyx_L3_error)
23576           __Pyx_GOTREF(__pyx_t_4);
23577           __Pyx_DECREF_SET(__pyx_v_s, __pyx_t_4);
23578           __pyx_t_4 = 0;
23579         }
23580         __pyx_L10:;
23581 
23582         /* "lupa/_lupa.pyx":1521
23583  *         runtime = <LuaRuntime?>py_obj.runtime
23584  *         s = str(<object>py_obj.obj)
23585  *         if isinstance(s, unicode):             # <<<<<<<<<<<<<<
23586  *             if runtime._encoding is None:
23587  *                 s = (<unicode>s).encode('UTF-8')
23588  */
23589         goto __pyx_L9;
23590       }
23591 
23592       /* "lupa/_lupa.pyx":1527
23593  *                 s = (<unicode>s).encode(runtime._encoding)
23594  *         else:
23595  *             assert isinstance(s, bytes)             # <<<<<<<<<<<<<<
23596  *         lua.lua_pushlstring(L, <bytes>s, len(<bytes>s))
23597  *         return 1 # returning 1 value
23598  */
23599       /*else*/ {
23600         #ifndef CYTHON_WITHOUT_ASSERTIONS
23601         if (unlikely(!Py_OptimizeFlag)) {
23602           __pyx_t_5 = PyBytes_Check(__pyx_v_s);
23603           if (unlikely(!(__pyx_t_5 != 0))) {
23604             PyErr_SetNone(PyExc_AssertionError);
23605             __PYX_ERR(0, 1527, __pyx_L3_error)
23606           }
23607         }
23608         #endif
23609       }
23610       __pyx_L9:;
23611 
23612       /* "lupa/_lupa.pyx":1528
23613  *         else:
23614  *             assert isinstance(s, bytes)
23615  *         lua.lua_pushlstring(L, <bytes>s, len(<bytes>s))             # <<<<<<<<<<<<<<
23616  *         return 1 # returning 1 value
23617  *     except:
23618  */
23619       if (unlikely(__pyx_v_s == Py_None)) {
23620         PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
23621         __PYX_ERR(0, 1528, __pyx_L3_error)
23622       }
23623       __pyx_t_8 = __Pyx_PyBytes_AsWritableString(__pyx_v_s); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) __PYX_ERR(0, 1528, __pyx_L3_error)
23624       if (unlikely(__pyx_v_s == Py_None)) {
23625         PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
23626         __PYX_ERR(0, 1528, __pyx_L3_error)
23627       }
23628       __pyx_t_9 = PyBytes_GET_SIZE(((PyObject*)__pyx_v_s)); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1528, __pyx_L3_error)
23629       lua_pushlstring(__pyx_v_L, __pyx_t_8, __pyx_t_9);
23630 
23631       /* "lupa/_lupa.pyx":1529
23632  *             assert isinstance(s, bytes)
23633  *         lua.lua_pushlstring(L, <bytes>s, len(<bytes>s))
23634  *         return 1 # returning 1 value             # <<<<<<<<<<<<<<
23635  *     except:
23636  *         try: runtime.store_raised_exception(L, b'error during Python str() call')
23637  */
23638       __pyx_r = 1;
23639       goto __pyx_L7_try_return;
23640 
23641       /* "lupa/_lupa.pyx":1518
23642  * cdef int py_str_with_gil(lua_State* L, py_object* py_obj) with gil:
23643  *     cdef LuaRuntime runtime
23644  *     try:             # <<<<<<<<<<<<<<
23645  *         runtime = <LuaRuntime?>py_obj.runtime
23646  *         s = str(<object>py_obj.obj)
23647  */
23648     }
23649     __pyx_L3_error:;
23650     __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
23651 
23652     /* "lupa/_lupa.pyx":1530
23653  *         lua.lua_pushlstring(L, <bytes>s, len(<bytes>s))
23654  *         return 1 # returning 1 value
23655  *     except:             # <<<<<<<<<<<<<<
23656  *         try: runtime.store_raised_exception(L, b'error during Python str() call')
23657  *         finally: return -1
23658  */
23659     /*except:*/ {
23660       __Pyx_AddTraceback("lupa._lupa.py_str_with_gil", __pyx_clineno, __pyx_lineno, __pyx_filename);
23661       if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_10, &__pyx_t_11) < 0) __PYX_ERR(0, 1530, __pyx_L5_except_error)
23662       __Pyx_GOTREF(__pyx_t_4);
23663       __Pyx_GOTREF(__pyx_t_10);
23664       __Pyx_GOTREF(__pyx_t_11);
23665 
23666       /* "lupa/_lupa.pyx":1531
23667  *         return 1 # returning 1 value
23668  *     except:
23669  *         try: runtime.store_raised_exception(L, b'error during Python str() call')             # <<<<<<<<<<<<<<
23670  *         finally: return -1
23671  *
23672  */
23673       /*try:*/ {
23674         if (unlikely(!__pyx_v_runtime)) { __Pyx_RaiseUnboundLocalError("runtime"); __PYX_ERR(0, 1531, __pyx_L16_error) }
23675         __pyx_t_12 = __pyx_f_4lupa_5_lupa_10LuaRuntime_store_raised_exception(__pyx_v_runtime, __pyx_v_L, __pyx_kp_b_error_during_Python_str_call); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 1531, __pyx_L16_error)
23676       }
23677 
23678       /* "lupa/_lupa.pyx":1532
23679  *     except:
23680  *         try: runtime.store_raised_exception(L, b'error during Python str() call')
23681  *         finally: return -1             # <<<<<<<<<<<<<<
23682  *
23683  * cdef int py_object_str(lua_State* L) nogil:
23684  */
23685       /*finally:*/ {
23686         /*normal exit:*/{
23687           __pyx_r = -1;
23688           __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
23689           __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
23690           __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
23691           goto __pyx_L6_except_return;
23692         }
23693         __pyx_L16_error:;
23694         /*exception exit:*/{
23695           __Pyx_PyThreadState_declare
23696           __Pyx_PyThreadState_assign
23697           __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0;
23698           if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_16, &__pyx_t_17, &__pyx_t_18);
23699           if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15) < 0)) __Pyx_ErrFetch(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15);
23700           __Pyx_XGOTREF(__pyx_t_13);
23701           __Pyx_XGOTREF(__pyx_t_14);
23702           __Pyx_XGOTREF(__pyx_t_15);
23703           __Pyx_XGOTREF(__pyx_t_16);
23704           __Pyx_XGOTREF(__pyx_t_17);
23705           __Pyx_XGOTREF(__pyx_t_18);
23706           {
23707             __pyx_r = -1;
23708             __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
23709             __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
23710             __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
23711             goto __pyx_L20_return;
23712           }
23713           __pyx_L20_return:;
23714           if (PY_MAJOR_VERSION >= 3) {
23715             __Pyx_XGIVEREF(__pyx_t_16);
23716             __Pyx_XGIVEREF(__pyx_t_17);
23717             __Pyx_XGIVEREF(__pyx_t_18);
23718             __Pyx_ExceptionReset(__pyx_t_16, __pyx_t_17, __pyx_t_18);
23719           }
23720           __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
23721           __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
23722           __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
23723           __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0;
23724           goto __pyx_L6_except_return;
23725         }
23726       }
23727     }
23728     __pyx_L5_except_error:;
23729 
23730     /* "lupa/_lupa.pyx":1518
23731  * cdef int py_str_with_gil(lua_State* L, py_object* py_obj) with gil:
23732  *     cdef LuaRuntime runtime
23733  *     try:             # <<<<<<<<<<<<<<
23734  *         runtime = <LuaRuntime?>py_obj.runtime
23735  *         s = str(<object>py_obj.obj)
23736  */
23737     __Pyx_XGIVEREF(__pyx_t_1);
23738     __Pyx_XGIVEREF(__pyx_t_2);
23739     __Pyx_XGIVEREF(__pyx_t_3);
23740     __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
23741     goto __pyx_L1_error;
23742     __pyx_L7_try_return:;
23743     __Pyx_XGIVEREF(__pyx_t_1);
23744     __Pyx_XGIVEREF(__pyx_t_2);
23745     __Pyx_XGIVEREF(__pyx_t_3);
23746     __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
23747     goto __pyx_L0;
23748     __pyx_L6_except_return:;
23749     __Pyx_XGIVEREF(__pyx_t_1);
23750     __Pyx_XGIVEREF(__pyx_t_2);
23751     __Pyx_XGIVEREF(__pyx_t_3);
23752     __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
23753     goto __pyx_L0;
23754   }
23755 
23756   /* "lupa/_lupa.pyx":1516
23757  * # str() support for Python objects
23758  *
23759  * cdef int py_str_with_gil(lua_State* L, py_object* py_obj) with gil:             # <<<<<<<<<<<<<<
23760  *     cdef LuaRuntime runtime
23761  *     try:
23762  */
23763 
23764   /* function exit code */
23765   __pyx_L1_error:;
23766   __Pyx_XDECREF(__pyx_t_4);
23767   __Pyx_XDECREF(__pyx_t_10);
23768   __Pyx_XDECREF(__pyx_t_11);
23769   __Pyx_WriteUnraisable("lupa._lupa.py_str_with_gil", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
23770   __pyx_r = 0;
23771   __pyx_L0:;
23772   __Pyx_XDECREF((PyObject *)__pyx_v_runtime);
23773   __Pyx_XDECREF(__pyx_v_s);
23774   __Pyx_RefNannyFinishContext();
23775   #ifdef WITH_THREAD
23776   __Pyx_PyGILState_Release(__pyx_gilstate_save);
23777   #endif
23778   return __pyx_r;
23779 }
23780 
23781 /* "lupa/_lupa.pyx":1534
23782  *         finally: return -1
23783  *
23784  * cdef int py_object_str(lua_State* L) nogil:             # <<<<<<<<<<<<<<
23785  *     cdef py_object* py_obj = unwrap_lua_object(L, 1) # may not return on error!
23786  *     if not py_obj:
23787  */
23788 
__pyx_f_4lupa_5_lupa_py_object_str(lua_State * __pyx_v_L)23789 static int __pyx_f_4lupa_5_lupa_py_object_str(lua_State *__pyx_v_L) {
23790   struct __pyx_t_4lupa_5_lupa_py_object *__pyx_v_py_obj;
23791   int __pyx_v_result;
23792   int __pyx_r;
23793   int __pyx_t_1;
23794 
23795   /* "lupa/_lupa.pyx":1535
23796  *
23797  * cdef int py_object_str(lua_State* L) nogil:
23798  *     cdef py_object* py_obj = unwrap_lua_object(L, 1) # may not return on error!             # <<<<<<<<<<<<<<
23799  *     if not py_obj:
23800  *         return lua.luaL_argerror(L, 1, "not a python object")   # never returns!
23801  */
23802   __pyx_v_py_obj = __pyx_f_4lupa_5_lupa_unwrap_lua_object(__pyx_v_L, 1);
23803 
23804   /* "lupa/_lupa.pyx":1536
23805  * cdef int py_object_str(lua_State* L) nogil:
23806  *     cdef py_object* py_obj = unwrap_lua_object(L, 1) # may not return on error!
23807  *     if not py_obj:             # <<<<<<<<<<<<<<
23808  *         return lua.luaL_argerror(L, 1, "not a python object")   # never returns!
23809  *     result = py_str_with_gil(L, py_obj)
23810  */
23811   __pyx_t_1 = ((!(__pyx_v_py_obj != 0)) != 0);
23812   if (__pyx_t_1) {
23813 
23814     /* "lupa/_lupa.pyx":1537
23815  *     cdef py_object* py_obj = unwrap_lua_object(L, 1) # may not return on error!
23816  *     if not py_obj:
23817  *         return lua.luaL_argerror(L, 1, "not a python object")   # never returns!             # <<<<<<<<<<<<<<
23818  *     result = py_str_with_gil(L, py_obj)
23819  *     if result < 0:
23820  */
23821     __pyx_r = luaL_argerror(__pyx_v_L, 1, ((char *)"not a python object"));
23822     goto __pyx_L0;
23823 
23824     /* "lupa/_lupa.pyx":1536
23825  * cdef int py_object_str(lua_State* L) nogil:
23826  *     cdef py_object* py_obj = unwrap_lua_object(L, 1) # may not return on error!
23827  *     if not py_obj:             # <<<<<<<<<<<<<<
23828  *         return lua.luaL_argerror(L, 1, "not a python object")   # never returns!
23829  *     result = py_str_with_gil(L, py_obj)
23830  */
23831   }
23832 
23833   /* "lupa/_lupa.pyx":1538
23834  *     if not py_obj:
23835  *         return lua.luaL_argerror(L, 1, "not a python object")   # never returns!
23836  *     result = py_str_with_gil(L, py_obj)             # <<<<<<<<<<<<<<
23837  *     if result < 0:
23838  *         return lua.lua_error(L)  # never returns!
23839  */
23840   __pyx_v_result = __pyx_f_4lupa_5_lupa_py_str_with_gil(__pyx_v_L, __pyx_v_py_obj);
23841 
23842   /* "lupa/_lupa.pyx":1539
23843  *         return lua.luaL_argerror(L, 1, "not a python object")   # never returns!
23844  *     result = py_str_with_gil(L, py_obj)
23845  *     if result < 0:             # <<<<<<<<<<<<<<
23846  *         return lua.lua_error(L)  # never returns!
23847  *     return result
23848  */
23849   __pyx_t_1 = ((__pyx_v_result < 0) != 0);
23850   if (__pyx_t_1) {
23851 
23852     /* "lupa/_lupa.pyx":1540
23853  *     result = py_str_with_gil(L, py_obj)
23854  *     if result < 0:
23855  *         return lua.lua_error(L)  # never returns!             # <<<<<<<<<<<<<<
23856  *     return result
23857  *
23858  */
23859     __pyx_r = lua_error(__pyx_v_L);
23860     goto __pyx_L0;
23861 
23862     /* "lupa/_lupa.pyx":1539
23863  *         return lua.luaL_argerror(L, 1, "not a python object")   # never returns!
23864  *     result = py_str_with_gil(L, py_obj)
23865  *     if result < 0:             # <<<<<<<<<<<<<<
23866  *         return lua.lua_error(L)  # never returns!
23867  *     return result
23868  */
23869   }
23870 
23871   /* "lupa/_lupa.pyx":1541
23872  *     if result < 0:
23873  *         return lua.lua_error(L)  # never returns!
23874  *     return result             # <<<<<<<<<<<<<<
23875  *
23876  * # item access for Python objects
23877  */
23878   __pyx_r = __pyx_v_result;
23879   goto __pyx_L0;
23880 
23881   /* "lupa/_lupa.pyx":1534
23882  *         finally: return -1
23883  *
23884  * cdef int py_object_str(lua_State* L) nogil:             # <<<<<<<<<<<<<<
23885  *     cdef py_object* py_obj = unwrap_lua_object(L, 1) # may not return on error!
23886  *     if not py_obj:
23887  */
23888 
23889   /* function exit code */
23890   __pyx_L0:;
23891   return __pyx_r;
23892 }
23893 
23894 /* "lupa/_lupa.pyx":1561
23895  * #   using the getitem method of access.
23896  *
23897  * cdef int getitem_for_lua(LuaRuntime runtime, lua_State* L, py_object* py_obj, int key_n) except -1:             # <<<<<<<<<<<<<<
23898  *     return py_to_lua(runtime, L,
23899  *                      (<object>py_obj.obj)[ py_from_lua(runtime, L, key_n) ])
23900  */
23901 
__pyx_f_4lupa_5_lupa_getitem_for_lua(struct __pyx_obj_4lupa_5_lupa_LuaRuntime * __pyx_v_runtime,lua_State * __pyx_v_L,struct __pyx_t_4lupa_5_lupa_py_object * __pyx_v_py_obj,int __pyx_v_key_n)23902 static int __pyx_f_4lupa_5_lupa_getitem_for_lua(struct __pyx_obj_4lupa_5_lupa_LuaRuntime *__pyx_v_runtime, lua_State *__pyx_v_L, struct __pyx_t_4lupa_5_lupa_py_object *__pyx_v_py_obj, int __pyx_v_key_n) {
23903   int __pyx_r;
23904   __Pyx_RefNannyDeclarations
23905   PyObject *__pyx_t_1 = NULL;
23906   PyObject *__pyx_t_2 = NULL;
23907   int __pyx_t_3;
23908   int __pyx_lineno = 0;
23909   const char *__pyx_filename = NULL;
23910   int __pyx_clineno = 0;
23911   __Pyx_RefNannySetupContext("getitem_for_lua", 0);
23912 
23913   /* "lupa/_lupa.pyx":1563
23914  * cdef int getitem_for_lua(LuaRuntime runtime, lua_State* L, py_object* py_obj, int key_n) except -1:
23915  *     return py_to_lua(runtime, L,
23916  *                      (<object>py_obj.obj)[ py_from_lua(runtime, L, key_n) ])             # <<<<<<<<<<<<<<
23917  *
23918  * cdef int setitem_for_lua(LuaRuntime runtime, lua_State* L, py_object* py_obj, int key_n, int value_n) except -1:
23919  */
23920   __pyx_t_1 = __pyx_f_4lupa_5_lupa_py_from_lua(__pyx_v_runtime, __pyx_v_L, __pyx_v_key_n); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1563, __pyx_L1_error)
23921   __Pyx_GOTREF(__pyx_t_1);
23922   __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_py_obj->obj), __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1563, __pyx_L1_error)
23923   __Pyx_GOTREF(__pyx_t_2);
23924   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23925 
23926   /* "lupa/_lupa.pyx":1562
23927  *
23928  * cdef int getitem_for_lua(LuaRuntime runtime, lua_State* L, py_object* py_obj, int key_n) except -1:
23929  *     return py_to_lua(runtime, L,             # <<<<<<<<<<<<<<
23930  *                      (<object>py_obj.obj)[ py_from_lua(runtime, L, key_n) ])
23931  *
23932  */
23933   __pyx_t_3 = __pyx_f_4lupa_5_lupa_py_to_lua(__pyx_v_runtime, __pyx_v_L, __pyx_t_2, NULL); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 1562, __pyx_L1_error)
23934   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
23935   __pyx_r = __pyx_t_3;
23936   goto __pyx_L0;
23937 
23938   /* "lupa/_lupa.pyx":1561
23939  * #   using the getitem method of access.
23940  *
23941  * cdef int getitem_for_lua(LuaRuntime runtime, lua_State* L, py_object* py_obj, int key_n) except -1:             # <<<<<<<<<<<<<<
23942  *     return py_to_lua(runtime, L,
23943  *                      (<object>py_obj.obj)[ py_from_lua(runtime, L, key_n) ])
23944  */
23945 
23946   /* function exit code */
23947   __pyx_L1_error:;
23948   __Pyx_XDECREF(__pyx_t_1);
23949   __Pyx_XDECREF(__pyx_t_2);
23950   __Pyx_AddTraceback("lupa._lupa.getitem_for_lua", __pyx_clineno, __pyx_lineno, __pyx_filename);
23951   __pyx_r = -1;
23952   __pyx_L0:;
23953   __Pyx_RefNannyFinishContext();
23954   return __pyx_r;
23955 }
23956 
23957 /* "lupa/_lupa.pyx":1565
23958  *                      (<object>py_obj.obj)[ py_from_lua(runtime, L, key_n) ])
23959  *
23960  * cdef int setitem_for_lua(LuaRuntime runtime, lua_State* L, py_object* py_obj, int key_n, int value_n) except -1:             # <<<<<<<<<<<<<<
23961  *     (<object>py_obj.obj)[ py_from_lua(runtime, L, key_n) ] = py_from_lua(runtime, L, value_n)
23962  *     return 0
23963  */
23964 
__pyx_f_4lupa_5_lupa_setitem_for_lua(struct __pyx_obj_4lupa_5_lupa_LuaRuntime * __pyx_v_runtime,lua_State * __pyx_v_L,struct __pyx_t_4lupa_5_lupa_py_object * __pyx_v_py_obj,int __pyx_v_key_n,int __pyx_v_value_n)23965 static int __pyx_f_4lupa_5_lupa_setitem_for_lua(struct __pyx_obj_4lupa_5_lupa_LuaRuntime *__pyx_v_runtime, lua_State *__pyx_v_L, struct __pyx_t_4lupa_5_lupa_py_object *__pyx_v_py_obj, int __pyx_v_key_n, int __pyx_v_value_n) {
23966   int __pyx_r;
23967   __Pyx_RefNannyDeclarations
23968   PyObject *__pyx_t_1 = NULL;
23969   PyObject *__pyx_t_2 = NULL;
23970   int __pyx_lineno = 0;
23971   const char *__pyx_filename = NULL;
23972   int __pyx_clineno = 0;
23973   __Pyx_RefNannySetupContext("setitem_for_lua", 0);
23974 
23975   /* "lupa/_lupa.pyx":1566
23976  *
23977  * cdef int setitem_for_lua(LuaRuntime runtime, lua_State* L, py_object* py_obj, int key_n, int value_n) except -1:
23978  *     (<object>py_obj.obj)[ py_from_lua(runtime, L, key_n) ] = py_from_lua(runtime, L, value_n)             # <<<<<<<<<<<<<<
23979  *     return 0
23980  *
23981  */
23982   __pyx_t_1 = __pyx_f_4lupa_5_lupa_py_from_lua(__pyx_v_runtime, __pyx_v_L, __pyx_v_value_n); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1566, __pyx_L1_error)
23983   __Pyx_GOTREF(__pyx_t_1);
23984   __pyx_t_2 = __pyx_f_4lupa_5_lupa_py_from_lua(__pyx_v_runtime, __pyx_v_L, __pyx_v_key_n); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1566, __pyx_L1_error)
23985   __Pyx_GOTREF(__pyx_t_2);
23986   if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_py_obj->obj), __pyx_t_2, __pyx_t_1) < 0)) __PYX_ERR(0, 1566, __pyx_L1_error)
23987   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
23988   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23989 
23990   /* "lupa/_lupa.pyx":1567
23991  * cdef int setitem_for_lua(LuaRuntime runtime, lua_State* L, py_object* py_obj, int key_n, int value_n) except -1:
23992  *     (<object>py_obj.obj)[ py_from_lua(runtime, L, key_n) ] = py_from_lua(runtime, L, value_n)
23993  *     return 0             # <<<<<<<<<<<<<<
23994  *
23995  * cdef int getattr_for_lua(LuaRuntime runtime, lua_State* L, py_object* py_obj, int key_n) except -1:
23996  */
23997   __pyx_r = 0;
23998   goto __pyx_L0;
23999 
24000   /* "lupa/_lupa.pyx":1565
24001  *                      (<object>py_obj.obj)[ py_from_lua(runtime, L, key_n) ])
24002  *
24003  * cdef int setitem_for_lua(LuaRuntime runtime, lua_State* L, py_object* py_obj, int key_n, int value_n) except -1:             # <<<<<<<<<<<<<<
24004  *     (<object>py_obj.obj)[ py_from_lua(runtime, L, key_n) ] = py_from_lua(runtime, L, value_n)
24005  *     return 0
24006  */
24007 
24008   /* function exit code */
24009   __pyx_L1_error:;
24010   __Pyx_XDECREF(__pyx_t_1);
24011   __Pyx_XDECREF(__pyx_t_2);
24012   __Pyx_AddTraceback("lupa._lupa.setitem_for_lua", __pyx_clineno, __pyx_lineno, __pyx_filename);
24013   __pyx_r = -1;
24014   __pyx_L0:;
24015   __Pyx_RefNannyFinishContext();
24016   return __pyx_r;
24017 }
24018 
24019 /* "lupa/_lupa.pyx":1569
24020  *     return 0
24021  *
24022  * cdef int getattr_for_lua(LuaRuntime runtime, lua_State* L, py_object* py_obj, int key_n) except -1:             # <<<<<<<<<<<<<<
24023  *     obj = <object>py_obj.obj
24024  *     attr_name = py_from_lua(runtime, L, key_n)
24025  */
24026 
__pyx_f_4lupa_5_lupa_getattr_for_lua(struct __pyx_obj_4lupa_5_lupa_LuaRuntime * __pyx_v_runtime,lua_State * __pyx_v_L,struct __pyx_t_4lupa_5_lupa_py_object * __pyx_v_py_obj,int __pyx_v_key_n)24027 static int __pyx_f_4lupa_5_lupa_getattr_for_lua(struct __pyx_obj_4lupa_5_lupa_LuaRuntime *__pyx_v_runtime, lua_State *__pyx_v_L, struct __pyx_t_4lupa_5_lupa_py_object *__pyx_v_py_obj, int __pyx_v_key_n) {
24028   PyObject *__pyx_v_obj = NULL;
24029   PyObject *__pyx_v_attr_name = NULL;
24030   PyObject *__pyx_v_value = NULL;
24031   int __pyx_r;
24032   __Pyx_RefNannyDeclarations
24033   PyObject *__pyx_t_1 = NULL;
24034   int __pyx_t_2;
24035   int __pyx_t_3;
24036   PyObject *__pyx_t_4 = NULL;
24037   PyObject *__pyx_t_5 = NULL;
24038   int __pyx_t_6;
24039   PyObject *__pyx_t_7 = NULL;
24040   char const *__pyx_t_8;
24041   int __pyx_lineno = 0;
24042   const char *__pyx_filename = NULL;
24043   int __pyx_clineno = 0;
24044   __Pyx_RefNannySetupContext("getattr_for_lua", 0);
24045 
24046   /* "lupa/_lupa.pyx":1570
24047  *
24048  * cdef int getattr_for_lua(LuaRuntime runtime, lua_State* L, py_object* py_obj, int key_n) except -1:
24049  *     obj = <object>py_obj.obj             # <<<<<<<<<<<<<<
24050  *     attr_name = py_from_lua(runtime, L, key_n)
24051  *     if runtime._attribute_getter is not None:
24052  */
24053   __pyx_t_1 = ((PyObject *)__pyx_v_py_obj->obj);
24054   __Pyx_INCREF(__pyx_t_1);
24055   __pyx_v_obj = __pyx_t_1;
24056   __pyx_t_1 = 0;
24057 
24058   /* "lupa/_lupa.pyx":1571
24059  * cdef int getattr_for_lua(LuaRuntime runtime, lua_State* L, py_object* py_obj, int key_n) except -1:
24060  *     obj = <object>py_obj.obj
24061  *     attr_name = py_from_lua(runtime, L, key_n)             # <<<<<<<<<<<<<<
24062  *     if runtime._attribute_getter is not None:
24063  *         value = runtime._attribute_getter(obj, attr_name)
24064  */
24065   __pyx_t_1 = __pyx_f_4lupa_5_lupa_py_from_lua(__pyx_v_runtime, __pyx_v_L, __pyx_v_key_n); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1571, __pyx_L1_error)
24066   __Pyx_GOTREF(__pyx_t_1);
24067   __pyx_v_attr_name = __pyx_t_1;
24068   __pyx_t_1 = 0;
24069 
24070   /* "lupa/_lupa.pyx":1572
24071  *     obj = <object>py_obj.obj
24072  *     attr_name = py_from_lua(runtime, L, key_n)
24073  *     if runtime._attribute_getter is not None:             # <<<<<<<<<<<<<<
24074  *         value = runtime._attribute_getter(obj, attr_name)
24075  *         return py_to_lua(runtime, L, value)
24076  */
24077   __pyx_t_2 = (__pyx_v_runtime->_attribute_getter != Py_None);
24078   __pyx_t_3 = (__pyx_t_2 != 0);
24079   if (__pyx_t_3) {
24080 
24081     /* "lupa/_lupa.pyx":1573
24082  *     attr_name = py_from_lua(runtime, L, key_n)
24083  *     if runtime._attribute_getter is not None:
24084  *         value = runtime._attribute_getter(obj, attr_name)             # <<<<<<<<<<<<<<
24085  *         return py_to_lua(runtime, L, value)
24086  *     if runtime._attribute_filter is not None:
24087  */
24088     __Pyx_INCREF(__pyx_v_runtime->_attribute_getter);
24089     __pyx_t_4 = __pyx_v_runtime->_attribute_getter; __pyx_t_5 = NULL;
24090     __pyx_t_6 = 0;
24091     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
24092       __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
24093       if (likely(__pyx_t_5)) {
24094         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
24095         __Pyx_INCREF(__pyx_t_5);
24096         __Pyx_INCREF(function);
24097         __Pyx_DECREF_SET(__pyx_t_4, function);
24098         __pyx_t_6 = 1;
24099       }
24100     }
24101     #if CYTHON_FAST_PYCALL
24102     if (PyFunction_Check(__pyx_t_4)) {
24103       PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_obj, __pyx_v_attr_name};
24104       __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1573, __pyx_L1_error)
24105       __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
24106       __Pyx_GOTREF(__pyx_t_1);
24107     } else
24108     #endif
24109     #if CYTHON_FAST_PYCCALL
24110     if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
24111       PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_obj, __pyx_v_attr_name};
24112       __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1573, __pyx_L1_error)
24113       __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
24114       __Pyx_GOTREF(__pyx_t_1);
24115     } else
24116     #endif
24117     {
24118       __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1573, __pyx_L1_error)
24119       __Pyx_GOTREF(__pyx_t_7);
24120       if (__pyx_t_5) {
24121         __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
24122       }
24123       __Pyx_INCREF(__pyx_v_obj);
24124       __Pyx_GIVEREF(__pyx_v_obj);
24125       PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_v_obj);
24126       __Pyx_INCREF(__pyx_v_attr_name);
24127       __Pyx_GIVEREF(__pyx_v_attr_name);
24128       PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_v_attr_name);
24129       __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1573, __pyx_L1_error)
24130       __Pyx_GOTREF(__pyx_t_1);
24131       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
24132     }
24133     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
24134     __pyx_v_value = __pyx_t_1;
24135     __pyx_t_1 = 0;
24136 
24137     /* "lupa/_lupa.pyx":1574
24138  *     if runtime._attribute_getter is not None:
24139  *         value = runtime._attribute_getter(obj, attr_name)
24140  *         return py_to_lua(runtime, L, value)             # <<<<<<<<<<<<<<
24141  *     if runtime._attribute_filter is not None:
24142  *         attr_name = runtime._attribute_filter(obj, attr_name, False)
24143  */
24144     __pyx_t_6 = __pyx_f_4lupa_5_lupa_py_to_lua(__pyx_v_runtime, __pyx_v_L, __pyx_v_value, NULL); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 1574, __pyx_L1_error)
24145     __pyx_r = __pyx_t_6;
24146     goto __pyx_L0;
24147 
24148     /* "lupa/_lupa.pyx":1572
24149  *     obj = <object>py_obj.obj
24150  *     attr_name = py_from_lua(runtime, L, key_n)
24151  *     if runtime._attribute_getter is not None:             # <<<<<<<<<<<<<<
24152  *         value = runtime._attribute_getter(obj, attr_name)
24153  *         return py_to_lua(runtime, L, value)
24154  */
24155   }
24156 
24157   /* "lupa/_lupa.pyx":1575
24158  *         value = runtime._attribute_getter(obj, attr_name)
24159  *         return py_to_lua(runtime, L, value)
24160  *     if runtime._attribute_filter is not None:             # <<<<<<<<<<<<<<
24161  *         attr_name = runtime._attribute_filter(obj, attr_name, False)
24162  *     if isinstance(attr_name, bytes):
24163  */
24164   __pyx_t_3 = (__pyx_v_runtime->_attribute_filter != Py_None);
24165   __pyx_t_2 = (__pyx_t_3 != 0);
24166   if (__pyx_t_2) {
24167 
24168     /* "lupa/_lupa.pyx":1576
24169  *         return py_to_lua(runtime, L, value)
24170  *     if runtime._attribute_filter is not None:
24171  *         attr_name = runtime._attribute_filter(obj, attr_name, False)             # <<<<<<<<<<<<<<
24172  *     if isinstance(attr_name, bytes):
24173  *         attr_name = (<bytes>attr_name).decode(runtime._source_encoding)
24174  */
24175     __Pyx_INCREF(__pyx_v_runtime->_attribute_filter);
24176     __pyx_t_4 = __pyx_v_runtime->_attribute_filter; __pyx_t_7 = NULL;
24177     __pyx_t_6 = 0;
24178     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
24179       __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4);
24180       if (likely(__pyx_t_7)) {
24181         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
24182         __Pyx_INCREF(__pyx_t_7);
24183         __Pyx_INCREF(function);
24184         __Pyx_DECREF_SET(__pyx_t_4, function);
24185         __pyx_t_6 = 1;
24186       }
24187     }
24188     #if CYTHON_FAST_PYCALL
24189     if (PyFunction_Check(__pyx_t_4)) {
24190       PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_v_obj, __pyx_v_attr_name, Py_False};
24191       __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1576, __pyx_L1_error)
24192       __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
24193       __Pyx_GOTREF(__pyx_t_1);
24194     } else
24195     #endif
24196     #if CYTHON_FAST_PYCCALL
24197     if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
24198       PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_v_obj, __pyx_v_attr_name, Py_False};
24199       __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1576, __pyx_L1_error)
24200       __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
24201       __Pyx_GOTREF(__pyx_t_1);
24202     } else
24203     #endif
24204     {
24205       __pyx_t_5 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1576, __pyx_L1_error)
24206       __Pyx_GOTREF(__pyx_t_5);
24207       if (__pyx_t_7) {
24208         __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_7); __pyx_t_7 = NULL;
24209       }
24210       __Pyx_INCREF(__pyx_v_obj);
24211       __Pyx_GIVEREF(__pyx_v_obj);
24212       PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_6, __pyx_v_obj);
24213       __Pyx_INCREF(__pyx_v_attr_name);
24214       __Pyx_GIVEREF(__pyx_v_attr_name);
24215       PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_6, __pyx_v_attr_name);
24216       __Pyx_INCREF(Py_False);
24217       __Pyx_GIVEREF(Py_False);
24218       PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_6, Py_False);
24219       __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1576, __pyx_L1_error)
24220       __Pyx_GOTREF(__pyx_t_1);
24221       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
24222     }
24223     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
24224     __Pyx_DECREF_SET(__pyx_v_attr_name, __pyx_t_1);
24225     __pyx_t_1 = 0;
24226 
24227     /* "lupa/_lupa.pyx":1575
24228  *         value = runtime._attribute_getter(obj, attr_name)
24229  *         return py_to_lua(runtime, L, value)
24230  *     if runtime._attribute_filter is not None:             # <<<<<<<<<<<<<<
24231  *         attr_name = runtime._attribute_filter(obj, attr_name, False)
24232  *     if isinstance(attr_name, bytes):
24233  */
24234   }
24235 
24236   /* "lupa/_lupa.pyx":1577
24237  *     if runtime._attribute_filter is not None:
24238  *         attr_name = runtime._attribute_filter(obj, attr_name, False)
24239  *     if isinstance(attr_name, bytes):             # <<<<<<<<<<<<<<
24240  *         attr_name = (<bytes>attr_name).decode(runtime._source_encoding)
24241  *     return py_to_lua(runtime, L, getattr(obj, attr_name))
24242  */
24243   __pyx_t_2 = PyBytes_Check(__pyx_v_attr_name);
24244   __pyx_t_3 = (__pyx_t_2 != 0);
24245   if (__pyx_t_3) {
24246 
24247     /* "lupa/_lupa.pyx":1578
24248  *         attr_name = runtime._attribute_filter(obj, attr_name, False)
24249  *     if isinstance(attr_name, bytes):
24250  *         attr_name = (<bytes>attr_name).decode(runtime._source_encoding)             # <<<<<<<<<<<<<<
24251  *     return py_to_lua(runtime, L, getattr(obj, attr_name))
24252  *
24253  */
24254     if (unlikely(__pyx_v_attr_name == Py_None)) {
24255       PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "decode");
24256       __PYX_ERR(0, 1578, __pyx_L1_error)
24257     }
24258     if (unlikely(__pyx_v_runtime->_source_encoding == Py_None)) {
24259       PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
24260       __PYX_ERR(0, 1578, __pyx_L1_error)
24261     }
24262     __pyx_t_8 = __Pyx_PyBytes_AsString(__pyx_v_runtime->_source_encoding); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) __PYX_ERR(0, 1578, __pyx_L1_error)
24263     __pyx_t_1 = __Pyx_decode_bytes(((PyObject*)__pyx_v_attr_name), 0, PY_SSIZE_T_MAX, __pyx_t_8, NULL, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1578, __pyx_L1_error)
24264     __Pyx_GOTREF(__pyx_t_1);
24265     __Pyx_DECREF_SET(__pyx_v_attr_name, __pyx_t_1);
24266     __pyx_t_1 = 0;
24267 
24268     /* "lupa/_lupa.pyx":1577
24269  *     if runtime._attribute_filter is not None:
24270  *         attr_name = runtime._attribute_filter(obj, attr_name, False)
24271  *     if isinstance(attr_name, bytes):             # <<<<<<<<<<<<<<
24272  *         attr_name = (<bytes>attr_name).decode(runtime._source_encoding)
24273  *     return py_to_lua(runtime, L, getattr(obj, attr_name))
24274  */
24275   }
24276 
24277   /* "lupa/_lupa.pyx":1579
24278  *     if isinstance(attr_name, bytes):
24279  *         attr_name = (<bytes>attr_name).decode(runtime._source_encoding)
24280  *     return py_to_lua(runtime, L, getattr(obj, attr_name))             # <<<<<<<<<<<<<<
24281  *
24282  * cdef int setattr_for_lua(LuaRuntime runtime, lua_State* L, py_object* py_obj, int key_n, int value_n) except -1:
24283  */
24284   __pyx_t_1 = __Pyx_GetAttr(__pyx_v_obj, __pyx_v_attr_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1579, __pyx_L1_error)
24285   __Pyx_GOTREF(__pyx_t_1);
24286   __pyx_t_6 = __pyx_f_4lupa_5_lupa_py_to_lua(__pyx_v_runtime, __pyx_v_L, __pyx_t_1, NULL); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 1579, __pyx_L1_error)
24287   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24288   __pyx_r = __pyx_t_6;
24289   goto __pyx_L0;
24290 
24291   /* "lupa/_lupa.pyx":1569
24292  *     return 0
24293  *
24294  * cdef int getattr_for_lua(LuaRuntime runtime, lua_State* L, py_object* py_obj, int key_n) except -1:             # <<<<<<<<<<<<<<
24295  *     obj = <object>py_obj.obj
24296  *     attr_name = py_from_lua(runtime, L, key_n)
24297  */
24298 
24299   /* function exit code */
24300   __pyx_L1_error:;
24301   __Pyx_XDECREF(__pyx_t_1);
24302   __Pyx_XDECREF(__pyx_t_4);
24303   __Pyx_XDECREF(__pyx_t_5);
24304   __Pyx_XDECREF(__pyx_t_7);
24305   __Pyx_AddTraceback("lupa._lupa.getattr_for_lua", __pyx_clineno, __pyx_lineno, __pyx_filename);
24306   __pyx_r = -1;
24307   __pyx_L0:;
24308   __Pyx_XDECREF(__pyx_v_obj);
24309   __Pyx_XDECREF(__pyx_v_attr_name);
24310   __Pyx_XDECREF(__pyx_v_value);
24311   __Pyx_RefNannyFinishContext();
24312   return __pyx_r;
24313 }
24314 
24315 /* "lupa/_lupa.pyx":1581
24316  *     return py_to_lua(runtime, L, getattr(obj, attr_name))
24317  *
24318  * cdef int setattr_for_lua(LuaRuntime runtime, lua_State* L, py_object* py_obj, int key_n, int value_n) except -1:             # <<<<<<<<<<<<<<
24319  *     obj = <object>py_obj.obj
24320  *     attr_name = py_from_lua(runtime, L, key_n)
24321  */
24322 
__pyx_f_4lupa_5_lupa_setattr_for_lua(struct __pyx_obj_4lupa_5_lupa_LuaRuntime * __pyx_v_runtime,lua_State * __pyx_v_L,struct __pyx_t_4lupa_5_lupa_py_object * __pyx_v_py_obj,int __pyx_v_key_n,int __pyx_v_value_n)24323 static int __pyx_f_4lupa_5_lupa_setattr_for_lua(struct __pyx_obj_4lupa_5_lupa_LuaRuntime *__pyx_v_runtime, lua_State *__pyx_v_L, struct __pyx_t_4lupa_5_lupa_py_object *__pyx_v_py_obj, int __pyx_v_key_n, int __pyx_v_value_n) {
24324   PyObject *__pyx_v_obj = NULL;
24325   PyObject *__pyx_v_attr_name = NULL;
24326   PyObject *__pyx_v_attr_value = NULL;
24327   int __pyx_r;
24328   __Pyx_RefNannyDeclarations
24329   PyObject *__pyx_t_1 = NULL;
24330   int __pyx_t_2;
24331   int __pyx_t_3;
24332   PyObject *__pyx_t_4 = NULL;
24333   PyObject *__pyx_t_5 = NULL;
24334   int __pyx_t_6;
24335   PyObject *__pyx_t_7 = NULL;
24336   char const *__pyx_t_8;
24337   int __pyx_t_9;
24338   int __pyx_lineno = 0;
24339   const char *__pyx_filename = NULL;
24340   int __pyx_clineno = 0;
24341   __Pyx_RefNannySetupContext("setattr_for_lua", 0);
24342 
24343   /* "lupa/_lupa.pyx":1582
24344  *
24345  * cdef int setattr_for_lua(LuaRuntime runtime, lua_State* L, py_object* py_obj, int key_n, int value_n) except -1:
24346  *     obj = <object>py_obj.obj             # <<<<<<<<<<<<<<
24347  *     attr_name = py_from_lua(runtime, L, key_n)
24348  *     attr_value = py_from_lua(runtime, L, value_n)
24349  */
24350   __pyx_t_1 = ((PyObject *)__pyx_v_py_obj->obj);
24351   __Pyx_INCREF(__pyx_t_1);
24352   __pyx_v_obj = __pyx_t_1;
24353   __pyx_t_1 = 0;
24354 
24355   /* "lupa/_lupa.pyx":1583
24356  * cdef int setattr_for_lua(LuaRuntime runtime, lua_State* L, py_object* py_obj, int key_n, int value_n) except -1:
24357  *     obj = <object>py_obj.obj
24358  *     attr_name = py_from_lua(runtime, L, key_n)             # <<<<<<<<<<<<<<
24359  *     attr_value = py_from_lua(runtime, L, value_n)
24360  *     if runtime._attribute_setter is not None:
24361  */
24362   __pyx_t_1 = __pyx_f_4lupa_5_lupa_py_from_lua(__pyx_v_runtime, __pyx_v_L, __pyx_v_key_n); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1583, __pyx_L1_error)
24363   __Pyx_GOTREF(__pyx_t_1);
24364   __pyx_v_attr_name = __pyx_t_1;
24365   __pyx_t_1 = 0;
24366 
24367   /* "lupa/_lupa.pyx":1584
24368  *     obj = <object>py_obj.obj
24369  *     attr_name = py_from_lua(runtime, L, key_n)
24370  *     attr_value = py_from_lua(runtime, L, value_n)             # <<<<<<<<<<<<<<
24371  *     if runtime._attribute_setter is not None:
24372  *         runtime._attribute_setter(obj, attr_name, attr_value)
24373  */
24374   __pyx_t_1 = __pyx_f_4lupa_5_lupa_py_from_lua(__pyx_v_runtime, __pyx_v_L, __pyx_v_value_n); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1584, __pyx_L1_error)
24375   __Pyx_GOTREF(__pyx_t_1);
24376   __pyx_v_attr_value = __pyx_t_1;
24377   __pyx_t_1 = 0;
24378 
24379   /* "lupa/_lupa.pyx":1585
24380  *     attr_name = py_from_lua(runtime, L, key_n)
24381  *     attr_value = py_from_lua(runtime, L, value_n)
24382  *     if runtime._attribute_setter is not None:             # <<<<<<<<<<<<<<
24383  *         runtime._attribute_setter(obj, attr_name, attr_value)
24384  *     else:
24385  */
24386   __pyx_t_2 = (__pyx_v_runtime->_attribute_setter != Py_None);
24387   __pyx_t_3 = (__pyx_t_2 != 0);
24388   if (__pyx_t_3) {
24389 
24390     /* "lupa/_lupa.pyx":1586
24391  *     attr_value = py_from_lua(runtime, L, value_n)
24392  *     if runtime._attribute_setter is not None:
24393  *         runtime._attribute_setter(obj, attr_name, attr_value)             # <<<<<<<<<<<<<<
24394  *     else:
24395  *         if runtime._attribute_filter is not None:
24396  */
24397     __Pyx_INCREF(__pyx_v_runtime->_attribute_setter);
24398     __pyx_t_4 = __pyx_v_runtime->_attribute_setter; __pyx_t_5 = NULL;
24399     __pyx_t_6 = 0;
24400     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
24401       __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
24402       if (likely(__pyx_t_5)) {
24403         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
24404         __Pyx_INCREF(__pyx_t_5);
24405         __Pyx_INCREF(function);
24406         __Pyx_DECREF_SET(__pyx_t_4, function);
24407         __pyx_t_6 = 1;
24408       }
24409     }
24410     #if CYTHON_FAST_PYCALL
24411     if (PyFunction_Check(__pyx_t_4)) {
24412       PyObject *__pyx_temp[4] = {__pyx_t_5, __pyx_v_obj, __pyx_v_attr_name, __pyx_v_attr_value};
24413       __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1586, __pyx_L1_error)
24414       __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
24415       __Pyx_GOTREF(__pyx_t_1);
24416     } else
24417     #endif
24418     #if CYTHON_FAST_PYCCALL
24419     if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
24420       PyObject *__pyx_temp[4] = {__pyx_t_5, __pyx_v_obj, __pyx_v_attr_name, __pyx_v_attr_value};
24421       __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1586, __pyx_L1_error)
24422       __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
24423       __Pyx_GOTREF(__pyx_t_1);
24424     } else
24425     #endif
24426     {
24427       __pyx_t_7 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1586, __pyx_L1_error)
24428       __Pyx_GOTREF(__pyx_t_7);
24429       if (__pyx_t_5) {
24430         __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
24431       }
24432       __Pyx_INCREF(__pyx_v_obj);
24433       __Pyx_GIVEREF(__pyx_v_obj);
24434       PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_v_obj);
24435       __Pyx_INCREF(__pyx_v_attr_name);
24436       __Pyx_GIVEREF(__pyx_v_attr_name);
24437       PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_v_attr_name);
24438       __Pyx_INCREF(__pyx_v_attr_value);
24439       __Pyx_GIVEREF(__pyx_v_attr_value);
24440       PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_6, __pyx_v_attr_value);
24441       __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1586, __pyx_L1_error)
24442       __Pyx_GOTREF(__pyx_t_1);
24443       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
24444     }
24445     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
24446     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24447 
24448     /* "lupa/_lupa.pyx":1585
24449  *     attr_name = py_from_lua(runtime, L, key_n)
24450  *     attr_value = py_from_lua(runtime, L, value_n)
24451  *     if runtime._attribute_setter is not None:             # <<<<<<<<<<<<<<
24452  *         runtime._attribute_setter(obj, attr_name, attr_value)
24453  *     else:
24454  */
24455     goto __pyx_L3;
24456   }
24457 
24458   /* "lupa/_lupa.pyx":1588
24459  *         runtime._attribute_setter(obj, attr_name, attr_value)
24460  *     else:
24461  *         if runtime._attribute_filter is not None:             # <<<<<<<<<<<<<<
24462  *             attr_name = runtime._attribute_filter(obj, attr_name, True)
24463  *         if isinstance(attr_name, bytes):
24464  */
24465   /*else*/ {
24466     __pyx_t_3 = (__pyx_v_runtime->_attribute_filter != Py_None);
24467     __pyx_t_2 = (__pyx_t_3 != 0);
24468     if (__pyx_t_2) {
24469 
24470       /* "lupa/_lupa.pyx":1589
24471  *     else:
24472  *         if runtime._attribute_filter is not None:
24473  *             attr_name = runtime._attribute_filter(obj, attr_name, True)             # <<<<<<<<<<<<<<
24474  *         if isinstance(attr_name, bytes):
24475  *             attr_name = (<bytes>attr_name).decode(runtime._source_encoding)
24476  */
24477       __Pyx_INCREF(__pyx_v_runtime->_attribute_filter);
24478       __pyx_t_4 = __pyx_v_runtime->_attribute_filter; __pyx_t_7 = NULL;
24479       __pyx_t_6 = 0;
24480       if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
24481         __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4);
24482         if (likely(__pyx_t_7)) {
24483           PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
24484           __Pyx_INCREF(__pyx_t_7);
24485           __Pyx_INCREF(function);
24486           __Pyx_DECREF_SET(__pyx_t_4, function);
24487           __pyx_t_6 = 1;
24488         }
24489       }
24490       #if CYTHON_FAST_PYCALL
24491       if (PyFunction_Check(__pyx_t_4)) {
24492         PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_v_obj, __pyx_v_attr_name, Py_True};
24493         __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1589, __pyx_L1_error)
24494         __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
24495         __Pyx_GOTREF(__pyx_t_1);
24496       } else
24497       #endif
24498       #if CYTHON_FAST_PYCCALL
24499       if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
24500         PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_v_obj, __pyx_v_attr_name, Py_True};
24501         __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1589, __pyx_L1_error)
24502         __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
24503         __Pyx_GOTREF(__pyx_t_1);
24504       } else
24505       #endif
24506       {
24507         __pyx_t_5 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1589, __pyx_L1_error)
24508         __Pyx_GOTREF(__pyx_t_5);
24509         if (__pyx_t_7) {
24510           __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_7); __pyx_t_7 = NULL;
24511         }
24512         __Pyx_INCREF(__pyx_v_obj);
24513         __Pyx_GIVEREF(__pyx_v_obj);
24514         PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_6, __pyx_v_obj);
24515         __Pyx_INCREF(__pyx_v_attr_name);
24516         __Pyx_GIVEREF(__pyx_v_attr_name);
24517         PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_6, __pyx_v_attr_name);
24518         __Pyx_INCREF(Py_True);
24519         __Pyx_GIVEREF(Py_True);
24520         PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_6, Py_True);
24521         __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1589, __pyx_L1_error)
24522         __Pyx_GOTREF(__pyx_t_1);
24523         __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
24524       }
24525       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
24526       __Pyx_DECREF_SET(__pyx_v_attr_name, __pyx_t_1);
24527       __pyx_t_1 = 0;
24528 
24529       /* "lupa/_lupa.pyx":1588
24530  *         runtime._attribute_setter(obj, attr_name, attr_value)
24531  *     else:
24532  *         if runtime._attribute_filter is not None:             # <<<<<<<<<<<<<<
24533  *             attr_name = runtime._attribute_filter(obj, attr_name, True)
24534  *         if isinstance(attr_name, bytes):
24535  */
24536     }
24537 
24538     /* "lupa/_lupa.pyx":1590
24539  *         if runtime._attribute_filter is not None:
24540  *             attr_name = runtime._attribute_filter(obj, attr_name, True)
24541  *         if isinstance(attr_name, bytes):             # <<<<<<<<<<<<<<
24542  *             attr_name = (<bytes>attr_name).decode(runtime._source_encoding)
24543  *         setattr(obj, attr_name, attr_value)
24544  */
24545     __pyx_t_2 = PyBytes_Check(__pyx_v_attr_name);
24546     __pyx_t_3 = (__pyx_t_2 != 0);
24547     if (__pyx_t_3) {
24548 
24549       /* "lupa/_lupa.pyx":1591
24550  *             attr_name = runtime._attribute_filter(obj, attr_name, True)
24551  *         if isinstance(attr_name, bytes):
24552  *             attr_name = (<bytes>attr_name).decode(runtime._source_encoding)             # <<<<<<<<<<<<<<
24553  *         setattr(obj, attr_name, attr_value)
24554  *     return 0
24555  */
24556       if (unlikely(__pyx_v_attr_name == Py_None)) {
24557         PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "decode");
24558         __PYX_ERR(0, 1591, __pyx_L1_error)
24559       }
24560       if (unlikely(__pyx_v_runtime->_source_encoding == Py_None)) {
24561         PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
24562         __PYX_ERR(0, 1591, __pyx_L1_error)
24563       }
24564       __pyx_t_8 = __Pyx_PyBytes_AsString(__pyx_v_runtime->_source_encoding); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) __PYX_ERR(0, 1591, __pyx_L1_error)
24565       __pyx_t_1 = __Pyx_decode_bytes(((PyObject*)__pyx_v_attr_name), 0, PY_SSIZE_T_MAX, __pyx_t_8, NULL, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1591, __pyx_L1_error)
24566       __Pyx_GOTREF(__pyx_t_1);
24567       __Pyx_DECREF_SET(__pyx_v_attr_name, __pyx_t_1);
24568       __pyx_t_1 = 0;
24569 
24570       /* "lupa/_lupa.pyx":1590
24571  *         if runtime._attribute_filter is not None:
24572  *             attr_name = runtime._attribute_filter(obj, attr_name, True)
24573  *         if isinstance(attr_name, bytes):             # <<<<<<<<<<<<<<
24574  *             attr_name = (<bytes>attr_name).decode(runtime._source_encoding)
24575  *         setattr(obj, attr_name, attr_value)
24576  */
24577     }
24578 
24579     /* "lupa/_lupa.pyx":1592
24580  *         if isinstance(attr_name, bytes):
24581  *             attr_name = (<bytes>attr_name).decode(runtime._source_encoding)
24582  *         setattr(obj, attr_name, attr_value)             # <<<<<<<<<<<<<<
24583  *     return 0
24584  *
24585  */
24586     __pyx_t_9 = PyObject_SetAttr(__pyx_v_obj, __pyx_v_attr_name, __pyx_v_attr_value); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 1592, __pyx_L1_error)
24587   }
24588   __pyx_L3:;
24589 
24590   /* "lupa/_lupa.pyx":1593
24591  *             attr_name = (<bytes>attr_name).decode(runtime._source_encoding)
24592  *         setattr(obj, attr_name, attr_value)
24593  *     return 0             # <<<<<<<<<<<<<<
24594  *
24595  *
24596  */
24597   __pyx_r = 0;
24598   goto __pyx_L0;
24599 
24600   /* "lupa/_lupa.pyx":1581
24601  *     return py_to_lua(runtime, L, getattr(obj, attr_name))
24602  *
24603  * cdef int setattr_for_lua(LuaRuntime runtime, lua_State* L, py_object* py_obj, int key_n, int value_n) except -1:             # <<<<<<<<<<<<<<
24604  *     obj = <object>py_obj.obj
24605  *     attr_name = py_from_lua(runtime, L, key_n)
24606  */
24607 
24608   /* function exit code */
24609   __pyx_L1_error:;
24610   __Pyx_XDECREF(__pyx_t_1);
24611   __Pyx_XDECREF(__pyx_t_4);
24612   __Pyx_XDECREF(__pyx_t_5);
24613   __Pyx_XDECREF(__pyx_t_7);
24614   __Pyx_AddTraceback("lupa._lupa.setattr_for_lua", __pyx_clineno, __pyx_lineno, __pyx_filename);
24615   __pyx_r = -1;
24616   __pyx_L0:;
24617   __Pyx_XDECREF(__pyx_v_obj);
24618   __Pyx_XDECREF(__pyx_v_attr_name);
24619   __Pyx_XDECREF(__pyx_v_attr_value);
24620   __Pyx_RefNannyFinishContext();
24621   return __pyx_r;
24622 }
24623 
24624 /* "lupa/_lupa.pyx":1596
24625  *
24626  *
24627  * cdef int py_object_getindex_with_gil(lua_State* L, py_object* py_obj) with gil:             # <<<<<<<<<<<<<<
24628  *     cdef LuaRuntime runtime
24629  *     try:
24630  */
24631 
__pyx_f_4lupa_5_lupa_py_object_getindex_with_gil(lua_State * __pyx_v_L,struct __pyx_t_4lupa_5_lupa_py_object * __pyx_v_py_obj)24632 static int __pyx_f_4lupa_5_lupa_py_object_getindex_with_gil(lua_State *__pyx_v_L, struct __pyx_t_4lupa_5_lupa_py_object *__pyx_v_py_obj) {
24633   struct __pyx_obj_4lupa_5_lupa_LuaRuntime *__pyx_v_runtime = 0;
24634   int __pyx_r;
24635   __Pyx_RefNannyDeclarations
24636   PyObject *__pyx_t_1 = NULL;
24637   PyObject *__pyx_t_2 = NULL;
24638   PyObject *__pyx_t_3 = NULL;
24639   PyObject *__pyx_t_4 = NULL;
24640   int __pyx_t_5;
24641   int __pyx_t_6;
24642   int __pyx_t_7;
24643   int __pyx_t_8;
24644   PyObject *__pyx_t_9 = NULL;
24645   PyObject *__pyx_t_10 = NULL;
24646   int __pyx_lineno = 0;
24647   const char *__pyx_filename = NULL;
24648   int __pyx_clineno = 0;
24649   #ifdef WITH_THREAD
24650   PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
24651   #endif
24652   __Pyx_RefNannySetupContext("py_object_getindex_with_gil", 0);
24653 
24654   /* "lupa/_lupa.pyx":1598
24655  * cdef int py_object_getindex_with_gil(lua_State* L, py_object* py_obj) with gil:
24656  *     cdef LuaRuntime runtime
24657  *     try:             # <<<<<<<<<<<<<<
24658  *         runtime = <LuaRuntime?>py_obj.runtime
24659  *         if (py_obj.type_flags & OBJ_AS_INDEX) and not runtime._attribute_getter:
24660  */
24661   {
24662     __Pyx_PyThreadState_declare
24663     __Pyx_PyThreadState_assign
24664     __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
24665     __Pyx_XGOTREF(__pyx_t_1);
24666     __Pyx_XGOTREF(__pyx_t_2);
24667     __Pyx_XGOTREF(__pyx_t_3);
24668     /*try:*/ {
24669 
24670       /* "lupa/_lupa.pyx":1599
24671  *     cdef LuaRuntime runtime
24672  *     try:
24673  *         runtime = <LuaRuntime?>py_obj.runtime             # <<<<<<<<<<<<<<
24674  *         if (py_obj.type_flags & OBJ_AS_INDEX) and not runtime._attribute_getter:
24675  *             return getitem_for_lua(runtime, L, py_obj, 2)
24676  */
24677       __pyx_t_4 = ((PyObject *)__pyx_v_py_obj->runtime);
24678       __Pyx_INCREF(__pyx_t_4);
24679       __pyx_v_runtime = ((struct __pyx_obj_4lupa_5_lupa_LuaRuntime *)__pyx_t_4);
24680       __pyx_t_4 = 0;
24681 
24682       /* "lupa/_lupa.pyx":1600
24683  *     try:
24684  *         runtime = <LuaRuntime?>py_obj.runtime
24685  *         if (py_obj.type_flags & OBJ_AS_INDEX) and not runtime._attribute_getter:             # <<<<<<<<<<<<<<
24686  *             return getitem_for_lua(runtime, L, py_obj, 2)
24687  *         else:
24688  */
24689       __pyx_t_6 = ((__pyx_v_py_obj->type_flags & __pyx_e_4lupa_5_lupa_OBJ_AS_INDEX) != 0);
24690       if (__pyx_t_6) {
24691       } else {
24692         __pyx_t_5 = __pyx_t_6;
24693         goto __pyx_L10_bool_binop_done;
24694       }
24695       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_runtime->_attribute_getter); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 1600, __pyx_L3_error)
24696       __pyx_t_7 = ((!__pyx_t_6) != 0);
24697       __pyx_t_5 = __pyx_t_7;
24698       __pyx_L10_bool_binop_done:;
24699       if (__pyx_t_5) {
24700 
24701         /* "lupa/_lupa.pyx":1601
24702  *         runtime = <LuaRuntime?>py_obj.runtime
24703  *         if (py_obj.type_flags & OBJ_AS_INDEX) and not runtime._attribute_getter:
24704  *             return getitem_for_lua(runtime, L, py_obj, 2)             # <<<<<<<<<<<<<<
24705  *         else:
24706  *             return getattr_for_lua(runtime, L, py_obj, 2)
24707  */
24708         __pyx_t_8 = __pyx_f_4lupa_5_lupa_getitem_for_lua(__pyx_v_runtime, __pyx_v_L, __pyx_v_py_obj, 2); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 1601, __pyx_L3_error)
24709         __pyx_r = __pyx_t_8;
24710         goto __pyx_L7_try_return;
24711 
24712         /* "lupa/_lupa.pyx":1600
24713  *     try:
24714  *         runtime = <LuaRuntime?>py_obj.runtime
24715  *         if (py_obj.type_flags & OBJ_AS_INDEX) and not runtime._attribute_getter:             # <<<<<<<<<<<<<<
24716  *             return getitem_for_lua(runtime, L, py_obj, 2)
24717  *         else:
24718  */
24719       }
24720 
24721       /* "lupa/_lupa.pyx":1603
24722  *             return getitem_for_lua(runtime, L, py_obj, 2)
24723  *         else:
24724  *             return getattr_for_lua(runtime, L, py_obj, 2)             # <<<<<<<<<<<<<<
24725  *     except:
24726  *         runtime.store_raised_exception(L, b'error reading Python attribute/item')
24727  */
24728       /*else*/ {
24729         __pyx_t_8 = __pyx_f_4lupa_5_lupa_getattr_for_lua(__pyx_v_runtime, __pyx_v_L, __pyx_v_py_obj, 2); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 1603, __pyx_L3_error)
24730         __pyx_r = __pyx_t_8;
24731         goto __pyx_L7_try_return;
24732       }
24733 
24734       /* "lupa/_lupa.pyx":1598
24735  * cdef int py_object_getindex_with_gil(lua_State* L, py_object* py_obj) with gil:
24736  *     cdef LuaRuntime runtime
24737  *     try:             # <<<<<<<<<<<<<<
24738  *         runtime = <LuaRuntime?>py_obj.runtime
24739  *         if (py_obj.type_flags & OBJ_AS_INDEX) and not runtime._attribute_getter:
24740  */
24741     }
24742     __pyx_L3_error:;
24743     __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
24744 
24745     /* "lupa/_lupa.pyx":1604
24746  *         else:
24747  *             return getattr_for_lua(runtime, L, py_obj, 2)
24748  *     except:             # <<<<<<<<<<<<<<
24749  *         runtime.store_raised_exception(L, b'error reading Python attribute/item')
24750  *         return -1
24751  */
24752     /*except:*/ {
24753       __Pyx_AddTraceback("lupa._lupa.py_object_getindex_with_gil", __pyx_clineno, __pyx_lineno, __pyx_filename);
24754       if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_9, &__pyx_t_10) < 0) __PYX_ERR(0, 1604, __pyx_L5_except_error)
24755       __Pyx_GOTREF(__pyx_t_4);
24756       __Pyx_GOTREF(__pyx_t_9);
24757       __Pyx_GOTREF(__pyx_t_10);
24758 
24759       /* "lupa/_lupa.pyx":1605
24760  *             return getattr_for_lua(runtime, L, py_obj, 2)
24761  *     except:
24762  *         runtime.store_raised_exception(L, b'error reading Python attribute/item')             # <<<<<<<<<<<<<<
24763  *         return -1
24764  *
24765  */
24766       if (unlikely(!__pyx_v_runtime)) { __Pyx_RaiseUnboundLocalError("runtime"); __PYX_ERR(0, 1605, __pyx_L5_except_error) }
24767       __pyx_t_8 = __pyx_f_4lupa_5_lupa_10LuaRuntime_store_raised_exception(__pyx_v_runtime, __pyx_v_L, __pyx_kp_b_error_reading_Python_attribute_i); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 1605, __pyx_L5_except_error)
24768 
24769       /* "lupa/_lupa.pyx":1606
24770  *     except:
24771  *         runtime.store_raised_exception(L, b'error reading Python attribute/item')
24772  *         return -1             # <<<<<<<<<<<<<<
24773  *
24774  * cdef int py_object_getindex(lua_State* L) nogil:
24775  */
24776       __pyx_r = -1;
24777       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
24778       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
24779       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
24780       goto __pyx_L6_except_return;
24781     }
24782     __pyx_L5_except_error:;
24783 
24784     /* "lupa/_lupa.pyx":1598
24785  * cdef int py_object_getindex_with_gil(lua_State* L, py_object* py_obj) with gil:
24786  *     cdef LuaRuntime runtime
24787  *     try:             # <<<<<<<<<<<<<<
24788  *         runtime = <LuaRuntime?>py_obj.runtime
24789  *         if (py_obj.type_flags & OBJ_AS_INDEX) and not runtime._attribute_getter:
24790  */
24791     __Pyx_XGIVEREF(__pyx_t_1);
24792     __Pyx_XGIVEREF(__pyx_t_2);
24793     __Pyx_XGIVEREF(__pyx_t_3);
24794     __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
24795     goto __pyx_L1_error;
24796     __pyx_L7_try_return:;
24797     __Pyx_XGIVEREF(__pyx_t_1);
24798     __Pyx_XGIVEREF(__pyx_t_2);
24799     __Pyx_XGIVEREF(__pyx_t_3);
24800     __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
24801     goto __pyx_L0;
24802     __pyx_L6_except_return:;
24803     __Pyx_XGIVEREF(__pyx_t_1);
24804     __Pyx_XGIVEREF(__pyx_t_2);
24805     __Pyx_XGIVEREF(__pyx_t_3);
24806     __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
24807     goto __pyx_L0;
24808   }
24809 
24810   /* "lupa/_lupa.pyx":1596
24811  *
24812  *
24813  * cdef int py_object_getindex_with_gil(lua_State* L, py_object* py_obj) with gil:             # <<<<<<<<<<<<<<
24814  *     cdef LuaRuntime runtime
24815  *     try:
24816  */
24817 
24818   /* function exit code */
24819   __pyx_L1_error:;
24820   __Pyx_XDECREF(__pyx_t_4);
24821   __Pyx_XDECREF(__pyx_t_9);
24822   __Pyx_XDECREF(__pyx_t_10);
24823   __Pyx_WriteUnraisable("lupa._lupa.py_object_getindex_with_gil", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
24824   __pyx_r = 0;
24825   __pyx_L0:;
24826   __Pyx_XDECREF((PyObject *)__pyx_v_runtime);
24827   __Pyx_RefNannyFinishContext();
24828   #ifdef WITH_THREAD
24829   __Pyx_PyGILState_Release(__pyx_gilstate_save);
24830   #endif
24831   return __pyx_r;
24832 }
24833 
24834 /* "lupa/_lupa.pyx":1608
24835  *         return -1
24836  *
24837  * cdef int py_object_getindex(lua_State* L) nogil:             # <<<<<<<<<<<<<<
24838  *     cdef py_object* py_obj = unwrap_lua_object(L, 1) # may not return on error!
24839  *     if not py_obj:
24840  */
24841 
__pyx_f_4lupa_5_lupa_py_object_getindex(lua_State * __pyx_v_L)24842 static int __pyx_f_4lupa_5_lupa_py_object_getindex(lua_State *__pyx_v_L) {
24843   struct __pyx_t_4lupa_5_lupa_py_object *__pyx_v_py_obj;
24844   int __pyx_v_result;
24845   int __pyx_r;
24846   int __pyx_t_1;
24847 
24848   /* "lupa/_lupa.pyx":1609
24849  *
24850  * cdef int py_object_getindex(lua_State* L) nogil:
24851  *     cdef py_object* py_obj = unwrap_lua_object(L, 1) # may not return on error!             # <<<<<<<<<<<<<<
24852  *     if not py_obj:
24853  *         return lua.luaL_argerror(L, 1, "not a python object")   # never returns!
24854  */
24855   __pyx_v_py_obj = __pyx_f_4lupa_5_lupa_unwrap_lua_object(__pyx_v_L, 1);
24856 
24857   /* "lupa/_lupa.pyx":1610
24858  * cdef int py_object_getindex(lua_State* L) nogil:
24859  *     cdef py_object* py_obj = unwrap_lua_object(L, 1) # may not return on error!
24860  *     if not py_obj:             # <<<<<<<<<<<<<<
24861  *         return lua.luaL_argerror(L, 1, "not a python object")   # never returns!
24862  *     result = py_object_getindex_with_gil(L, py_obj)
24863  */
24864   __pyx_t_1 = ((!(__pyx_v_py_obj != 0)) != 0);
24865   if (__pyx_t_1) {
24866 
24867     /* "lupa/_lupa.pyx":1611
24868  *     cdef py_object* py_obj = unwrap_lua_object(L, 1) # may not return on error!
24869  *     if not py_obj:
24870  *         return lua.luaL_argerror(L, 1, "not a python object")   # never returns!             # <<<<<<<<<<<<<<
24871  *     result = py_object_getindex_with_gil(L, py_obj)
24872  *     if result < 0:
24873  */
24874     __pyx_r = luaL_argerror(__pyx_v_L, 1, ((char *)"not a python object"));
24875     goto __pyx_L0;
24876 
24877     /* "lupa/_lupa.pyx":1610
24878  * cdef int py_object_getindex(lua_State* L) nogil:
24879  *     cdef py_object* py_obj = unwrap_lua_object(L, 1) # may not return on error!
24880  *     if not py_obj:             # <<<<<<<<<<<<<<
24881  *         return lua.luaL_argerror(L, 1, "not a python object")   # never returns!
24882  *     result = py_object_getindex_with_gil(L, py_obj)
24883  */
24884   }
24885 
24886   /* "lupa/_lupa.pyx":1612
24887  *     if not py_obj:
24888  *         return lua.luaL_argerror(L, 1, "not a python object")   # never returns!
24889  *     result = py_object_getindex_with_gil(L, py_obj)             # <<<<<<<<<<<<<<
24890  *     if result < 0:
24891  *         return lua.lua_error(L)  # never returns!
24892  */
24893   __pyx_v_result = __pyx_f_4lupa_5_lupa_py_object_getindex_with_gil(__pyx_v_L, __pyx_v_py_obj);
24894 
24895   /* "lupa/_lupa.pyx":1613
24896  *         return lua.luaL_argerror(L, 1, "not a python object")   # never returns!
24897  *     result = py_object_getindex_with_gil(L, py_obj)
24898  *     if result < 0:             # <<<<<<<<<<<<<<
24899  *         return lua.lua_error(L)  # never returns!
24900  *     return result
24901  */
24902   __pyx_t_1 = ((__pyx_v_result < 0) != 0);
24903   if (__pyx_t_1) {
24904 
24905     /* "lupa/_lupa.pyx":1614
24906  *     result = py_object_getindex_with_gil(L, py_obj)
24907  *     if result < 0:
24908  *         return lua.lua_error(L)  # never returns!             # <<<<<<<<<<<<<<
24909  *     return result
24910  *
24911  */
24912     __pyx_r = lua_error(__pyx_v_L);
24913     goto __pyx_L0;
24914 
24915     /* "lupa/_lupa.pyx":1613
24916  *         return lua.luaL_argerror(L, 1, "not a python object")   # never returns!
24917  *     result = py_object_getindex_with_gil(L, py_obj)
24918  *     if result < 0:             # <<<<<<<<<<<<<<
24919  *         return lua.lua_error(L)  # never returns!
24920  *     return result
24921  */
24922   }
24923 
24924   /* "lupa/_lupa.pyx":1615
24925  *     if result < 0:
24926  *         return lua.lua_error(L)  # never returns!
24927  *     return result             # <<<<<<<<<<<<<<
24928  *
24929  *
24930  */
24931   __pyx_r = __pyx_v_result;
24932   goto __pyx_L0;
24933 
24934   /* "lupa/_lupa.pyx":1608
24935  *         return -1
24936  *
24937  * cdef int py_object_getindex(lua_State* L) nogil:             # <<<<<<<<<<<<<<
24938  *     cdef py_object* py_obj = unwrap_lua_object(L, 1) # may not return on error!
24939  *     if not py_obj:
24940  */
24941 
24942   /* function exit code */
24943   __pyx_L0:;
24944   return __pyx_r;
24945 }
24946 
24947 /* "lupa/_lupa.pyx":1618
24948  *
24949  *
24950  * cdef int py_object_setindex_with_gil(lua_State* L, py_object* py_obj) with gil:             # <<<<<<<<<<<<<<
24951  *     cdef LuaRuntime runtime
24952  *     try:
24953  */
24954 
__pyx_f_4lupa_5_lupa_py_object_setindex_with_gil(lua_State * __pyx_v_L,struct __pyx_t_4lupa_5_lupa_py_object * __pyx_v_py_obj)24955 static int __pyx_f_4lupa_5_lupa_py_object_setindex_with_gil(lua_State *__pyx_v_L, struct __pyx_t_4lupa_5_lupa_py_object *__pyx_v_py_obj) {
24956   struct __pyx_obj_4lupa_5_lupa_LuaRuntime *__pyx_v_runtime = 0;
24957   int __pyx_r;
24958   __Pyx_RefNannyDeclarations
24959   PyObject *__pyx_t_1 = NULL;
24960   PyObject *__pyx_t_2 = NULL;
24961   PyObject *__pyx_t_3 = NULL;
24962   PyObject *__pyx_t_4 = NULL;
24963   int __pyx_t_5;
24964   int __pyx_t_6;
24965   int __pyx_t_7;
24966   int __pyx_t_8;
24967   PyObject *__pyx_t_9 = NULL;
24968   PyObject *__pyx_t_10 = NULL;
24969   int __pyx_lineno = 0;
24970   const char *__pyx_filename = NULL;
24971   int __pyx_clineno = 0;
24972   #ifdef WITH_THREAD
24973   PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
24974   #endif
24975   __Pyx_RefNannySetupContext("py_object_setindex_with_gil", 0);
24976 
24977   /* "lupa/_lupa.pyx":1620
24978  * cdef int py_object_setindex_with_gil(lua_State* L, py_object* py_obj) with gil:
24979  *     cdef LuaRuntime runtime
24980  *     try:             # <<<<<<<<<<<<<<
24981  *         runtime = <LuaRuntime?>py_obj.runtime
24982  *         if (py_obj.type_flags & OBJ_AS_INDEX) and not runtime._attribute_setter:
24983  */
24984   {
24985     __Pyx_PyThreadState_declare
24986     __Pyx_PyThreadState_assign
24987     __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
24988     __Pyx_XGOTREF(__pyx_t_1);
24989     __Pyx_XGOTREF(__pyx_t_2);
24990     __Pyx_XGOTREF(__pyx_t_3);
24991     /*try:*/ {
24992 
24993       /* "lupa/_lupa.pyx":1621
24994  *     cdef LuaRuntime runtime
24995  *     try:
24996  *         runtime = <LuaRuntime?>py_obj.runtime             # <<<<<<<<<<<<<<
24997  *         if (py_obj.type_flags & OBJ_AS_INDEX) and not runtime._attribute_setter:
24998  *             return setitem_for_lua(runtime, L, py_obj, 2, 3)
24999  */
25000       __pyx_t_4 = ((PyObject *)__pyx_v_py_obj->runtime);
25001       __Pyx_INCREF(__pyx_t_4);
25002       __pyx_v_runtime = ((struct __pyx_obj_4lupa_5_lupa_LuaRuntime *)__pyx_t_4);
25003       __pyx_t_4 = 0;
25004 
25005       /* "lupa/_lupa.pyx":1622
25006  *     try:
25007  *         runtime = <LuaRuntime?>py_obj.runtime
25008  *         if (py_obj.type_flags & OBJ_AS_INDEX) and not runtime._attribute_setter:             # <<<<<<<<<<<<<<
25009  *             return setitem_for_lua(runtime, L, py_obj, 2, 3)
25010  *         else:
25011  */
25012       __pyx_t_6 = ((__pyx_v_py_obj->type_flags & __pyx_e_4lupa_5_lupa_OBJ_AS_INDEX) != 0);
25013       if (__pyx_t_6) {
25014       } else {
25015         __pyx_t_5 = __pyx_t_6;
25016         goto __pyx_L10_bool_binop_done;
25017       }
25018       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_runtime->_attribute_setter); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 1622, __pyx_L3_error)
25019       __pyx_t_7 = ((!__pyx_t_6) != 0);
25020       __pyx_t_5 = __pyx_t_7;
25021       __pyx_L10_bool_binop_done:;
25022       if (__pyx_t_5) {
25023 
25024         /* "lupa/_lupa.pyx":1623
25025  *         runtime = <LuaRuntime?>py_obj.runtime
25026  *         if (py_obj.type_flags & OBJ_AS_INDEX) and not runtime._attribute_setter:
25027  *             return setitem_for_lua(runtime, L, py_obj, 2, 3)             # <<<<<<<<<<<<<<
25028  *         else:
25029  *             return setattr_for_lua(runtime, L, py_obj, 2, 3)
25030  */
25031         __pyx_t_8 = __pyx_f_4lupa_5_lupa_setitem_for_lua(__pyx_v_runtime, __pyx_v_L, __pyx_v_py_obj, 2, 3); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 1623, __pyx_L3_error)
25032         __pyx_r = __pyx_t_8;
25033         goto __pyx_L7_try_return;
25034 
25035         /* "lupa/_lupa.pyx":1622
25036  *     try:
25037  *         runtime = <LuaRuntime?>py_obj.runtime
25038  *         if (py_obj.type_flags & OBJ_AS_INDEX) and not runtime._attribute_setter:             # <<<<<<<<<<<<<<
25039  *             return setitem_for_lua(runtime, L, py_obj, 2, 3)
25040  *         else:
25041  */
25042       }
25043 
25044       /* "lupa/_lupa.pyx":1625
25045  *             return setitem_for_lua(runtime, L, py_obj, 2, 3)
25046  *         else:
25047  *             return setattr_for_lua(runtime, L, py_obj, 2, 3)             # <<<<<<<<<<<<<<
25048  *     except:
25049  *         runtime.store_raised_exception(L, b'error writing Python attribute/item')
25050  */
25051       /*else*/ {
25052         __pyx_t_8 = __pyx_f_4lupa_5_lupa_setattr_for_lua(__pyx_v_runtime, __pyx_v_L, __pyx_v_py_obj, 2, 3); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 1625, __pyx_L3_error)
25053         __pyx_r = __pyx_t_8;
25054         goto __pyx_L7_try_return;
25055       }
25056 
25057       /* "lupa/_lupa.pyx":1620
25058  * cdef int py_object_setindex_with_gil(lua_State* L, py_object* py_obj) with gil:
25059  *     cdef LuaRuntime runtime
25060  *     try:             # <<<<<<<<<<<<<<
25061  *         runtime = <LuaRuntime?>py_obj.runtime
25062  *         if (py_obj.type_flags & OBJ_AS_INDEX) and not runtime._attribute_setter:
25063  */
25064     }
25065     __pyx_L3_error:;
25066     __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
25067 
25068     /* "lupa/_lupa.pyx":1626
25069  *         else:
25070  *             return setattr_for_lua(runtime, L, py_obj, 2, 3)
25071  *     except:             # <<<<<<<<<<<<<<
25072  *         runtime.store_raised_exception(L, b'error writing Python attribute/item')
25073  *         return -1
25074  */
25075     /*except:*/ {
25076       __Pyx_AddTraceback("lupa._lupa.py_object_setindex_with_gil", __pyx_clineno, __pyx_lineno, __pyx_filename);
25077       if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_9, &__pyx_t_10) < 0) __PYX_ERR(0, 1626, __pyx_L5_except_error)
25078       __Pyx_GOTREF(__pyx_t_4);
25079       __Pyx_GOTREF(__pyx_t_9);
25080       __Pyx_GOTREF(__pyx_t_10);
25081 
25082       /* "lupa/_lupa.pyx":1627
25083  *             return setattr_for_lua(runtime, L, py_obj, 2, 3)
25084  *     except:
25085  *         runtime.store_raised_exception(L, b'error writing Python attribute/item')             # <<<<<<<<<<<<<<
25086  *         return -1
25087  *
25088  */
25089       if (unlikely(!__pyx_v_runtime)) { __Pyx_RaiseUnboundLocalError("runtime"); __PYX_ERR(0, 1627, __pyx_L5_except_error) }
25090       __pyx_t_8 = __pyx_f_4lupa_5_lupa_10LuaRuntime_store_raised_exception(__pyx_v_runtime, __pyx_v_L, __pyx_kp_b_error_writing_Python_attribute_i); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 1627, __pyx_L5_except_error)
25091 
25092       /* "lupa/_lupa.pyx":1628
25093  *     except:
25094  *         runtime.store_raised_exception(L, b'error writing Python attribute/item')
25095  *         return -1             # <<<<<<<<<<<<<<
25096  *
25097  * cdef int py_object_setindex(lua_State* L) nogil:
25098  */
25099       __pyx_r = -1;
25100       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
25101       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
25102       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
25103       goto __pyx_L6_except_return;
25104     }
25105     __pyx_L5_except_error:;
25106 
25107     /* "lupa/_lupa.pyx":1620
25108  * cdef int py_object_setindex_with_gil(lua_State* L, py_object* py_obj) with gil:
25109  *     cdef LuaRuntime runtime
25110  *     try:             # <<<<<<<<<<<<<<
25111  *         runtime = <LuaRuntime?>py_obj.runtime
25112  *         if (py_obj.type_flags & OBJ_AS_INDEX) and not runtime._attribute_setter:
25113  */
25114     __Pyx_XGIVEREF(__pyx_t_1);
25115     __Pyx_XGIVEREF(__pyx_t_2);
25116     __Pyx_XGIVEREF(__pyx_t_3);
25117     __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
25118     goto __pyx_L1_error;
25119     __pyx_L7_try_return:;
25120     __Pyx_XGIVEREF(__pyx_t_1);
25121     __Pyx_XGIVEREF(__pyx_t_2);
25122     __Pyx_XGIVEREF(__pyx_t_3);
25123     __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
25124     goto __pyx_L0;
25125     __pyx_L6_except_return:;
25126     __Pyx_XGIVEREF(__pyx_t_1);
25127     __Pyx_XGIVEREF(__pyx_t_2);
25128     __Pyx_XGIVEREF(__pyx_t_3);
25129     __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
25130     goto __pyx_L0;
25131   }
25132 
25133   /* "lupa/_lupa.pyx":1618
25134  *
25135  *
25136  * cdef int py_object_setindex_with_gil(lua_State* L, py_object* py_obj) with gil:             # <<<<<<<<<<<<<<
25137  *     cdef LuaRuntime runtime
25138  *     try:
25139  */
25140 
25141   /* function exit code */
25142   __pyx_L1_error:;
25143   __Pyx_XDECREF(__pyx_t_4);
25144   __Pyx_XDECREF(__pyx_t_9);
25145   __Pyx_XDECREF(__pyx_t_10);
25146   __Pyx_WriteUnraisable("lupa._lupa.py_object_setindex_with_gil", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
25147   __pyx_r = 0;
25148   __pyx_L0:;
25149   __Pyx_XDECREF((PyObject *)__pyx_v_runtime);
25150   __Pyx_RefNannyFinishContext();
25151   #ifdef WITH_THREAD
25152   __Pyx_PyGILState_Release(__pyx_gilstate_save);
25153   #endif
25154   return __pyx_r;
25155 }
25156 
25157 /* "lupa/_lupa.pyx":1630
25158  *         return -1
25159  *
25160  * cdef int py_object_setindex(lua_State* L) nogil:             # <<<<<<<<<<<<<<
25161  *     cdef py_object* py_obj = unwrap_lua_object(L, 1) # may not return on error!
25162  *     if not py_obj:
25163  */
25164 
__pyx_f_4lupa_5_lupa_py_object_setindex(lua_State * __pyx_v_L)25165 static int __pyx_f_4lupa_5_lupa_py_object_setindex(lua_State *__pyx_v_L) {
25166   struct __pyx_t_4lupa_5_lupa_py_object *__pyx_v_py_obj;
25167   int __pyx_v_result;
25168   int __pyx_r;
25169   int __pyx_t_1;
25170 
25171   /* "lupa/_lupa.pyx":1631
25172  *
25173  * cdef int py_object_setindex(lua_State* L) nogil:
25174  *     cdef py_object* py_obj = unwrap_lua_object(L, 1) # may not return on error!             # <<<<<<<<<<<<<<
25175  *     if not py_obj:
25176  *         return lua.luaL_argerror(L, 1, "not a python object")   # never returns!
25177  */
25178   __pyx_v_py_obj = __pyx_f_4lupa_5_lupa_unwrap_lua_object(__pyx_v_L, 1);
25179 
25180   /* "lupa/_lupa.pyx":1632
25181  * cdef int py_object_setindex(lua_State* L) nogil:
25182  *     cdef py_object* py_obj = unwrap_lua_object(L, 1) # may not return on error!
25183  *     if not py_obj:             # <<<<<<<<<<<<<<
25184  *         return lua.luaL_argerror(L, 1, "not a python object")   # never returns!
25185  *     result = py_object_setindex_with_gil(L, py_obj)
25186  */
25187   __pyx_t_1 = ((!(__pyx_v_py_obj != 0)) != 0);
25188   if (__pyx_t_1) {
25189 
25190     /* "lupa/_lupa.pyx":1633
25191  *     cdef py_object* py_obj = unwrap_lua_object(L, 1) # may not return on error!
25192  *     if not py_obj:
25193  *         return lua.luaL_argerror(L, 1, "not a python object")   # never returns!             # <<<<<<<<<<<<<<
25194  *     result = py_object_setindex_with_gil(L, py_obj)
25195  *     if result < 0:
25196  */
25197     __pyx_r = luaL_argerror(__pyx_v_L, 1, ((char *)"not a python object"));
25198     goto __pyx_L0;
25199 
25200     /* "lupa/_lupa.pyx":1632
25201  * cdef int py_object_setindex(lua_State* L) nogil:
25202  *     cdef py_object* py_obj = unwrap_lua_object(L, 1) # may not return on error!
25203  *     if not py_obj:             # <<<<<<<<<<<<<<
25204  *         return lua.luaL_argerror(L, 1, "not a python object")   # never returns!
25205  *     result = py_object_setindex_with_gil(L, py_obj)
25206  */
25207   }
25208 
25209   /* "lupa/_lupa.pyx":1634
25210  *     if not py_obj:
25211  *         return lua.luaL_argerror(L, 1, "not a python object")   # never returns!
25212  *     result = py_object_setindex_with_gil(L, py_obj)             # <<<<<<<<<<<<<<
25213  *     if result < 0:
25214  *         return lua.lua_error(L)  # never returns!
25215  */
25216   __pyx_v_result = __pyx_f_4lupa_5_lupa_py_object_setindex_with_gil(__pyx_v_L, __pyx_v_py_obj);
25217 
25218   /* "lupa/_lupa.pyx":1635
25219  *         return lua.luaL_argerror(L, 1, "not a python object")   # never returns!
25220  *     result = py_object_setindex_with_gil(L, py_obj)
25221  *     if result < 0:             # <<<<<<<<<<<<<<
25222  *         return lua.lua_error(L)  # never returns!
25223  *     return result
25224  */
25225   __pyx_t_1 = ((__pyx_v_result < 0) != 0);
25226   if (__pyx_t_1) {
25227 
25228     /* "lupa/_lupa.pyx":1636
25229  *     result = py_object_setindex_with_gil(L, py_obj)
25230  *     if result < 0:
25231  *         return lua.lua_error(L)  # never returns!             # <<<<<<<<<<<<<<
25232  *     return result
25233  *
25234  */
25235     __pyx_r = lua_error(__pyx_v_L);
25236     goto __pyx_L0;
25237 
25238     /* "lupa/_lupa.pyx":1635
25239  *         return lua.luaL_argerror(L, 1, "not a python object")   # never returns!
25240  *     result = py_object_setindex_with_gil(L, py_obj)
25241  *     if result < 0:             # <<<<<<<<<<<<<<
25242  *         return lua.lua_error(L)  # never returns!
25243  *     return result
25244  */
25245   }
25246 
25247   /* "lupa/_lupa.pyx":1637
25248  *     if result < 0:
25249  *         return lua.lua_error(L)  # never returns!
25250  *     return result             # <<<<<<<<<<<<<<
25251  *
25252  * # special methods for Lua wrapped Python objects
25253  */
25254   __pyx_r = __pyx_v_result;
25255   goto __pyx_L0;
25256 
25257   /* "lupa/_lupa.pyx":1630
25258  *         return -1
25259  *
25260  * cdef int py_object_setindex(lua_State* L) nogil:             # <<<<<<<<<<<<<<
25261  *     cdef py_object* py_obj = unwrap_lua_object(L, 1) # may not return on error!
25262  *     if not py_obj:
25263  */
25264 
25265   /* function exit code */
25266   __pyx_L0:;
25267   return __pyx_r;
25268 }
25269 
25270 /* "lupa/_lupa.pyx":1652
25271  * ## # Python helper functions for Lua
25272  *
25273  * cdef inline py_object* unpack_single_python_argument_or_jump(lua_State* L) nogil:             # <<<<<<<<<<<<<<
25274  *     if lua.lua_gettop(L) > 1:
25275  *         lua.luaL_argerror(L, 2, "invalid arguments")   # never returns!
25276  */
25277 
__pyx_f_4lupa_5_lupa_unpack_single_python_argument_or_jump(lua_State * __pyx_v_L)25278 static CYTHON_INLINE struct __pyx_t_4lupa_5_lupa_py_object *__pyx_f_4lupa_5_lupa_unpack_single_python_argument_or_jump(lua_State *__pyx_v_L) {
25279   struct __pyx_t_4lupa_5_lupa_py_object *__pyx_v_py_obj;
25280   struct __pyx_t_4lupa_5_lupa_py_object *__pyx_r;
25281   int __pyx_t_1;
25282 
25283   /* "lupa/_lupa.pyx":1653
25284  *
25285  * cdef inline py_object* unpack_single_python_argument_or_jump(lua_State* L) nogil:
25286  *     if lua.lua_gettop(L) > 1:             # <<<<<<<<<<<<<<
25287  *         lua.luaL_argerror(L, 2, "invalid arguments")   # never returns!
25288  *     cdef py_object* py_obj = unwrap_lua_object(L, 1)
25289  */
25290   __pyx_t_1 = ((lua_gettop(__pyx_v_L) > 1) != 0);
25291   if (__pyx_t_1) {
25292 
25293     /* "lupa/_lupa.pyx":1654
25294  * cdef inline py_object* unpack_single_python_argument_or_jump(lua_State* L) nogil:
25295  *     if lua.lua_gettop(L) > 1:
25296  *         lua.luaL_argerror(L, 2, "invalid arguments")   # never returns!             # <<<<<<<<<<<<<<
25297  *     cdef py_object* py_obj = unwrap_lua_object(L, 1)
25298  *     if not py_obj:
25299  */
25300     (void)(luaL_argerror(__pyx_v_L, 2, ((char *)"invalid arguments")));
25301 
25302     /* "lupa/_lupa.pyx":1653
25303  *
25304  * cdef inline py_object* unpack_single_python_argument_or_jump(lua_State* L) nogil:
25305  *     if lua.lua_gettop(L) > 1:             # <<<<<<<<<<<<<<
25306  *         lua.luaL_argerror(L, 2, "invalid arguments")   # never returns!
25307  *     cdef py_object* py_obj = unwrap_lua_object(L, 1)
25308  */
25309   }
25310 
25311   /* "lupa/_lupa.pyx":1655
25312  *     if lua.lua_gettop(L) > 1:
25313  *         lua.luaL_argerror(L, 2, "invalid arguments")   # never returns!
25314  *     cdef py_object* py_obj = unwrap_lua_object(L, 1)             # <<<<<<<<<<<<<<
25315  *     if not py_obj:
25316  *         lua.luaL_argerror(L, 1, "not a python object")   # never returns!
25317  */
25318   __pyx_v_py_obj = __pyx_f_4lupa_5_lupa_unwrap_lua_object(__pyx_v_L, 1);
25319 
25320   /* "lupa/_lupa.pyx":1656
25321  *         lua.luaL_argerror(L, 2, "invalid arguments")   # never returns!
25322  *     cdef py_object* py_obj = unwrap_lua_object(L, 1)
25323  *     if not py_obj:             # <<<<<<<<<<<<<<
25324  *         lua.luaL_argerror(L, 1, "not a python object")   # never returns!
25325  *     return py_obj
25326  */
25327   __pyx_t_1 = ((!(__pyx_v_py_obj != 0)) != 0);
25328   if (__pyx_t_1) {
25329 
25330     /* "lupa/_lupa.pyx":1657
25331  *     cdef py_object* py_obj = unwrap_lua_object(L, 1)
25332  *     if not py_obj:
25333  *         lua.luaL_argerror(L, 1, "not a python object")   # never returns!             # <<<<<<<<<<<<<<
25334  *     return py_obj
25335  *
25336  */
25337     (void)(luaL_argerror(__pyx_v_L, 1, ((char *)"not a python object")));
25338 
25339     /* "lupa/_lupa.pyx":1656
25340  *         lua.luaL_argerror(L, 2, "invalid arguments")   # never returns!
25341  *     cdef py_object* py_obj = unwrap_lua_object(L, 1)
25342  *     if not py_obj:             # <<<<<<<<<<<<<<
25343  *         lua.luaL_argerror(L, 1, "not a python object")   # never returns!
25344  *     return py_obj
25345  */
25346   }
25347 
25348   /* "lupa/_lupa.pyx":1658
25349  *     if not py_obj:
25350  *         lua.luaL_argerror(L, 1, "not a python object")   # never returns!
25351  *     return py_obj             # <<<<<<<<<<<<<<
25352  *
25353  * cdef py_object* unwrap_lua_object(lua_State* L, int n) nogil:
25354  */
25355   __pyx_r = __pyx_v_py_obj;
25356   goto __pyx_L0;
25357 
25358   /* "lupa/_lupa.pyx":1652
25359  * ## # Python helper functions for Lua
25360  *
25361  * cdef inline py_object* unpack_single_python_argument_or_jump(lua_State* L) nogil:             # <<<<<<<<<<<<<<
25362  *     if lua.lua_gettop(L) > 1:
25363  *         lua.luaL_argerror(L, 2, "invalid arguments")   # never returns!
25364  */
25365 
25366   /* function exit code */
25367   __pyx_L0:;
25368   return __pyx_r;
25369 }
25370 
25371 /* "lupa/_lupa.pyx":1660
25372  *     return py_obj
25373  *
25374  * cdef py_object* unwrap_lua_object(lua_State* L, int n) nogil:             # <<<<<<<<<<<<<<
25375  *     if lua.lua_isuserdata(L, n):
25376  *         return unpack_userdata(L, n)
25377  */
25378 
__pyx_f_4lupa_5_lupa_unwrap_lua_object(lua_State * __pyx_v_L,int __pyx_v_n)25379 static struct __pyx_t_4lupa_5_lupa_py_object *__pyx_f_4lupa_5_lupa_unwrap_lua_object(lua_State *__pyx_v_L, int __pyx_v_n) {
25380   struct __pyx_t_4lupa_5_lupa_py_object *__pyx_r;
25381   int __pyx_t_1;
25382 
25383   /* "lupa/_lupa.pyx":1661
25384  *
25385  * cdef py_object* unwrap_lua_object(lua_State* L, int n) nogil:
25386  *     if lua.lua_isuserdata(L, n):             # <<<<<<<<<<<<<<
25387  *         return unpack_userdata(L, n)
25388  *     else:
25389  */
25390   __pyx_t_1 = (lua_isuserdata(__pyx_v_L, __pyx_v_n) != 0);
25391   if (__pyx_t_1) {
25392 
25393     /* "lupa/_lupa.pyx":1662
25394  * cdef py_object* unwrap_lua_object(lua_State* L, int n) nogil:
25395  *     if lua.lua_isuserdata(L, n):
25396  *         return unpack_userdata(L, n)             # <<<<<<<<<<<<<<
25397  *     else:
25398  *         return unpack_wrapped_pyfunction(L, n)
25399  */
25400     __pyx_r = __pyx_f_4lupa_5_lupa_unpack_userdata(__pyx_v_L, __pyx_v_n);
25401     goto __pyx_L0;
25402 
25403     /* "lupa/_lupa.pyx":1661
25404  *
25405  * cdef py_object* unwrap_lua_object(lua_State* L, int n) nogil:
25406  *     if lua.lua_isuserdata(L, n):             # <<<<<<<<<<<<<<
25407  *         return unpack_userdata(L, n)
25408  *     else:
25409  */
25410   }
25411 
25412   /* "lupa/_lupa.pyx":1664
25413  *         return unpack_userdata(L, n)
25414  *     else:
25415  *         return unpack_wrapped_pyfunction(L, n)             # <<<<<<<<<<<<<<
25416  *
25417  * cdef int py_wrap_object_protocol_with_gil(lua_State* L, py_object* py_obj, int type_flags) with gil:
25418  */
25419   /*else*/ {
25420     __pyx_r = __pyx_f_4lupa_5_lupa_unpack_wrapped_pyfunction(__pyx_v_L, __pyx_v_n);
25421     goto __pyx_L0;
25422   }
25423 
25424   /* "lupa/_lupa.pyx":1660
25425  *     return py_obj
25426  *
25427  * cdef py_object* unwrap_lua_object(lua_State* L, int n) nogil:             # <<<<<<<<<<<<<<
25428  *     if lua.lua_isuserdata(L, n):
25429  *         return unpack_userdata(L, n)
25430  */
25431 
25432   /* function exit code */
25433   __pyx_L0:;
25434   return __pyx_r;
25435 }
25436 
25437 /* "lupa/_lupa.pyx":1666
25438  *         return unpack_wrapped_pyfunction(L, n)
25439  *
25440  * cdef int py_wrap_object_protocol_with_gil(lua_State* L, py_object* py_obj, int type_flags) with gil:             # <<<<<<<<<<<<<<
25441  *     cdef LuaRuntime runtime
25442  *     try:
25443  */
25444 
__pyx_f_4lupa_5_lupa_py_wrap_object_protocol_with_gil(lua_State * __pyx_v_L,struct __pyx_t_4lupa_5_lupa_py_object * __pyx_v_py_obj,int __pyx_v_type_flags)25445 static int __pyx_f_4lupa_5_lupa_py_wrap_object_protocol_with_gil(lua_State *__pyx_v_L, struct __pyx_t_4lupa_5_lupa_py_object *__pyx_v_py_obj, int __pyx_v_type_flags) {
25446   struct __pyx_obj_4lupa_5_lupa_LuaRuntime *__pyx_v_runtime = 0;
25447   int __pyx_r;
25448   __Pyx_RefNannyDeclarations
25449   PyObject *__pyx_t_1 = NULL;
25450   PyObject *__pyx_t_2 = NULL;
25451   PyObject *__pyx_t_3 = NULL;
25452   PyObject *__pyx_t_4 = NULL;
25453   #ifdef WITH_THREAD
25454   PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
25455   #endif
25456   __Pyx_RefNannySetupContext("py_wrap_object_protocol_with_gil", 0);
25457 
25458   /* "lupa/_lupa.pyx":1668
25459  * cdef int py_wrap_object_protocol_with_gil(lua_State* L, py_object* py_obj, int type_flags) with gil:
25460  *     cdef LuaRuntime runtime
25461  *     try:             # <<<<<<<<<<<<<<
25462  *         runtime = <LuaRuntime?>py_obj.runtime
25463  *         return py_to_lua_custom(runtime, L, <object>py_obj.obj, type_flags)
25464  */
25465   {
25466     (void)__pyx_t_1; (void)__pyx_t_2; (void)__pyx_t_3; /* mark used */
25467     /*try:*/ {
25468 
25469       /* "lupa/_lupa.pyx":1669
25470  *     cdef LuaRuntime runtime
25471  *     try:
25472  *         runtime = <LuaRuntime?>py_obj.runtime             # <<<<<<<<<<<<<<
25473  *         return py_to_lua_custom(runtime, L, <object>py_obj.obj, type_flags)
25474  *     except:
25475  */
25476       __pyx_t_4 = ((PyObject *)__pyx_v_py_obj->runtime);
25477       __Pyx_INCREF(__pyx_t_4);
25478       __pyx_v_runtime = ((struct __pyx_obj_4lupa_5_lupa_LuaRuntime *)__pyx_t_4);
25479       __pyx_t_4 = 0;
25480 
25481       /* "lupa/_lupa.pyx":1670
25482  *     try:
25483  *         runtime = <LuaRuntime?>py_obj.runtime
25484  *         return py_to_lua_custom(runtime, L, <object>py_obj.obj, type_flags)             # <<<<<<<<<<<<<<
25485  *     except:
25486  *         try: runtime.store_raised_exception(L, b'error during type adaptation')
25487  */
25488       __pyx_t_4 = ((PyObject *)__pyx_v_py_obj->obj);
25489       __Pyx_INCREF(__pyx_t_4);
25490       __pyx_r = __pyx_f_4lupa_5_lupa_py_to_lua_custom(__pyx_v_runtime, __pyx_v_L, __pyx_t_4, __pyx_v_type_flags);
25491       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
25492       goto __pyx_L7_try_return;
25493 
25494       /* "lupa/_lupa.pyx":1668
25495  * cdef int py_wrap_object_protocol_with_gil(lua_State* L, py_object* py_obj, int type_flags) with gil:
25496  *     cdef LuaRuntime runtime
25497  *     try:             # <<<<<<<<<<<<<<
25498  *         runtime = <LuaRuntime?>py_obj.runtime
25499  *         return py_to_lua_custom(runtime, L, <object>py_obj.obj, type_flags)
25500  */
25501     }
25502     __pyx_L7_try_return:;
25503     goto __pyx_L0;
25504   }
25505 
25506   /* "lupa/_lupa.pyx":1666
25507  *         return unpack_wrapped_pyfunction(L, n)
25508  *
25509  * cdef int py_wrap_object_protocol_with_gil(lua_State* L, py_object* py_obj, int type_flags) with gil:             # <<<<<<<<<<<<<<
25510  *     cdef LuaRuntime runtime
25511  *     try:
25512  */
25513 
25514   /* function exit code */
25515   __pyx_L0:;
25516   __Pyx_XDECREF((PyObject *)__pyx_v_runtime);
25517   __Pyx_RefNannyFinishContext();
25518   #ifdef WITH_THREAD
25519   __Pyx_PyGILState_Release(__pyx_gilstate_save);
25520   #endif
25521   return __pyx_r;
25522 }
25523 
25524 /* "lupa/_lupa.pyx":1675
25525  *         finally: return -1
25526  *
25527  * cdef int py_wrap_object_protocol(lua_State* L, int type_flags) nogil:             # <<<<<<<<<<<<<<
25528  *     cdef py_object* py_obj = unpack_single_python_argument_or_jump(L) # never returns on error!
25529  *     result = py_wrap_object_protocol_with_gil(L, py_obj, type_flags)
25530  */
25531 
__pyx_f_4lupa_5_lupa_py_wrap_object_protocol(lua_State * __pyx_v_L,int __pyx_v_type_flags)25532 static int __pyx_f_4lupa_5_lupa_py_wrap_object_protocol(lua_State *__pyx_v_L, int __pyx_v_type_flags) {
25533   struct __pyx_t_4lupa_5_lupa_py_object *__pyx_v_py_obj;
25534   int __pyx_v_result;
25535   int __pyx_r;
25536   int __pyx_t_1;
25537 
25538   /* "lupa/_lupa.pyx":1676
25539  *
25540  * cdef int py_wrap_object_protocol(lua_State* L, int type_flags) nogil:
25541  *     cdef py_object* py_obj = unpack_single_python_argument_or_jump(L) # never returns on error!             # <<<<<<<<<<<<<<
25542  *     result = py_wrap_object_protocol_with_gil(L, py_obj, type_flags)
25543  *     if result < 0:
25544  */
25545   __pyx_v_py_obj = __pyx_f_4lupa_5_lupa_unpack_single_python_argument_or_jump(__pyx_v_L);
25546 
25547   /* "lupa/_lupa.pyx":1677
25548  * cdef int py_wrap_object_protocol(lua_State* L, int type_flags) nogil:
25549  *     cdef py_object* py_obj = unpack_single_python_argument_or_jump(L) # never returns on error!
25550  *     result = py_wrap_object_protocol_with_gil(L, py_obj, type_flags)             # <<<<<<<<<<<<<<
25551  *     if result < 0:
25552  *         return lua.lua_error(L)  # never returns!
25553  */
25554   __pyx_v_result = __pyx_f_4lupa_5_lupa_py_wrap_object_protocol_with_gil(__pyx_v_L, __pyx_v_py_obj, __pyx_v_type_flags);
25555 
25556   /* "lupa/_lupa.pyx":1678
25557  *     cdef py_object* py_obj = unpack_single_python_argument_or_jump(L) # never returns on error!
25558  *     result = py_wrap_object_protocol_with_gil(L, py_obj, type_flags)
25559  *     if result < 0:             # <<<<<<<<<<<<<<
25560  *         return lua.lua_error(L)  # never returns!
25561  *     return result
25562  */
25563   __pyx_t_1 = ((__pyx_v_result < 0) != 0);
25564   if (__pyx_t_1) {
25565 
25566     /* "lupa/_lupa.pyx":1679
25567  *     result = py_wrap_object_protocol_with_gil(L, py_obj, type_flags)
25568  *     if result < 0:
25569  *         return lua.lua_error(L)  # never returns!             # <<<<<<<<<<<<<<
25570  *     return result
25571  *
25572  */
25573     __pyx_r = lua_error(__pyx_v_L);
25574     goto __pyx_L0;
25575 
25576     /* "lupa/_lupa.pyx":1678
25577  *     cdef py_object* py_obj = unpack_single_python_argument_or_jump(L) # never returns on error!
25578  *     result = py_wrap_object_protocol_with_gil(L, py_obj, type_flags)
25579  *     if result < 0:             # <<<<<<<<<<<<<<
25580  *         return lua.lua_error(L)  # never returns!
25581  *     return result
25582  */
25583   }
25584 
25585   /* "lupa/_lupa.pyx":1680
25586  *     if result < 0:
25587  *         return lua.lua_error(L)  # never returns!
25588  *     return result             # <<<<<<<<<<<<<<
25589  *
25590  * cdef int py_as_attrgetter(lua_State* L) nogil:
25591  */
25592   __pyx_r = __pyx_v_result;
25593   goto __pyx_L0;
25594 
25595   /* "lupa/_lupa.pyx":1675
25596  *         finally: return -1
25597  *
25598  * cdef int py_wrap_object_protocol(lua_State* L, int type_flags) nogil:             # <<<<<<<<<<<<<<
25599  *     cdef py_object* py_obj = unpack_single_python_argument_or_jump(L) # never returns on error!
25600  *     result = py_wrap_object_protocol_with_gil(L, py_obj, type_flags)
25601  */
25602 
25603   /* function exit code */
25604   __pyx_L0:;
25605   return __pyx_r;
25606 }
25607 
25608 /* "lupa/_lupa.pyx":1682
25609  *     return result
25610  *
25611  * cdef int py_as_attrgetter(lua_State* L) nogil:             # <<<<<<<<<<<<<<
25612  *     return py_wrap_object_protocol(L, 0)
25613  *
25614  */
25615 
__pyx_f_4lupa_5_lupa_py_as_attrgetter(lua_State * __pyx_v_L)25616 static int __pyx_f_4lupa_5_lupa_py_as_attrgetter(lua_State *__pyx_v_L) {
25617   int __pyx_r;
25618 
25619   /* "lupa/_lupa.pyx":1683
25620  *
25621  * cdef int py_as_attrgetter(lua_State* L) nogil:
25622  *     return py_wrap_object_protocol(L, 0)             # <<<<<<<<<<<<<<
25623  *
25624  * cdef int py_as_itemgetter(lua_State* L) nogil:
25625  */
25626   __pyx_r = __pyx_f_4lupa_5_lupa_py_wrap_object_protocol(__pyx_v_L, 0);
25627   goto __pyx_L0;
25628 
25629   /* "lupa/_lupa.pyx":1682
25630  *     return result
25631  *
25632  * cdef int py_as_attrgetter(lua_State* L) nogil:             # <<<<<<<<<<<<<<
25633  *     return py_wrap_object_protocol(L, 0)
25634  *
25635  */
25636 
25637   /* function exit code */
25638   __pyx_L0:;
25639   return __pyx_r;
25640 }
25641 
25642 /* "lupa/_lupa.pyx":1685
25643  *     return py_wrap_object_protocol(L, 0)
25644  *
25645  * cdef int py_as_itemgetter(lua_State* L) nogil:             # <<<<<<<<<<<<<<
25646  *     return py_wrap_object_protocol(L, OBJ_AS_INDEX)
25647  *
25648  */
25649 
__pyx_f_4lupa_5_lupa_py_as_itemgetter(lua_State * __pyx_v_L)25650 static int __pyx_f_4lupa_5_lupa_py_as_itemgetter(lua_State *__pyx_v_L) {
25651   int __pyx_r;
25652 
25653   /* "lupa/_lupa.pyx":1686
25654  *
25655  * cdef int py_as_itemgetter(lua_State* L) nogil:
25656  *     return py_wrap_object_protocol(L, OBJ_AS_INDEX)             # <<<<<<<<<<<<<<
25657  *
25658  * cdef int py_as_function(lua_State* L) nogil:
25659  */
25660   __pyx_r = __pyx_f_4lupa_5_lupa_py_wrap_object_protocol(__pyx_v_L, __pyx_e_4lupa_5_lupa_OBJ_AS_INDEX);
25661   goto __pyx_L0;
25662 
25663   /* "lupa/_lupa.pyx":1685
25664  *     return py_wrap_object_protocol(L, 0)
25665  *
25666  * cdef int py_as_itemgetter(lua_State* L) nogil:             # <<<<<<<<<<<<<<
25667  *     return py_wrap_object_protocol(L, OBJ_AS_INDEX)
25668  *
25669  */
25670 
25671   /* function exit code */
25672   __pyx_L0:;
25673   return __pyx_r;
25674 }
25675 
25676 /* "lupa/_lupa.pyx":1688
25677  *     return py_wrap_object_protocol(L, OBJ_AS_INDEX)
25678  *
25679  * cdef int py_as_function(lua_State* L) nogil:             # <<<<<<<<<<<<<<
25680  *     cdef py_object* py_obj = unpack_single_python_argument_or_jump(L) # never returns on error!
25681  *     lua.lua_pushcclosure(L, <lua.lua_CFunction>py_asfunc_call, 1)
25682  */
25683 
__pyx_f_4lupa_5_lupa_py_as_function(lua_State * __pyx_v_L)25684 static int __pyx_f_4lupa_5_lupa_py_as_function(lua_State *__pyx_v_L) {
25685   CYTHON_UNUSED struct __pyx_t_4lupa_5_lupa_py_object *__pyx_v_py_obj;
25686   int __pyx_r;
25687 
25688   /* "lupa/_lupa.pyx":1689
25689  *
25690  * cdef int py_as_function(lua_State* L) nogil:
25691  *     cdef py_object* py_obj = unpack_single_python_argument_or_jump(L) # never returns on error!             # <<<<<<<<<<<<<<
25692  *     lua.lua_pushcclosure(L, <lua.lua_CFunction>py_asfunc_call, 1)
25693  *     return 1
25694  */
25695   __pyx_v_py_obj = __pyx_f_4lupa_5_lupa_unpack_single_python_argument_or_jump(__pyx_v_L);
25696 
25697   /* "lupa/_lupa.pyx":1690
25698  * cdef int py_as_function(lua_State* L) nogil:
25699  *     cdef py_object* py_obj = unpack_single_python_argument_or_jump(L) # never returns on error!
25700  *     lua.lua_pushcclosure(L, <lua.lua_CFunction>py_asfunc_call, 1)             # <<<<<<<<<<<<<<
25701  *     return 1
25702  *
25703  */
25704   lua_pushcclosure(__pyx_v_L, ((lua_CFunction)__pyx_f_4lupa_5_lupa_py_asfunc_call), 1);
25705 
25706   /* "lupa/_lupa.pyx":1691
25707  *     cdef py_object* py_obj = unpack_single_python_argument_or_jump(L) # never returns on error!
25708  *     lua.lua_pushcclosure(L, <lua.lua_CFunction>py_asfunc_call, 1)
25709  *     return 1             # <<<<<<<<<<<<<<
25710  *
25711  * # iteration support for Python objects in Lua
25712  */
25713   __pyx_r = 1;
25714   goto __pyx_L0;
25715 
25716   /* "lupa/_lupa.pyx":1688
25717  *     return py_wrap_object_protocol(L, OBJ_AS_INDEX)
25718  *
25719  * cdef int py_as_function(lua_State* L) nogil:             # <<<<<<<<<<<<<<
25720  *     cdef py_object* py_obj = unpack_single_python_argument_or_jump(L) # never returns on error!
25721  *     lua.lua_pushcclosure(L, <lua.lua_CFunction>py_asfunc_call, 1)
25722  */
25723 
25724   /* function exit code */
25725   __pyx_L0:;
25726   return __pyx_r;
25727 }
25728 
25729 /* "lupa/_lupa.pyx":1695
25730  * # iteration support for Python objects in Lua
25731  *
25732  * cdef int py_iter(lua_State* L) nogil:             # <<<<<<<<<<<<<<
25733  *     cdef py_object* py_obj = unpack_single_python_argument_or_jump(L) # never returns on error!
25734  *     result = py_iter_with_gil(L, py_obj, 0)
25735  */
25736 
__pyx_f_4lupa_5_lupa_py_iter(lua_State * __pyx_v_L)25737 static int __pyx_f_4lupa_5_lupa_py_iter(lua_State *__pyx_v_L) {
25738   struct __pyx_t_4lupa_5_lupa_py_object *__pyx_v_py_obj;
25739   int __pyx_v_result;
25740   int __pyx_r;
25741   int __pyx_t_1;
25742 
25743   /* "lupa/_lupa.pyx":1696
25744  *
25745  * cdef int py_iter(lua_State* L) nogil:
25746  *     cdef py_object* py_obj = unpack_single_python_argument_or_jump(L) # never returns on error!             # <<<<<<<<<<<<<<
25747  *     result = py_iter_with_gil(L, py_obj, 0)
25748  *     if result < 0:
25749  */
25750   __pyx_v_py_obj = __pyx_f_4lupa_5_lupa_unpack_single_python_argument_or_jump(__pyx_v_L);
25751 
25752   /* "lupa/_lupa.pyx":1697
25753  * cdef int py_iter(lua_State* L) nogil:
25754  *     cdef py_object* py_obj = unpack_single_python_argument_or_jump(L) # never returns on error!
25755  *     result = py_iter_with_gil(L, py_obj, 0)             # <<<<<<<<<<<<<<
25756  *     if result < 0:
25757  *         return lua.lua_error(L)  # never returns!
25758  */
25759   __pyx_v_result = __pyx_f_4lupa_5_lupa_py_iter_with_gil(__pyx_v_L, __pyx_v_py_obj, 0);
25760 
25761   /* "lupa/_lupa.pyx":1698
25762  *     cdef py_object* py_obj = unpack_single_python_argument_or_jump(L) # never returns on error!
25763  *     result = py_iter_with_gil(L, py_obj, 0)
25764  *     if result < 0:             # <<<<<<<<<<<<<<
25765  *         return lua.lua_error(L)  # never returns!
25766  *     return result
25767  */
25768   __pyx_t_1 = ((__pyx_v_result < 0) != 0);
25769   if (__pyx_t_1) {
25770 
25771     /* "lupa/_lupa.pyx":1699
25772  *     result = py_iter_with_gil(L, py_obj, 0)
25773  *     if result < 0:
25774  *         return lua.lua_error(L)  # never returns!             # <<<<<<<<<<<<<<
25775  *     return result
25776  *
25777  */
25778     __pyx_r = lua_error(__pyx_v_L);
25779     goto __pyx_L0;
25780 
25781     /* "lupa/_lupa.pyx":1698
25782  *     cdef py_object* py_obj = unpack_single_python_argument_or_jump(L) # never returns on error!
25783  *     result = py_iter_with_gil(L, py_obj, 0)
25784  *     if result < 0:             # <<<<<<<<<<<<<<
25785  *         return lua.lua_error(L)  # never returns!
25786  *     return result
25787  */
25788   }
25789 
25790   /* "lupa/_lupa.pyx":1700
25791  *     if result < 0:
25792  *         return lua.lua_error(L)  # never returns!
25793  *     return result             # <<<<<<<<<<<<<<
25794  *
25795  * cdef int py_iterex(lua_State* L) nogil:
25796  */
25797   __pyx_r = __pyx_v_result;
25798   goto __pyx_L0;
25799 
25800   /* "lupa/_lupa.pyx":1695
25801  * # iteration support for Python objects in Lua
25802  *
25803  * cdef int py_iter(lua_State* L) nogil:             # <<<<<<<<<<<<<<
25804  *     cdef py_object* py_obj = unpack_single_python_argument_or_jump(L) # never returns on error!
25805  *     result = py_iter_with_gil(L, py_obj, 0)
25806  */
25807 
25808   /* function exit code */
25809   __pyx_L0:;
25810   return __pyx_r;
25811 }
25812 
25813 /* "lupa/_lupa.pyx":1702
25814  *     return result
25815  *
25816  * cdef int py_iterex(lua_State* L) nogil:             # <<<<<<<<<<<<<<
25817  *     cdef py_object* py_obj = unpack_single_python_argument_or_jump(L) # never returns on error!
25818  *     result = py_iter_with_gil(L, py_obj, OBJ_UNPACK_TUPLE)
25819  */
25820 
__pyx_f_4lupa_5_lupa_py_iterex(lua_State * __pyx_v_L)25821 static int __pyx_f_4lupa_5_lupa_py_iterex(lua_State *__pyx_v_L) {
25822   struct __pyx_t_4lupa_5_lupa_py_object *__pyx_v_py_obj;
25823   int __pyx_v_result;
25824   int __pyx_r;
25825   int __pyx_t_1;
25826 
25827   /* "lupa/_lupa.pyx":1703
25828  *
25829  * cdef int py_iterex(lua_State* L) nogil:
25830  *     cdef py_object* py_obj = unpack_single_python_argument_or_jump(L) # never returns on error!             # <<<<<<<<<<<<<<
25831  *     result = py_iter_with_gil(L, py_obj, OBJ_UNPACK_TUPLE)
25832  *     if result < 0:
25833  */
25834   __pyx_v_py_obj = __pyx_f_4lupa_5_lupa_unpack_single_python_argument_or_jump(__pyx_v_L);
25835 
25836   /* "lupa/_lupa.pyx":1704
25837  * cdef int py_iterex(lua_State* L) nogil:
25838  *     cdef py_object* py_obj = unpack_single_python_argument_or_jump(L) # never returns on error!
25839  *     result = py_iter_with_gil(L, py_obj, OBJ_UNPACK_TUPLE)             # <<<<<<<<<<<<<<
25840  *     if result < 0:
25841  *         return lua.lua_error(L)  # never returns!
25842  */
25843   __pyx_v_result = __pyx_f_4lupa_5_lupa_py_iter_with_gil(__pyx_v_L, __pyx_v_py_obj, __pyx_e_4lupa_5_lupa_OBJ_UNPACK_TUPLE);
25844 
25845   /* "lupa/_lupa.pyx":1705
25846  *     cdef py_object* py_obj = unpack_single_python_argument_or_jump(L) # never returns on error!
25847  *     result = py_iter_with_gil(L, py_obj, OBJ_UNPACK_TUPLE)
25848  *     if result < 0:             # <<<<<<<<<<<<<<
25849  *         return lua.lua_error(L)  # never returns!
25850  *     return result
25851  */
25852   __pyx_t_1 = ((__pyx_v_result < 0) != 0);
25853   if (__pyx_t_1) {
25854 
25855     /* "lupa/_lupa.pyx":1706
25856  *     result = py_iter_with_gil(L, py_obj, OBJ_UNPACK_TUPLE)
25857  *     if result < 0:
25858  *         return lua.lua_error(L)  # never returns!             # <<<<<<<<<<<<<<
25859  *     return result
25860  *
25861  */
25862     __pyx_r = lua_error(__pyx_v_L);
25863     goto __pyx_L0;
25864 
25865     /* "lupa/_lupa.pyx":1705
25866  *     cdef py_object* py_obj = unpack_single_python_argument_or_jump(L) # never returns on error!
25867  *     result = py_iter_with_gil(L, py_obj, OBJ_UNPACK_TUPLE)
25868  *     if result < 0:             # <<<<<<<<<<<<<<
25869  *         return lua.lua_error(L)  # never returns!
25870  *     return result
25871  */
25872   }
25873 
25874   /* "lupa/_lupa.pyx":1707
25875  *     if result < 0:
25876  *         return lua.lua_error(L)  # never returns!
25877  *     return result             # <<<<<<<<<<<<<<
25878  *
25879  * cdef int py_enumerate(lua_State* L) nogil:
25880  */
25881   __pyx_r = __pyx_v_result;
25882   goto __pyx_L0;
25883 
25884   /* "lupa/_lupa.pyx":1702
25885  *     return result
25886  *
25887  * cdef int py_iterex(lua_State* L) nogil:             # <<<<<<<<<<<<<<
25888  *     cdef py_object* py_obj = unpack_single_python_argument_or_jump(L) # never returns on error!
25889  *     result = py_iter_with_gil(L, py_obj, OBJ_UNPACK_TUPLE)
25890  */
25891 
25892   /* function exit code */
25893   __pyx_L0:;
25894   return __pyx_r;
25895 }
25896 
25897 /* "lupa/_lupa.pyx":1709
25898  *     return result
25899  *
25900  * cdef int py_enumerate(lua_State* L) nogil:             # <<<<<<<<<<<<<<
25901  *     if lua.lua_gettop(L) > 2:
25902  *         lua.luaL_argerror(L, 3, "invalid arguments")   # never returns!
25903  */
25904 
__pyx_f_4lupa_5_lupa_py_enumerate(lua_State * __pyx_v_L)25905 static int __pyx_f_4lupa_5_lupa_py_enumerate(lua_State *__pyx_v_L) {
25906   struct __pyx_t_4lupa_5_lupa_py_object *__pyx_v_py_obj;
25907   double __pyx_v_start;
25908   int __pyx_v_result;
25909   int __pyx_r;
25910   int __pyx_t_1;
25911   double __pyx_t_2;
25912 
25913   /* "lupa/_lupa.pyx":1710
25914  *
25915  * cdef int py_enumerate(lua_State* L) nogil:
25916  *     if lua.lua_gettop(L) > 2:             # <<<<<<<<<<<<<<
25917  *         lua.luaL_argerror(L, 3, "invalid arguments")   # never returns!
25918  *     cdef py_object* py_obj = unwrap_lua_object(L, 1)
25919  */
25920   __pyx_t_1 = ((lua_gettop(__pyx_v_L) > 2) != 0);
25921   if (__pyx_t_1) {
25922 
25923     /* "lupa/_lupa.pyx":1711
25924  * cdef int py_enumerate(lua_State* L) nogil:
25925  *     if lua.lua_gettop(L) > 2:
25926  *         lua.luaL_argerror(L, 3, "invalid arguments")   # never returns!             # <<<<<<<<<<<<<<
25927  *     cdef py_object* py_obj = unwrap_lua_object(L, 1)
25928  *     if not py_obj:
25929  */
25930     (void)(luaL_argerror(__pyx_v_L, 3, ((char *)"invalid arguments")));
25931 
25932     /* "lupa/_lupa.pyx":1710
25933  *
25934  * cdef int py_enumerate(lua_State* L) nogil:
25935  *     if lua.lua_gettop(L) > 2:             # <<<<<<<<<<<<<<
25936  *         lua.luaL_argerror(L, 3, "invalid arguments")   # never returns!
25937  *     cdef py_object* py_obj = unwrap_lua_object(L, 1)
25938  */
25939   }
25940 
25941   /* "lupa/_lupa.pyx":1712
25942  *     if lua.lua_gettop(L) > 2:
25943  *         lua.luaL_argerror(L, 3, "invalid arguments")   # never returns!
25944  *     cdef py_object* py_obj = unwrap_lua_object(L, 1)             # <<<<<<<<<<<<<<
25945  *     if not py_obj:
25946  *         lua.luaL_argerror(L, 1, "not a python object")   # never returns!
25947  */
25948   __pyx_v_py_obj = __pyx_f_4lupa_5_lupa_unwrap_lua_object(__pyx_v_L, 1);
25949 
25950   /* "lupa/_lupa.pyx":1713
25951  *         lua.luaL_argerror(L, 3, "invalid arguments")   # never returns!
25952  *     cdef py_object* py_obj = unwrap_lua_object(L, 1)
25953  *     if not py_obj:             # <<<<<<<<<<<<<<
25954  *         lua.luaL_argerror(L, 1, "not a python object")   # never returns!
25955  *     cdef double start = lua.lua_tonumber(L, -1) if lua.lua_gettop(L) == 2 else 0.0
25956  */
25957   __pyx_t_1 = ((!(__pyx_v_py_obj != 0)) != 0);
25958   if (__pyx_t_1) {
25959 
25960     /* "lupa/_lupa.pyx":1714
25961  *     cdef py_object* py_obj = unwrap_lua_object(L, 1)
25962  *     if not py_obj:
25963  *         lua.luaL_argerror(L, 1, "not a python object")   # never returns!             # <<<<<<<<<<<<<<
25964  *     cdef double start = lua.lua_tonumber(L, -1) if lua.lua_gettop(L) == 2 else 0.0
25965  *     result = py_enumerate_with_gil(L, py_obj, start)
25966  */
25967     (void)(luaL_argerror(__pyx_v_L, 1, ((char *)"not a python object")));
25968 
25969     /* "lupa/_lupa.pyx":1713
25970  *         lua.luaL_argerror(L, 3, "invalid arguments")   # never returns!
25971  *     cdef py_object* py_obj = unwrap_lua_object(L, 1)
25972  *     if not py_obj:             # <<<<<<<<<<<<<<
25973  *         lua.luaL_argerror(L, 1, "not a python object")   # never returns!
25974  *     cdef double start = lua.lua_tonumber(L, -1) if lua.lua_gettop(L) == 2 else 0.0
25975  */
25976   }
25977 
25978   /* "lupa/_lupa.pyx":1715
25979  *     if not py_obj:
25980  *         lua.luaL_argerror(L, 1, "not a python object")   # never returns!
25981  *     cdef double start = lua.lua_tonumber(L, -1) if lua.lua_gettop(L) == 2 else 0.0             # <<<<<<<<<<<<<<
25982  *     result = py_enumerate_with_gil(L, py_obj, start)
25983  *     if result < 0:
25984  */
25985   if (((lua_gettop(__pyx_v_L) == 2) != 0)) {
25986     __pyx_t_2 = lua_tonumber(__pyx_v_L, -1);
25987   } else {
25988     __pyx_t_2 = 0.0;
25989   }
25990   __pyx_v_start = __pyx_t_2;
25991 
25992   /* "lupa/_lupa.pyx":1716
25993  *         lua.luaL_argerror(L, 1, "not a python object")   # never returns!
25994  *     cdef double start = lua.lua_tonumber(L, -1) if lua.lua_gettop(L) == 2 else 0.0
25995  *     result = py_enumerate_with_gil(L, py_obj, start)             # <<<<<<<<<<<<<<
25996  *     if result < 0:
25997  *         return lua.lua_error(L)  # never returns!
25998  */
25999   __pyx_v_result = __pyx_f_4lupa_5_lupa_py_enumerate_with_gil(__pyx_v_L, __pyx_v_py_obj, __pyx_v_start);
26000 
26001   /* "lupa/_lupa.pyx":1717
26002  *     cdef double start = lua.lua_tonumber(L, -1) if lua.lua_gettop(L) == 2 else 0.0
26003  *     result = py_enumerate_with_gil(L, py_obj, start)
26004  *     if result < 0:             # <<<<<<<<<<<<<<
26005  *         return lua.lua_error(L)  # never returns!
26006  *     return result
26007  */
26008   __pyx_t_1 = ((__pyx_v_result < 0) != 0);
26009   if (__pyx_t_1) {
26010 
26011     /* "lupa/_lupa.pyx":1718
26012  *     result = py_enumerate_with_gil(L, py_obj, start)
26013  *     if result < 0:
26014  *         return lua.lua_error(L)  # never returns!             # <<<<<<<<<<<<<<
26015  *     return result
26016  *
26017  */
26018     __pyx_r = lua_error(__pyx_v_L);
26019     goto __pyx_L0;
26020 
26021     /* "lupa/_lupa.pyx":1717
26022  *     cdef double start = lua.lua_tonumber(L, -1) if lua.lua_gettop(L) == 2 else 0.0
26023  *     result = py_enumerate_with_gil(L, py_obj, start)
26024  *     if result < 0:             # <<<<<<<<<<<<<<
26025  *         return lua.lua_error(L)  # never returns!
26026  *     return result
26027  */
26028   }
26029 
26030   /* "lupa/_lupa.pyx":1719
26031  *     if result < 0:
26032  *         return lua.lua_error(L)  # never returns!
26033  *     return result             # <<<<<<<<<<<<<<
26034  *
26035  *
26036  */
26037   __pyx_r = __pyx_v_result;
26038   goto __pyx_L0;
26039 
26040   /* "lupa/_lupa.pyx":1709
26041  *     return result
26042  *
26043  * cdef int py_enumerate(lua_State* L) nogil:             # <<<<<<<<<<<<<<
26044  *     if lua.lua_gettop(L) > 2:
26045  *         lua.luaL_argerror(L, 3, "invalid arguments")   # never returns!
26046  */
26047 
26048   /* function exit code */
26049   __pyx_L0:;
26050   return __pyx_r;
26051 }
26052 
26053 /* "lupa/_lupa.pyx":1722
26054  *
26055  *
26056  * cdef int py_enumerate_with_gil(lua_State* L, py_object* py_obj, double start) with gil:             # <<<<<<<<<<<<<<
26057  *     cdef LuaRuntime runtime
26058  *     try:
26059  */
26060 
__pyx_f_4lupa_5_lupa_py_enumerate_with_gil(lua_State * __pyx_v_L,struct __pyx_t_4lupa_5_lupa_py_object * __pyx_v_py_obj,double __pyx_v_start)26061 static int __pyx_f_4lupa_5_lupa_py_enumerate_with_gil(lua_State *__pyx_v_L, struct __pyx_t_4lupa_5_lupa_py_object *__pyx_v_py_obj, double __pyx_v_start) {
26062   struct __pyx_obj_4lupa_5_lupa_LuaRuntime *__pyx_v_runtime = 0;
26063   PyObject *__pyx_v_obj = NULL;
26064   int __pyx_r;
26065   __Pyx_RefNannyDeclarations
26066   PyObject *__pyx_t_1 = NULL;
26067   PyObject *__pyx_t_2 = NULL;
26068   PyObject *__pyx_t_3 = NULL;
26069   PyObject *__pyx_t_4 = NULL;
26070   PyObject *__pyx_t_5 = NULL;
26071   PyObject *__pyx_t_6 = NULL;
26072   int __pyx_t_7;
26073   PyObject *__pyx_t_8 = NULL;
26074   PyObject *__pyx_t_9 = NULL;
26075   PyObject *__pyx_t_10 = NULL;
26076   PyObject *__pyx_t_11 = NULL;
26077   PyObject *__pyx_t_12 = NULL;
26078   PyObject *__pyx_t_13 = NULL;
26079   int __pyx_lineno = 0;
26080   const char *__pyx_filename = NULL;
26081   int __pyx_clineno = 0;
26082   #ifdef WITH_THREAD
26083   PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
26084   #endif
26085   __Pyx_RefNannySetupContext("py_enumerate_with_gil", 0);
26086 
26087   /* "lupa/_lupa.pyx":1724
26088  * cdef int py_enumerate_with_gil(lua_State* L, py_object* py_obj, double start) with gil:
26089  *     cdef LuaRuntime runtime
26090  *     try:             # <<<<<<<<<<<<<<
26091  *         runtime = <LuaRuntime?>py_obj.runtime
26092  *         obj = iter(<object>py_obj.obj)
26093  */
26094   {
26095     __Pyx_PyThreadState_declare
26096     __Pyx_PyThreadState_assign
26097     __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
26098     __Pyx_XGOTREF(__pyx_t_1);
26099     __Pyx_XGOTREF(__pyx_t_2);
26100     __Pyx_XGOTREF(__pyx_t_3);
26101     /*try:*/ {
26102 
26103       /* "lupa/_lupa.pyx":1725
26104  *     cdef LuaRuntime runtime
26105  *     try:
26106  *         runtime = <LuaRuntime?>py_obj.runtime             # <<<<<<<<<<<<<<
26107  *         obj = iter(<object>py_obj.obj)
26108  *         return py_push_iterator(runtime, L, obj, OBJ_ENUMERATOR, start - 1.0)
26109  */
26110       __pyx_t_4 = ((PyObject *)__pyx_v_py_obj->runtime);
26111       __Pyx_INCREF(__pyx_t_4);
26112       __pyx_v_runtime = ((struct __pyx_obj_4lupa_5_lupa_LuaRuntime *)__pyx_t_4);
26113       __pyx_t_4 = 0;
26114 
26115       /* "lupa/_lupa.pyx":1726
26116  *     try:
26117  *         runtime = <LuaRuntime?>py_obj.runtime
26118  *         obj = iter(<object>py_obj.obj)             # <<<<<<<<<<<<<<
26119  *         return py_push_iterator(runtime, L, obj, OBJ_ENUMERATOR, start - 1.0)
26120  *     except:
26121  */
26122       __pyx_t_4 = ((PyObject *)__pyx_v_py_obj->obj);
26123       __Pyx_INCREF(__pyx_t_4);
26124       __pyx_t_5 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1726, __pyx_L3_error)
26125       __Pyx_GOTREF(__pyx_t_5);
26126       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
26127       __pyx_v_obj = __pyx_t_5;
26128       __pyx_t_5 = 0;
26129 
26130       /* "lupa/_lupa.pyx":1727
26131  *         runtime = <LuaRuntime?>py_obj.runtime
26132  *         obj = iter(<object>py_obj.obj)
26133  *         return py_push_iterator(runtime, L, obj, OBJ_ENUMERATOR, start - 1.0)             # <<<<<<<<<<<<<<
26134  *     except:
26135  *         try: runtime.store_raised_exception(L, b'error creating an iterator with enumerate()')
26136  */
26137       __pyx_r = __pyx_f_4lupa_5_lupa_py_push_iterator(__pyx_v_runtime, __pyx_v_L, __pyx_v_obj, __pyx_e_4lupa_5_lupa_OBJ_ENUMERATOR, (__pyx_v_start - 1.0));
26138       goto __pyx_L7_try_return;
26139 
26140       /* "lupa/_lupa.pyx":1724
26141  * cdef int py_enumerate_with_gil(lua_State* L, py_object* py_obj, double start) with gil:
26142  *     cdef LuaRuntime runtime
26143  *     try:             # <<<<<<<<<<<<<<
26144  *         runtime = <LuaRuntime?>py_obj.runtime
26145  *         obj = iter(<object>py_obj.obj)
26146  */
26147     }
26148     __pyx_L3_error:;
26149     __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
26150     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
26151 
26152     /* "lupa/_lupa.pyx":1728
26153  *         obj = iter(<object>py_obj.obj)
26154  *         return py_push_iterator(runtime, L, obj, OBJ_ENUMERATOR, start - 1.0)
26155  *     except:             # <<<<<<<<<<<<<<
26156  *         try: runtime.store_raised_exception(L, b'error creating an iterator with enumerate()')
26157  *         finally: return -1
26158  */
26159     /*except:*/ {
26160       __Pyx_AddTraceback("lupa._lupa.py_enumerate_with_gil", __pyx_clineno, __pyx_lineno, __pyx_filename);
26161       if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_4, &__pyx_t_6) < 0) __PYX_ERR(0, 1728, __pyx_L5_except_error)
26162       __Pyx_GOTREF(__pyx_t_5);
26163       __Pyx_GOTREF(__pyx_t_4);
26164       __Pyx_GOTREF(__pyx_t_6);
26165 
26166       /* "lupa/_lupa.pyx":1729
26167  *         return py_push_iterator(runtime, L, obj, OBJ_ENUMERATOR, start - 1.0)
26168  *     except:
26169  *         try: runtime.store_raised_exception(L, b'error creating an iterator with enumerate()')             # <<<<<<<<<<<<<<
26170  *         finally: return -1
26171  *
26172  */
26173       /*try:*/ {
26174         if (unlikely(!__pyx_v_runtime)) { __Pyx_RaiseUnboundLocalError("runtime"); __PYX_ERR(0, 1729, __pyx_L14_error) }
26175         __pyx_t_7 = __pyx_f_4lupa_5_lupa_10LuaRuntime_store_raised_exception(__pyx_v_runtime, __pyx_v_L, __pyx_kp_b_error_creating_an_iterator_with); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 1729, __pyx_L14_error)
26176       }
26177 
26178       /* "lupa/_lupa.pyx":1730
26179  *     except:
26180  *         try: runtime.store_raised_exception(L, b'error creating an iterator with enumerate()')
26181  *         finally: return -1             # <<<<<<<<<<<<<<
26182  *
26183  * cdef int py_iter_with_gil(lua_State* L, py_object* py_obj, int type_flags) with gil:
26184  */
26185       /*finally:*/ {
26186         /*normal exit:*/{
26187           __pyx_r = -1;
26188           __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
26189           __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
26190           __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
26191           goto __pyx_L6_except_return;
26192         }
26193         __pyx_L14_error:;
26194         /*exception exit:*/{
26195           __Pyx_PyThreadState_declare
26196           __Pyx_PyThreadState_assign
26197           __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0;
26198           if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
26199           if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10) < 0)) __Pyx_ErrFetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
26200           __Pyx_XGOTREF(__pyx_t_8);
26201           __Pyx_XGOTREF(__pyx_t_9);
26202           __Pyx_XGOTREF(__pyx_t_10);
26203           __Pyx_XGOTREF(__pyx_t_11);
26204           __Pyx_XGOTREF(__pyx_t_12);
26205           __Pyx_XGOTREF(__pyx_t_13);
26206           {
26207             __pyx_r = -1;
26208             __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
26209             __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
26210             __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
26211             goto __pyx_L18_return;
26212           }
26213           __pyx_L18_return:;
26214           if (PY_MAJOR_VERSION >= 3) {
26215             __Pyx_XGIVEREF(__pyx_t_11);
26216             __Pyx_XGIVEREF(__pyx_t_12);
26217             __Pyx_XGIVEREF(__pyx_t_13);
26218             __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13);
26219           }
26220           __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
26221           __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
26222           __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
26223           __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0;
26224           goto __pyx_L6_except_return;
26225         }
26226       }
26227     }
26228     __pyx_L5_except_error:;
26229 
26230     /* "lupa/_lupa.pyx":1724
26231  * cdef int py_enumerate_with_gil(lua_State* L, py_object* py_obj, double start) with gil:
26232  *     cdef LuaRuntime runtime
26233  *     try:             # <<<<<<<<<<<<<<
26234  *         runtime = <LuaRuntime?>py_obj.runtime
26235  *         obj = iter(<object>py_obj.obj)
26236  */
26237     __Pyx_XGIVEREF(__pyx_t_1);
26238     __Pyx_XGIVEREF(__pyx_t_2);
26239     __Pyx_XGIVEREF(__pyx_t_3);
26240     __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
26241     goto __pyx_L1_error;
26242     __pyx_L7_try_return:;
26243     __Pyx_XGIVEREF(__pyx_t_1);
26244     __Pyx_XGIVEREF(__pyx_t_2);
26245     __Pyx_XGIVEREF(__pyx_t_3);
26246     __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
26247     goto __pyx_L0;
26248     __pyx_L6_except_return:;
26249     __Pyx_XGIVEREF(__pyx_t_1);
26250     __Pyx_XGIVEREF(__pyx_t_2);
26251     __Pyx_XGIVEREF(__pyx_t_3);
26252     __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
26253     goto __pyx_L0;
26254   }
26255 
26256   /* "lupa/_lupa.pyx":1722
26257  *
26258  *
26259  * cdef int py_enumerate_with_gil(lua_State* L, py_object* py_obj, double start) with gil:             # <<<<<<<<<<<<<<
26260  *     cdef LuaRuntime runtime
26261  *     try:
26262  */
26263 
26264   /* function exit code */
26265   __pyx_L1_error:;
26266   __Pyx_XDECREF(__pyx_t_4);
26267   __Pyx_XDECREF(__pyx_t_5);
26268   __Pyx_XDECREF(__pyx_t_6);
26269   __Pyx_WriteUnraisable("lupa._lupa.py_enumerate_with_gil", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
26270   __pyx_r = 0;
26271   __pyx_L0:;
26272   __Pyx_XDECREF((PyObject *)__pyx_v_runtime);
26273   __Pyx_XDECREF(__pyx_v_obj);
26274   __Pyx_RefNannyFinishContext();
26275   #ifdef WITH_THREAD
26276   __Pyx_PyGILState_Release(__pyx_gilstate_save);
26277   #endif
26278   return __pyx_r;
26279 }
26280 
26281 /* "lupa/_lupa.pyx":1732
26282  *         finally: return -1
26283  *
26284  * cdef int py_iter_with_gil(lua_State* L, py_object* py_obj, int type_flags) with gil:             # <<<<<<<<<<<<<<
26285  *     cdef LuaRuntime runtime
26286  *     try:
26287  */
26288 
__pyx_f_4lupa_5_lupa_py_iter_with_gil(lua_State * __pyx_v_L,struct __pyx_t_4lupa_5_lupa_py_object * __pyx_v_py_obj,int __pyx_v_type_flags)26289 static int __pyx_f_4lupa_5_lupa_py_iter_with_gil(lua_State *__pyx_v_L, struct __pyx_t_4lupa_5_lupa_py_object *__pyx_v_py_obj, int __pyx_v_type_flags) {
26290   struct __pyx_obj_4lupa_5_lupa_LuaRuntime *__pyx_v_runtime = 0;
26291   PyObject *__pyx_v_obj = NULL;
26292   int __pyx_r;
26293   __Pyx_RefNannyDeclarations
26294   PyObject *__pyx_t_1 = NULL;
26295   PyObject *__pyx_t_2 = NULL;
26296   PyObject *__pyx_t_3 = NULL;
26297   PyObject *__pyx_t_4 = NULL;
26298   PyObject *__pyx_t_5 = NULL;
26299   PyObject *__pyx_t_6 = NULL;
26300   int __pyx_t_7;
26301   PyObject *__pyx_t_8 = NULL;
26302   PyObject *__pyx_t_9 = NULL;
26303   PyObject *__pyx_t_10 = NULL;
26304   PyObject *__pyx_t_11 = NULL;
26305   PyObject *__pyx_t_12 = NULL;
26306   PyObject *__pyx_t_13 = NULL;
26307   int __pyx_lineno = 0;
26308   const char *__pyx_filename = NULL;
26309   int __pyx_clineno = 0;
26310   #ifdef WITH_THREAD
26311   PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
26312   #endif
26313   __Pyx_RefNannySetupContext("py_iter_with_gil", 0);
26314 
26315   /* "lupa/_lupa.pyx":1734
26316  * cdef int py_iter_with_gil(lua_State* L, py_object* py_obj, int type_flags) with gil:
26317  *     cdef LuaRuntime runtime
26318  *     try:             # <<<<<<<<<<<<<<
26319  *         runtime = <LuaRuntime?>py_obj.runtime
26320  *         obj = iter(<object>py_obj.obj)
26321  */
26322   {
26323     __Pyx_PyThreadState_declare
26324     __Pyx_PyThreadState_assign
26325     __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
26326     __Pyx_XGOTREF(__pyx_t_1);
26327     __Pyx_XGOTREF(__pyx_t_2);
26328     __Pyx_XGOTREF(__pyx_t_3);
26329     /*try:*/ {
26330 
26331       /* "lupa/_lupa.pyx":1735
26332  *     cdef LuaRuntime runtime
26333  *     try:
26334  *         runtime = <LuaRuntime?>py_obj.runtime             # <<<<<<<<<<<<<<
26335  *         obj = iter(<object>py_obj.obj)
26336  *         return py_push_iterator(runtime, L, obj, type_flags, 0.0)
26337  */
26338       __pyx_t_4 = ((PyObject *)__pyx_v_py_obj->runtime);
26339       __Pyx_INCREF(__pyx_t_4);
26340       __pyx_v_runtime = ((struct __pyx_obj_4lupa_5_lupa_LuaRuntime *)__pyx_t_4);
26341       __pyx_t_4 = 0;
26342 
26343       /* "lupa/_lupa.pyx":1736
26344  *     try:
26345  *         runtime = <LuaRuntime?>py_obj.runtime
26346  *         obj = iter(<object>py_obj.obj)             # <<<<<<<<<<<<<<
26347  *         return py_push_iterator(runtime, L, obj, type_flags, 0.0)
26348  *     except:
26349  */
26350       __pyx_t_4 = ((PyObject *)__pyx_v_py_obj->obj);
26351       __Pyx_INCREF(__pyx_t_4);
26352       __pyx_t_5 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1736, __pyx_L3_error)
26353       __Pyx_GOTREF(__pyx_t_5);
26354       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
26355       __pyx_v_obj = __pyx_t_5;
26356       __pyx_t_5 = 0;
26357 
26358       /* "lupa/_lupa.pyx":1737
26359  *         runtime = <LuaRuntime?>py_obj.runtime
26360  *         obj = iter(<object>py_obj.obj)
26361  *         return py_push_iterator(runtime, L, obj, type_flags, 0.0)             # <<<<<<<<<<<<<<
26362  *     except:
26363  *         try: runtime.store_raised_exception(L, b'error creating an iterator')
26364  */
26365       __pyx_r = __pyx_f_4lupa_5_lupa_py_push_iterator(__pyx_v_runtime, __pyx_v_L, __pyx_v_obj, __pyx_v_type_flags, 0.0);
26366       goto __pyx_L7_try_return;
26367 
26368       /* "lupa/_lupa.pyx":1734
26369  * cdef int py_iter_with_gil(lua_State* L, py_object* py_obj, int type_flags) with gil:
26370  *     cdef LuaRuntime runtime
26371  *     try:             # <<<<<<<<<<<<<<
26372  *         runtime = <LuaRuntime?>py_obj.runtime
26373  *         obj = iter(<object>py_obj.obj)
26374  */
26375     }
26376     __pyx_L3_error:;
26377     __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
26378     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
26379 
26380     /* "lupa/_lupa.pyx":1738
26381  *         obj = iter(<object>py_obj.obj)
26382  *         return py_push_iterator(runtime, L, obj, type_flags, 0.0)
26383  *     except:             # <<<<<<<<<<<<<<
26384  *         try: runtime.store_raised_exception(L, b'error creating an iterator')
26385  *         finally: return -1
26386  */
26387     /*except:*/ {
26388       __Pyx_AddTraceback("lupa._lupa.py_iter_with_gil", __pyx_clineno, __pyx_lineno, __pyx_filename);
26389       if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_4, &__pyx_t_6) < 0) __PYX_ERR(0, 1738, __pyx_L5_except_error)
26390       __Pyx_GOTREF(__pyx_t_5);
26391       __Pyx_GOTREF(__pyx_t_4);
26392       __Pyx_GOTREF(__pyx_t_6);
26393 
26394       /* "lupa/_lupa.pyx":1739
26395  *         return py_push_iterator(runtime, L, obj, type_flags, 0.0)
26396  *     except:
26397  *         try: runtime.store_raised_exception(L, b'error creating an iterator')             # <<<<<<<<<<<<<<
26398  *         finally: return -1
26399  *
26400  */
26401       /*try:*/ {
26402         if (unlikely(!__pyx_v_runtime)) { __Pyx_RaiseUnboundLocalError("runtime"); __PYX_ERR(0, 1739, __pyx_L14_error) }
26403         __pyx_t_7 = __pyx_f_4lupa_5_lupa_10LuaRuntime_store_raised_exception(__pyx_v_runtime, __pyx_v_L, __pyx_kp_b_error_creating_an_iterator); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 1739, __pyx_L14_error)
26404       }
26405 
26406       /* "lupa/_lupa.pyx":1740
26407  *     except:
26408  *         try: runtime.store_raised_exception(L, b'error creating an iterator')
26409  *         finally: return -1             # <<<<<<<<<<<<<<
26410  *
26411  * cdef int py_push_iterator(LuaRuntime runtime, lua_State* L, iterator, int type_flags,
26412  */
26413       /*finally:*/ {
26414         /*normal exit:*/{
26415           __pyx_r = -1;
26416           __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
26417           __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
26418           __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
26419           goto __pyx_L6_except_return;
26420         }
26421         __pyx_L14_error:;
26422         /*exception exit:*/{
26423           __Pyx_PyThreadState_declare
26424           __Pyx_PyThreadState_assign
26425           __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0;
26426           if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
26427           if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10) < 0)) __Pyx_ErrFetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
26428           __Pyx_XGOTREF(__pyx_t_8);
26429           __Pyx_XGOTREF(__pyx_t_9);
26430           __Pyx_XGOTREF(__pyx_t_10);
26431           __Pyx_XGOTREF(__pyx_t_11);
26432           __Pyx_XGOTREF(__pyx_t_12);
26433           __Pyx_XGOTREF(__pyx_t_13);
26434           {
26435             __pyx_r = -1;
26436             __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
26437             __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
26438             __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
26439             goto __pyx_L18_return;
26440           }
26441           __pyx_L18_return:;
26442           if (PY_MAJOR_VERSION >= 3) {
26443             __Pyx_XGIVEREF(__pyx_t_11);
26444             __Pyx_XGIVEREF(__pyx_t_12);
26445             __Pyx_XGIVEREF(__pyx_t_13);
26446             __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13);
26447           }
26448           __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
26449           __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
26450           __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
26451           __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0;
26452           goto __pyx_L6_except_return;
26453         }
26454       }
26455     }
26456     __pyx_L5_except_error:;
26457 
26458     /* "lupa/_lupa.pyx":1734
26459  * cdef int py_iter_with_gil(lua_State* L, py_object* py_obj, int type_flags) with gil:
26460  *     cdef LuaRuntime runtime
26461  *     try:             # <<<<<<<<<<<<<<
26462  *         runtime = <LuaRuntime?>py_obj.runtime
26463  *         obj = iter(<object>py_obj.obj)
26464  */
26465     __Pyx_XGIVEREF(__pyx_t_1);
26466     __Pyx_XGIVEREF(__pyx_t_2);
26467     __Pyx_XGIVEREF(__pyx_t_3);
26468     __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
26469     goto __pyx_L1_error;
26470     __pyx_L7_try_return:;
26471     __Pyx_XGIVEREF(__pyx_t_1);
26472     __Pyx_XGIVEREF(__pyx_t_2);
26473     __Pyx_XGIVEREF(__pyx_t_3);
26474     __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
26475     goto __pyx_L0;
26476     __pyx_L6_except_return:;
26477     __Pyx_XGIVEREF(__pyx_t_1);
26478     __Pyx_XGIVEREF(__pyx_t_2);
26479     __Pyx_XGIVEREF(__pyx_t_3);
26480     __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
26481     goto __pyx_L0;
26482   }
26483 
26484   /* "lupa/_lupa.pyx":1732
26485  *         finally: return -1
26486  *
26487  * cdef int py_iter_with_gil(lua_State* L, py_object* py_obj, int type_flags) with gil:             # <<<<<<<<<<<<<<
26488  *     cdef LuaRuntime runtime
26489  *     try:
26490  */
26491 
26492   /* function exit code */
26493   __pyx_L1_error:;
26494   __Pyx_XDECREF(__pyx_t_4);
26495   __Pyx_XDECREF(__pyx_t_5);
26496   __Pyx_XDECREF(__pyx_t_6);
26497   __Pyx_WriteUnraisable("lupa._lupa.py_iter_with_gil", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
26498   __pyx_r = 0;
26499   __pyx_L0:;
26500   __Pyx_XDECREF((PyObject *)__pyx_v_runtime);
26501   __Pyx_XDECREF(__pyx_v_obj);
26502   __Pyx_RefNannyFinishContext();
26503   #ifdef WITH_THREAD
26504   __Pyx_PyGILState_Release(__pyx_gilstate_save);
26505   #endif
26506   return __pyx_r;
26507 }
26508 
26509 /* "lupa/_lupa.pyx":1742
26510  *         finally: return -1
26511  *
26512  * cdef int py_push_iterator(LuaRuntime runtime, lua_State* L, iterator, int type_flags,             # <<<<<<<<<<<<<<
26513  *                           lua.lua_Number initial_value):
26514  *     # Lua needs three values: iterator C function + state + control variable (last iter) value
26515  */
26516 
__pyx_f_4lupa_5_lupa_py_push_iterator(struct __pyx_obj_4lupa_5_lupa_LuaRuntime * __pyx_v_runtime,lua_State * __pyx_v_L,PyObject * __pyx_v_iterator,int __pyx_v_type_flags,lua_Number __pyx_v_initial_value)26517 static int __pyx_f_4lupa_5_lupa_py_push_iterator(struct __pyx_obj_4lupa_5_lupa_LuaRuntime *__pyx_v_runtime, lua_State *__pyx_v_L, PyObject *__pyx_v_iterator, int __pyx_v_type_flags, lua_Number __pyx_v_initial_value) {
26518   int __pyx_v_old_top;
26519   int __pyx_r;
26520   __Pyx_RefNannyDeclarations
26521   int __pyx_t_1;
26522   __Pyx_RefNannySetupContext("py_push_iterator", 0);
26523 
26524   /* "lupa/_lupa.pyx":1745
26525  *                           lua.lua_Number initial_value):
26526  *     # Lua needs three values: iterator C function + state + control variable (last iter) value
26527  *     old_top = lua.lua_gettop(L)             # <<<<<<<<<<<<<<
26528  *     lua.lua_pushcfunction(L, <lua.lua_CFunction>py_iter_next)
26529  *     # push the wrapped iterator object as for-loop state object
26530  */
26531   __pyx_v_old_top = lua_gettop(__pyx_v_L);
26532 
26533   /* "lupa/_lupa.pyx":1746
26534  *     # Lua needs three values: iterator C function + state + control variable (last iter) value
26535  *     old_top = lua.lua_gettop(L)
26536  *     lua.lua_pushcfunction(L, <lua.lua_CFunction>py_iter_next)             # <<<<<<<<<<<<<<
26537  *     # push the wrapped iterator object as for-loop state object
26538  *     if runtime._unpack_returned_tuples:
26539  */
26540   lua_pushcfunction(__pyx_v_L, ((lua_CFunction)__pyx_f_4lupa_5_lupa_py_iter_next));
26541 
26542   /* "lupa/_lupa.pyx":1748
26543  *     lua.lua_pushcfunction(L, <lua.lua_CFunction>py_iter_next)
26544  *     # push the wrapped iterator object as for-loop state object
26545  *     if runtime._unpack_returned_tuples:             # <<<<<<<<<<<<<<
26546  *         type_flags |= OBJ_UNPACK_TUPLE
26547  *     if py_to_lua_custom(runtime, L, iterator, type_flags) < 1:
26548  */
26549   __pyx_t_1 = (__pyx_v_runtime->_unpack_returned_tuples != 0);
26550   if (__pyx_t_1) {
26551 
26552     /* "lupa/_lupa.pyx":1749
26553  *     # push the wrapped iterator object as for-loop state object
26554  *     if runtime._unpack_returned_tuples:
26555  *         type_flags |= OBJ_UNPACK_TUPLE             # <<<<<<<<<<<<<<
26556  *     if py_to_lua_custom(runtime, L, iterator, type_flags) < 1:
26557  *         lua.lua_settop(L, old_top)
26558  */
26559     __pyx_v_type_flags = (__pyx_v_type_flags | __pyx_e_4lupa_5_lupa_OBJ_UNPACK_TUPLE);
26560 
26561     /* "lupa/_lupa.pyx":1748
26562  *     lua.lua_pushcfunction(L, <lua.lua_CFunction>py_iter_next)
26563  *     # push the wrapped iterator object as for-loop state object
26564  *     if runtime._unpack_returned_tuples:             # <<<<<<<<<<<<<<
26565  *         type_flags |= OBJ_UNPACK_TUPLE
26566  *     if py_to_lua_custom(runtime, L, iterator, type_flags) < 1:
26567  */
26568   }
26569 
26570   /* "lupa/_lupa.pyx":1750
26571  *     if runtime._unpack_returned_tuples:
26572  *         type_flags |= OBJ_UNPACK_TUPLE
26573  *     if py_to_lua_custom(runtime, L, iterator, type_flags) < 1:             # <<<<<<<<<<<<<<
26574  *         lua.lua_settop(L, old_top)
26575  *         return -1
26576  */
26577   __pyx_t_1 = ((__pyx_f_4lupa_5_lupa_py_to_lua_custom(__pyx_v_runtime, __pyx_v_L, __pyx_v_iterator, __pyx_v_type_flags) < 1) != 0);
26578   if (__pyx_t_1) {
26579 
26580     /* "lupa/_lupa.pyx":1751
26581  *         type_flags |= OBJ_UNPACK_TUPLE
26582  *     if py_to_lua_custom(runtime, L, iterator, type_flags) < 1:
26583  *         lua.lua_settop(L, old_top)             # <<<<<<<<<<<<<<
26584  *         return -1
26585  *     # push either enumerator index or nil as control variable value
26586  */
26587     lua_settop(__pyx_v_L, __pyx_v_old_top);
26588 
26589     /* "lupa/_lupa.pyx":1752
26590  *     if py_to_lua_custom(runtime, L, iterator, type_flags) < 1:
26591  *         lua.lua_settop(L, old_top)
26592  *         return -1             # <<<<<<<<<<<<<<
26593  *     # push either enumerator index or nil as control variable value
26594  *     if type_flags & OBJ_ENUMERATOR:
26595  */
26596     __pyx_r = -1;
26597     goto __pyx_L0;
26598 
26599     /* "lupa/_lupa.pyx":1750
26600  *     if runtime._unpack_returned_tuples:
26601  *         type_flags |= OBJ_UNPACK_TUPLE
26602  *     if py_to_lua_custom(runtime, L, iterator, type_flags) < 1:             # <<<<<<<<<<<<<<
26603  *         lua.lua_settop(L, old_top)
26604  *         return -1
26605  */
26606   }
26607 
26608   /* "lupa/_lupa.pyx":1754
26609  *         return -1
26610  *     # push either enumerator index or nil as control variable value
26611  *     if type_flags & OBJ_ENUMERATOR:             # <<<<<<<<<<<<<<
26612  *         lua.lua_pushnumber(L, initial_value)
26613  *     else:
26614  */
26615   __pyx_t_1 = ((__pyx_v_type_flags & __pyx_e_4lupa_5_lupa_OBJ_ENUMERATOR) != 0);
26616   if (__pyx_t_1) {
26617 
26618     /* "lupa/_lupa.pyx":1755
26619  *     # push either enumerator index or nil as control variable value
26620  *     if type_flags & OBJ_ENUMERATOR:
26621  *         lua.lua_pushnumber(L, initial_value)             # <<<<<<<<<<<<<<
26622  *     else:
26623  *         lua.lua_pushnil(L)
26624  */
26625     lua_pushnumber(__pyx_v_L, __pyx_v_initial_value);
26626 
26627     /* "lupa/_lupa.pyx":1754
26628  *         return -1
26629  *     # push either enumerator index or nil as control variable value
26630  *     if type_flags & OBJ_ENUMERATOR:             # <<<<<<<<<<<<<<
26631  *         lua.lua_pushnumber(L, initial_value)
26632  *     else:
26633  */
26634     goto __pyx_L5;
26635   }
26636 
26637   /* "lupa/_lupa.pyx":1757
26638  *         lua.lua_pushnumber(L, initial_value)
26639  *     else:
26640  *         lua.lua_pushnil(L)             # <<<<<<<<<<<<<<
26641  *     return 3
26642  *
26643  */
26644   /*else*/ {
26645     lua_pushnil(__pyx_v_L);
26646   }
26647   __pyx_L5:;
26648 
26649   /* "lupa/_lupa.pyx":1758
26650  *     else:
26651  *         lua.lua_pushnil(L)
26652  *     return 3             # <<<<<<<<<<<<<<
26653  *
26654  * cdef int py_iter_next(lua_State* L) nogil:
26655  */
26656   __pyx_r = 3;
26657   goto __pyx_L0;
26658 
26659   /* "lupa/_lupa.pyx":1742
26660  *         finally: return -1
26661  *
26662  * cdef int py_push_iterator(LuaRuntime runtime, lua_State* L, iterator, int type_flags,             # <<<<<<<<<<<<<<
26663  *                           lua.lua_Number initial_value):
26664  *     # Lua needs three values: iterator C function + state + control variable (last iter) value
26665  */
26666 
26667   /* function exit code */
26668   __pyx_L0:;
26669   __Pyx_RefNannyFinishContext();
26670   return __pyx_r;
26671 }
26672 
26673 /* "lupa/_lupa.pyx":1760
26674  *     return 3
26675  *
26676  * cdef int py_iter_next(lua_State* L) nogil:             # <<<<<<<<<<<<<<
26677  *     # first value in the C closure: the Python iterator object
26678  *     cdef py_object* py_obj = unwrap_lua_object(L, 1)
26679  */
26680 
__pyx_f_4lupa_5_lupa_py_iter_next(lua_State * __pyx_v_L)26681 static int __pyx_f_4lupa_5_lupa_py_iter_next(lua_State *__pyx_v_L) {
26682   struct __pyx_t_4lupa_5_lupa_py_object *__pyx_v_py_obj;
26683   int __pyx_v_result;
26684   int __pyx_r;
26685   int __pyx_t_1;
26686 
26687   /* "lupa/_lupa.pyx":1762
26688  * cdef int py_iter_next(lua_State* L) nogil:
26689  *     # first value in the C closure: the Python iterator object
26690  *     cdef py_object* py_obj = unwrap_lua_object(L, 1)             # <<<<<<<<<<<<<<
26691  *     if not py_obj:
26692  *         return lua.luaL_argerror(L, 1, "not a python object")   # never returns!
26693  */
26694   __pyx_v_py_obj = __pyx_f_4lupa_5_lupa_unwrap_lua_object(__pyx_v_L, 1);
26695 
26696   /* "lupa/_lupa.pyx":1763
26697  *     # first value in the C closure: the Python iterator object
26698  *     cdef py_object* py_obj = unwrap_lua_object(L, 1)
26699  *     if not py_obj:             # <<<<<<<<<<<<<<
26700  *         return lua.luaL_argerror(L, 1, "not a python object")   # never returns!
26701  *     result = py_iter_next_with_gil(L, py_obj)
26702  */
26703   __pyx_t_1 = ((!(__pyx_v_py_obj != 0)) != 0);
26704   if (__pyx_t_1) {
26705 
26706     /* "lupa/_lupa.pyx":1764
26707  *     cdef py_object* py_obj = unwrap_lua_object(L, 1)
26708  *     if not py_obj:
26709  *         return lua.luaL_argerror(L, 1, "not a python object")   # never returns!             # <<<<<<<<<<<<<<
26710  *     result = py_iter_next_with_gil(L, py_obj)
26711  *     if result < 0:
26712  */
26713     __pyx_r = luaL_argerror(__pyx_v_L, 1, ((char *)"not a python object"));
26714     goto __pyx_L0;
26715 
26716     /* "lupa/_lupa.pyx":1763
26717  *     # first value in the C closure: the Python iterator object
26718  *     cdef py_object* py_obj = unwrap_lua_object(L, 1)
26719  *     if not py_obj:             # <<<<<<<<<<<<<<
26720  *         return lua.luaL_argerror(L, 1, "not a python object")   # never returns!
26721  *     result = py_iter_next_with_gil(L, py_obj)
26722  */
26723   }
26724 
26725   /* "lupa/_lupa.pyx":1765
26726  *     if not py_obj:
26727  *         return lua.luaL_argerror(L, 1, "not a python object")   # never returns!
26728  *     result = py_iter_next_with_gil(L, py_obj)             # <<<<<<<<<<<<<<
26729  *     if result < 0:
26730  *         return lua.lua_error(L)  # never returns!
26731  */
26732   __pyx_v_result = __pyx_f_4lupa_5_lupa_py_iter_next_with_gil(__pyx_v_L, __pyx_v_py_obj);
26733 
26734   /* "lupa/_lupa.pyx":1766
26735  *         return lua.luaL_argerror(L, 1, "not a python object")   # never returns!
26736  *     result = py_iter_next_with_gil(L, py_obj)
26737  *     if result < 0:             # <<<<<<<<<<<<<<
26738  *         return lua.lua_error(L)  # never returns!
26739  *     return result
26740  */
26741   __pyx_t_1 = ((__pyx_v_result < 0) != 0);
26742   if (__pyx_t_1) {
26743 
26744     /* "lupa/_lupa.pyx":1767
26745  *     result = py_iter_next_with_gil(L, py_obj)
26746  *     if result < 0:
26747  *         return lua.lua_error(L)  # never returns!             # <<<<<<<<<<<<<<
26748  *     return result
26749  *
26750  */
26751     __pyx_r = lua_error(__pyx_v_L);
26752     goto __pyx_L0;
26753 
26754     /* "lupa/_lupa.pyx":1766
26755  *         return lua.luaL_argerror(L, 1, "not a python object")   # never returns!
26756  *     result = py_iter_next_with_gil(L, py_obj)
26757  *     if result < 0:             # <<<<<<<<<<<<<<
26758  *         return lua.lua_error(L)  # never returns!
26759  *     return result
26760  */
26761   }
26762 
26763   /* "lupa/_lupa.pyx":1768
26764  *     if result < 0:
26765  *         return lua.lua_error(L)  # never returns!
26766  *     return result             # <<<<<<<<<<<<<<
26767  *
26768  * cdef int py_iter_next_with_gil(lua_State* L, py_object* py_iter) with gil:
26769  */
26770   __pyx_r = __pyx_v_result;
26771   goto __pyx_L0;
26772 
26773   /* "lupa/_lupa.pyx":1760
26774  *     return 3
26775  *
26776  * cdef int py_iter_next(lua_State* L) nogil:             # <<<<<<<<<<<<<<
26777  *     # first value in the C closure: the Python iterator object
26778  *     cdef py_object* py_obj = unwrap_lua_object(L, 1)
26779  */
26780 
26781   /* function exit code */
26782   __pyx_L0:;
26783   return __pyx_r;
26784 }
26785 
26786 /* "lupa/_lupa.pyx":1770
26787  *     return result
26788  *
26789  * cdef int py_iter_next_with_gil(lua_State* L, py_object* py_iter) with gil:             # <<<<<<<<<<<<<<
26790  *     cdef LuaRuntime runtime
26791  *     try:
26792  */
26793 
__pyx_f_4lupa_5_lupa_py_iter_next_with_gil(lua_State * __pyx_v_L,struct __pyx_t_4lupa_5_lupa_py_object * __pyx_v_py_iter)26794 static int __pyx_f_4lupa_5_lupa_py_iter_next_with_gil(lua_State *__pyx_v_L, struct __pyx_t_4lupa_5_lupa_py_object *__pyx_v_py_iter) {
26795   struct __pyx_obj_4lupa_5_lupa_LuaRuntime *__pyx_v_runtime = 0;
26796   PyObject *__pyx_v_obj = NULL;
26797   int __pyx_v_allow_nil;
26798   PyObject *__pyx_v_result = NULL;
26799   int __pyx_r;
26800   __Pyx_RefNannyDeclarations
26801   PyObject *__pyx_t_1 = NULL;
26802   PyObject *__pyx_t_2 = NULL;
26803   PyObject *__pyx_t_3 = NULL;
26804   PyObject *__pyx_t_4 = NULL;
26805   PyObject *__pyx_t_5 = NULL;
26806   PyObject *__pyx_t_6 = NULL;
26807   PyObject *__pyx_t_7 = NULL;
26808   PyObject *__pyx_t_8 = NULL;
26809   int __pyx_t_9;
26810   PyObject *__pyx_t_10 = NULL;
26811   int __pyx_t_11;
26812   int __pyx_t_12;
26813   int __pyx_t_13;
26814   struct __pyx_opt_args_4lupa_5_lupa_push_lua_arguments __pyx_t_14;
26815   Py_ssize_t __pyx_t_15;
26816   struct __pyx_opt_args_4lupa_5_lupa_py_to_lua __pyx_t_16;
26817   PyObject *__pyx_t_17 = NULL;
26818   PyObject *__pyx_t_18 = NULL;
26819   PyObject *__pyx_t_19 = NULL;
26820   int __pyx_lineno = 0;
26821   const char *__pyx_filename = NULL;
26822   int __pyx_clineno = 0;
26823   #ifdef WITH_THREAD
26824   PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
26825   #endif
26826   __Pyx_RefNannySetupContext("py_iter_next_with_gil", 0);
26827 
26828   /* "lupa/_lupa.pyx":1772
26829  * cdef int py_iter_next_with_gil(lua_State* L, py_object* py_iter) with gil:
26830  *     cdef LuaRuntime runtime
26831  *     try:             # <<<<<<<<<<<<<<
26832  *         runtime = <LuaRuntime?>py_iter.runtime
26833  *         try:
26834  */
26835   {
26836     __Pyx_PyThreadState_declare
26837     __Pyx_PyThreadState_assign
26838     __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
26839     __Pyx_XGOTREF(__pyx_t_1);
26840     __Pyx_XGOTREF(__pyx_t_2);
26841     __Pyx_XGOTREF(__pyx_t_3);
26842     /*try:*/ {
26843 
26844       /* "lupa/_lupa.pyx":1773
26845  *     cdef LuaRuntime runtime
26846  *     try:
26847  *         runtime = <LuaRuntime?>py_iter.runtime             # <<<<<<<<<<<<<<
26848  *         try:
26849  *             obj = next(<object>py_iter.obj)
26850  */
26851       __pyx_t_4 = ((PyObject *)__pyx_v_py_iter->runtime);
26852       __Pyx_INCREF(__pyx_t_4);
26853       __pyx_v_runtime = ((struct __pyx_obj_4lupa_5_lupa_LuaRuntime *)__pyx_t_4);
26854       __pyx_t_4 = 0;
26855 
26856       /* "lupa/_lupa.pyx":1774
26857  *     try:
26858  *         runtime = <LuaRuntime?>py_iter.runtime
26859  *         try:             # <<<<<<<<<<<<<<
26860  *             obj = next(<object>py_iter.obj)
26861  *         except StopIteration:
26862  */
26863       {
26864         __Pyx_PyThreadState_declare
26865         __Pyx_PyThreadState_assign
26866         __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7);
26867         __Pyx_XGOTREF(__pyx_t_5);
26868         __Pyx_XGOTREF(__pyx_t_6);
26869         __Pyx_XGOTREF(__pyx_t_7);
26870         /*try:*/ {
26871 
26872           /* "lupa/_lupa.pyx":1775
26873  *         runtime = <LuaRuntime?>py_iter.runtime
26874  *         try:
26875  *             obj = next(<object>py_iter.obj)             # <<<<<<<<<<<<<<
26876  *         except StopIteration:
26877  *             lua.lua_pushnil(L)
26878  */
26879           __pyx_t_4 = ((PyObject *)__pyx_v_py_iter->obj);
26880           __Pyx_INCREF(__pyx_t_4);
26881           __pyx_t_8 = __Pyx_PyIter_Next(__pyx_t_4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1775, __pyx_L9_error)
26882           __Pyx_GOTREF(__pyx_t_8);
26883           __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
26884           __pyx_v_obj = __pyx_t_8;
26885           __pyx_t_8 = 0;
26886 
26887           /* "lupa/_lupa.pyx":1774
26888  *     try:
26889  *         runtime = <LuaRuntime?>py_iter.runtime
26890  *         try:             # <<<<<<<<<<<<<<
26891  *             obj = next(<object>py_iter.obj)
26892  *         except StopIteration:
26893  */
26894         }
26895         __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
26896         __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
26897         __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
26898         goto __pyx_L14_try_end;
26899         __pyx_L9_error:;
26900         __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
26901         __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
26902 
26903         /* "lupa/_lupa.pyx":1776
26904  *         try:
26905  *             obj = next(<object>py_iter.obj)
26906  *         except StopIteration:             # <<<<<<<<<<<<<<
26907  *             lua.lua_pushnil(L)
26908  *             return 1
26909  */
26910         __pyx_t_9 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_StopIteration);
26911         if (__pyx_t_9) {
26912           __Pyx_AddTraceback("lupa._lupa.py_iter_next_with_gil", __pyx_clineno, __pyx_lineno, __pyx_filename);
26913           if (__Pyx_GetException(&__pyx_t_8, &__pyx_t_4, &__pyx_t_10) < 0) __PYX_ERR(0, 1776, __pyx_L11_except_error)
26914           __Pyx_GOTREF(__pyx_t_8);
26915           __Pyx_GOTREF(__pyx_t_4);
26916           __Pyx_GOTREF(__pyx_t_10);
26917 
26918           /* "lupa/_lupa.pyx":1777
26919  *             obj = next(<object>py_iter.obj)
26920  *         except StopIteration:
26921  *             lua.lua_pushnil(L)             # <<<<<<<<<<<<<<
26922  *             return 1
26923  *
26924  */
26925           lua_pushnil(__pyx_v_L);
26926 
26927           /* "lupa/_lupa.pyx":1778
26928  *         except StopIteration:
26929  *             lua.lua_pushnil(L)
26930  *             return 1             # <<<<<<<<<<<<<<
26931  *
26932  *         # NOTE: cannot return nil for None as first item
26933  */
26934           __pyx_r = 1;
26935           __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
26936           __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
26937           __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
26938           goto __pyx_L12_except_return;
26939         }
26940         goto __pyx_L11_except_error;
26941         __pyx_L11_except_error:;
26942 
26943         /* "lupa/_lupa.pyx":1774
26944  *     try:
26945  *         runtime = <LuaRuntime?>py_iter.runtime
26946  *         try:             # <<<<<<<<<<<<<<
26947  *             obj = next(<object>py_iter.obj)
26948  *         except StopIteration:
26949  */
26950         __Pyx_XGIVEREF(__pyx_t_5);
26951         __Pyx_XGIVEREF(__pyx_t_6);
26952         __Pyx_XGIVEREF(__pyx_t_7);
26953         __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
26954         goto __pyx_L3_error;
26955         __pyx_L12_except_return:;
26956         __Pyx_XGIVEREF(__pyx_t_5);
26957         __Pyx_XGIVEREF(__pyx_t_6);
26958         __Pyx_XGIVEREF(__pyx_t_7);
26959         __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
26960         goto __pyx_L7_try_return;
26961         __pyx_L14_try_end:;
26962       }
26963 
26964       /* "lupa/_lupa.pyx":1782
26965  *         # NOTE: cannot return nil for None as first item
26966  *         # as Lua interprets it as end of the iterator
26967  *         allow_nil = False             # <<<<<<<<<<<<<<
26968  *         if py_iter.type_flags & OBJ_ENUMERATOR:
26969  *             lua.lua_pushnumber(L, lua.lua_tonumber(L, -1) + 1.0)
26970  */
26971       __pyx_v_allow_nil = 0;
26972 
26973       /* "lupa/_lupa.pyx":1783
26974  *         # as Lua interprets it as end of the iterator
26975  *         allow_nil = False
26976  *         if py_iter.type_flags & OBJ_ENUMERATOR:             # <<<<<<<<<<<<<<
26977  *             lua.lua_pushnumber(L, lua.lua_tonumber(L, -1) + 1.0)
26978  *             allow_nil = True
26979  */
26980       __pyx_t_11 = ((__pyx_v_py_iter->type_flags & __pyx_e_4lupa_5_lupa_OBJ_ENUMERATOR) != 0);
26981       if (__pyx_t_11) {
26982 
26983         /* "lupa/_lupa.pyx":1784
26984  *         allow_nil = False
26985  *         if py_iter.type_flags & OBJ_ENUMERATOR:
26986  *             lua.lua_pushnumber(L, lua.lua_tonumber(L, -1) + 1.0)             # <<<<<<<<<<<<<<
26987  *             allow_nil = True
26988  *         if (py_iter.type_flags & OBJ_UNPACK_TUPLE) and isinstance(obj, tuple):
26989  */
26990         lua_pushnumber(__pyx_v_L, (lua_tonumber(__pyx_v_L, -1) + 1.0));
26991 
26992         /* "lupa/_lupa.pyx":1785
26993  *         if py_iter.type_flags & OBJ_ENUMERATOR:
26994  *             lua.lua_pushnumber(L, lua.lua_tonumber(L, -1) + 1.0)
26995  *             allow_nil = True             # <<<<<<<<<<<<<<
26996  *         if (py_iter.type_flags & OBJ_UNPACK_TUPLE) and isinstance(obj, tuple):
26997  *             # special case: when the iterable returns a tuple, unpack it
26998  */
26999         __pyx_v_allow_nil = 1;
27000 
27001         /* "lupa/_lupa.pyx":1783
27002  *         # as Lua interprets it as end of the iterator
27003  *         allow_nil = False
27004  *         if py_iter.type_flags & OBJ_ENUMERATOR:             # <<<<<<<<<<<<<<
27005  *             lua.lua_pushnumber(L, lua.lua_tonumber(L, -1) + 1.0)
27006  *             allow_nil = True
27007  */
27008       }
27009 
27010       /* "lupa/_lupa.pyx":1786
27011  *             lua.lua_pushnumber(L, lua.lua_tonumber(L, -1) + 1.0)
27012  *             allow_nil = True
27013  *         if (py_iter.type_flags & OBJ_UNPACK_TUPLE) and isinstance(obj, tuple):             # <<<<<<<<<<<<<<
27014  *             # special case: when the iterable returns a tuple, unpack it
27015  *             push_lua_arguments(runtime, L, <tuple>obj, first_may_be_nil=allow_nil)
27016  */
27017       __pyx_t_12 = ((__pyx_v_py_iter->type_flags & __pyx_e_4lupa_5_lupa_OBJ_UNPACK_TUPLE) != 0);
27018       if (__pyx_t_12) {
27019       } else {
27020         __pyx_t_11 = __pyx_t_12;
27021         goto __pyx_L19_bool_binop_done;
27022       }
27023       __pyx_t_12 = PyTuple_Check(__pyx_v_obj);
27024       __pyx_t_13 = (__pyx_t_12 != 0);
27025       __pyx_t_11 = __pyx_t_13;
27026       __pyx_L19_bool_binop_done:;
27027       if (__pyx_t_11) {
27028 
27029         /* "lupa/_lupa.pyx":1788
27030  *         if (py_iter.type_flags & OBJ_UNPACK_TUPLE) and isinstance(obj, tuple):
27031  *             # special case: when the iterable returns a tuple, unpack it
27032  *             push_lua_arguments(runtime, L, <tuple>obj, first_may_be_nil=allow_nil)             # <<<<<<<<<<<<<<
27033  *             result = len(<tuple>obj)
27034  *         else:
27035  */
27036         __pyx_t_14.__pyx_n = 1;
27037         __pyx_t_14.first_may_be_nil = __pyx_v_allow_nil;
27038         __pyx_t_9 = __pyx_f_4lupa_5_lupa_push_lua_arguments(__pyx_v_runtime, __pyx_v_L, ((PyObject*)__pyx_v_obj), &__pyx_t_14); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 1788, __pyx_L3_error)
27039 
27040         /* "lupa/_lupa.pyx":1789
27041  *             # special case: when the iterable returns a tuple, unpack it
27042  *             push_lua_arguments(runtime, L, <tuple>obj, first_may_be_nil=allow_nil)
27043  *             result = len(<tuple>obj)             # <<<<<<<<<<<<<<
27044  *         else:
27045  *             result = py_to_lua(runtime, L, obj, wrap_none=not allow_nil)
27046  */
27047         if (unlikely(__pyx_v_obj == Py_None)) {
27048           PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
27049           __PYX_ERR(0, 1789, __pyx_L3_error)
27050         }
27051         __pyx_t_15 = PyTuple_GET_SIZE(((PyObject*)__pyx_v_obj)); if (unlikely(__pyx_t_15 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1789, __pyx_L3_error)
27052         __pyx_t_10 = PyInt_FromSsize_t(__pyx_t_15); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1789, __pyx_L3_error)
27053         __Pyx_GOTREF(__pyx_t_10);
27054         __pyx_v_result = __pyx_t_10;
27055         __pyx_t_10 = 0;
27056 
27057         /* "lupa/_lupa.pyx":1786
27058  *             lua.lua_pushnumber(L, lua.lua_tonumber(L, -1) + 1.0)
27059  *             allow_nil = True
27060  *         if (py_iter.type_flags & OBJ_UNPACK_TUPLE) and isinstance(obj, tuple):             # <<<<<<<<<<<<<<
27061  *             # special case: when the iterable returns a tuple, unpack it
27062  *             push_lua_arguments(runtime, L, <tuple>obj, first_may_be_nil=allow_nil)
27063  */
27064         goto __pyx_L18;
27065       }
27066 
27067       /* "lupa/_lupa.pyx":1791
27068  *             result = len(<tuple>obj)
27069  *         else:
27070  *             result = py_to_lua(runtime, L, obj, wrap_none=not allow_nil)             # <<<<<<<<<<<<<<
27071  *             if result < 1:
27072  *                 return -1
27073  */
27074       /*else*/ {
27075         __pyx_t_16.__pyx_n = 1;
27076         __pyx_t_16.wrap_none = (!(__pyx_v_allow_nil != 0));
27077         __pyx_t_9 = __pyx_f_4lupa_5_lupa_py_to_lua(__pyx_v_runtime, __pyx_v_L, __pyx_v_obj, &__pyx_t_16); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 1791, __pyx_L3_error)
27078         __pyx_t_10 = __Pyx_PyInt_From_int(__pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1791, __pyx_L3_error)
27079         __Pyx_GOTREF(__pyx_t_10);
27080         __pyx_v_result = __pyx_t_10;
27081         __pyx_t_10 = 0;
27082 
27083         /* "lupa/_lupa.pyx":1792
27084  *         else:
27085  *             result = py_to_lua(runtime, L, obj, wrap_none=not allow_nil)
27086  *             if result < 1:             # <<<<<<<<<<<<<<
27087  *                 return -1
27088  *         if py_iter.type_flags & OBJ_ENUMERATOR:
27089  */
27090         __pyx_t_10 = PyObject_RichCompare(__pyx_v_result, __pyx_int_1, Py_LT); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1792, __pyx_L3_error)
27091         __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 1792, __pyx_L3_error)
27092         __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
27093         if (__pyx_t_11) {
27094 
27095           /* "lupa/_lupa.pyx":1793
27096  *             result = py_to_lua(runtime, L, obj, wrap_none=not allow_nil)
27097  *             if result < 1:
27098  *                 return -1             # <<<<<<<<<<<<<<
27099  *         if py_iter.type_flags & OBJ_ENUMERATOR:
27100  *             result += 1
27101  */
27102           __pyx_r = -1;
27103           goto __pyx_L7_try_return;
27104 
27105           /* "lupa/_lupa.pyx":1792
27106  *         else:
27107  *             result = py_to_lua(runtime, L, obj, wrap_none=not allow_nil)
27108  *             if result < 1:             # <<<<<<<<<<<<<<
27109  *                 return -1
27110  *         if py_iter.type_flags & OBJ_ENUMERATOR:
27111  */
27112         }
27113       }
27114       __pyx_L18:;
27115 
27116       /* "lupa/_lupa.pyx":1794
27117  *             if result < 1:
27118  *                 return -1
27119  *         if py_iter.type_flags & OBJ_ENUMERATOR:             # <<<<<<<<<<<<<<
27120  *             result += 1
27121  *         return result
27122  */
27123       __pyx_t_11 = ((__pyx_v_py_iter->type_flags & __pyx_e_4lupa_5_lupa_OBJ_ENUMERATOR) != 0);
27124       if (__pyx_t_11) {
27125 
27126         /* "lupa/_lupa.pyx":1795
27127  *                 return -1
27128  *         if py_iter.type_flags & OBJ_ENUMERATOR:
27129  *             result += 1             # <<<<<<<<<<<<<<
27130  *         return result
27131  *     except:
27132  */
27133         __pyx_t_10 = __Pyx_PyInt_AddObjC(__pyx_v_result, __pyx_int_1, 1, 1, 0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1795, __pyx_L3_error)
27134         __Pyx_GOTREF(__pyx_t_10);
27135         __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_10);
27136         __pyx_t_10 = 0;
27137 
27138         /* "lupa/_lupa.pyx":1794
27139  *             if result < 1:
27140  *                 return -1
27141  *         if py_iter.type_flags & OBJ_ENUMERATOR:             # <<<<<<<<<<<<<<
27142  *             result += 1
27143  *         return result
27144  */
27145       }
27146 
27147       /* "lupa/_lupa.pyx":1796
27148  *         if py_iter.type_flags & OBJ_ENUMERATOR:
27149  *             result += 1
27150  *         return result             # <<<<<<<<<<<<<<
27151  *     except:
27152  *         try: runtime.store_raised_exception(L, b'error while calling next(iterator)')
27153  */
27154       __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_v_result); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1796, __pyx_L3_error)
27155       __pyx_r = __pyx_t_9;
27156       goto __pyx_L7_try_return;
27157 
27158       /* "lupa/_lupa.pyx":1772
27159  * cdef int py_iter_next_with_gil(lua_State* L, py_object* py_iter) with gil:
27160  *     cdef LuaRuntime runtime
27161  *     try:             # <<<<<<<<<<<<<<
27162  *         runtime = <LuaRuntime?>py_iter.runtime
27163  *         try:
27164  */
27165     }
27166     __pyx_L3_error:;
27167     __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
27168     __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
27169     __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
27170 
27171     /* "lupa/_lupa.pyx":1797
27172  *             result += 1
27173  *         return result
27174  *     except:             # <<<<<<<<<<<<<<
27175  *         try: runtime.store_raised_exception(L, b'error while calling next(iterator)')
27176  *         finally: return -1
27177  */
27178     /*except:*/ {
27179       __Pyx_AddTraceback("lupa._lupa.py_iter_next_with_gil", __pyx_clineno, __pyx_lineno, __pyx_filename);
27180       if (__Pyx_GetException(&__pyx_t_10, &__pyx_t_4, &__pyx_t_8) < 0) __PYX_ERR(0, 1797, __pyx_L5_except_error)
27181       __Pyx_GOTREF(__pyx_t_10);
27182       __Pyx_GOTREF(__pyx_t_4);
27183       __Pyx_GOTREF(__pyx_t_8);
27184 
27185       /* "lupa/_lupa.pyx":1798
27186  *         return result
27187  *     except:
27188  *         try: runtime.store_raised_exception(L, b'error while calling next(iterator)')             # <<<<<<<<<<<<<<
27189  *         finally: return -1
27190  *
27191  */
27192       /*try:*/ {
27193         if (unlikely(!__pyx_v_runtime)) { __Pyx_RaiseUnboundLocalError("runtime"); __PYX_ERR(0, 1798, __pyx_L28_error) }
27194         __pyx_t_9 = __pyx_f_4lupa_5_lupa_10LuaRuntime_store_raised_exception(__pyx_v_runtime, __pyx_v_L, __pyx_kp_b_error_while_calling_next_iterato); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 1798, __pyx_L28_error)
27195       }
27196 
27197       /* "lupa/_lupa.pyx":1799
27198  *     except:
27199  *         try: runtime.store_raised_exception(L, b'error while calling next(iterator)')
27200  *         finally: return -1             # <<<<<<<<<<<<<<
27201  *
27202  * # 'python' module functions in Lua
27203  */
27204       /*finally:*/ {
27205         /*normal exit:*/{
27206           __pyx_r = -1;
27207           __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
27208           __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
27209           __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
27210           goto __pyx_L6_except_return;
27211         }
27212         __pyx_L28_error:;
27213         /*exception exit:*/{
27214           __Pyx_PyThreadState_declare
27215           __Pyx_PyThreadState_assign
27216           __pyx_t_7 = 0; __pyx_t_6 = 0; __pyx_t_5 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0;
27217           if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_17, &__pyx_t_18, &__pyx_t_19);
27218           if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_7, &__pyx_t_6, &__pyx_t_5) < 0)) __Pyx_ErrFetch(&__pyx_t_7, &__pyx_t_6, &__pyx_t_5);
27219           __Pyx_XGOTREF(__pyx_t_7);
27220           __Pyx_XGOTREF(__pyx_t_6);
27221           __Pyx_XGOTREF(__pyx_t_5);
27222           __Pyx_XGOTREF(__pyx_t_17);
27223           __Pyx_XGOTREF(__pyx_t_18);
27224           __Pyx_XGOTREF(__pyx_t_19);
27225           {
27226             __pyx_r = -1;
27227             __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
27228             __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
27229             __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
27230             goto __pyx_L32_return;
27231           }
27232           __pyx_L32_return:;
27233           if (PY_MAJOR_VERSION >= 3) {
27234             __Pyx_XGIVEREF(__pyx_t_17);
27235             __Pyx_XGIVEREF(__pyx_t_18);
27236             __Pyx_XGIVEREF(__pyx_t_19);
27237             __Pyx_ExceptionReset(__pyx_t_17, __pyx_t_18, __pyx_t_19);
27238           }
27239           __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
27240           __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
27241           __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
27242           __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0;
27243           goto __pyx_L6_except_return;
27244         }
27245       }
27246     }
27247     __pyx_L5_except_error:;
27248 
27249     /* "lupa/_lupa.pyx":1772
27250  * cdef int py_iter_next_with_gil(lua_State* L, py_object* py_iter) with gil:
27251  *     cdef LuaRuntime runtime
27252  *     try:             # <<<<<<<<<<<<<<
27253  *         runtime = <LuaRuntime?>py_iter.runtime
27254  *         try:
27255  */
27256     __Pyx_XGIVEREF(__pyx_t_1);
27257     __Pyx_XGIVEREF(__pyx_t_2);
27258     __Pyx_XGIVEREF(__pyx_t_3);
27259     __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
27260     goto __pyx_L1_error;
27261     __pyx_L7_try_return:;
27262     __Pyx_XGIVEREF(__pyx_t_1);
27263     __Pyx_XGIVEREF(__pyx_t_2);
27264     __Pyx_XGIVEREF(__pyx_t_3);
27265     __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
27266     goto __pyx_L0;
27267     __pyx_L6_except_return:;
27268     __Pyx_XGIVEREF(__pyx_t_1);
27269     __Pyx_XGIVEREF(__pyx_t_2);
27270     __Pyx_XGIVEREF(__pyx_t_3);
27271     __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
27272     goto __pyx_L0;
27273   }
27274 
27275   /* "lupa/_lupa.pyx":1770
27276  *     return result
27277  *
27278  * cdef int py_iter_next_with_gil(lua_State* L, py_object* py_iter) with gil:             # <<<<<<<<<<<<<<
27279  *     cdef LuaRuntime runtime
27280  *     try:
27281  */
27282 
27283   /* function exit code */
27284   __pyx_L1_error:;
27285   __Pyx_XDECREF(__pyx_t_4);
27286   __Pyx_XDECREF(__pyx_t_8);
27287   __Pyx_XDECREF(__pyx_t_10);
27288   __Pyx_WriteUnraisable("lupa._lupa.py_iter_next_with_gil", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
27289   __pyx_r = 0;
27290   __pyx_L0:;
27291   __Pyx_XDECREF((PyObject *)__pyx_v_runtime);
27292   __Pyx_XDECREF(__pyx_v_obj);
27293   __Pyx_XDECREF(__pyx_v_result);
27294   __Pyx_RefNannyFinishContext();
27295   #ifdef WITH_THREAD
27296   __Pyx_PyGILState_Release(__pyx_gilstate_save);
27297   #endif
27298   return __pyx_r;
27299 }
27300 
27301 /* "lupa/_lupa.pyx":1815
27302  * # Setup helpers for library tables (removed from C-API in Lua 5.3).
27303  *
27304  * cdef void luaL_setfuncs(lua_State *L, const lua.luaL_Reg *l, int nup):             # <<<<<<<<<<<<<<
27305  *     cdef int i
27306  *     lua.luaL_checkstack(L, nup, "too many upvalues")
27307  */
27308 
__pyx_f_4lupa_5_lupa_luaL_setfuncs(lua_State * __pyx_v_L,luaL_Reg const * __pyx_v_l,int __pyx_v_nup)27309 static void __pyx_f_4lupa_5_lupa_luaL_setfuncs(lua_State *__pyx_v_L, luaL_Reg const *__pyx_v_l, int __pyx_v_nup) {
27310   CYTHON_UNUSED int __pyx_v_i;
27311   __Pyx_RefNannyDeclarations
27312   int __pyx_t_1;
27313   int __pyx_t_2;
27314   int __pyx_t_3;
27315   int __pyx_t_4;
27316   __Pyx_RefNannySetupContext("luaL_setfuncs", 0);
27317 
27318   /* "lupa/_lupa.pyx":1817
27319  * cdef void luaL_setfuncs(lua_State *L, const lua.luaL_Reg *l, int nup):
27320  *     cdef int i
27321  *     lua.luaL_checkstack(L, nup, "too many upvalues")             # <<<<<<<<<<<<<<
27322  *     while l.name != NULL:
27323  *         for i in range(nup):
27324  */
27325   luaL_checkstack(__pyx_v_L, __pyx_v_nup, ((char *)"too many upvalues"));
27326 
27327   /* "lupa/_lupa.pyx":1818
27328  *     cdef int i
27329  *     lua.luaL_checkstack(L, nup, "too many upvalues")
27330  *     while l.name != NULL:             # <<<<<<<<<<<<<<
27331  *         for i in range(nup):
27332  *             lua.lua_pushvalue(L, -nup)
27333  */
27334   while (1) {
27335     __pyx_t_1 = ((__pyx_v_l->name != NULL) != 0);
27336     if (!__pyx_t_1) break;
27337 
27338     /* "lupa/_lupa.pyx":1819
27339  *     lua.luaL_checkstack(L, nup, "too many upvalues")
27340  *     while l.name != NULL:
27341  *         for i in range(nup):             # <<<<<<<<<<<<<<
27342  *             lua.lua_pushvalue(L, -nup)
27343  *         lua.lua_pushcclosure(L, l.func, nup)
27344  */
27345     __pyx_t_2 = __pyx_v_nup;
27346     __pyx_t_3 = __pyx_t_2;
27347     for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
27348       __pyx_v_i = __pyx_t_4;
27349 
27350       /* "lupa/_lupa.pyx":1820
27351  *     while l.name != NULL:
27352  *         for i in range(nup):
27353  *             lua.lua_pushvalue(L, -nup)             # <<<<<<<<<<<<<<
27354  *         lua.lua_pushcclosure(L, l.func, nup)
27355  *         lua.lua_setfield(L, -(nup + 2), l.name)
27356  */
27357       lua_pushvalue(__pyx_v_L, (-__pyx_v_nup));
27358     }
27359 
27360     /* "lupa/_lupa.pyx":1821
27361  *         for i in range(nup):
27362  *             lua.lua_pushvalue(L, -nup)
27363  *         lua.lua_pushcclosure(L, l.func, nup)             # <<<<<<<<<<<<<<
27364  *         lua.lua_setfield(L, -(nup + 2), l.name)
27365  *         l += 1
27366  */
27367     lua_pushcclosure(__pyx_v_L, __pyx_v_l->func, __pyx_v_nup);
27368 
27369     /* "lupa/_lupa.pyx":1822
27370  *             lua.lua_pushvalue(L, -nup)
27371  *         lua.lua_pushcclosure(L, l.func, nup)
27372  *         lua.lua_setfield(L, -(nup + 2), l.name)             # <<<<<<<<<<<<<<
27373  *         l += 1
27374  *     lua.lua_pop(L, nup)
27375  */
27376     lua_setfield(__pyx_v_L, (-(__pyx_v_nup + 2)), __pyx_v_l->name);
27377 
27378     /* "lupa/_lupa.pyx":1823
27379  *         lua.lua_pushcclosure(L, l.func, nup)
27380  *         lua.lua_setfield(L, -(nup + 2), l.name)
27381  *         l += 1             # <<<<<<<<<<<<<<
27382  *     lua.lua_pop(L, nup)
27383  *
27384  */
27385     __pyx_v_l = (__pyx_v_l + 1);
27386   }
27387 
27388   /* "lupa/_lupa.pyx":1824
27389  *         lua.lua_setfield(L, -(nup + 2), l.name)
27390  *         l += 1
27391  *     lua.lua_pop(L, nup)             # <<<<<<<<<<<<<<
27392  *
27393  *
27394  */
27395   lua_pop(__pyx_v_L, __pyx_v_nup);
27396 
27397   /* "lupa/_lupa.pyx":1815
27398  * # Setup helpers for library tables (removed from C-API in Lua 5.3).
27399  *
27400  * cdef void luaL_setfuncs(lua_State *L, const lua.luaL_Reg *l, int nup):             # <<<<<<<<<<<<<<
27401  *     cdef int i
27402  *     lua.luaL_checkstack(L, nup, "too many upvalues")
27403  */
27404 
27405   /* function exit code */
27406   __Pyx_RefNannyFinishContext();
27407 }
27408 
27409 /* "lupa/_lupa.pyx":1827
27410  *
27411  *
27412  * cdef int libsize(const lua.luaL_Reg *l):             # <<<<<<<<<<<<<<
27413  *     cdef int size = 0
27414  *     while l and l.name:
27415  */
27416 
__pyx_f_4lupa_5_lupa_libsize(luaL_Reg const * __pyx_v_l)27417 static int __pyx_f_4lupa_5_lupa_libsize(luaL_Reg const *__pyx_v_l) {
27418   int __pyx_v_size;
27419   int __pyx_r;
27420   __Pyx_RefNannyDeclarations
27421   int __pyx_t_1;
27422   int __pyx_t_2;
27423   __Pyx_RefNannySetupContext("libsize", 0);
27424 
27425   /* "lupa/_lupa.pyx":1828
27426  *
27427  * cdef int libsize(const lua.luaL_Reg *l):
27428  *     cdef int size = 0             # <<<<<<<<<<<<<<
27429  *     while l and l.name:
27430  *         l += 1
27431  */
27432   __pyx_v_size = 0;
27433 
27434   /* "lupa/_lupa.pyx":1829
27435  * cdef int libsize(const lua.luaL_Reg *l):
27436  *     cdef int size = 0
27437  *     while l and l.name:             # <<<<<<<<<<<<<<
27438  *         l += 1
27439  *         size += 1
27440  */
27441   while (1) {
27442     __pyx_t_2 = (__pyx_v_l != 0);
27443     if (__pyx_t_2) {
27444     } else {
27445       __pyx_t_1 = __pyx_t_2;
27446       goto __pyx_L5_bool_binop_done;
27447     }
27448     __pyx_t_2 = (__pyx_v_l->name != 0);
27449     __pyx_t_1 = __pyx_t_2;
27450     __pyx_L5_bool_binop_done:;
27451     if (!__pyx_t_1) break;
27452 
27453     /* "lupa/_lupa.pyx":1830
27454  *     cdef int size = 0
27455  *     while l and l.name:
27456  *         l += 1             # <<<<<<<<<<<<<<
27457  *         size += 1
27458  *     return size
27459  */
27460     __pyx_v_l = (__pyx_v_l + 1);
27461 
27462     /* "lupa/_lupa.pyx":1831
27463  *     while l and l.name:
27464  *         l += 1
27465  *         size += 1             # <<<<<<<<<<<<<<
27466  *     return size
27467  *
27468  */
27469     __pyx_v_size = (__pyx_v_size + 1);
27470   }
27471 
27472   /* "lupa/_lupa.pyx":1832
27473  *         l += 1
27474  *         size += 1
27475  *     return size             # <<<<<<<<<<<<<<
27476  *
27477  *
27478  */
27479   __pyx_r = __pyx_v_size;
27480   goto __pyx_L0;
27481 
27482   /* "lupa/_lupa.pyx":1827
27483  *
27484  *
27485  * cdef int libsize(const lua.luaL_Reg *l):             # <<<<<<<<<<<<<<
27486  *     cdef int size = 0
27487  *     while l and l.name:
27488  */
27489 
27490   /* function exit code */
27491   __pyx_L0:;
27492   __Pyx_RefNannyFinishContext();
27493   return __pyx_r;
27494 }
27495 
27496 /* "lupa/_lupa.pyx":1835
27497  *
27498  *
27499  * cdef const char *luaL_findtable(lua_State *L, int idx,             # <<<<<<<<<<<<<<
27500  *                                 const char *fname, int size_hint):
27501  *     cdef const char *end
27502  */
27503 
__pyx_f_4lupa_5_lupa_luaL_findtable(lua_State * __pyx_v_L,int __pyx_v_idx,char const * __pyx_v_fname,int __pyx_v_size_hint)27504 static char const *__pyx_f_4lupa_5_lupa_luaL_findtable(lua_State *__pyx_v_L, int __pyx_v_idx, char const *__pyx_v_fname, int __pyx_v_size_hint) {
27505   char const *__pyx_v_end;
27506   char const *__pyx_r;
27507   __Pyx_RefNannyDeclarations
27508   int __pyx_t_1;
27509   int __pyx_t_2;
27510   __Pyx_RefNannySetupContext("luaL_findtable", 0);
27511 
27512   /* "lupa/_lupa.pyx":1838
27513  *                                 const char *fname, int size_hint):
27514  *     cdef const char *end
27515  *     if idx:             # <<<<<<<<<<<<<<
27516  *         lua.lua_pushvalue(L, idx)
27517  *
27518  */
27519   __pyx_t_1 = (__pyx_v_idx != 0);
27520   if (__pyx_t_1) {
27521 
27522     /* "lupa/_lupa.pyx":1839
27523  *     cdef const char *end
27524  *     if idx:
27525  *         lua.lua_pushvalue(L, idx)             # <<<<<<<<<<<<<<
27526  *
27527  *     while True:
27528  */
27529     lua_pushvalue(__pyx_v_L, __pyx_v_idx);
27530 
27531     /* "lupa/_lupa.pyx":1838
27532  *                                 const char *fname, int size_hint):
27533  *     cdef const char *end
27534  *     if idx:             # <<<<<<<<<<<<<<
27535  *         lua.lua_pushvalue(L, idx)
27536  *
27537  */
27538   }
27539 
27540   /* "lupa/_lupa.pyx":1841
27541  *         lua.lua_pushvalue(L, idx)
27542  *
27543  *     while True:             # <<<<<<<<<<<<<<
27544  *         end = strchr(fname, '.')
27545  *         if end == NULL:
27546  */
27547   while (1) {
27548 
27549     /* "lupa/_lupa.pyx":1842
27550  *
27551  *     while True:
27552  *         end = strchr(fname, '.')             # <<<<<<<<<<<<<<
27553  *         if end == NULL:
27554  *             end = fname + strlen(fname)
27555  */
27556     __pyx_v_end = strchr(__pyx_v_fname, '.');
27557 
27558     /* "lupa/_lupa.pyx":1843
27559  *     while True:
27560  *         end = strchr(fname, '.')
27561  *         if end == NULL:             # <<<<<<<<<<<<<<
27562  *             end = fname + strlen(fname)
27563  *         lua.lua_pushlstring(L, fname, end - fname)
27564  */
27565     __pyx_t_1 = ((__pyx_v_end == NULL) != 0);
27566     if (__pyx_t_1) {
27567 
27568       /* "lupa/_lupa.pyx":1844
27569  *         end = strchr(fname, '.')
27570  *         if end == NULL:
27571  *             end = fname + strlen(fname)             # <<<<<<<<<<<<<<
27572  *         lua.lua_pushlstring(L, fname, end - fname)
27573  *         lua.lua_rawget(L, -2)
27574  */
27575       __pyx_v_end = (__pyx_v_fname + strlen(__pyx_v_fname));
27576 
27577       /* "lupa/_lupa.pyx":1843
27578  *     while True:
27579  *         end = strchr(fname, '.')
27580  *         if end == NULL:             # <<<<<<<<<<<<<<
27581  *             end = fname + strlen(fname)
27582  *         lua.lua_pushlstring(L, fname, end - fname)
27583  */
27584     }
27585 
27586     /* "lupa/_lupa.pyx":1845
27587  *         if end == NULL:
27588  *             end = fname + strlen(fname)
27589  *         lua.lua_pushlstring(L, fname, end - fname)             # <<<<<<<<<<<<<<
27590  *         lua.lua_rawget(L, -2)
27591  *         if lua.lua_type(L, -1) == lua.LUA_TNIL:
27592  */
27593     lua_pushlstring(__pyx_v_L, __pyx_v_fname, (__pyx_v_end - __pyx_v_fname));
27594 
27595     /* "lupa/_lupa.pyx":1846
27596  *             end = fname + strlen(fname)
27597  *         lua.lua_pushlstring(L, fname, end - fname)
27598  *         lua.lua_rawget(L, -2)             # <<<<<<<<<<<<<<
27599  *         if lua.lua_type(L, -1) == lua.LUA_TNIL:
27600  *             lua.lua_pop(L, 1)
27601  */
27602     lua_rawget(__pyx_v_L, -2);
27603 
27604     /* "lupa/_lupa.pyx":1847
27605  *         lua.lua_pushlstring(L, fname, end - fname)
27606  *         lua.lua_rawget(L, -2)
27607  *         if lua.lua_type(L, -1) == lua.LUA_TNIL:             # <<<<<<<<<<<<<<
27608  *             lua.lua_pop(L, 1)
27609  *             lua.lua_createtable(L, 0, (1 if end[0] == '.' else size_hint))
27610  */
27611     __pyx_t_1 = ((lua_type(__pyx_v_L, -1) == LUA_TNIL) != 0);
27612     if (__pyx_t_1) {
27613 
27614       /* "lupa/_lupa.pyx":1848
27615  *         lua.lua_rawget(L, -2)
27616  *         if lua.lua_type(L, -1) == lua.LUA_TNIL:
27617  *             lua.lua_pop(L, 1)             # <<<<<<<<<<<<<<
27618  *             lua.lua_createtable(L, 0, (1 if end[0] == '.' else size_hint))
27619  *             lua.lua_pushlstring(L, fname, end - fname)
27620  */
27621       lua_pop(__pyx_v_L, 1);
27622 
27623       /* "lupa/_lupa.pyx":1849
27624  *         if lua.lua_type(L, -1) == lua.LUA_TNIL:
27625  *             lua.lua_pop(L, 1)
27626  *             lua.lua_createtable(L, 0, (1 if end[0] == '.' else size_hint))             # <<<<<<<<<<<<<<
27627  *             lua.lua_pushlstring(L, fname, end - fname)
27628  *             lua.lua_pushvalue(L, -2)
27629  */
27630       if ((((__pyx_v_end[0]) == '.') != 0)) {
27631         __pyx_t_2 = 1;
27632       } else {
27633         __pyx_t_2 = __pyx_v_size_hint;
27634       }
27635       lua_createtable(__pyx_v_L, 0, __pyx_t_2);
27636 
27637       /* "lupa/_lupa.pyx":1850
27638  *             lua.lua_pop(L, 1)
27639  *             lua.lua_createtable(L, 0, (1 if end[0] == '.' else size_hint))
27640  *             lua.lua_pushlstring(L, fname, end - fname)             # <<<<<<<<<<<<<<
27641  *             lua.lua_pushvalue(L, -2)
27642  *             lua.lua_settable(L, -4)
27643  */
27644       lua_pushlstring(__pyx_v_L, __pyx_v_fname, (__pyx_v_end - __pyx_v_fname));
27645 
27646       /* "lupa/_lupa.pyx":1851
27647  *             lua.lua_createtable(L, 0, (1 if end[0] == '.' else size_hint))
27648  *             lua.lua_pushlstring(L, fname, end - fname)
27649  *             lua.lua_pushvalue(L, -2)             # <<<<<<<<<<<<<<
27650  *             lua.lua_settable(L, -4)
27651  *         elif not lua.lua_istable(L, -1):
27652  */
27653       lua_pushvalue(__pyx_v_L, -2);
27654 
27655       /* "lupa/_lupa.pyx":1852
27656  *             lua.lua_pushlstring(L, fname, end - fname)
27657  *             lua.lua_pushvalue(L, -2)
27658  *             lua.lua_settable(L, -4)             # <<<<<<<<<<<<<<
27659  *         elif not lua.lua_istable(L, -1):
27660  *             lua.lua_pop(L, 2)
27661  */
27662       lua_settable(__pyx_v_L, -4);
27663 
27664       /* "lupa/_lupa.pyx":1847
27665  *         lua.lua_pushlstring(L, fname, end - fname)
27666  *         lua.lua_rawget(L, -2)
27667  *         if lua.lua_type(L, -1) == lua.LUA_TNIL:             # <<<<<<<<<<<<<<
27668  *             lua.lua_pop(L, 1)
27669  *             lua.lua_createtable(L, 0, (1 if end[0] == '.' else size_hint))
27670  */
27671       goto __pyx_L7;
27672     }
27673 
27674     /* "lupa/_lupa.pyx":1853
27675  *             lua.lua_pushvalue(L, -2)
27676  *             lua.lua_settable(L, -4)
27677  *         elif not lua.lua_istable(L, -1):             # <<<<<<<<<<<<<<
27678  *             lua.lua_pop(L, 2)
27679  *             return fname
27680  */
27681     __pyx_t_1 = ((!(lua_istable(__pyx_v_L, -1) != 0)) != 0);
27682     if (__pyx_t_1) {
27683 
27684       /* "lupa/_lupa.pyx":1854
27685  *             lua.lua_settable(L, -4)
27686  *         elif not lua.lua_istable(L, -1):
27687  *             lua.lua_pop(L, 2)             # <<<<<<<<<<<<<<
27688  *             return fname
27689  *         lua.lua_remove(L, -2)
27690  */
27691       lua_pop(__pyx_v_L, 2);
27692 
27693       /* "lupa/_lupa.pyx":1855
27694  *         elif not lua.lua_istable(L, -1):
27695  *             lua.lua_pop(L, 2)
27696  *             return fname             # <<<<<<<<<<<<<<
27697  *         lua.lua_remove(L, -2)
27698  *         fname = end + 1
27699  */
27700       __pyx_r = __pyx_v_fname;
27701       goto __pyx_L0;
27702 
27703       /* "lupa/_lupa.pyx":1853
27704  *             lua.lua_pushvalue(L, -2)
27705  *             lua.lua_settable(L, -4)
27706  *         elif not lua.lua_istable(L, -1):             # <<<<<<<<<<<<<<
27707  *             lua.lua_pop(L, 2)
27708  *             return fname
27709  */
27710     }
27711     __pyx_L7:;
27712 
27713     /* "lupa/_lupa.pyx":1856
27714  *             lua.lua_pop(L, 2)
27715  *             return fname
27716  *         lua.lua_remove(L, -2)             # <<<<<<<<<<<<<<
27717  *         fname = end + 1
27718  *         if end[0] != '.':
27719  */
27720     lua_remove(__pyx_v_L, -2);
27721 
27722     /* "lupa/_lupa.pyx":1857
27723  *             return fname
27724  *         lua.lua_remove(L, -2)
27725  *         fname = end + 1             # <<<<<<<<<<<<<<
27726  *         if end[0] != '.':
27727  *             break
27728  */
27729     __pyx_v_fname = (__pyx_v_end + 1);
27730 
27731     /* "lupa/_lupa.pyx":1858
27732  *         lua.lua_remove(L, -2)
27733  *         fname = end + 1
27734  *         if end[0] != '.':             # <<<<<<<<<<<<<<
27735  *             break
27736  *     return NULL
27737  */
27738     __pyx_t_1 = (((__pyx_v_end[0]) != '.') != 0);
27739     if (__pyx_t_1) {
27740 
27741       /* "lupa/_lupa.pyx":1859
27742  *         fname = end + 1
27743  *         if end[0] != '.':
27744  *             break             # <<<<<<<<<<<<<<
27745  *     return NULL
27746  *
27747  */
27748       goto __pyx_L5_break;
27749 
27750       /* "lupa/_lupa.pyx":1858
27751  *         lua.lua_remove(L, -2)
27752  *         fname = end + 1
27753  *         if end[0] != '.':             # <<<<<<<<<<<<<<
27754  *             break
27755  *     return NULL
27756  */
27757     }
27758   }
27759   __pyx_L5_break:;
27760 
27761   /* "lupa/_lupa.pyx":1860
27762  *         if end[0] != '.':
27763  *             break
27764  *     return NULL             # <<<<<<<<<<<<<<
27765  *
27766  *
27767  */
27768   __pyx_r = NULL;
27769   goto __pyx_L0;
27770 
27771   /* "lupa/_lupa.pyx":1835
27772  *
27773  *
27774  * cdef const char *luaL_findtable(lua_State *L, int idx,             # <<<<<<<<<<<<<<
27775  *                                 const char *fname, int size_hint):
27776  *     cdef const char *end
27777  */
27778 
27779   /* function exit code */
27780   __pyx_L0:;
27781   __Pyx_RefNannyFinishContext();
27782   return __pyx_r;
27783 }
27784 
27785 /* "lupa/_lupa.pyx":1863
27786  *
27787  *
27788  * cdef void luaL_pushmodule(lua_State *L, const char *modname, int size_hint):             # <<<<<<<<<<<<<<
27789  *     # XXX: "_LOADED" is the value of LUA_LOADED_TABLE,
27790  *     # but it's absent in lua51
27791  */
27792 
__pyx_f_4lupa_5_lupa_luaL_pushmodule(lua_State * __pyx_v_L,char const * __pyx_v_modname,int __pyx_v_size_hint)27793 static void __pyx_f_4lupa_5_lupa_luaL_pushmodule(lua_State *__pyx_v_L, char const *__pyx_v_modname, int __pyx_v_size_hint) {
27794   __Pyx_RefNannyDeclarations
27795   int __pyx_t_1;
27796   __Pyx_RefNannySetupContext("luaL_pushmodule", 0);
27797 
27798   /* "lupa/_lupa.pyx":1866
27799  *     # XXX: "_LOADED" is the value of LUA_LOADED_TABLE,
27800  *     # but it's absent in lua51
27801  *     luaL_findtable(L, lua.LUA_REGISTRYINDEX, "_LOADED", 1)             # <<<<<<<<<<<<<<
27802  *     lua.lua_getfield(L, -1, modname)
27803  *     if lua.lua_type(L, -1) != lua.LUA_TTABLE:
27804  */
27805   (void)(__pyx_f_4lupa_5_lupa_luaL_findtable(__pyx_v_L, LUA_REGISTRYINDEX, ((char const *)"_LOADED"), 1));
27806 
27807   /* "lupa/_lupa.pyx":1867
27808  *     # but it's absent in lua51
27809  *     luaL_findtable(L, lua.LUA_REGISTRYINDEX, "_LOADED", 1)
27810  *     lua.lua_getfield(L, -1, modname)             # <<<<<<<<<<<<<<
27811  *     if lua.lua_type(L, -1) != lua.LUA_TTABLE:
27812  *         lua.lua_pop(L, 1)
27813  */
27814   lua_getfield(__pyx_v_L, -1, __pyx_v_modname);
27815 
27816   /* "lupa/_lupa.pyx":1868
27817  *     luaL_findtable(L, lua.LUA_REGISTRYINDEX, "_LOADED", 1)
27818  *     lua.lua_getfield(L, -1, modname)
27819  *     if lua.lua_type(L, -1) != lua.LUA_TTABLE:             # <<<<<<<<<<<<<<
27820  *         lua.lua_pop(L, 1)
27821  *         lua.lua_getglobal(L, '_G')
27822  */
27823   __pyx_t_1 = ((lua_type(__pyx_v_L, -1) != LUA_TTABLE) != 0);
27824   if (__pyx_t_1) {
27825 
27826     /* "lupa/_lupa.pyx":1869
27827  *     lua.lua_getfield(L, -1, modname)
27828  *     if lua.lua_type(L, -1) != lua.LUA_TTABLE:
27829  *         lua.lua_pop(L, 1)             # <<<<<<<<<<<<<<
27830  *         lua.lua_getglobal(L, '_G')
27831  *         if luaL_findtable(L, 0, modname, size_hint) != NULL:
27832  */
27833     lua_pop(__pyx_v_L, 1);
27834 
27835     /* "lupa/_lupa.pyx":1870
27836  *     if lua.lua_type(L, -1) != lua.LUA_TTABLE:
27837  *         lua.lua_pop(L, 1)
27838  *         lua.lua_getglobal(L, '_G')             # <<<<<<<<<<<<<<
27839  *         if luaL_findtable(L, 0, modname, size_hint) != NULL:
27840  *             lua.luaL_error(L, "name conflict for module '%s'", modname)
27841  */
27842     lua_getglobal(__pyx_v_L, ((char *)"_G"));
27843 
27844     /* "lupa/_lupa.pyx":1871
27845  *         lua.lua_pop(L, 1)
27846  *         lua.lua_getglobal(L, '_G')
27847  *         if luaL_findtable(L, 0, modname, size_hint) != NULL:             # <<<<<<<<<<<<<<
27848  *             lua.luaL_error(L, "name conflict for module '%s'", modname)
27849  *         lua.lua_pushvalue(L, -1)
27850  */
27851     __pyx_t_1 = ((__pyx_f_4lupa_5_lupa_luaL_findtable(__pyx_v_L, 0, __pyx_v_modname, __pyx_v_size_hint) != NULL) != 0);
27852     if (__pyx_t_1) {
27853 
27854       /* "lupa/_lupa.pyx":1872
27855  *         lua.lua_getglobal(L, '_G')
27856  *         if luaL_findtable(L, 0, modname, size_hint) != NULL:
27857  *             lua.luaL_error(L, "name conflict for module '%s'", modname)             # <<<<<<<<<<<<<<
27858  *         lua.lua_pushvalue(L, -1)
27859  *         lua.lua_setfield(L, -3, modname)
27860  */
27861       (void)(luaL_error(__pyx_v_L, ((char *)"name conflict for module '%s'"), __pyx_v_modname));
27862 
27863       /* "lupa/_lupa.pyx":1871
27864  *         lua.lua_pop(L, 1)
27865  *         lua.lua_getglobal(L, '_G')
27866  *         if luaL_findtable(L, 0, modname, size_hint) != NULL:             # <<<<<<<<<<<<<<
27867  *             lua.luaL_error(L, "name conflict for module '%s'", modname)
27868  *         lua.lua_pushvalue(L, -1)
27869  */
27870     }
27871 
27872     /* "lupa/_lupa.pyx":1873
27873  *         if luaL_findtable(L, 0, modname, size_hint) != NULL:
27874  *             lua.luaL_error(L, "name conflict for module '%s'", modname)
27875  *         lua.lua_pushvalue(L, -1)             # <<<<<<<<<<<<<<
27876  *         lua.lua_setfield(L, -3, modname)
27877  *     lua.lua_remove(L, -2)
27878  */
27879     lua_pushvalue(__pyx_v_L, -1);
27880 
27881     /* "lupa/_lupa.pyx":1874
27882  *             lua.luaL_error(L, "name conflict for module '%s'", modname)
27883  *         lua.lua_pushvalue(L, -1)
27884  *         lua.lua_setfield(L, -3, modname)             # <<<<<<<<<<<<<<
27885  *     lua.lua_remove(L, -2)
27886  *
27887  */
27888     lua_setfield(__pyx_v_L, -3, __pyx_v_modname);
27889 
27890     /* "lupa/_lupa.pyx":1868
27891  *     luaL_findtable(L, lua.LUA_REGISTRYINDEX, "_LOADED", 1)
27892  *     lua.lua_getfield(L, -1, modname)
27893  *     if lua.lua_type(L, -1) != lua.LUA_TTABLE:             # <<<<<<<<<<<<<<
27894  *         lua.lua_pop(L, 1)
27895  *         lua.lua_getglobal(L, '_G')
27896  */
27897   }
27898 
27899   /* "lupa/_lupa.pyx":1875
27900  *         lua.lua_pushvalue(L, -1)
27901  *         lua.lua_setfield(L, -3, modname)
27902  *     lua.lua_remove(L, -2)             # <<<<<<<<<<<<<<
27903  *
27904  *
27905  */
27906   lua_remove(__pyx_v_L, -2);
27907 
27908   /* "lupa/_lupa.pyx":1863
27909  *
27910  *
27911  * cdef void luaL_pushmodule(lua_State *L, const char *modname, int size_hint):             # <<<<<<<<<<<<<<
27912  *     # XXX: "_LOADED" is the value of LUA_LOADED_TABLE,
27913  *     # but it's absent in lua51
27914  */
27915 
27916   /* function exit code */
27917   __Pyx_RefNannyFinishContext();
27918 }
27919 
27920 /* "lupa/_lupa.pyx":1878
27921  *
27922  *
27923  * cdef void luaL_openlib(lua_State *L, const char *libname,             # <<<<<<<<<<<<<<
27924  *                        const lua.luaL_Reg *l, int nup):
27925  *     if libname:
27926  */
27927 
__pyx_f_4lupa_5_lupa_luaL_openlib(lua_State * __pyx_v_L,char const * __pyx_v_libname,luaL_Reg const * __pyx_v_l,int __pyx_v_nup)27928 static void __pyx_f_4lupa_5_lupa_luaL_openlib(lua_State *__pyx_v_L, char const *__pyx_v_libname, luaL_Reg const *__pyx_v_l, int __pyx_v_nup) {
27929   __Pyx_RefNannyDeclarations
27930   int __pyx_t_1;
27931   __Pyx_RefNannySetupContext("luaL_openlib", 0);
27932 
27933   /* "lupa/_lupa.pyx":1880
27934  * cdef void luaL_openlib(lua_State *L, const char *libname,
27935  *                        const lua.luaL_Reg *l, int nup):
27936  *     if libname:             # <<<<<<<<<<<<<<
27937  *         luaL_pushmodule(L, libname, libsize(l))
27938  *         lua.lua_insert(L, -(nup + 1))
27939  */
27940   __pyx_t_1 = (__pyx_v_libname != 0);
27941   if (__pyx_t_1) {
27942 
27943     /* "lupa/_lupa.pyx":1881
27944  *                        const lua.luaL_Reg *l, int nup):
27945  *     if libname:
27946  *         luaL_pushmodule(L, libname, libsize(l))             # <<<<<<<<<<<<<<
27947  *         lua.lua_insert(L, -(nup + 1))
27948  *     if l:
27949  */
27950     __pyx_f_4lupa_5_lupa_luaL_pushmodule(__pyx_v_L, __pyx_v_libname, __pyx_f_4lupa_5_lupa_libsize(__pyx_v_l));
27951 
27952     /* "lupa/_lupa.pyx":1882
27953  *     if libname:
27954  *         luaL_pushmodule(L, libname, libsize(l))
27955  *         lua.lua_insert(L, -(nup + 1))             # <<<<<<<<<<<<<<
27956  *     if l:
27957  *         luaL_setfuncs(L, l, nup)
27958  */
27959     lua_insert(__pyx_v_L, (-(__pyx_v_nup + 1)));
27960 
27961     /* "lupa/_lupa.pyx":1880
27962  * cdef void luaL_openlib(lua_State *L, const char *libname,
27963  *                        const lua.luaL_Reg *l, int nup):
27964  *     if libname:             # <<<<<<<<<<<<<<
27965  *         luaL_pushmodule(L, libname, libsize(l))
27966  *         lua.lua_insert(L, -(nup + 1))
27967  */
27968   }
27969 
27970   /* "lupa/_lupa.pyx":1883
27971  *         luaL_pushmodule(L, libname, libsize(l))
27972  *         lua.lua_insert(L, -(nup + 1))
27973  *     if l:             # <<<<<<<<<<<<<<
27974  *         luaL_setfuncs(L, l, nup)
27975  *     else:
27976  */
27977   __pyx_t_1 = (__pyx_v_l != 0);
27978   if (__pyx_t_1) {
27979 
27980     /* "lupa/_lupa.pyx":1884
27981  *         lua.lua_insert(L, -(nup + 1))
27982  *     if l:
27983  *         luaL_setfuncs(L, l, nup)             # <<<<<<<<<<<<<<
27984  *     else:
27985  *         lua.lua_pop(L, nup)
27986  */
27987     __pyx_f_4lupa_5_lupa_luaL_setfuncs(__pyx_v_L, __pyx_v_l, __pyx_v_nup);
27988 
27989     /* "lupa/_lupa.pyx":1883
27990  *         luaL_pushmodule(L, libname, libsize(l))
27991  *         lua.lua_insert(L, -(nup + 1))
27992  *     if l:             # <<<<<<<<<<<<<<
27993  *         luaL_setfuncs(L, l, nup)
27994  *     else:
27995  */
27996     goto __pyx_L4;
27997   }
27998 
27999   /* "lupa/_lupa.pyx":1886
28000  *         luaL_setfuncs(L, l, nup)
28001  *     else:
28002  *         lua.lua_pop(L, nup)             # <<<<<<<<<<<<<<
28003  */
28004   /*else*/ {
28005     lua_pop(__pyx_v_L, __pyx_v_nup);
28006   }
28007   __pyx_L4:;
28008 
28009   /* "lupa/_lupa.pyx":1878
28010  *
28011  *
28012  * cdef void luaL_openlib(lua_State *L, const char *libname,             # <<<<<<<<<<<<<<
28013  *                        const lua.luaL_Reg *l, int nup):
28014  *     if libname:
28015  */
28016 
28017   /* function exit code */
28018   __Pyx_RefNannyFinishContext();
28019 }
28020 
__pyx_tp_new_4lupa_5_lupa_FastRLock(PyTypeObject * t,CYTHON_UNUSED PyObject * a,CYTHON_UNUSED PyObject * k)28021 static PyObject *__pyx_tp_new_4lupa_5_lupa_FastRLock(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
28022   PyObject *o;
28023   if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
28024     o = (*t->tp_alloc)(t, 0);
28025   } else {
28026     o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
28027   }
28028   if (unlikely(!o)) return 0;
28029   if (unlikely(__pyx_pw_4lupa_5_lupa_9FastRLock_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) goto bad;
28030   return o;
28031   bad:
28032   Py_DECREF(o); o = 0;
28033   return NULL;
28034 }
28035 
__pyx_tp_dealloc_4lupa_5_lupa_FastRLock(PyObject * o)28036 static void __pyx_tp_dealloc_4lupa_5_lupa_FastRLock(PyObject *o) {
28037   #if CYTHON_USE_TP_FINALIZE
28038   if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
28039     if (PyObject_CallFinalizerFromDealloc(o)) return;
28040   }
28041   #endif
28042   {
28043     PyObject *etype, *eval, *etb;
28044     PyErr_Fetch(&etype, &eval, &etb);
28045     __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
28046     __pyx_pw_4lupa_5_lupa_9FastRLock_3__dealloc__(o);
28047     __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
28048     PyErr_Restore(etype, eval, etb);
28049   }
28050   (*Py_TYPE(o)->tp_free)(o);
28051 }
28052 
28053 static PyMethodDef __pyx_methods_4lupa_5_lupa_FastRLock[] = {
28054   {"acquire", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lupa_5_lupa_9FastRLock_5acquire, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4lupa_5_lupa_9FastRLock_4acquire},
28055   {"release", (PyCFunction)__pyx_pw_4lupa_5_lupa_9FastRLock_7release, METH_NOARGS, __pyx_doc_4lupa_5_lupa_9FastRLock_6release},
28056   {"__enter__", (PyCFunction)__pyx_pw_4lupa_5_lupa_9FastRLock_9__enter__, METH_NOARGS, __pyx_doc_4lupa_5_lupa_9FastRLock_8__enter__},
28057   {"__exit__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lupa_5_lupa_9FastRLock_11__exit__, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4lupa_5_lupa_9FastRLock_10__exit__},
28058   {"_is_owned", (PyCFunction)__pyx_pw_4lupa_5_lupa_9FastRLock_13_is_owned, METH_NOARGS, __pyx_doc_4lupa_5_lupa_9FastRLock_12_is_owned},
28059   {"__reduce_cython__", (PyCFunction)__pyx_pw_4lupa_5_lupa_9FastRLock_15__reduce_cython__, METH_NOARGS, __pyx_doc_4lupa_5_lupa_9FastRLock_14__reduce_cython__},
28060   {"__setstate_cython__", (PyCFunction)__pyx_pw_4lupa_5_lupa_9FastRLock_17__setstate_cython__, METH_O, __pyx_doc_4lupa_5_lupa_9FastRLock_16__setstate_cython__},
28061   {0, 0, 0, 0}
28062 };
28063 
28064 static PyTypeObject __pyx_type_4lupa_5_lupa_FastRLock = {
28065   PyVarObject_HEAD_INIT(0, 0)
28066   "lupa._lupa.FastRLock", /*tp_name*/
28067   sizeof(struct __pyx_obj_4lupa_5_lupa_FastRLock), /*tp_basicsize*/
28068   0, /*tp_itemsize*/
28069   __pyx_tp_dealloc_4lupa_5_lupa_FastRLock, /*tp_dealloc*/
28070   #if PY_VERSION_HEX < 0x030800b4
28071   0, /*tp_print*/
28072   #endif
28073   #if PY_VERSION_HEX >= 0x030800b4
28074   0, /*tp_vectorcall_offset*/
28075   #endif
28076   0, /*tp_getattr*/
28077   0, /*tp_setattr*/
28078   #if PY_MAJOR_VERSION < 3
28079   0, /*tp_compare*/
28080   #endif
28081   #if PY_MAJOR_VERSION >= 3
28082   0, /*tp_as_async*/
28083   #endif
28084   0, /*tp_repr*/
28085   0, /*tp_as_number*/
28086   0, /*tp_as_sequence*/
28087   0, /*tp_as_mapping*/
28088   0, /*tp_hash*/
28089   0, /*tp_call*/
28090   0, /*tp_str*/
28091   0, /*tp_getattro*/
28092   0, /*tp_setattro*/
28093   0, /*tp_as_buffer*/
28094   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
28095   "Fast, re-entrant locking.\n\n    Under uncongested conditions, the lock is never acquired but only\n    counted.  Only when a second thread comes in and notices that the\n    lock is needed, it acquires the lock and notifies the first thread\n    to release it when it's done.  This is all made possible by the\n    wonderful GIL.\n    ", /*tp_doc*/
28096   0, /*tp_traverse*/
28097   0, /*tp_clear*/
28098   0, /*tp_richcompare*/
28099   0, /*tp_weaklistoffset*/
28100   0, /*tp_iter*/
28101   0, /*tp_iternext*/
28102   __pyx_methods_4lupa_5_lupa_FastRLock, /*tp_methods*/
28103   0, /*tp_members*/
28104   0, /*tp_getset*/
28105   0, /*tp_base*/
28106   0, /*tp_dict*/
28107   0, /*tp_descr_get*/
28108   0, /*tp_descr_set*/
28109   0, /*tp_dictoffset*/
28110   0, /*tp_init*/
28111   0, /*tp_alloc*/
28112   __pyx_tp_new_4lupa_5_lupa_FastRLock, /*tp_new*/
28113   0, /*tp_free*/
28114   0, /*tp_is_gc*/
28115   0, /*tp_bases*/
28116   0, /*tp_mro*/
28117   0, /*tp_cache*/
28118   0, /*tp_subclasses*/
28119   0, /*tp_weaklist*/
28120   0, /*tp_del*/
28121   0, /*tp_version_tag*/
28122   #if PY_VERSION_HEX >= 0x030400a1
28123   0, /*tp_finalize*/
28124   #endif
28125   #if PY_VERSION_HEX >= 0x030800b1
28126   0, /*tp_vectorcall*/
28127   #endif
28128   #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
28129   0, /*tp_print*/
28130   #endif
28131 };
28132 static struct __pyx_vtabstruct_4lupa_5_lupa_LuaRuntime __pyx_vtable_4lupa_5_lupa_LuaRuntime;
28133 
__pyx_tp_new_4lupa_5_lupa_LuaRuntime(PyTypeObject * t,PyObject * a,PyObject * k)28134 static PyObject *__pyx_tp_new_4lupa_5_lupa_LuaRuntime(PyTypeObject *t, PyObject *a, PyObject *k) {
28135   struct __pyx_obj_4lupa_5_lupa_LuaRuntime *p;
28136   PyObject *o;
28137   if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
28138     o = (*t->tp_alloc)(t, 0);
28139   } else {
28140     o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
28141   }
28142   if (unlikely(!o)) return 0;
28143   p = ((struct __pyx_obj_4lupa_5_lupa_LuaRuntime *)o);
28144   p->__pyx_vtab = __pyx_vtabptr_4lupa_5_lupa_LuaRuntime;
28145   p->_lock = ((struct __pyx_obj_4lupa_5_lupa_FastRLock *)Py_None); Py_INCREF(Py_None);
28146   p->_pyrefs_in_lua = ((PyObject*)Py_None); Py_INCREF(Py_None);
28147   p->_raised_exception = ((PyObject*)Py_None); Py_INCREF(Py_None);
28148   p->_encoding = ((PyObject*)Py_None); Py_INCREF(Py_None);
28149   p->_source_encoding = ((PyObject*)Py_None); Py_INCREF(Py_None);
28150   p->_attribute_filter = Py_None; Py_INCREF(Py_None);
28151   p->_attribute_getter = Py_None; Py_INCREF(Py_None);
28152   p->_attribute_setter = Py_None; Py_INCREF(Py_None);
28153   if (unlikely(__pyx_pw_4lupa_5_lupa_10LuaRuntime_1__cinit__(o, a, k) < 0)) goto bad;
28154   return o;
28155   bad:
28156   Py_DECREF(o); o = 0;
28157   return NULL;
28158 }
28159 
__pyx_tp_dealloc_4lupa_5_lupa_LuaRuntime(PyObject * o)28160 static void __pyx_tp_dealloc_4lupa_5_lupa_LuaRuntime(PyObject *o) {
28161   struct __pyx_obj_4lupa_5_lupa_LuaRuntime *p = (struct __pyx_obj_4lupa_5_lupa_LuaRuntime *)o;
28162   #if CYTHON_USE_TP_FINALIZE
28163   if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
28164     if (PyObject_CallFinalizerFromDealloc(o)) return;
28165   }
28166   #endif
28167   PyObject_GC_UnTrack(o);
28168   {
28169     PyObject *etype, *eval, *etb;
28170     PyErr_Fetch(&etype, &eval, &etb);
28171     __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
28172     __pyx_pw_4lupa_5_lupa_10LuaRuntime_3__dealloc__(o);
28173     __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
28174     PyErr_Restore(etype, eval, etb);
28175   }
28176   Py_CLEAR(p->_lock);
28177   Py_CLEAR(p->_pyrefs_in_lua);
28178   Py_CLEAR(p->_raised_exception);
28179   Py_CLEAR(p->_encoding);
28180   Py_CLEAR(p->_source_encoding);
28181   Py_CLEAR(p->_attribute_filter);
28182   Py_CLEAR(p->_attribute_getter);
28183   Py_CLEAR(p->_attribute_setter);
28184   (*Py_TYPE(o)->tp_free)(o);
28185 }
28186 
__pyx_tp_traverse_4lupa_5_lupa_LuaRuntime(PyObject * o,visitproc v,void * a)28187 static int __pyx_tp_traverse_4lupa_5_lupa_LuaRuntime(PyObject *o, visitproc v, void *a) {
28188   int e;
28189   struct __pyx_obj_4lupa_5_lupa_LuaRuntime *p = (struct __pyx_obj_4lupa_5_lupa_LuaRuntime *)o;
28190   if (p->_lock) {
28191     e = (*v)(((PyObject *)p->_lock), a); if (e) return e;
28192   }
28193   if (p->_pyrefs_in_lua) {
28194     e = (*v)(p->_pyrefs_in_lua, a); if (e) return e;
28195   }
28196   if (p->_raised_exception) {
28197     e = (*v)(p->_raised_exception, a); if (e) return e;
28198   }
28199   if (p->_attribute_filter) {
28200     e = (*v)(p->_attribute_filter, a); if (e) return e;
28201   }
28202   if (p->_attribute_getter) {
28203     e = (*v)(p->_attribute_getter, a); if (e) return e;
28204   }
28205   if (p->_attribute_setter) {
28206     e = (*v)(p->_attribute_setter, a); if (e) return e;
28207   }
28208   return 0;
28209 }
28210 
__pyx_getprop_4lupa_5_lupa_10LuaRuntime_lua_version(PyObject * o,CYTHON_UNUSED void * x)28211 static PyObject *__pyx_getprop_4lupa_5_lupa_10LuaRuntime_lua_version(PyObject *o, CYTHON_UNUSED void *x) {
28212   return __pyx_pw_4lupa_5_lupa_10LuaRuntime_11lua_version_1__get__(o);
28213 }
28214 
__pyx_getprop_4lupa_5_lupa_10LuaRuntime_lua_implementation(PyObject * o,CYTHON_UNUSED void * x)28215 static PyObject *__pyx_getprop_4lupa_5_lupa_10LuaRuntime_lua_implementation(PyObject *o, CYTHON_UNUSED void *x) {
28216   return __pyx_pw_4lupa_5_lupa_10LuaRuntime_18lua_implementation_1__get__(o);
28217 }
28218 
28219 static PyMethodDef __pyx_methods_4lupa_5_lupa_LuaRuntime[] = {
28220   {"eval", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lupa_5_lupa_10LuaRuntime_5eval, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4lupa_5_lupa_10LuaRuntime_4eval},
28221   {"execute", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lupa_5_lupa_10LuaRuntime_7execute, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4lupa_5_lupa_10LuaRuntime_6execute},
28222   {"compile", (PyCFunction)__pyx_pw_4lupa_5_lupa_10LuaRuntime_9compile, METH_O, __pyx_doc_4lupa_5_lupa_10LuaRuntime_8compile},
28223   {"require", (PyCFunction)__pyx_pw_4lupa_5_lupa_10LuaRuntime_11require, METH_O, __pyx_doc_4lupa_5_lupa_10LuaRuntime_10require},
28224   {"globals", (PyCFunction)__pyx_pw_4lupa_5_lupa_10LuaRuntime_13globals, METH_NOARGS, __pyx_doc_4lupa_5_lupa_10LuaRuntime_12globals},
28225   {"table", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lupa_5_lupa_10LuaRuntime_15table, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4lupa_5_lupa_10LuaRuntime_14table},
28226   {"table_from", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lupa_5_lupa_10LuaRuntime_17table_from, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4lupa_5_lupa_10LuaRuntime_16table_from},
28227   {"__reduce_cython__", (PyCFunction)__pyx_pw_4lupa_5_lupa_10LuaRuntime_19__reduce_cython__, METH_NOARGS, __pyx_doc_4lupa_5_lupa_10LuaRuntime_18__reduce_cython__},
28228   {"__setstate_cython__", (PyCFunction)__pyx_pw_4lupa_5_lupa_10LuaRuntime_21__setstate_cython__, METH_O, __pyx_doc_4lupa_5_lupa_10LuaRuntime_20__setstate_cython__},
28229   {0, 0, 0, 0}
28230 };
28231 
28232 static struct PyGetSetDef __pyx_getsets_4lupa_5_lupa_LuaRuntime[] = {
28233   {(char *)"lua_version", __pyx_getprop_4lupa_5_lupa_10LuaRuntime_lua_version, 0, (char *)"\n        The Lua runtime/language version as tuple, e.g. (5, 3) for Lua 5.3.\n        ", 0},
28234   {(char *)"lua_implementation", __pyx_getprop_4lupa_5_lupa_10LuaRuntime_lua_implementation, 0, (char *)"\n        The Lua implementation version string, e.g. \"Lua 5.3\" or \"LuaJIT 2.0.1\".\n        May execute Lua code.\n        ", 0},
28235   {0, 0, 0, 0, 0}
28236 };
28237 
28238 static PyTypeObject __pyx_type_4lupa_5_lupa_LuaRuntime = {
28239   PyVarObject_HEAD_INIT(0, 0)
28240   "lupa._lupa.LuaRuntime", /*tp_name*/
28241   sizeof(struct __pyx_obj_4lupa_5_lupa_LuaRuntime), /*tp_basicsize*/
28242   0, /*tp_itemsize*/
28243   __pyx_tp_dealloc_4lupa_5_lupa_LuaRuntime, /*tp_dealloc*/
28244   #if PY_VERSION_HEX < 0x030800b4
28245   0, /*tp_print*/
28246   #endif
28247   #if PY_VERSION_HEX >= 0x030800b4
28248   0, /*tp_vectorcall_offset*/
28249   #endif
28250   0, /*tp_getattr*/
28251   0, /*tp_setattr*/
28252   #if PY_MAJOR_VERSION < 3
28253   0, /*tp_compare*/
28254   #endif
28255   #if PY_MAJOR_VERSION >= 3
28256   0, /*tp_as_async*/
28257   #endif
28258   0, /*tp_repr*/
28259   0, /*tp_as_number*/
28260   0, /*tp_as_sequence*/
28261   0, /*tp_as_mapping*/
28262   0, /*tp_hash*/
28263   0, /*tp_call*/
28264   0, /*tp_str*/
28265   0, /*tp_getattro*/
28266   0, /*tp_setattro*/
28267   0, /*tp_as_buffer*/
28268   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
28269   "The main entry point to the Lua runtime.\n\n    Available options:\n\n    * ``encoding``: the string encoding, defaulting to UTF-8.  If set\n      to ``None``, all string values will be returned as byte strings.\n      Otherwise, they will be decoded to unicode strings on the way\n      from Lua to Python and unicode strings will be encoded on the\n      way to Lua.  Note that ``str()`` calls on Lua objects will\n      always return a unicode object.\n\n    * ``source_encoding``: the encoding used for Lua code, defaulting to\n      the string encoding or UTF-8 if the string encoding is ``None``.\n\n    * ``attribute_filter``: filter function for attribute access\n      (get/set).  Must have the signature ``func(obj, attr_name,\n      is_setting)``, where ``is_setting`` is True when the attribute\n      is being set.  If provided, the function will be called for all\n      Python object attributes that are being accessed from Lua code.\n      Normally, it should return an attribute name that will then be\n      used for the lookup.  If it wants to prevent access, it should\n      raise an ``AttributeError``.  Note that Lua does not guarantee\n      that the names will be strings.  (New in Lupa 0.20)\n\n    * ``attribute_handlers``: like ``attribute_filter`` above, but\n      handles the getting/setting itself rather than giving hints\n      to the LuaRuntime.  This must be a 2-tuple, ``(getter, setter)``\n      where ``getter`` has the signature ``func(obj, attr_name)``\n      and either returns the value for ``obj.attr_name`` or raises an\n      ``AttributeError``  The function ``setter`` has the signature\n      ``func(obj, attr_name, value)`` and may raise an ``AttributeError``.\n      The return value of the setter is unused.  (New in Lupa 1.0)\n\n    * ``register_eval``: should Python's ``eval()`` function be available\n      to Lua code as ``python.eval()``?  Note that this does not remove it\n      from the builtins.  Use an ``attribute_filter`` function for t""hat.\n      (default: True)\n\n    * ``register_builtins``: should Python's builtins be available to Lua\n      code as ``python.builtins.*``?  Note that this does not prevent access\n      to the globals available as special Python function attributes, for\n      example.  Use an ``attribute_filter`` function for that.\n      (default: True, new in Lupa 1.2)\n\n    * ``unpack_returned_tuples``: should Python tuples be unpacked in Lua?\n      If ``py_fun()`` returns ``(1, 2, 3)``, then does ``a, b, c = py_fun()``\n      give ``a == 1 and b == 2 and c == 3`` or does it give\n      ``a == (1,2,3), b == nil, c == nil``?  ``unpack_returned_tuples=True``\n      gives the former.\n      (default: False, new in Lupa 0.21)\n\n    Example usage::\n\n      >>> from lupa import LuaRuntime\n      >>> lua = LuaRuntime()\n\n      >>> lua.eval('1+1')\n      2\n\n      >>> lua_func = lua.eval('function(f, n) return f(n) end')\n\n      >>> def py_add1(n): return n+1\n      >>> lua_func(py_add1, 2)\n      3\n    ", /*tp_doc*/
28270   __pyx_tp_traverse_4lupa_5_lupa_LuaRuntime, /*tp_traverse*/
28271   0, /*tp_clear*/
28272   0, /*tp_richcompare*/
28273   0, /*tp_weaklistoffset*/
28274   0, /*tp_iter*/
28275   0, /*tp_iternext*/
28276   __pyx_methods_4lupa_5_lupa_LuaRuntime, /*tp_methods*/
28277   0, /*tp_members*/
28278   __pyx_getsets_4lupa_5_lupa_LuaRuntime, /*tp_getset*/
28279   0, /*tp_base*/
28280   0, /*tp_dict*/
28281   0, /*tp_descr_get*/
28282   0, /*tp_descr_set*/
28283   0, /*tp_dictoffset*/
28284   0, /*tp_init*/
28285   0, /*tp_alloc*/
28286   __pyx_tp_new_4lupa_5_lupa_LuaRuntime, /*tp_new*/
28287   0, /*tp_free*/
28288   0, /*tp_is_gc*/
28289   0, /*tp_bases*/
28290   0, /*tp_mro*/
28291   0, /*tp_cache*/
28292   0, /*tp_subclasses*/
28293   0, /*tp_weaklist*/
28294   0, /*tp_del*/
28295   0, /*tp_version_tag*/
28296   #if PY_VERSION_HEX >= 0x030400a1
28297   0, /*tp_finalize*/
28298   #endif
28299   #if PY_VERSION_HEX >= 0x030800b1
28300   0, /*tp_vectorcall*/
28301   #endif
28302   #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
28303   0, /*tp_print*/
28304   #endif
28305 };
28306 static struct __pyx_vtabstruct_4lupa_5_lupa__LuaObject __pyx_vtable_4lupa_5_lupa__LuaObject;
28307 
28308 static struct __pyx_obj_4lupa_5_lupa__LuaObject *__pyx_freelist_4lupa_5_lupa__LuaObject[16];
28309 static int __pyx_freecount_4lupa_5_lupa__LuaObject = 0;
28310 
__pyx_tp_new_4lupa_5_lupa__LuaObject(PyTypeObject * t,CYTHON_UNUSED PyObject * a,CYTHON_UNUSED PyObject * k)28311 static PyObject *__pyx_tp_new_4lupa_5_lupa__LuaObject(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
28312   struct __pyx_obj_4lupa_5_lupa__LuaObject *p;
28313   PyObject *o;
28314   if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4lupa_5_lupa__LuaObject > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4lupa_5_lupa__LuaObject)) & ((t->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)) == 0))) {
28315     o = (PyObject*)__pyx_freelist_4lupa_5_lupa__LuaObject[--__pyx_freecount_4lupa_5_lupa__LuaObject];
28316     memset(o, 0, sizeof(struct __pyx_obj_4lupa_5_lupa__LuaObject));
28317     (void) PyObject_INIT(o, t);
28318     PyObject_GC_Track(o);
28319   } else {
28320     if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
28321       o = (*t->tp_alloc)(t, 0);
28322     } else {
28323       o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
28324     }
28325     if (unlikely(!o)) return 0;
28326   }
28327   p = ((struct __pyx_obj_4lupa_5_lupa__LuaObject *)o);
28328   p->__pyx_vtab = __pyx_vtabptr_4lupa_5_lupa__LuaObject;
28329   p->_runtime = ((struct __pyx_obj_4lupa_5_lupa_LuaRuntime *)Py_None); Py_INCREF(Py_None);
28330   return o;
28331 }
28332 
__pyx_tp_dealloc_4lupa_5_lupa__LuaObject(PyObject * o)28333 static void __pyx_tp_dealloc_4lupa_5_lupa__LuaObject(PyObject *o) {
28334   struct __pyx_obj_4lupa_5_lupa__LuaObject *p = (struct __pyx_obj_4lupa_5_lupa__LuaObject *)o;
28335   #if CYTHON_USE_TP_FINALIZE
28336   if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
28337     if (PyObject_CallFinalizerFromDealloc(o)) return;
28338   }
28339   #endif
28340   PyObject_GC_UnTrack(o);
28341   {
28342     PyObject *etype, *eval, *etb;
28343     PyErr_Fetch(&etype, &eval, &etb);
28344     __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
28345     __pyx_pw_4lupa_5_lupa_10_LuaObject_3__dealloc__(o);
28346     __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
28347     PyErr_Restore(etype, eval, etb);
28348   }
28349   Py_CLEAR(p->_runtime);
28350   if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4lupa_5_lupa__LuaObject < 16) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4lupa_5_lupa__LuaObject)) & ((Py_TYPE(o)->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)) == 0))) {
28351     __pyx_freelist_4lupa_5_lupa__LuaObject[__pyx_freecount_4lupa_5_lupa__LuaObject++] = ((struct __pyx_obj_4lupa_5_lupa__LuaObject *)o);
28352   } else {
28353     (*Py_TYPE(o)->tp_free)(o);
28354   }
28355 }
28356 
__pyx_tp_traverse_4lupa_5_lupa__LuaObject(PyObject * o,visitproc v,void * a)28357 static int __pyx_tp_traverse_4lupa_5_lupa__LuaObject(PyObject *o, visitproc v, void *a) {
28358   int e;
28359   struct __pyx_obj_4lupa_5_lupa__LuaObject *p = (struct __pyx_obj_4lupa_5_lupa__LuaObject *)o;
28360   if (p->_runtime) {
28361     e = (*v)(((PyObject *)p->_runtime), a); if (e) return e;
28362   }
28363   return 0;
28364 }
__pyx_sq_item_4lupa_5_lupa__LuaObject(PyObject * o,Py_ssize_t i)28365 static PyObject *__pyx_sq_item_4lupa_5_lupa__LuaObject(PyObject *o, Py_ssize_t i) {
28366   PyObject *r;
28367   PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
28368   r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
28369   Py_DECREF(x);
28370   return r;
28371 }
28372 
__pyx_tp_getattro_4lupa_5_lupa__LuaObject(PyObject * o,PyObject * n)28373 static PyObject *__pyx_tp_getattro_4lupa_5_lupa__LuaObject(PyObject *o, PyObject *n) {
28374   PyObject *v = __Pyx_PyObject_GenericGetAttr(o, n);
28375   if (!v && PyErr_ExceptionMatches(PyExc_AttributeError)) {
28376     PyErr_Clear();
28377     v = __pyx_pw_4lupa_5_lupa_10_LuaObject_17__getattr__(o, n);
28378   }
28379   return v;
28380 }
28381 
28382 static PyMethodDef __pyx_methods_4lupa_5_lupa__LuaObject[] = {
28383   {"__getattr__", (PyCFunction)__pyx_pw_4lupa_5_lupa_10_LuaObject_17__getattr__, METH_O|METH_COEXIST, 0},
28384   {"__reduce_cython__", (PyCFunction)__pyx_pw_4lupa_5_lupa_10_LuaObject_21__reduce_cython__, METH_NOARGS, __pyx_doc_4lupa_5_lupa_10_LuaObject_20__reduce_cython__},
28385   {"__setstate_cython__", (PyCFunction)__pyx_pw_4lupa_5_lupa_10_LuaObject_23__setstate_cython__, METH_O, __pyx_doc_4lupa_5_lupa_10_LuaObject_22__setstate_cython__},
28386   {0, 0, 0, 0}
28387 };
28388 
28389 static PyNumberMethods __pyx_tp_as_number__LuaObject = {
28390   0, /*nb_add*/
28391   0, /*nb_subtract*/
28392   0, /*nb_multiply*/
28393   #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
28394   0, /*nb_divide*/
28395   #endif
28396   0, /*nb_remainder*/
28397   0, /*nb_divmod*/
28398   0, /*nb_power*/
28399   0, /*nb_negative*/
28400   0, /*nb_positive*/
28401   0, /*nb_absolute*/
28402   __pyx_pw_4lupa_5_lupa_10_LuaObject_9__nonzero__, /*nb_nonzero*/
28403   0, /*nb_invert*/
28404   0, /*nb_lshift*/
28405   0, /*nb_rshift*/
28406   0, /*nb_and*/
28407   0, /*nb_xor*/
28408   0, /*nb_or*/
28409   #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
28410   0, /*nb_coerce*/
28411   #endif
28412   0, /*nb_int*/
28413   #if PY_MAJOR_VERSION < 3
28414   0, /*nb_long*/
28415   #else
28416   0, /*reserved*/
28417   #endif
28418   0, /*nb_float*/
28419   #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
28420   0, /*nb_oct*/
28421   #endif
28422   #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
28423   0, /*nb_hex*/
28424   #endif
28425   0, /*nb_inplace_add*/
28426   0, /*nb_inplace_subtract*/
28427   0, /*nb_inplace_multiply*/
28428   #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
28429   0, /*nb_inplace_divide*/
28430   #endif
28431   0, /*nb_inplace_remainder*/
28432   0, /*nb_inplace_power*/
28433   0, /*nb_inplace_lshift*/
28434   0, /*nb_inplace_rshift*/
28435   0, /*nb_inplace_and*/
28436   0, /*nb_inplace_xor*/
28437   0, /*nb_inplace_or*/
28438   0, /*nb_floor_divide*/
28439   0, /*nb_true_divide*/
28440   0, /*nb_inplace_floor_divide*/
28441   0, /*nb_inplace_true_divide*/
28442   0, /*nb_index*/
28443   #if PY_VERSION_HEX >= 0x03050000
28444   0, /*nb_matrix_multiply*/
28445   #endif
28446   #if PY_VERSION_HEX >= 0x03050000
28447   0, /*nb_inplace_matrix_multiply*/
28448   #endif
28449 };
28450 
28451 static PySequenceMethods __pyx_tp_as_sequence__LuaObject = {
28452   __pyx_pw_4lupa_5_lupa_10_LuaObject_7__len__, /*sq_length*/
28453   0, /*sq_concat*/
28454   0, /*sq_repeat*/
28455   __pyx_sq_item_4lupa_5_lupa__LuaObject, /*sq_item*/
28456   0, /*sq_slice*/
28457   0, /*sq_ass_item*/
28458   0, /*sq_ass_slice*/
28459   0, /*sq_contains*/
28460   0, /*sq_inplace_concat*/
28461   0, /*sq_inplace_repeat*/
28462 };
28463 
28464 static PyMappingMethods __pyx_tp_as_mapping__LuaObject = {
28465   __pyx_pw_4lupa_5_lupa_10_LuaObject_7__len__, /*mp_length*/
28466   __pyx_pw_4lupa_5_lupa_10_LuaObject_19__getitem__, /*mp_subscript*/
28467   0, /*mp_ass_subscript*/
28468 };
28469 
28470 static PyTypeObject __pyx_type_4lupa_5_lupa__LuaObject = {
28471   PyVarObject_HEAD_INIT(0, 0)
28472   "lupa._lupa._LuaObject", /*tp_name*/
28473   sizeof(struct __pyx_obj_4lupa_5_lupa__LuaObject), /*tp_basicsize*/
28474   0, /*tp_itemsize*/
28475   __pyx_tp_dealloc_4lupa_5_lupa__LuaObject, /*tp_dealloc*/
28476   #if PY_VERSION_HEX < 0x030800b4
28477   0, /*tp_print*/
28478   #endif
28479   #if PY_VERSION_HEX >= 0x030800b4
28480   0, /*tp_vectorcall_offset*/
28481   #endif
28482   0, /*tp_getattr*/
28483   0, /*tp_setattr*/
28484   #if PY_MAJOR_VERSION < 3
28485   0, /*tp_compare*/
28486   #endif
28487   #if PY_MAJOR_VERSION >= 3
28488   0, /*tp_as_async*/
28489   #endif
28490   __pyx_pw_4lupa_5_lupa_10_LuaObject_13__repr__, /*tp_repr*/
28491   &__pyx_tp_as_number__LuaObject, /*tp_as_number*/
28492   &__pyx_tp_as_sequence__LuaObject, /*tp_as_sequence*/
28493   &__pyx_tp_as_mapping__LuaObject, /*tp_as_mapping*/
28494   0, /*tp_hash*/
28495   __pyx_pw_4lupa_5_lupa_10_LuaObject_5__call__, /*tp_call*/
28496   __pyx_pw_4lupa_5_lupa_10_LuaObject_15__str__, /*tp_str*/
28497   __pyx_tp_getattro_4lupa_5_lupa__LuaObject, /*tp_getattro*/
28498   0, /*tp_setattro*/
28499   0, /*tp_as_buffer*/
28500   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
28501   "_LuaObject()\nA wrapper around a Lua object such as a table or function.\n    ", /*tp_doc*/
28502   __pyx_tp_traverse_4lupa_5_lupa__LuaObject, /*tp_traverse*/
28503   0, /*tp_clear*/
28504   0, /*tp_richcompare*/
28505   0, /*tp_weaklistoffset*/
28506   __pyx_pw_4lupa_5_lupa_10_LuaObject_11__iter__, /*tp_iter*/
28507   0, /*tp_iternext*/
28508   __pyx_methods_4lupa_5_lupa__LuaObject, /*tp_methods*/
28509   0, /*tp_members*/
28510   0, /*tp_getset*/
28511   0, /*tp_base*/
28512   0, /*tp_dict*/
28513   0, /*tp_descr_get*/
28514   0, /*tp_descr_set*/
28515   0, /*tp_dictoffset*/
28516   __pyx_pw_4lupa_5_lupa_10_LuaObject_1__init__, /*tp_init*/
28517   0, /*tp_alloc*/
28518   __pyx_tp_new_4lupa_5_lupa__LuaObject, /*tp_new*/
28519   0, /*tp_free*/
28520   0, /*tp_is_gc*/
28521   0, /*tp_bases*/
28522   0, /*tp_mro*/
28523   0, /*tp_cache*/
28524   0, /*tp_subclasses*/
28525   0, /*tp_weaklist*/
28526   0, /*tp_del*/
28527   0, /*tp_version_tag*/
28528   #if PY_VERSION_HEX >= 0x030400a1
28529   0, /*tp_finalize*/
28530   #endif
28531   #if PY_VERSION_HEX >= 0x030800b1
28532   0, /*tp_vectorcall*/
28533   #endif
28534   #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
28535   0, /*tp_print*/
28536   #endif
28537 };
28538 static struct __pyx_vtabstruct_4lupa_5_lupa__LuaTable __pyx_vtable_4lupa_5_lupa__LuaTable;
28539 
__pyx_tp_new_4lupa_5_lupa__LuaTable(PyTypeObject * t,PyObject * a,PyObject * k)28540 static PyObject *__pyx_tp_new_4lupa_5_lupa__LuaTable(PyTypeObject *t, PyObject *a, PyObject *k) {
28541   struct __pyx_obj_4lupa_5_lupa__LuaTable *p;
28542   PyObject *o = __pyx_tp_new_4lupa_5_lupa__LuaObject(t, a, k);
28543   if (unlikely(!o)) return 0;
28544   p = ((struct __pyx_obj_4lupa_5_lupa__LuaTable *)o);
28545   p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lupa_5_lupa__LuaObject*)__pyx_vtabptr_4lupa_5_lupa__LuaTable;
28546   return o;
28547 }
28548 
__pyx_mp_ass_subscript_4lupa_5_lupa__LuaTable(PyObject * o,PyObject * i,PyObject * v)28549 static int __pyx_mp_ass_subscript_4lupa_5_lupa__LuaTable(PyObject *o, PyObject *i, PyObject *v) {
28550   if (v) {
28551     return __pyx_pw_4lupa_5_lupa_9_LuaTable_11__setitem__(o, i, v);
28552   }
28553   else {
28554     return __pyx_pw_4lupa_5_lupa_9_LuaTable_15__delitem__(o, i);
28555   }
28556 }
28557 
__pyx_tp_setattro_4lupa_5_lupa__LuaTable(PyObject * o,PyObject * n,PyObject * v)28558 static int __pyx_tp_setattro_4lupa_5_lupa__LuaTable(PyObject *o, PyObject *n, PyObject *v) {
28559   if (v) {
28560     return __pyx_pw_4lupa_5_lupa_9_LuaTable_9__setattr__(o, n, v);
28561   }
28562   else {
28563     return __pyx_pw_4lupa_5_lupa_9_LuaTable_13__delattr__(o, n);
28564   }
28565 }
28566 
28567 static PyMethodDef __pyx_methods_4lupa_5_lupa__LuaTable[] = {
28568   {"keys", (PyCFunction)__pyx_pw_4lupa_5_lupa_9_LuaTable_3keys, METH_NOARGS, __pyx_doc_4lupa_5_lupa_9_LuaTable_2keys},
28569   {"values", (PyCFunction)__pyx_pw_4lupa_5_lupa_9_LuaTable_5values, METH_NOARGS, __pyx_doc_4lupa_5_lupa_9_LuaTable_4values},
28570   {"items", (PyCFunction)__pyx_pw_4lupa_5_lupa_9_LuaTable_7items, METH_NOARGS, __pyx_doc_4lupa_5_lupa_9_LuaTable_6items},
28571   {"__reduce_cython__", (PyCFunction)__pyx_pw_4lupa_5_lupa_9_LuaTable_17__reduce_cython__, METH_NOARGS, __pyx_doc_4lupa_5_lupa_9_LuaTable_16__reduce_cython__},
28572   {"__setstate_cython__", (PyCFunction)__pyx_pw_4lupa_5_lupa_9_LuaTable_19__setstate_cython__, METH_O, __pyx_doc_4lupa_5_lupa_9_LuaTable_18__setstate_cython__},
28573   {0, 0, 0, 0}
28574 };
28575 
28576 static PyMappingMethods __pyx_tp_as_mapping__LuaTable = {
28577   #if CYTHON_COMPILING_IN_PYPY
28578   __pyx_pw_4lupa_5_lupa_10_LuaObject_7__len__, /*mp_length*/
28579   #else
28580   0, /*mp_length*/
28581   #endif
28582   #if CYTHON_COMPILING_IN_PYPY
28583   __pyx_pw_4lupa_5_lupa_10_LuaObject_19__getitem__, /*mp_subscript*/
28584   #else
28585   0, /*mp_subscript*/
28586   #endif
28587   __pyx_mp_ass_subscript_4lupa_5_lupa__LuaTable, /*mp_ass_subscript*/
28588 };
28589 
28590 static PyTypeObject __pyx_type_4lupa_5_lupa__LuaTable = {
28591   PyVarObject_HEAD_INIT(0, 0)
28592   "lupa._lupa._LuaTable", /*tp_name*/
28593   sizeof(struct __pyx_obj_4lupa_5_lupa__LuaTable), /*tp_basicsize*/
28594   0, /*tp_itemsize*/
28595   __pyx_tp_dealloc_4lupa_5_lupa__LuaObject, /*tp_dealloc*/
28596   #if PY_VERSION_HEX < 0x030800b4
28597   0, /*tp_print*/
28598   #endif
28599   #if PY_VERSION_HEX >= 0x030800b4
28600   0, /*tp_vectorcall_offset*/
28601   #endif
28602   0, /*tp_getattr*/
28603   0, /*tp_setattr*/
28604   #if PY_MAJOR_VERSION < 3
28605   0, /*tp_compare*/
28606   #endif
28607   #if PY_MAJOR_VERSION >= 3
28608   0, /*tp_as_async*/
28609   #endif
28610   #if CYTHON_COMPILING_IN_PYPY
28611   __pyx_pw_4lupa_5_lupa_10_LuaObject_13__repr__, /*tp_repr*/
28612   #else
28613   0, /*tp_repr*/
28614   #endif
28615   0, /*tp_as_number*/
28616   0, /*tp_as_sequence*/
28617   &__pyx_tp_as_mapping__LuaTable, /*tp_as_mapping*/
28618   0, /*tp_hash*/
28619   #if CYTHON_COMPILING_IN_PYPY
28620   __pyx_pw_4lupa_5_lupa_10_LuaObject_5__call__, /*tp_call*/
28621   #else
28622   0, /*tp_call*/
28623   #endif
28624   #if CYTHON_COMPILING_IN_PYPY
28625   __pyx_pw_4lupa_5_lupa_10_LuaObject_15__str__, /*tp_str*/
28626   #else
28627   0, /*tp_str*/
28628   #endif
28629   0, /*tp_getattro*/
28630   __pyx_tp_setattro_4lupa_5_lupa__LuaTable, /*tp_setattro*/
28631   0, /*tp_as_buffer*/
28632   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
28633   0, /*tp_doc*/
28634   __pyx_tp_traverse_4lupa_5_lupa__LuaObject, /*tp_traverse*/
28635   0, /*tp_clear*/
28636   0, /*tp_richcompare*/
28637   0, /*tp_weaklistoffset*/
28638   __pyx_pw_4lupa_5_lupa_9_LuaTable_1__iter__, /*tp_iter*/
28639   0, /*tp_iternext*/
28640   __pyx_methods_4lupa_5_lupa__LuaTable, /*tp_methods*/
28641   0, /*tp_members*/
28642   0, /*tp_getset*/
28643   0, /*tp_base*/
28644   0, /*tp_dict*/
28645   0, /*tp_descr_get*/
28646   0, /*tp_descr_set*/
28647   0, /*tp_dictoffset*/
28648   #if CYTHON_COMPILING_IN_PYPY
28649   __pyx_pw_4lupa_5_lupa_10_LuaObject_1__init__, /*tp_init*/
28650   #else
28651   0, /*tp_init*/
28652   #endif
28653   0, /*tp_alloc*/
28654   __pyx_tp_new_4lupa_5_lupa__LuaTable, /*tp_new*/
28655   0, /*tp_free*/
28656   0, /*tp_is_gc*/
28657   0, /*tp_bases*/
28658   0, /*tp_mro*/
28659   0, /*tp_cache*/
28660   0, /*tp_subclasses*/
28661   0, /*tp_weaklist*/
28662   0, /*tp_del*/
28663   0, /*tp_version_tag*/
28664   #if PY_VERSION_HEX >= 0x030400a1
28665   0, /*tp_finalize*/
28666   #endif
28667   #if PY_VERSION_HEX >= 0x030800b1
28668   0, /*tp_vectorcall*/
28669   #endif
28670   #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
28671   0, /*tp_print*/
28672   #endif
28673 };
28674 static struct __pyx_vtabstruct_4lupa_5_lupa__LuaFunction __pyx_vtable_4lupa_5_lupa__LuaFunction;
28675 
__pyx_tp_new_4lupa_5_lupa__LuaFunction(PyTypeObject * t,PyObject * a,PyObject * k)28676 static PyObject *__pyx_tp_new_4lupa_5_lupa__LuaFunction(PyTypeObject *t, PyObject *a, PyObject *k) {
28677   struct __pyx_obj_4lupa_5_lupa__LuaFunction *p;
28678   PyObject *o = __pyx_tp_new_4lupa_5_lupa__LuaObject(t, a, k);
28679   if (unlikely(!o)) return 0;
28680   p = ((struct __pyx_obj_4lupa_5_lupa__LuaFunction *)o);
28681   p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lupa_5_lupa__LuaObject*)__pyx_vtabptr_4lupa_5_lupa__LuaFunction;
28682   return o;
28683 }
28684 
28685 static PyMethodDef __pyx_methods_4lupa_5_lupa__LuaFunction[] = {
28686   {"coroutine", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lupa_5_lupa_12_LuaFunction_1coroutine, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4lupa_5_lupa_12_LuaFunction_coroutine},
28687   {"__reduce_cython__", (PyCFunction)__pyx_pw_4lupa_5_lupa_12_LuaFunction_3__reduce_cython__, METH_NOARGS, __pyx_doc_4lupa_5_lupa_12_LuaFunction_2__reduce_cython__},
28688   {"__setstate_cython__", (PyCFunction)__pyx_pw_4lupa_5_lupa_12_LuaFunction_5__setstate_cython__, METH_O, __pyx_doc_4lupa_5_lupa_12_LuaFunction_4__setstate_cython__},
28689   {0, 0, 0, 0}
28690 };
28691 
28692 static PyTypeObject __pyx_type_4lupa_5_lupa__LuaFunction = {
28693   PyVarObject_HEAD_INIT(0, 0)
28694   "lupa._lupa._LuaFunction", /*tp_name*/
28695   sizeof(struct __pyx_obj_4lupa_5_lupa__LuaFunction), /*tp_basicsize*/
28696   0, /*tp_itemsize*/
28697   __pyx_tp_dealloc_4lupa_5_lupa__LuaObject, /*tp_dealloc*/
28698   #if PY_VERSION_HEX < 0x030800b4
28699   0, /*tp_print*/
28700   #endif
28701   #if PY_VERSION_HEX >= 0x030800b4
28702   0, /*tp_vectorcall_offset*/
28703   #endif
28704   0, /*tp_getattr*/
28705   0, /*tp_setattr*/
28706   #if PY_MAJOR_VERSION < 3
28707   0, /*tp_compare*/
28708   #endif
28709   #if PY_MAJOR_VERSION >= 3
28710   0, /*tp_as_async*/
28711   #endif
28712   #if CYTHON_COMPILING_IN_PYPY
28713   __pyx_pw_4lupa_5_lupa_10_LuaObject_13__repr__, /*tp_repr*/
28714   #else
28715   0, /*tp_repr*/
28716   #endif
28717   0, /*tp_as_number*/
28718   0, /*tp_as_sequence*/
28719   0, /*tp_as_mapping*/
28720   0, /*tp_hash*/
28721   #if CYTHON_COMPILING_IN_PYPY
28722   __pyx_pw_4lupa_5_lupa_10_LuaObject_5__call__, /*tp_call*/
28723   #else
28724   0, /*tp_call*/
28725   #endif
28726   #if CYTHON_COMPILING_IN_PYPY
28727   __pyx_pw_4lupa_5_lupa_10_LuaObject_15__str__, /*tp_str*/
28728   #else
28729   0, /*tp_str*/
28730   #endif
28731   0, /*tp_getattro*/
28732   0, /*tp_setattro*/
28733   0, /*tp_as_buffer*/
28734   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
28735   "A Lua function (which may become a coroutine).\n    ", /*tp_doc*/
28736   __pyx_tp_traverse_4lupa_5_lupa__LuaObject, /*tp_traverse*/
28737   0, /*tp_clear*/
28738   0, /*tp_richcompare*/
28739   0, /*tp_weaklistoffset*/
28740   #if CYTHON_COMPILING_IN_PYPY
28741   __pyx_pw_4lupa_5_lupa_10_LuaObject_11__iter__, /*tp_iter*/
28742   #else
28743   0, /*tp_iter*/
28744   #endif
28745   0, /*tp_iternext*/
28746   __pyx_methods_4lupa_5_lupa__LuaFunction, /*tp_methods*/
28747   0, /*tp_members*/
28748   0, /*tp_getset*/
28749   0, /*tp_base*/
28750   0, /*tp_dict*/
28751   0, /*tp_descr_get*/
28752   0, /*tp_descr_set*/
28753   0, /*tp_dictoffset*/
28754   #if CYTHON_COMPILING_IN_PYPY
28755   __pyx_pw_4lupa_5_lupa_10_LuaObject_1__init__, /*tp_init*/
28756   #else
28757   0, /*tp_init*/
28758   #endif
28759   0, /*tp_alloc*/
28760   __pyx_tp_new_4lupa_5_lupa__LuaFunction, /*tp_new*/
28761   0, /*tp_free*/
28762   0, /*tp_is_gc*/
28763   0, /*tp_bases*/
28764   0, /*tp_mro*/
28765   0, /*tp_cache*/
28766   0, /*tp_subclasses*/
28767   0, /*tp_weaklist*/
28768   0, /*tp_del*/
28769   0, /*tp_version_tag*/
28770   #if PY_VERSION_HEX >= 0x030400a1
28771   0, /*tp_finalize*/
28772   #endif
28773   #if PY_VERSION_HEX >= 0x030800b1
28774   0, /*tp_vectorcall*/
28775   #endif
28776   #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
28777   0, /*tp_print*/
28778   #endif
28779 };
28780 static struct __pyx_vtabstruct_4lupa_5_lupa__LuaCoroutineFunction __pyx_vtable_4lupa_5_lupa__LuaCoroutineFunction;
28781 
__pyx_tp_new_4lupa_5_lupa__LuaCoroutineFunction(PyTypeObject * t,PyObject * a,PyObject * k)28782 static PyObject *__pyx_tp_new_4lupa_5_lupa__LuaCoroutineFunction(PyTypeObject *t, PyObject *a, PyObject *k) {
28783   struct __pyx_obj_4lupa_5_lupa__LuaCoroutineFunction *p;
28784   PyObject *o = __pyx_tp_new_4lupa_5_lupa__LuaFunction(t, a, k);
28785   if (unlikely(!o)) return 0;
28786   p = ((struct __pyx_obj_4lupa_5_lupa__LuaCoroutineFunction *)o);
28787   p->__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lupa_5_lupa__LuaObject*)__pyx_vtabptr_4lupa_5_lupa__LuaCoroutineFunction;
28788   return o;
28789 }
28790 
28791 static PyMethodDef __pyx_methods_4lupa_5_lupa__LuaCoroutineFunction[] = {
28792   {"__reduce_cython__", (PyCFunction)__pyx_pw_4lupa_5_lupa_21_LuaCoroutineFunction_3__reduce_cython__, METH_NOARGS, __pyx_doc_4lupa_5_lupa_21_LuaCoroutineFunction_2__reduce_cython__},
28793   {"__setstate_cython__", (PyCFunction)__pyx_pw_4lupa_5_lupa_21_LuaCoroutineFunction_5__setstate_cython__, METH_O, __pyx_doc_4lupa_5_lupa_21_LuaCoroutineFunction_4__setstate_cython__},
28794   {0, 0, 0, 0}
28795 };
28796 
28797 static PyTypeObject __pyx_type_4lupa_5_lupa__LuaCoroutineFunction = {
28798   PyVarObject_HEAD_INIT(0, 0)
28799   "lupa._lupa._LuaCoroutineFunction", /*tp_name*/
28800   sizeof(struct __pyx_obj_4lupa_5_lupa__LuaCoroutineFunction), /*tp_basicsize*/
28801   0, /*tp_itemsize*/
28802   __pyx_tp_dealloc_4lupa_5_lupa__LuaObject, /*tp_dealloc*/
28803   #if PY_VERSION_HEX < 0x030800b4
28804   0, /*tp_print*/
28805   #endif
28806   #if PY_VERSION_HEX >= 0x030800b4
28807   0, /*tp_vectorcall_offset*/
28808   #endif
28809   0, /*tp_getattr*/
28810   0, /*tp_setattr*/
28811   #if PY_MAJOR_VERSION < 3
28812   0, /*tp_compare*/
28813   #endif
28814   #if PY_MAJOR_VERSION >= 3
28815   0, /*tp_as_async*/
28816   #endif
28817   #if CYTHON_COMPILING_IN_PYPY
28818   __pyx_pw_4lupa_5_lupa_10_LuaObject_13__repr__, /*tp_repr*/
28819   #else
28820   0, /*tp_repr*/
28821   #endif
28822   0, /*tp_as_number*/
28823   0, /*tp_as_sequence*/
28824   0, /*tp_as_mapping*/
28825   0, /*tp_hash*/
28826   __pyx_pw_4lupa_5_lupa_21_LuaCoroutineFunction_1__call__, /*tp_call*/
28827   #if CYTHON_COMPILING_IN_PYPY
28828   __pyx_pw_4lupa_5_lupa_10_LuaObject_15__str__, /*tp_str*/
28829   #else
28830   0, /*tp_str*/
28831   #endif
28832   0, /*tp_getattro*/
28833   0, /*tp_setattro*/
28834   0, /*tp_as_buffer*/
28835   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
28836   "A function that returns a new coroutine when called.\n    ", /*tp_doc*/
28837   __pyx_tp_traverse_4lupa_5_lupa__LuaObject, /*tp_traverse*/
28838   0, /*tp_clear*/
28839   0, /*tp_richcompare*/
28840   0, /*tp_weaklistoffset*/
28841   #if CYTHON_COMPILING_IN_PYPY
28842   __pyx_pw_4lupa_5_lupa_10_LuaObject_11__iter__, /*tp_iter*/
28843   #else
28844   0, /*tp_iter*/
28845   #endif
28846   0, /*tp_iternext*/
28847   __pyx_methods_4lupa_5_lupa__LuaCoroutineFunction, /*tp_methods*/
28848   0, /*tp_members*/
28849   0, /*tp_getset*/
28850   0, /*tp_base*/
28851   0, /*tp_dict*/
28852   0, /*tp_descr_get*/
28853   0, /*tp_descr_set*/
28854   0, /*tp_dictoffset*/
28855   #if CYTHON_COMPILING_IN_PYPY
28856   __pyx_pw_4lupa_5_lupa_10_LuaObject_1__init__, /*tp_init*/
28857   #else
28858   0, /*tp_init*/
28859   #endif
28860   0, /*tp_alloc*/
28861   __pyx_tp_new_4lupa_5_lupa__LuaCoroutineFunction, /*tp_new*/
28862   0, /*tp_free*/
28863   0, /*tp_is_gc*/
28864   0, /*tp_bases*/
28865   0, /*tp_mro*/
28866   0, /*tp_cache*/
28867   0, /*tp_subclasses*/
28868   0, /*tp_weaklist*/
28869   0, /*tp_del*/
28870   0, /*tp_version_tag*/
28871   #if PY_VERSION_HEX >= 0x030400a1
28872   0, /*tp_finalize*/
28873   #endif
28874   #if PY_VERSION_HEX >= 0x030800b1
28875   0, /*tp_vectorcall*/
28876   #endif
28877   #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
28878   0, /*tp_print*/
28879   #endif
28880 };
28881 static struct __pyx_vtabstruct_4lupa_5_lupa__LuaThread __pyx_vtable_4lupa_5_lupa__LuaThread;
28882 
__pyx_tp_new_4lupa_5_lupa__LuaThread(PyTypeObject * t,PyObject * a,PyObject * k)28883 static PyObject *__pyx_tp_new_4lupa_5_lupa__LuaThread(PyTypeObject *t, PyObject *a, PyObject *k) {
28884   struct __pyx_obj_4lupa_5_lupa__LuaThread *p;
28885   PyObject *o = __pyx_tp_new_4lupa_5_lupa__LuaObject(t, a, k);
28886   if (unlikely(!o)) return 0;
28887   p = ((struct __pyx_obj_4lupa_5_lupa__LuaThread *)o);
28888   p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4lupa_5_lupa__LuaObject*)__pyx_vtabptr_4lupa_5_lupa__LuaThread;
28889   p->_arguments = ((PyObject*)Py_None); Py_INCREF(Py_None);
28890   return o;
28891 }
28892 
__pyx_tp_dealloc_4lupa_5_lupa__LuaThread(PyObject * o)28893 static void __pyx_tp_dealloc_4lupa_5_lupa__LuaThread(PyObject *o) {
28894   struct __pyx_obj_4lupa_5_lupa__LuaThread *p = (struct __pyx_obj_4lupa_5_lupa__LuaThread *)o;
28895   PyObject_GC_UnTrack(o);
28896   Py_CLEAR(p->_arguments);
28897   PyObject_GC_Track(o);
28898   __pyx_tp_dealloc_4lupa_5_lupa__LuaObject(o);
28899 }
28900 
__pyx_tp_traverse_4lupa_5_lupa__LuaThread(PyObject * o,visitproc v,void * a)28901 static int __pyx_tp_traverse_4lupa_5_lupa__LuaThread(PyObject *o, visitproc v, void *a) {
28902   int e;
28903   struct __pyx_obj_4lupa_5_lupa__LuaThread *p = (struct __pyx_obj_4lupa_5_lupa__LuaThread *)o;
28904   e = __pyx_tp_traverse_4lupa_5_lupa__LuaObject(o, v, a); if (e) return e;
28905   if (p->_arguments) {
28906     e = (*v)(p->_arguments, a); if (e) return e;
28907   }
28908   return 0;
28909 }
28910 
__pyx_specialmethod___pyx_pw_4lupa_5_lupa_10_LuaThread_3__next__(PyObject * self,CYTHON_UNUSED PyObject * arg)28911 static PyObject *__pyx_specialmethod___pyx_pw_4lupa_5_lupa_10_LuaThread_3__next__(PyObject *self, CYTHON_UNUSED PyObject *arg) {return __pyx_pw_4lupa_5_lupa_10_LuaThread_3__next__(self);}
28912 
28913 static PyMethodDef __pyx_methods_4lupa_5_lupa__LuaThread[] = {
28914   {"__next__", (PyCFunction)__pyx_specialmethod___pyx_pw_4lupa_5_lupa_10_LuaThread_3__next__, METH_NOARGS|METH_COEXIST, 0},
28915   {"send", (PyCFunction)__pyx_pw_4lupa_5_lupa_10_LuaThread_5send, METH_O, __pyx_doc_4lupa_5_lupa_10_LuaThread_4send},
28916   {"__reduce_cython__", (PyCFunction)__pyx_pw_4lupa_5_lupa_10_LuaThread_9__reduce_cython__, METH_NOARGS, __pyx_doc_4lupa_5_lupa_10_LuaThread_8__reduce_cython__},
28917   {"__setstate_cython__", (PyCFunction)__pyx_pw_4lupa_5_lupa_10_LuaThread_11__setstate_cython__, METH_O, __pyx_doc_4lupa_5_lupa_10_LuaThread_10__setstate_cython__},
28918   {0, 0, 0, 0}
28919 };
28920 
28921 static PyNumberMethods __pyx_tp_as_number__LuaThread = {
28922   0, /*nb_add*/
28923   0, /*nb_subtract*/
28924   0, /*nb_multiply*/
28925   #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
28926   0, /*nb_divide*/
28927   #endif
28928   0, /*nb_remainder*/
28929   0, /*nb_divmod*/
28930   0, /*nb_power*/
28931   0, /*nb_negative*/
28932   0, /*nb_positive*/
28933   0, /*nb_absolute*/
28934   __pyx_pw_4lupa_5_lupa_10_LuaThread_7__bool__, /*nb_nonzero*/
28935   0, /*nb_invert*/
28936   0, /*nb_lshift*/
28937   0, /*nb_rshift*/
28938   0, /*nb_and*/
28939   0, /*nb_xor*/
28940   0, /*nb_or*/
28941   #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
28942   0, /*nb_coerce*/
28943   #endif
28944   0, /*nb_int*/
28945   #if PY_MAJOR_VERSION < 3
28946   0, /*nb_long*/
28947   #else
28948   0, /*reserved*/
28949   #endif
28950   0, /*nb_float*/
28951   #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
28952   0, /*nb_oct*/
28953   #endif
28954   #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
28955   0, /*nb_hex*/
28956   #endif
28957   0, /*nb_inplace_add*/
28958   0, /*nb_inplace_subtract*/
28959   0, /*nb_inplace_multiply*/
28960   #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
28961   0, /*nb_inplace_divide*/
28962   #endif
28963   0, /*nb_inplace_remainder*/
28964   0, /*nb_inplace_power*/
28965   0, /*nb_inplace_lshift*/
28966   0, /*nb_inplace_rshift*/
28967   0, /*nb_inplace_and*/
28968   0, /*nb_inplace_xor*/
28969   0, /*nb_inplace_or*/
28970   0, /*nb_floor_divide*/
28971   0, /*nb_true_divide*/
28972   0, /*nb_inplace_floor_divide*/
28973   0, /*nb_inplace_true_divide*/
28974   0, /*nb_index*/
28975   #if PY_VERSION_HEX >= 0x03050000
28976   0, /*nb_matrix_multiply*/
28977   #endif
28978   #if PY_VERSION_HEX >= 0x03050000
28979   0, /*nb_inplace_matrix_multiply*/
28980   #endif
28981 };
28982 
28983 static PyTypeObject __pyx_type_4lupa_5_lupa__LuaThread = {
28984   PyVarObject_HEAD_INIT(0, 0)
28985   "lupa._lupa._LuaThread", /*tp_name*/
28986   sizeof(struct __pyx_obj_4lupa_5_lupa__LuaThread), /*tp_basicsize*/
28987   0, /*tp_itemsize*/
28988   __pyx_tp_dealloc_4lupa_5_lupa__LuaThread, /*tp_dealloc*/
28989   #if PY_VERSION_HEX < 0x030800b4
28990   0, /*tp_print*/
28991   #endif
28992   #if PY_VERSION_HEX >= 0x030800b4
28993   0, /*tp_vectorcall_offset*/
28994   #endif
28995   0, /*tp_getattr*/
28996   0, /*tp_setattr*/
28997   #if PY_MAJOR_VERSION < 3
28998   0, /*tp_compare*/
28999   #endif
29000   #if PY_MAJOR_VERSION >= 3
29001   0, /*tp_as_async*/
29002   #endif
29003   #if CYTHON_COMPILING_IN_PYPY
29004   __pyx_pw_4lupa_5_lupa_10_LuaObject_13__repr__, /*tp_repr*/
29005   #else
29006   0, /*tp_repr*/
29007   #endif
29008   &__pyx_tp_as_number__LuaThread, /*tp_as_number*/
29009   0, /*tp_as_sequence*/
29010   0, /*tp_as_mapping*/
29011   0, /*tp_hash*/
29012   #if CYTHON_COMPILING_IN_PYPY
29013   __pyx_pw_4lupa_5_lupa_10_LuaObject_5__call__, /*tp_call*/
29014   #else
29015   0, /*tp_call*/
29016   #endif
29017   #if CYTHON_COMPILING_IN_PYPY
29018   __pyx_pw_4lupa_5_lupa_10_LuaObject_15__str__, /*tp_str*/
29019   #else
29020   0, /*tp_str*/
29021   #endif
29022   0, /*tp_getattro*/
29023   0, /*tp_setattro*/
29024   0, /*tp_as_buffer*/
29025   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
29026   "A Lua thread (coroutine).\n    ", /*tp_doc*/
29027   __pyx_tp_traverse_4lupa_5_lupa__LuaThread, /*tp_traverse*/
29028   0, /*tp_clear*/
29029   0, /*tp_richcompare*/
29030   0, /*tp_weaklistoffset*/
29031   __pyx_pw_4lupa_5_lupa_10_LuaThread_1__iter__, /*tp_iter*/
29032   __pyx_pw_4lupa_5_lupa_10_LuaThread_3__next__, /*tp_iternext*/
29033   __pyx_methods_4lupa_5_lupa__LuaThread, /*tp_methods*/
29034   0, /*tp_members*/
29035   0, /*tp_getset*/
29036   0, /*tp_base*/
29037   0, /*tp_dict*/
29038   0, /*tp_descr_get*/
29039   0, /*tp_descr_set*/
29040   0, /*tp_dictoffset*/
29041   #if CYTHON_COMPILING_IN_PYPY
29042   __pyx_pw_4lupa_5_lupa_10_LuaObject_1__init__, /*tp_init*/
29043   #else
29044   0, /*tp_init*/
29045   #endif
29046   0, /*tp_alloc*/
29047   __pyx_tp_new_4lupa_5_lupa__LuaThread, /*tp_new*/
29048   0, /*tp_free*/
29049   0, /*tp_is_gc*/
29050   0, /*tp_bases*/
29051   0, /*tp_mro*/
29052   0, /*tp_cache*/
29053   0, /*tp_subclasses*/
29054   0, /*tp_weaklist*/
29055   0, /*tp_del*/
29056   0, /*tp_version_tag*/
29057   #if PY_VERSION_HEX >= 0x030400a1
29058   0, /*tp_finalize*/
29059   #endif
29060   #if PY_VERSION_HEX >= 0x030800b1
29061   0, /*tp_vectorcall*/
29062   #endif
29063   #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
29064   0, /*tp_print*/
29065   #endif
29066 };
29067 
__pyx_tp_new_4lupa_5_lupa__LuaIter(PyTypeObject * t,PyObject * a,PyObject * k)29068 static PyObject *__pyx_tp_new_4lupa_5_lupa__LuaIter(PyTypeObject *t, PyObject *a, PyObject *k) {
29069   struct __pyx_obj_4lupa_5_lupa__LuaIter *p;
29070   PyObject *o;
29071   o = (*t->tp_alloc)(t, 0);
29072   if (unlikely(!o)) return 0;
29073   p = ((struct __pyx_obj_4lupa_5_lupa__LuaIter *)o);
29074   p->_runtime = ((struct __pyx_obj_4lupa_5_lupa_LuaRuntime *)Py_None); Py_INCREF(Py_None);
29075   p->_obj = ((struct __pyx_obj_4lupa_5_lupa__LuaObject *)Py_None); Py_INCREF(Py_None);
29076   if (unlikely(__pyx_pw_4lupa_5_lupa_8_LuaIter_1__cinit__(o, a, k) < 0)) goto bad;
29077   return o;
29078   bad:
29079   Py_DECREF(o); o = 0;
29080   return NULL;
29081 }
29082 
__pyx_tp_dealloc_4lupa_5_lupa__LuaIter(PyObject * o)29083 static void __pyx_tp_dealloc_4lupa_5_lupa__LuaIter(PyObject *o) {
29084   struct __pyx_obj_4lupa_5_lupa__LuaIter *p = (struct __pyx_obj_4lupa_5_lupa__LuaIter *)o;
29085   PyObject_GC_UnTrack(o);
29086   {
29087     PyObject *etype, *eval, *etb;
29088     PyErr_Fetch(&etype, &eval, &etb);
29089     __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
29090     __pyx_pw_4lupa_5_lupa_8_LuaIter_3__dealloc__(o);
29091     __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
29092     PyErr_Restore(etype, eval, etb);
29093   }
29094   Py_CLEAR(p->_runtime);
29095   Py_CLEAR(p->_obj);
29096   (*Py_TYPE(o)->tp_free)(o);
29097 }
29098 
__pyx_tp_traverse_4lupa_5_lupa__LuaIter(PyObject * o,visitproc v,void * a)29099 static int __pyx_tp_traverse_4lupa_5_lupa__LuaIter(PyObject *o, visitproc v, void *a) {
29100   int e;
29101   struct __pyx_obj_4lupa_5_lupa__LuaIter *p = (struct __pyx_obj_4lupa_5_lupa__LuaIter *)o;
29102   if (p->_runtime) {
29103     e = (*v)(((PyObject *)p->_runtime), a); if (e) return e;
29104   }
29105   if (p->_obj) {
29106     e = (*v)(((PyObject *)p->_obj), a); if (e) return e;
29107   }
29108   return 0;
29109 }
29110 
__pyx_specialmethod___pyx_pw_4lupa_5_lupa_8_LuaIter_9__next__(PyObject * self,CYTHON_UNUSED PyObject * arg)29111 static PyObject *__pyx_specialmethod___pyx_pw_4lupa_5_lupa_8_LuaIter_9__next__(PyObject *self, CYTHON_UNUSED PyObject *arg) {return __pyx_pw_4lupa_5_lupa_8_LuaIter_9__next__(self);}
29112 
29113 static PyMethodDef __pyx_methods_4lupa_5_lupa__LuaIter[] = {
29114   {"__next__", (PyCFunction)__pyx_specialmethod___pyx_pw_4lupa_5_lupa_8_LuaIter_9__next__, METH_NOARGS|METH_COEXIST, 0},
29115   {"__reduce_cython__", (PyCFunction)__pyx_pw_4lupa_5_lupa_8_LuaIter_11__reduce_cython__, METH_NOARGS, __pyx_doc_4lupa_5_lupa_8_LuaIter_10__reduce_cython__},
29116   {"__setstate_cython__", (PyCFunction)__pyx_pw_4lupa_5_lupa_8_LuaIter_13__setstate_cython__, METH_O, __pyx_doc_4lupa_5_lupa_8_LuaIter_12__setstate_cython__},
29117   {0, 0, 0, 0}
29118 };
29119 
29120 static PyTypeObject __pyx_type_4lupa_5_lupa__LuaIter = {
29121   PyVarObject_HEAD_INIT(0, 0)
29122   "lupa._lupa._LuaIter", /*tp_name*/
29123   sizeof(struct __pyx_obj_4lupa_5_lupa__LuaIter), /*tp_basicsize*/
29124   0, /*tp_itemsize*/
29125   __pyx_tp_dealloc_4lupa_5_lupa__LuaIter, /*tp_dealloc*/
29126   #if PY_VERSION_HEX < 0x030800b4
29127   0, /*tp_print*/
29128   #endif
29129   #if PY_VERSION_HEX >= 0x030800b4
29130   0, /*tp_vectorcall_offset*/
29131   #endif
29132   0, /*tp_getattr*/
29133   0, /*tp_setattr*/
29134   #if PY_MAJOR_VERSION < 3
29135   0, /*tp_compare*/
29136   #endif
29137   #if PY_MAJOR_VERSION >= 3
29138   0, /*tp_as_async*/
29139   #endif
29140   __pyx_pw_4lupa_5_lupa_8_LuaIter_5__repr__, /*tp_repr*/
29141   0, /*tp_as_number*/
29142   0, /*tp_as_sequence*/
29143   0, /*tp_as_mapping*/
29144   0, /*tp_hash*/
29145   0, /*tp_call*/
29146   0, /*tp_str*/
29147   0, /*tp_getattro*/
29148   0, /*tp_setattro*/
29149   0, /*tp_as_buffer*/
29150   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
29151   0, /*tp_doc*/
29152   __pyx_tp_traverse_4lupa_5_lupa__LuaIter, /*tp_traverse*/
29153   0, /*tp_clear*/
29154   0, /*tp_richcompare*/
29155   0, /*tp_weaklistoffset*/
29156   __pyx_pw_4lupa_5_lupa_8_LuaIter_7__iter__, /*tp_iter*/
29157   __pyx_pw_4lupa_5_lupa_8_LuaIter_9__next__, /*tp_iternext*/
29158   __pyx_methods_4lupa_5_lupa__LuaIter, /*tp_methods*/
29159   0, /*tp_members*/
29160   0, /*tp_getset*/
29161   0, /*tp_base*/
29162   0, /*tp_dict*/
29163   0, /*tp_descr_get*/
29164   0, /*tp_descr_set*/
29165   0, /*tp_dictoffset*/
29166   0, /*tp_init*/
29167   0, /*tp_alloc*/
29168   __pyx_tp_new_4lupa_5_lupa__LuaIter, /*tp_new*/
29169   0, /*tp_free*/
29170   0, /*tp_is_gc*/
29171   0, /*tp_bases*/
29172   0, /*tp_mro*/
29173   0, /*tp_cache*/
29174   0, /*tp_subclasses*/
29175   0, /*tp_weaklist*/
29176   0, /*tp_del*/
29177   0, /*tp_version_tag*/
29178   #if PY_VERSION_HEX >= 0x030400a1
29179   0, /*tp_finalize*/
29180   #endif
29181   #if PY_VERSION_HEX >= 0x030800b1
29182   0, /*tp_vectorcall*/
29183   #endif
29184   #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
29185   0, /*tp_print*/
29186   #endif
29187 };
29188 
29189 static struct __pyx_obj_4lupa_5_lupa__PyProtocolWrapper *__pyx_freelist_4lupa_5_lupa__PyProtocolWrapper[8];
29190 static int __pyx_freecount_4lupa_5_lupa__PyProtocolWrapper = 0;
29191 
__pyx_tp_new_4lupa_5_lupa__PyProtocolWrapper(PyTypeObject * t,CYTHON_UNUSED PyObject * a,CYTHON_UNUSED PyObject * k)29192 static PyObject *__pyx_tp_new_4lupa_5_lupa__PyProtocolWrapper(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
29193   struct __pyx_obj_4lupa_5_lupa__PyProtocolWrapper *p;
29194   PyObject *o;
29195   if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4lupa_5_lupa__PyProtocolWrapper > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4lupa_5_lupa__PyProtocolWrapper)))) {
29196     o = (PyObject*)__pyx_freelist_4lupa_5_lupa__PyProtocolWrapper[--__pyx_freecount_4lupa_5_lupa__PyProtocolWrapper];
29197     memset(o, 0, sizeof(struct __pyx_obj_4lupa_5_lupa__PyProtocolWrapper));
29198     (void) PyObject_INIT(o, t);
29199     PyObject_GC_Track(o);
29200   } else {
29201     o = (*t->tp_alloc)(t, 0);
29202     if (unlikely(!o)) return 0;
29203   }
29204   p = ((struct __pyx_obj_4lupa_5_lupa__PyProtocolWrapper *)o);
29205   p->_obj = Py_None; Py_INCREF(Py_None);
29206   if (unlikely(__pyx_pw_4lupa_5_lupa_18_PyProtocolWrapper_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) goto bad;
29207   return o;
29208   bad:
29209   Py_DECREF(o); o = 0;
29210   return NULL;
29211 }
29212 
__pyx_tp_dealloc_4lupa_5_lupa__PyProtocolWrapper(PyObject * o)29213 static void __pyx_tp_dealloc_4lupa_5_lupa__PyProtocolWrapper(PyObject *o) {
29214   struct __pyx_obj_4lupa_5_lupa__PyProtocolWrapper *p = (struct __pyx_obj_4lupa_5_lupa__PyProtocolWrapper *)o;
29215   PyObject_GC_UnTrack(o);
29216   Py_CLEAR(p->_obj);
29217   if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4lupa_5_lupa__PyProtocolWrapper < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4lupa_5_lupa__PyProtocolWrapper)))) {
29218     __pyx_freelist_4lupa_5_lupa__PyProtocolWrapper[__pyx_freecount_4lupa_5_lupa__PyProtocolWrapper++] = ((struct __pyx_obj_4lupa_5_lupa__PyProtocolWrapper *)o);
29219   } else {
29220     (*Py_TYPE(o)->tp_free)(o);
29221   }
29222 }
29223 
__pyx_tp_traverse_4lupa_5_lupa__PyProtocolWrapper(PyObject * o,visitproc v,void * a)29224 static int __pyx_tp_traverse_4lupa_5_lupa__PyProtocolWrapper(PyObject *o, visitproc v, void *a) {
29225   int e;
29226   struct __pyx_obj_4lupa_5_lupa__PyProtocolWrapper *p = (struct __pyx_obj_4lupa_5_lupa__PyProtocolWrapper *)o;
29227   if (p->_obj) {
29228     e = (*v)(p->_obj, a); if (e) return e;
29229   }
29230   return 0;
29231 }
29232 
__pyx_tp_clear_4lupa_5_lupa__PyProtocolWrapper(PyObject * o)29233 static int __pyx_tp_clear_4lupa_5_lupa__PyProtocolWrapper(PyObject *o) {
29234   PyObject* tmp;
29235   struct __pyx_obj_4lupa_5_lupa__PyProtocolWrapper *p = (struct __pyx_obj_4lupa_5_lupa__PyProtocolWrapper *)o;
29236   tmp = ((PyObject*)p->_obj);
29237   p->_obj = Py_None; Py_INCREF(Py_None);
29238   Py_XDECREF(tmp);
29239   return 0;
29240 }
29241 
29242 static PyMethodDef __pyx_methods_4lupa_5_lupa__PyProtocolWrapper[] = {
29243   {"__reduce_cython__", (PyCFunction)__pyx_pw_4lupa_5_lupa_18_PyProtocolWrapper_5__reduce_cython__, METH_NOARGS, __pyx_doc_4lupa_5_lupa_18_PyProtocolWrapper_4__reduce_cython__},
29244   {"__setstate_cython__", (PyCFunction)__pyx_pw_4lupa_5_lupa_18_PyProtocolWrapper_7__setstate_cython__, METH_O, __pyx_doc_4lupa_5_lupa_18_PyProtocolWrapper_6__setstate_cython__},
29245   {0, 0, 0, 0}
29246 };
29247 
29248 static PyTypeObject __pyx_type_4lupa_5_lupa__PyProtocolWrapper = {
29249   PyVarObject_HEAD_INIT(0, 0)
29250   "lupa._lupa._PyProtocolWrapper", /*tp_name*/
29251   sizeof(struct __pyx_obj_4lupa_5_lupa__PyProtocolWrapper), /*tp_basicsize*/
29252   0, /*tp_itemsize*/
29253   __pyx_tp_dealloc_4lupa_5_lupa__PyProtocolWrapper, /*tp_dealloc*/
29254   #if PY_VERSION_HEX < 0x030800b4
29255   0, /*tp_print*/
29256   #endif
29257   #if PY_VERSION_HEX >= 0x030800b4
29258   0, /*tp_vectorcall_offset*/
29259   #endif
29260   0, /*tp_getattr*/
29261   0, /*tp_setattr*/
29262   #if PY_MAJOR_VERSION < 3
29263   0, /*tp_compare*/
29264   #endif
29265   #if PY_MAJOR_VERSION >= 3
29266   0, /*tp_as_async*/
29267   #endif
29268   0, /*tp_repr*/
29269   0, /*tp_as_number*/
29270   0, /*tp_as_sequence*/
29271   0, /*tp_as_mapping*/
29272   0, /*tp_hash*/
29273   0, /*tp_call*/
29274   0, /*tp_str*/
29275   0, /*tp_getattro*/
29276   0, /*tp_setattro*/
29277   0, /*tp_as_buffer*/
29278   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
29279   "_PyProtocolWrapper()", /*tp_doc*/
29280   __pyx_tp_traverse_4lupa_5_lupa__PyProtocolWrapper, /*tp_traverse*/
29281   __pyx_tp_clear_4lupa_5_lupa__PyProtocolWrapper, /*tp_clear*/
29282   0, /*tp_richcompare*/
29283   0, /*tp_weaklistoffset*/
29284   0, /*tp_iter*/
29285   0, /*tp_iternext*/
29286   __pyx_methods_4lupa_5_lupa__PyProtocolWrapper, /*tp_methods*/
29287   0, /*tp_members*/
29288   0, /*tp_getset*/
29289   0, /*tp_base*/
29290   0, /*tp_dict*/
29291   0, /*tp_descr_get*/
29292   0, /*tp_descr_set*/
29293   0, /*tp_dictoffset*/
29294   __pyx_pw_4lupa_5_lupa_18_PyProtocolWrapper_3__init__, /*tp_init*/
29295   0, /*tp_alloc*/
29296   __pyx_tp_new_4lupa_5_lupa__PyProtocolWrapper, /*tp_new*/
29297   0, /*tp_free*/
29298   0, /*tp_is_gc*/
29299   0, /*tp_bases*/
29300   0, /*tp_mro*/
29301   0, /*tp_cache*/
29302   0, /*tp_subclasses*/
29303   0, /*tp_weaklist*/
29304   0, /*tp_del*/
29305   0, /*tp_version_tag*/
29306   #if PY_VERSION_HEX >= 0x030400a1
29307   0, /*tp_finalize*/
29308   #endif
29309   #if PY_VERSION_HEX >= 0x030800b1
29310   0, /*tp_vectorcall*/
29311   #endif
29312   #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
29313   0, /*tp_print*/
29314   #endif
29315 };
29316 
29317 static struct __pyx_obj_4lupa_5_lupa___pyx_scope_struct__unpacks_lua_table *__pyx_freelist_4lupa_5_lupa___pyx_scope_struct__unpacks_lua_table[8];
29318 static int __pyx_freecount_4lupa_5_lupa___pyx_scope_struct__unpacks_lua_table = 0;
29319 
__pyx_tp_new_4lupa_5_lupa___pyx_scope_struct__unpacks_lua_table(PyTypeObject * t,CYTHON_UNUSED PyObject * a,CYTHON_UNUSED PyObject * k)29320 static PyObject *__pyx_tp_new_4lupa_5_lupa___pyx_scope_struct__unpacks_lua_table(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
29321   PyObject *o;
29322   if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4lupa_5_lupa___pyx_scope_struct__unpacks_lua_table > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4lupa_5_lupa___pyx_scope_struct__unpacks_lua_table)))) {
29323     o = (PyObject*)__pyx_freelist_4lupa_5_lupa___pyx_scope_struct__unpacks_lua_table[--__pyx_freecount_4lupa_5_lupa___pyx_scope_struct__unpacks_lua_table];
29324     memset(o, 0, sizeof(struct __pyx_obj_4lupa_5_lupa___pyx_scope_struct__unpacks_lua_table));
29325     (void) PyObject_INIT(o, t);
29326     PyObject_GC_Track(o);
29327   } else {
29328     o = (*t->tp_alloc)(t, 0);
29329     if (unlikely(!o)) return 0;
29330   }
29331   return o;
29332 }
29333 
__pyx_tp_dealloc_4lupa_5_lupa___pyx_scope_struct__unpacks_lua_table(PyObject * o)29334 static void __pyx_tp_dealloc_4lupa_5_lupa___pyx_scope_struct__unpacks_lua_table(PyObject *o) {
29335   struct __pyx_obj_4lupa_5_lupa___pyx_scope_struct__unpacks_lua_table *p = (struct __pyx_obj_4lupa_5_lupa___pyx_scope_struct__unpacks_lua_table *)o;
29336   PyObject_GC_UnTrack(o);
29337   Py_CLEAR(p->__pyx_v_func);
29338   if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4lupa_5_lupa___pyx_scope_struct__unpacks_lua_table < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4lupa_5_lupa___pyx_scope_struct__unpacks_lua_table)))) {
29339     __pyx_freelist_4lupa_5_lupa___pyx_scope_struct__unpacks_lua_table[__pyx_freecount_4lupa_5_lupa___pyx_scope_struct__unpacks_lua_table++] = ((struct __pyx_obj_4lupa_5_lupa___pyx_scope_struct__unpacks_lua_table *)o);
29340   } else {
29341     (*Py_TYPE(o)->tp_free)(o);
29342   }
29343 }
29344 
__pyx_tp_traverse_4lupa_5_lupa___pyx_scope_struct__unpacks_lua_table(PyObject * o,visitproc v,void * a)29345 static int __pyx_tp_traverse_4lupa_5_lupa___pyx_scope_struct__unpacks_lua_table(PyObject *o, visitproc v, void *a) {
29346   int e;
29347   struct __pyx_obj_4lupa_5_lupa___pyx_scope_struct__unpacks_lua_table *p = (struct __pyx_obj_4lupa_5_lupa___pyx_scope_struct__unpacks_lua_table *)o;
29348   if (p->__pyx_v_func) {
29349     e = (*v)(p->__pyx_v_func, a); if (e) return e;
29350   }
29351   return 0;
29352 }
29353 
__pyx_tp_clear_4lupa_5_lupa___pyx_scope_struct__unpacks_lua_table(PyObject * o)29354 static int __pyx_tp_clear_4lupa_5_lupa___pyx_scope_struct__unpacks_lua_table(PyObject *o) {
29355   PyObject* tmp;
29356   struct __pyx_obj_4lupa_5_lupa___pyx_scope_struct__unpacks_lua_table *p = (struct __pyx_obj_4lupa_5_lupa___pyx_scope_struct__unpacks_lua_table *)o;
29357   tmp = ((PyObject*)p->__pyx_v_func);
29358   p->__pyx_v_func = Py_None; Py_INCREF(Py_None);
29359   Py_XDECREF(tmp);
29360   return 0;
29361 }
29362 
29363 static PyTypeObject __pyx_type_4lupa_5_lupa___pyx_scope_struct__unpacks_lua_table = {
29364   PyVarObject_HEAD_INIT(0, 0)
29365   "lupa._lupa.__pyx_scope_struct__unpacks_lua_table", /*tp_name*/
29366   sizeof(struct __pyx_obj_4lupa_5_lupa___pyx_scope_struct__unpacks_lua_table), /*tp_basicsize*/
29367   0, /*tp_itemsize*/
29368   __pyx_tp_dealloc_4lupa_5_lupa___pyx_scope_struct__unpacks_lua_table, /*tp_dealloc*/
29369   #if PY_VERSION_HEX < 0x030800b4
29370   0, /*tp_print*/
29371   #endif
29372   #if PY_VERSION_HEX >= 0x030800b4
29373   0, /*tp_vectorcall_offset*/
29374   #endif
29375   0, /*tp_getattr*/
29376   0, /*tp_setattr*/
29377   #if PY_MAJOR_VERSION < 3
29378   0, /*tp_compare*/
29379   #endif
29380   #if PY_MAJOR_VERSION >= 3
29381   0, /*tp_as_async*/
29382   #endif
29383   0, /*tp_repr*/
29384   0, /*tp_as_number*/
29385   0, /*tp_as_sequence*/
29386   0, /*tp_as_mapping*/
29387   0, /*tp_hash*/
29388   0, /*tp_call*/
29389   0, /*tp_str*/
29390   0, /*tp_getattro*/
29391   0, /*tp_setattro*/
29392   0, /*tp_as_buffer*/
29393   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
29394   0, /*tp_doc*/
29395   __pyx_tp_traverse_4lupa_5_lupa___pyx_scope_struct__unpacks_lua_table, /*tp_traverse*/
29396   __pyx_tp_clear_4lupa_5_lupa___pyx_scope_struct__unpacks_lua_table, /*tp_clear*/
29397   0, /*tp_richcompare*/
29398   0, /*tp_weaklistoffset*/
29399   0, /*tp_iter*/
29400   0, /*tp_iternext*/
29401   0, /*tp_methods*/
29402   0, /*tp_members*/
29403   0, /*tp_getset*/
29404   0, /*tp_base*/
29405   0, /*tp_dict*/
29406   0, /*tp_descr_get*/
29407   0, /*tp_descr_set*/
29408   0, /*tp_dictoffset*/
29409   0, /*tp_init*/
29410   0, /*tp_alloc*/
29411   __pyx_tp_new_4lupa_5_lupa___pyx_scope_struct__unpacks_lua_table, /*tp_new*/
29412   0, /*tp_free*/
29413   0, /*tp_is_gc*/
29414   0, /*tp_bases*/
29415   0, /*tp_mro*/
29416   0, /*tp_cache*/
29417   0, /*tp_subclasses*/
29418   0, /*tp_weaklist*/
29419   0, /*tp_del*/
29420   0, /*tp_version_tag*/
29421   #if PY_VERSION_HEX >= 0x030400a1
29422   0, /*tp_finalize*/
29423   #endif
29424   #if PY_VERSION_HEX >= 0x030800b1
29425   0, /*tp_vectorcall*/
29426   #endif
29427   #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
29428   0, /*tp_print*/
29429   #endif
29430 };
29431 
29432 static struct __pyx_obj_4lupa_5_lupa___pyx_scope_struct_1_unpacks_lua_table_method *__pyx_freelist_4lupa_5_lupa___pyx_scope_struct_1_unpacks_lua_table_method[8];
29433 static int __pyx_freecount_4lupa_5_lupa___pyx_scope_struct_1_unpacks_lua_table_method = 0;
29434 
__pyx_tp_new_4lupa_5_lupa___pyx_scope_struct_1_unpacks_lua_table_method(PyTypeObject * t,CYTHON_UNUSED PyObject * a,CYTHON_UNUSED PyObject * k)29435 static PyObject *__pyx_tp_new_4lupa_5_lupa___pyx_scope_struct_1_unpacks_lua_table_method(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
29436   PyObject *o;
29437   if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4lupa_5_lupa___pyx_scope_struct_1_unpacks_lua_table_method > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4lupa_5_lupa___pyx_scope_struct_1_unpacks_lua_table_method)))) {
29438     o = (PyObject*)__pyx_freelist_4lupa_5_lupa___pyx_scope_struct_1_unpacks_lua_table_method[--__pyx_freecount_4lupa_5_lupa___pyx_scope_struct_1_unpacks_lua_table_method];
29439     memset(o, 0, sizeof(struct __pyx_obj_4lupa_5_lupa___pyx_scope_struct_1_unpacks_lua_table_method));
29440     (void) PyObject_INIT(o, t);
29441     PyObject_GC_Track(o);
29442   } else {
29443     o = (*t->tp_alloc)(t, 0);
29444     if (unlikely(!o)) return 0;
29445   }
29446   return o;
29447 }
29448 
__pyx_tp_dealloc_4lupa_5_lupa___pyx_scope_struct_1_unpacks_lua_table_method(PyObject * o)29449 static void __pyx_tp_dealloc_4lupa_5_lupa___pyx_scope_struct_1_unpacks_lua_table_method(PyObject *o) {
29450   struct __pyx_obj_4lupa_5_lupa___pyx_scope_struct_1_unpacks_lua_table_method *p = (struct __pyx_obj_4lupa_5_lupa___pyx_scope_struct_1_unpacks_lua_table_method *)o;
29451   PyObject_GC_UnTrack(o);
29452   Py_CLEAR(p->__pyx_v_meth);
29453   if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4lupa_5_lupa___pyx_scope_struct_1_unpacks_lua_table_method < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4lupa_5_lupa___pyx_scope_struct_1_unpacks_lua_table_method)))) {
29454     __pyx_freelist_4lupa_5_lupa___pyx_scope_struct_1_unpacks_lua_table_method[__pyx_freecount_4lupa_5_lupa___pyx_scope_struct_1_unpacks_lua_table_method++] = ((struct __pyx_obj_4lupa_5_lupa___pyx_scope_struct_1_unpacks_lua_table_method *)o);
29455   } else {
29456     (*Py_TYPE(o)->tp_free)(o);
29457   }
29458 }
29459 
__pyx_tp_traverse_4lupa_5_lupa___pyx_scope_struct_1_unpacks_lua_table_method(PyObject * o,visitproc v,void * a)29460 static int __pyx_tp_traverse_4lupa_5_lupa___pyx_scope_struct_1_unpacks_lua_table_method(PyObject *o, visitproc v, void *a) {
29461   int e;
29462   struct __pyx_obj_4lupa_5_lupa___pyx_scope_struct_1_unpacks_lua_table_method *p = (struct __pyx_obj_4lupa_5_lupa___pyx_scope_struct_1_unpacks_lua_table_method *)o;
29463   if (p->__pyx_v_meth) {
29464     e = (*v)(p->__pyx_v_meth, a); if (e) return e;
29465   }
29466   return 0;
29467 }
29468 
__pyx_tp_clear_4lupa_5_lupa___pyx_scope_struct_1_unpacks_lua_table_method(PyObject * o)29469 static int __pyx_tp_clear_4lupa_5_lupa___pyx_scope_struct_1_unpacks_lua_table_method(PyObject *o) {
29470   PyObject* tmp;
29471   struct __pyx_obj_4lupa_5_lupa___pyx_scope_struct_1_unpacks_lua_table_method *p = (struct __pyx_obj_4lupa_5_lupa___pyx_scope_struct_1_unpacks_lua_table_method *)o;
29472   tmp = ((PyObject*)p->__pyx_v_meth);
29473   p->__pyx_v_meth = Py_None; Py_INCREF(Py_None);
29474   Py_XDECREF(tmp);
29475   return 0;
29476 }
29477 
29478 static PyTypeObject __pyx_type_4lupa_5_lupa___pyx_scope_struct_1_unpacks_lua_table_method = {
29479   PyVarObject_HEAD_INIT(0, 0)
29480   "lupa._lupa.__pyx_scope_struct_1_unpacks_lua_table_method", /*tp_name*/
29481   sizeof(struct __pyx_obj_4lupa_5_lupa___pyx_scope_struct_1_unpacks_lua_table_method), /*tp_basicsize*/
29482   0, /*tp_itemsize*/
29483   __pyx_tp_dealloc_4lupa_5_lupa___pyx_scope_struct_1_unpacks_lua_table_method, /*tp_dealloc*/
29484   #if PY_VERSION_HEX < 0x030800b4
29485   0, /*tp_print*/
29486   #endif
29487   #if PY_VERSION_HEX >= 0x030800b4
29488   0, /*tp_vectorcall_offset*/
29489   #endif
29490   0, /*tp_getattr*/
29491   0, /*tp_setattr*/
29492   #if PY_MAJOR_VERSION < 3
29493   0, /*tp_compare*/
29494   #endif
29495   #if PY_MAJOR_VERSION >= 3
29496   0, /*tp_as_async*/
29497   #endif
29498   0, /*tp_repr*/
29499   0, /*tp_as_number*/
29500   0, /*tp_as_sequence*/
29501   0, /*tp_as_mapping*/
29502   0, /*tp_hash*/
29503   0, /*tp_call*/
29504   0, /*tp_str*/
29505   0, /*tp_getattro*/
29506   0, /*tp_setattro*/
29507   0, /*tp_as_buffer*/
29508   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
29509   0, /*tp_doc*/
29510   __pyx_tp_traverse_4lupa_5_lupa___pyx_scope_struct_1_unpacks_lua_table_method, /*tp_traverse*/
29511   __pyx_tp_clear_4lupa_5_lupa___pyx_scope_struct_1_unpacks_lua_table_method, /*tp_clear*/
29512   0, /*tp_richcompare*/
29513   0, /*tp_weaklistoffset*/
29514   0, /*tp_iter*/
29515   0, /*tp_iternext*/
29516   0, /*tp_methods*/
29517   0, /*tp_members*/
29518   0, /*tp_getset*/
29519   0, /*tp_base*/
29520   0, /*tp_dict*/
29521   0, /*tp_descr_get*/
29522   0, /*tp_descr_set*/
29523   0, /*tp_dictoffset*/
29524   0, /*tp_init*/
29525   0, /*tp_alloc*/
29526   __pyx_tp_new_4lupa_5_lupa___pyx_scope_struct_1_unpacks_lua_table_method, /*tp_new*/
29527   0, /*tp_free*/
29528   0, /*tp_is_gc*/
29529   0, /*tp_bases*/
29530   0, /*tp_mro*/
29531   0, /*tp_cache*/
29532   0, /*tp_subclasses*/
29533   0, /*tp_weaklist*/
29534   0, /*tp_del*/
29535   0, /*tp_version_tag*/
29536   #if PY_VERSION_HEX >= 0x030400a1
29537   0, /*tp_finalize*/
29538   #endif
29539   #if PY_VERSION_HEX >= 0x030800b1
29540   0, /*tp_vectorcall*/
29541   #endif
29542   #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
29543   0, /*tp_print*/
29544   #endif
29545 };
29546 
29547 static PyMethodDef __pyx_methods[] = {
29548   {0, 0, 0, 0}
29549 };
29550 
29551 #if PY_MAJOR_VERSION >= 3
29552 #if CYTHON_PEP489_MULTI_PHASE_INIT
29553 static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
29554 static int __pyx_pymod_exec__lupa(PyObject* module); /*proto*/
29555 static PyModuleDef_Slot __pyx_moduledef_slots[] = {
29556   {Py_mod_create, (void*)__pyx_pymod_create},
29557   {Py_mod_exec, (void*)__pyx_pymod_exec__lupa},
29558   {0, NULL}
29559 };
29560 #endif
29561 
29562 static struct PyModuleDef __pyx_moduledef = {
29563     PyModuleDef_HEAD_INIT,
29564     "_lupa",
29565     __pyx_k_A_fast_Python_wrapper_around_Lu, /* m_doc */
29566   #if CYTHON_PEP489_MULTI_PHASE_INIT
29567     0, /* m_size */
29568   #else
29569     -1, /* m_size */
29570   #endif
29571     __pyx_methods /* m_methods */,
29572   #if CYTHON_PEP489_MULTI_PHASE_INIT
29573     __pyx_moduledef_slots, /* m_slots */
29574   #else
29575     NULL, /* m_reload */
29576   #endif
29577     NULL, /* m_traverse */
29578     NULL, /* m_clear */
29579     NULL /* m_free */
29580 };
29581 #endif
29582 #ifndef CYTHON_SMALL_CODE
29583 #if defined(__clang__)
29584     #define CYTHON_SMALL_CODE
29585 #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
29586     #define CYTHON_SMALL_CODE __attribute__((cold))
29587 #else
29588     #define CYTHON_SMALL_CODE
29589 #endif
29590 #endif
29591 
29592 static __Pyx_StringTabEntry __pyx_string_tab[] = {
29593   {&__pyx_n_s_AttributeError, __pyx_k_AttributeError, sizeof(__pyx_k_AttributeError), 0, 0, 1, 1},
29594   {&__pyx_n_s_BaseException, __pyx_k_BaseException, sizeof(__pyx_k_BaseException), 0, 0, 1, 1},
29595   {&__pyx_kp_s_Base_class_for_errors_in_the_Lua, __pyx_k_Base_class_for_errors_in_the_Lua, sizeof(__pyx_k_Base_class_for_errors_in_the_Lua), 0, 0, 1, 0},
29596   {&__pyx_kp_s_Failed_to_acquire_thread_lock, __pyx_k_Failed_to_acquire_thread_lock, sizeof(__pyx_k_Failed_to_acquire_thread_lock), 0, 0, 1, 0},
29597   {&__pyx_kp_s_Failed_to_initialise_Lua_runtime, __pyx_k_Failed_to_initialise_Lua_runtime, sizeof(__pyx_k_Failed_to_initialise_Lua_runtime), 0, 0, 1, 0},
29598   {&__pyx_n_s_FastRLock, __pyx_k_FastRLock, sizeof(__pyx_k_FastRLock), 0, 0, 1, 1},
29599   {&__pyx_n_s_FastRLock___enter, __pyx_k_FastRLock___enter, sizeof(__pyx_k_FastRLock___enter), 0, 0, 1, 1},
29600   {&__pyx_n_s_FastRLock___exit, __pyx_k_FastRLock___exit, sizeof(__pyx_k_FastRLock___exit), 0, 0, 1, 1},
29601   {&__pyx_n_s_FastRLock___reduce_cython, __pyx_k_FastRLock___reduce_cython, sizeof(__pyx_k_FastRLock___reduce_cython), 0, 0, 1, 1},
29602   {&__pyx_n_s_FastRLock___setstate_cython, __pyx_k_FastRLock___setstate_cython, sizeof(__pyx_k_FastRLock___setstate_cython), 0, 0, 1, 1},
29603   {&__pyx_n_s_FastRLock__is_owned, __pyx_k_FastRLock__is_owned, sizeof(__pyx_k_FastRLock__is_owned), 0, 0, 1, 1},
29604   {&__pyx_n_s_FastRLock_acquire, __pyx_k_FastRLock_acquire, sizeof(__pyx_k_FastRLock_acquire), 0, 0, 1, 1},
29605   {&__pyx_n_s_FastRLock_release, __pyx_k_FastRLock_release, sizeof(__pyx_k_FastRLock_release), 0, 0, 1, 1},
29606   {&__pyx_n_s_ImportError, __pyx_k_ImportError, sizeof(__pyx_k_ImportError), 0, 0, 1, 1},
29607   {&__pyx_n_s_KeyError, __pyx_k_KeyError, sizeof(__pyx_k_KeyError), 0, 0, 1, 1},
29608   {&__pyx_n_s_L, __pyx_k_L, sizeof(__pyx_k_L), 0, 0, 1, 1},
29609   {&__pyx_n_s_LUA_VERSION, __pyx_k_LUA_VERSION, sizeof(__pyx_k_LUA_VERSION), 0, 0, 1, 1},
29610   {&__pyx_n_s_LuaCoroutineFunction___reduce_c, __pyx_k_LuaCoroutineFunction___reduce_c, sizeof(__pyx_k_LuaCoroutineFunction___reduce_c), 0, 0, 1, 1},
29611   {&__pyx_n_s_LuaCoroutineFunction___setstate, __pyx_k_LuaCoroutineFunction___setstate, sizeof(__pyx_k_LuaCoroutineFunction___setstate), 0, 0, 1, 1},
29612   {&__pyx_n_s_LuaError, __pyx_k_LuaError, sizeof(__pyx_k_LuaError), 0, 0, 1, 1},
29613   {&__pyx_n_s_LuaFunction___reduce_cython, __pyx_k_LuaFunction___reduce_cython, sizeof(__pyx_k_LuaFunction___reduce_cython), 0, 0, 1, 1},
29614   {&__pyx_n_s_LuaFunction___setstate_cython, __pyx_k_LuaFunction___setstate_cython, sizeof(__pyx_k_LuaFunction___setstate_cython), 0, 0, 1, 1},
29615   {&__pyx_n_s_LuaFunction_coroutine, __pyx_k_LuaFunction_coroutine, sizeof(__pyx_k_LuaFunction_coroutine), 0, 0, 1, 1},
29616   {&__pyx_n_s_LuaIter___reduce_cython, __pyx_k_LuaIter___reduce_cython, sizeof(__pyx_k_LuaIter___reduce_cython), 0, 0, 1, 1},
29617   {&__pyx_n_s_LuaIter___setstate_cython, __pyx_k_LuaIter___setstate_cython, sizeof(__pyx_k_LuaIter___setstate_cython), 0, 0, 1, 1},
29618   {&__pyx_kp_u_LuaIter_r, __pyx_k_LuaIter_r, sizeof(__pyx_k_LuaIter_r), 0, 1, 0, 0},
29619   {&__pyx_n_s_LuaObject___reduce_cython, __pyx_k_LuaObject___reduce_cython, sizeof(__pyx_k_LuaObject___reduce_cython), 0, 0, 1, 1},
29620   {&__pyx_n_s_LuaObject___setstate_cython, __pyx_k_LuaObject___setstate_cython, sizeof(__pyx_k_LuaObject___setstate_cython), 0, 0, 1, 1},
29621   {&__pyx_n_s_LuaRuntime, __pyx_k_LuaRuntime, sizeof(__pyx_k_LuaRuntime), 0, 0, 1, 1},
29622   {&__pyx_n_s_LuaRuntime___reduce_cython, __pyx_k_LuaRuntime___reduce_cython, sizeof(__pyx_k_LuaRuntime___reduce_cython), 0, 0, 1, 1},
29623   {&__pyx_n_s_LuaRuntime___setstate_cython, __pyx_k_LuaRuntime___setstate_cython, sizeof(__pyx_k_LuaRuntime___setstate_cython), 0, 0, 1, 1},
29624   {&__pyx_n_s_LuaRuntime_compile, __pyx_k_LuaRuntime_compile, sizeof(__pyx_k_LuaRuntime_compile), 0, 0, 1, 1},
29625   {&__pyx_n_s_LuaRuntime_eval, __pyx_k_LuaRuntime_eval, sizeof(__pyx_k_LuaRuntime_eval), 0, 0, 1, 1},
29626   {&__pyx_n_s_LuaRuntime_execute, __pyx_k_LuaRuntime_execute, sizeof(__pyx_k_LuaRuntime_execute), 0, 0, 1, 1},
29627   {&__pyx_n_s_LuaRuntime_globals, __pyx_k_LuaRuntime_globals, sizeof(__pyx_k_LuaRuntime_globals), 0, 0, 1, 1},
29628   {&__pyx_n_s_LuaRuntime_require, __pyx_k_LuaRuntime_require, sizeof(__pyx_k_LuaRuntime_require), 0, 0, 1, 1},
29629   {&__pyx_n_s_LuaRuntime_table, __pyx_k_LuaRuntime_table, sizeof(__pyx_k_LuaRuntime_table), 0, 0, 1, 1},
29630   {&__pyx_n_s_LuaRuntime_table_from, __pyx_k_LuaRuntime_table_from, sizeof(__pyx_k_LuaRuntime_table_from), 0, 0, 1, 1},
29631   {&__pyx_n_s_LuaSyntaxError, __pyx_k_LuaSyntaxError, sizeof(__pyx_k_LuaSyntaxError), 0, 0, 1, 1},
29632   {&__pyx_n_s_LuaTable___reduce_cython, __pyx_k_LuaTable___reduce_cython, sizeof(__pyx_k_LuaTable___reduce_cython), 0, 0, 1, 1},
29633   {&__pyx_n_s_LuaTable___setstate_cython, __pyx_k_LuaTable___setstate_cython, sizeof(__pyx_k_LuaTable___setstate_cython), 0, 0, 1, 1},
29634   {&__pyx_n_s_LuaTable_items, __pyx_k_LuaTable_items, sizeof(__pyx_k_LuaTable_items), 0, 0, 1, 1},
29635   {&__pyx_n_s_LuaTable_keys, __pyx_k_LuaTable_keys, sizeof(__pyx_k_LuaTable_keys), 0, 0, 1, 1},
29636   {&__pyx_n_s_LuaTable_values, __pyx_k_LuaTable_values, sizeof(__pyx_k_LuaTable_values), 0, 0, 1, 1},
29637   {&__pyx_n_s_LuaThread___reduce_cython, __pyx_k_LuaThread___reduce_cython, sizeof(__pyx_k_LuaThread___reduce_cython), 0, 0, 1, 1},
29638   {&__pyx_n_s_LuaThread___setstate_cython, __pyx_k_LuaThread___setstate_cython, sizeof(__pyx_k_LuaThread___setstate_cython), 0, 0, 1, 1},
29639   {&__pyx_n_s_LuaThread_send, __pyx_k_LuaThread_send, sizeof(__pyx_k_LuaThread_send), 0, 0, 1, 1},
29640   {&__pyx_kp_s_Lua_object_is_not_a_function, __pyx_k_Lua_object_is_not_a_function, sizeof(__pyx_k_Lua_object_is_not_a_function), 0, 0, 1, 0},
29641   {&__pyx_n_s_Mapping, __pyx_k_Mapping, sizeof(__pyx_k_Mapping), 0, 0, 1, 1},
29642   {&__pyx_n_s_MemoryError, __pyx_k_MemoryError, sizeof(__pyx_k_MemoryError), 0, 0, 1, 1},
29643   {&__pyx_n_s_PyProtocolWrapper___reduce_cyth, __pyx_k_PyProtocolWrapper___reduce_cyth, sizeof(__pyx_k_PyProtocolWrapper___reduce_cyth), 0, 0, 1, 1},
29644   {&__pyx_n_s_PyProtocolWrapper___setstate_cy, __pyx_k_PyProtocolWrapper___setstate_cy, sizeof(__pyx_k_PyProtocolWrapper___setstate_cy), 0, 0, 1, 1},
29645   {&__pyx_n_b_Py_None, __pyx_k_Py_None, sizeof(__pyx_k_Py_None), 0, 0, 0, 1},
29646   {&__pyx_n_s_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 0, 0, 1, 1},
29647   {&__pyx_n_s_StopIteration, __pyx_k_StopIteration, sizeof(__pyx_k_StopIteration), 0, 0, 1, 1},
29648   {&__pyx_kp_s_Syntax_error_in_Lua_code, __pyx_k_Syntax_error_in_Lua_code, sizeof(__pyx_k_Syntax_error_in_Lua_code), 0, 0, 1, 0},
29649   {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1},
29650   {&__pyx_kp_s_Type_cannot_be_instantiated_from, __pyx_k_Type_cannot_be_instantiated_from, sizeof(__pyx_k_Type_cannot_be_instantiated_from), 0, 0, 1, 0},
29651   {&__pyx_kp_s_Type_cannot_be_instantiated_manu, __pyx_k_Type_cannot_be_instantiated_manu, sizeof(__pyx_k_Type_cannot_be_instantiated_manu), 0, 0, 1, 0},
29652   {&__pyx_kp_b_UTF_8, __pyx_k_UTF_8, sizeof(__pyx_k_UTF_8), 0, 0, 0, 0},
29653   {&__pyx_kp_s_UTF_8, __pyx_k_UTF_8, sizeof(__pyx_k_UTF_8), 0, 0, 1, 0},
29654   {&__pyx_n_s_UnicodeDecodeError, __pyx_k_UnicodeDecodeError, sizeof(__pyx_k_UnicodeDecodeError), 0, 0, 1, 1},
29655   {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
29656   {&__pyx_n_b__16, __pyx_k__16, sizeof(__pyx_k__16), 0, 0, 0, 1},
29657   {&__pyx_n_u__16, __pyx_k__16, sizeof(__pyx_k__16), 0, 1, 0, 1},
29658   {&__pyx_n_s_acquire, __pyx_k_acquire, sizeof(__pyx_k_acquire), 0, 0, 1, 1},
29659   {&__pyx_n_s_all, __pyx_k_all, sizeof(__pyx_k_all), 0, 0, 1, 1},
29660   {&__pyx_n_s_append, __pyx_k_append, sizeof(__pyx_k_append), 0, 0, 1, 1},
29661   {&__pyx_n_s_arg, __pyx_k_arg, sizeof(__pyx_k_arg), 0, 0, 1, 1},
29662   {&__pyx_n_s_args, __pyx_k_args, sizeof(__pyx_k_args), 0, 0, 1, 1},
29663   {&__pyx_n_s_as_attrgetter, __pyx_k_as_attrgetter, sizeof(__pyx_k_as_attrgetter), 0, 0, 1, 1},
29664   {&__pyx_n_s_as_itemgetter, __pyx_k_as_itemgetter, sizeof(__pyx_k_as_itemgetter), 0, 0, 1, 1},
29665   {&__pyx_n_s_attribute_filter, __pyx_k_attribute_filter, sizeof(__pyx_k_attribute_filter), 0, 0, 1, 1},
29666   {&__pyx_kp_s_attribute_filter_and_attribute_h, __pyx_k_attribute_filter_and_attribute_h, sizeof(__pyx_k_attribute_filter_and_attribute_h), 0, 0, 1, 0},
29667   {&__pyx_kp_s_attribute_filter_must_be_callabl, __pyx_k_attribute_filter_must_be_callabl, sizeof(__pyx_k_attribute_filter_must_be_callabl), 0, 0, 1, 0},
29668   {&__pyx_n_s_attribute_handlers, __pyx_k_attribute_handlers, sizeof(__pyx_k_attribute_handlers), 0, 0, 1, 1},
29669   {&__pyx_kp_s_attribute_handlers_must_be_a_seq, __pyx_k_attribute_handlers_must_be_a_seq, sizeof(__pyx_k_attribute_handlers_must_be_a_seq), 0, 0, 1, 0},
29670   {&__pyx_n_s_blocking, __pyx_k_blocking, sizeof(__pyx_k_blocking), 0, 0, 1, 1},
29671   {&__pyx_n_s_builtin, __pyx_k_builtin, sizeof(__pyx_k_builtin), 0, 0, 1, 1},
29672   {&__pyx_n_b_builtins, __pyx_k_builtins, sizeof(__pyx_k_builtins), 0, 0, 0, 1},
29673   {&__pyx_n_s_builtins, __pyx_k_builtins, sizeof(__pyx_k_builtins), 0, 0, 1, 1},
29674   {&__pyx_kp_s_byte_string_input_has_unknown_en, __pyx_k_byte_string_input_has_unknown_en, sizeof(__pyx_k_byte_string_input_has_unknown_en), 0, 0, 1, 0},
29675   {&__pyx_kp_s_can_t_send_non_None_value_to_a_j, __pyx_k_can_t_send_non_None_value_to_a_j, sizeof(__pyx_k_can_t_send_non_None_value_to_a_j), 0, 0, 1, 0},
29676   {&__pyx_kp_s_cannot_iterate_over_non_table_fo, __pyx_k_cannot_iterate_over_non_table_fo, sizeof(__pyx_k_cannot_iterate_over_non_table_fo), 0, 0, 1, 0},
29677   {&__pyx_kp_s_cannot_mix_objects_from_differen, __pyx_k_cannot_mix_objects_from_differen, sizeof(__pyx_k_cannot_mix_objects_from_differen), 0, 0, 1, 0},
29678   {&__pyx_kp_s_cannot_release_un_acquired_lock, __pyx_k_cannot_release_un_acquired_lock, sizeof(__pyx_k_cannot_release_un_acquired_lock), 0, 0, 1, 0},
29679   {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
29680   {&__pyx_n_s_co, __pyx_k_co, sizeof(__pyx_k_co), 0, 0, 1, 1},
29681   {&__pyx_n_s_collections, __pyx_k_collections, sizeof(__pyx_k_collections), 0, 0, 1, 1},
29682   {&__pyx_n_s_collections_abc, __pyx_k_collections_abc, sizeof(__pyx_k_collections_abc), 0, 0, 1, 1},
29683   {&__pyx_n_s_compile, __pyx_k_compile, sizeof(__pyx_k_compile), 0, 0, 1, 1},
29684   {&__pyx_n_s_coroutine, __pyx_k_coroutine, sizeof(__pyx_k_coroutine), 0, 0, 1, 1},
29685   {&__pyx_n_s_delattr, __pyx_k_delattr, sizeof(__pyx_k_delattr), 0, 0, 1, 1},
29686   {&__pyx_n_s_doc, __pyx_k_doc, sizeof(__pyx_k_doc), 0, 0, 1, 1},
29687   {&__pyx_n_s_encoding, __pyx_k_encoding, sizeof(__pyx_k_encoding), 0, 0, 1, 1},
29688   {&__pyx_n_s_enter, __pyx_k_enter, sizeof(__pyx_k_enter), 0, 0, 1, 1},
29689   {&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1},
29690   {&__pyx_n_s_err, __pyx_k_err, sizeof(__pyx_k_err), 0, 0, 1, 1},
29691   {&__pyx_n_s_error, __pyx_k_error, sizeof(__pyx_k_error), 0, 0, 1, 1},
29692   {&__pyx_kp_b_error_creating_an_iterator, __pyx_k_error_creating_an_iterator, sizeof(__pyx_k_error_creating_an_iterator), 0, 0, 0, 0},
29693   {&__pyx_kp_b_error_creating_an_iterator_with, __pyx_k_error_creating_an_iterator_with, sizeof(__pyx_k_error_creating_an_iterator_with), 0, 0, 0, 0},
29694   {&__pyx_kp_b_error_during_Python_call, __pyx_k_error_during_Python_call, sizeof(__pyx_k_error_during_Python_call), 0, 0, 0, 0},
29695   {&__pyx_kp_b_error_during_Python_str_call, __pyx_k_error_during_Python_str_call, sizeof(__pyx_k_error_during_Python_str_call), 0, 0, 0, 0},
29696   {&__pyx_kp_u_error_loading_code_s, __pyx_k_error_loading_code_s, sizeof(__pyx_k_error_loading_code_s), 0, 1, 0, 0},
29697   {&__pyx_kp_b_error_reading_Python_attribute_i, __pyx_k_error_reading_Python_attribute_i, sizeof(__pyx_k_error_reading_Python_attribute_i), 0, 0, 0, 0},
29698   {&__pyx_kp_b_error_while_calling_next_iterato, __pyx_k_error_while_calling_next_iterato, sizeof(__pyx_k_error_while_calling_next_iterato), 0, 0, 0, 0},
29699   {&__pyx_kp_b_error_while_cleaning_up_a_Python, __pyx_k_error_while_cleaning_up_a_Python, sizeof(__pyx_k_error_while_cleaning_up_a_Python), 0, 0, 0, 0},
29700   {&__pyx_kp_b_error_writing_Python_attribute_i, __pyx_k_error_writing_Python_attribute_i, sizeof(__pyx_k_error_writing_Python_attribute_i), 0, 0, 0, 0},
29701   {&__pyx_n_b_eval, __pyx_k_eval, sizeof(__pyx_k_eval), 0, 0, 0, 1},
29702   {&__pyx_n_s_eval, __pyx_k_eval, sizeof(__pyx_k_eval), 0, 0, 1, 1},
29703   {&__pyx_n_s_exc_info, __pyx_k_exc_info, sizeof(__pyx_k_exc_info), 0, 0, 1, 1},
29704   {&__pyx_n_s_execute, __pyx_k_execute, sizeof(__pyx_k_execute), 0, 0, 1, 1},
29705   {&__pyx_n_s_exit, __pyx_k_exit, sizeof(__pyx_k_exit), 0, 0, 1, 1},
29706   {&__pyx_kp_s_expected_string_got_s, __pyx_k_expected_string_got_s, sizeof(__pyx_k_expected_string_got_s), 0, 0, 1, 0},
29707   {&__pyx_kp_s_failed_to_convert_argument_at_in, __pyx_k_failed_to_convert_argument_at_in, sizeof(__pyx_k_failed_to_convert_argument_at_in), 0, 0, 1, 0},
29708   {&__pyx_kp_s_failed_to_convert_s_object, __pyx_k_failed_to_convert_s_object, sizeof(__pyx_k_failed_to_convert_s_object), 0, 0, 1, 0},
29709   {&__pyx_n_s_func, __pyx_k_func, sizeof(__pyx_k_func), 0, 0, 1, 1},
29710   {&__pyx_n_s_function, __pyx_k_function, sizeof(__pyx_k_function), 0, 0, 1, 1},
29711   {&__pyx_kp_s_function_if_type_jit_table_then, __pyx_k_function_if_type_jit_table_then, sizeof(__pyx_k_function_if_type_jit_table_then), 0, 0, 1, 0},
29712   {&__pyx_n_s_functools, __pyx_k_functools, sizeof(__pyx_k_functools), 0, 0, 1, 1},
29713   {&__pyx_n_s_getattr, __pyx_k_getattr, sizeof(__pyx_k_getattr), 0, 0, 1, 1},
29714   {&__pyx_n_s_getitem, __pyx_k_getitem, sizeof(__pyx_k_getitem), 0, 0, 1, 1},
29715   {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1},
29716   {&__pyx_n_s_globals, __pyx_k_globals, sizeof(__pyx_k_globals), 0, 0, 1, 1},
29717   {&__pyx_kp_s_globals_not_defined, __pyx_k_globals_not_defined, sizeof(__pyx_k_globals_not_defined), 0, 0, 1, 0},
29718   {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1},
29719   {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
29720   {&__pyx_n_s_is_owned, __pyx_k_is_owned, sizeof(__pyx_k_is_owned), 0, 0, 1, 1},
29721   {&__pyx_kp_s_item_attribute_access_not_suppor, __pyx_k_item_attribute_access_not_suppor, sizeof(__pyx_k_item_attribute_access_not_suppor), 0, 0, 1, 0},
29722   {&__pyx_n_s_items, __pyx_k_items, sizeof(__pyx_k_items), 0, 0, 1, 1},
29723   {&__pyx_kp_s_iteration_is_only_supported_for, __pyx_k_iteration_is_only_supported_for, sizeof(__pyx_k_iteration_is_only_supported_for), 0, 0, 1, 0},
29724   {&__pyx_n_s_iteritems, __pyx_k_iteritems, sizeof(__pyx_k_iteritems), 0, 0, 1, 1},
29725   {&__pyx_n_s_key, __pyx_k_key, sizeof(__pyx_k_key), 0, 0, 1, 1},
29726   {&__pyx_n_s_keys, __pyx_k_keys, sizeof(__pyx_k_keys), 0, 0, 1, 1},
29727   {&__pyx_n_s_kwargs, __pyx_k_kwargs, sizeof(__pyx_k_kwargs), 0, 0, 1, 1},
29728   {&__pyx_kp_s_lost_reference, __pyx_k_lost_reference, sizeof(__pyx_k_lost_reference), 0, 0, 1, 0},
29729   {&__pyx_n_s_ltype, __pyx_k_ltype, sizeof(__pyx_k_ltype), 0, 0, 1, 1},
29730   {&__pyx_n_s_lua_code, __pyx_k_lua_code, sizeof(__pyx_k_lua_code), 0, 0, 1, 1},
29731   {&__pyx_n_s_lua_object, __pyx_k_lua_object, sizeof(__pyx_k_lua_object), 0, 0, 1, 1},
29732   {&__pyx_n_s_lua_type, __pyx_k_lua_type, sizeof(__pyx_k_lua_type), 0, 0, 1, 1},
29733   {&__pyx_n_s_lua_type_name, __pyx_k_lua_type_name, sizeof(__pyx_k_lua_type_name), 0, 0, 1, 1},
29734   {&__pyx_n_s_lupa__lupa, __pyx_k_lupa__lupa, sizeof(__pyx_k_lupa__lupa), 0, 0, 1, 1},
29735   {&__pyx_kp_s_lupa__lupa_pyx, __pyx_k_lupa__lupa_pyx, sizeof(__pyx_k_lupa__lupa_pyx), 0, 0, 1, 0},
29736   {&__pyx_kp_s_lupa_lock_pxi, __pyx_k_lupa_lock_pxi, sizeof(__pyx_k_lupa_lock_pxi), 0, 0, 1, 0},
29737   {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
29738   {&__pyx_n_s_metaclass, __pyx_k_metaclass, sizeof(__pyx_k_metaclass), 0, 0, 1, 1},
29739   {&__pyx_n_s_meth, __pyx_k_meth, sizeof(__pyx_k_meth), 0, 0, 1, 1},
29740   {&__pyx_n_s_module, __pyx_k_module, sizeof(__pyx_k_module), 0, 0, 1, 1},
29741   {&__pyx_n_s_modulename, __pyx_k_modulename, sizeof(__pyx_k_modulename), 0, 0, 1, 1},
29742   {&__pyx_kp_s_modulename_must_be_a_string, __pyx_k_modulename_must_be_a_string, sizeof(__pyx_k_modulename_must_be_a_string), 0, 0, 1, 0},
29743   {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
29744   {&__pyx_n_s_name_2, __pyx_k_name_2, sizeof(__pyx_k_name_2), 0, 0, 1, 1},
29745   {&__pyx_kp_s_no_default___reduce___due_to_non, __pyx_k_no_default___reduce___due_to_non, sizeof(__pyx_k_no_default___reduce___due_to_non), 0, 0, 1, 0},
29746   {&__pyx_n_b_none, __pyx_k_none, sizeof(__pyx_k_none), 0, 0, 0, 1},
29747   {&__pyx_kp_s_not_a_python_object, __pyx_k_not_a_python_object, sizeof(__pyx_k_not_a_python_object), 0, 0, 1, 0},
29748   {&__pyx_n_s_obj, __pyx_k_obj, sizeof(__pyx_k_obj), 0, 0, 1, 1},
29749   {&__pyx_n_s_object, __pyx_k_object, sizeof(__pyx_k_object), 0, 0, 1, 1},
29750   {&__pyx_n_s_old_top, __pyx_k_old_top, sizeof(__pyx_k_old_top), 0, 0, 1, 1},
29751   {&__pyx_n_s_oldtop, __pyx_k_oldtop, sizeof(__pyx_k_oldtop), 0, 0, 1, 1},
29752   {&__pyx_n_s_pop, __pyx_k_pop, sizeof(__pyx_k_pop), 0, 0, 1, 1},
29753   {&__pyx_n_s_prepare, __pyx_k_prepare, sizeof(__pyx_k_prepare), 0, 0, 1, 1},
29754   {&__pyx_n_s_pyx_state, __pyx_k_pyx_state, sizeof(__pyx_k_pyx_state), 0, 0, 1, 1},
29755   {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1},
29756   {&__pyx_n_s_qualname, __pyx_k_qualname, sizeof(__pyx_k_qualname), 0, 0, 1, 1},
29757   {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
29758   {&__pyx_n_s_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1},
29759   {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1},
29760   {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1},
29761   {&__pyx_n_s_register_builtins, __pyx_k_register_builtins, sizeof(__pyx_k_register_builtins), 0, 0, 1, 1},
29762   {&__pyx_n_s_register_eval, __pyx_k_register_eval, sizeof(__pyx_k_register_eval), 0, 0, 1, 1},
29763   {&__pyx_n_s_release, __pyx_k_release, sizeof(__pyx_k_release), 0, 0, 1, 1},
29764   {&__pyx_n_s_require, __pyx_k_require, sizeof(__pyx_k_require), 0, 0, 1, 1},
29765   {&__pyx_kp_s_require_is_not_defined, __pyx_k_require_is_not_defined, sizeof(__pyx_k_require_is_not_defined), 0, 0, 1, 0},
29766   {&__pyx_kp_b_return, __pyx_k_return, sizeof(__pyx_k_return), 0, 0, 0, 0},
29767   {&__pyx_n_s_self, __pyx_k_self, sizeof(__pyx_k_self), 0, 0, 1, 1},
29768   {&__pyx_kp_s_self__co_state_self__state_canno, __pyx_k_self__co_state_self__state_canno, sizeof(__pyx_k_self__co_state_self__state_canno), 0, 0, 1, 0},
29769   {&__pyx_kp_s_self__state_cannot_be_converted, __pyx_k_self__state_cannot_be_converted, sizeof(__pyx_k_self__state_cannot_be_converted), 0, 0, 1, 0},
29770   {&__pyx_n_s_send, __pyx_k_send, sizeof(__pyx_k_send), 0, 0, 1, 1},
29771   {&__pyx_n_s_setattr, __pyx_k_setattr, sizeof(__pyx_k_setattr), 0, 0, 1, 1},
29772   {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1},
29773   {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1},
29774   {&__pyx_n_s_size, __pyx_k_size, sizeof(__pyx_k_size), 0, 0, 1, 1},
29775   {&__pyx_n_s_source_encoding, __pyx_k_source_encoding, sizeof(__pyx_k_source_encoding), 0, 0, 1, 1},
29776   {&__pyx_n_s_status, __pyx_k_status, sizeof(__pyx_k_status), 0, 0, 1, 1},
29777   {&__pyx_kp_s_stringsource, __pyx_k_stringsource, sizeof(__pyx_k_stringsource), 0, 0, 1, 0},
29778   {&__pyx_n_s_sys, __pyx_k_sys, sizeof(__pyx_k_sys), 0, 0, 1, 1},
29779   {&__pyx_n_s_t, __pyx_k_t, sizeof(__pyx_k_t), 0, 0, 1, 1},
29780   {&__pyx_n_s_table, __pyx_k_table, sizeof(__pyx_k_table), 0, 0, 1, 1},
29781   {&__pyx_n_s_table_from, __pyx_k_table_from, sizeof(__pyx_k_table_from), 0, 0, 1, 1},
29782   {&__pyx_n_s_tb, __pyx_k_tb, sizeof(__pyx_k_tb), 0, 0, 1, 1},
29783   {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
29784   {&__pyx_n_s_thread, __pyx_k_thread, sizeof(__pyx_k_thread), 0, 0, 1, 1},
29785   {&__pyx_n_s_unpack_returned_tuples, __pyx_k_unpack_returned_tuples, sizeof(__pyx_k_unpack_returned_tuples), 0, 0, 1, 1},
29786   {&__pyx_n_s_unpacks_lua_table, __pyx_k_unpacks_lua_table, sizeof(__pyx_k_unpacks_lua_table), 0, 0, 1, 1},
29787   {&__pyx_n_s_unpacks_lua_table_locals_wrapper, __pyx_k_unpacks_lua_table_locals_wrapper, sizeof(__pyx_k_unpacks_lua_table_locals_wrapper), 0, 0, 1, 1},
29788   {&__pyx_n_s_unpacks_lua_table_method, __pyx_k_unpacks_lua_table_method, sizeof(__pyx_k_unpacks_lua_table_method), 0, 0, 1, 1},
29789   {&__pyx_n_s_unpacks_lua_table_method_locals, __pyx_k_unpacks_lua_table_method_locals, sizeof(__pyx_k_unpacks_lua_table_method_locals), 0, 0, 1, 1},
29790   {&__pyx_n_s_userdata, __pyx_k_userdata, sizeof(__pyx_k_userdata), 0, 0, 1, 1},
29791   {&__pyx_n_s_v, __pyx_k_v, sizeof(__pyx_k_v), 0, 0, 1, 1},
29792   {&__pyx_n_s_value, __pyx_k_value, sizeof(__pyx_k_value), 0, 0, 1, 1},
29793   {&__pyx_n_s_values, __pyx_k_values, sizeof(__pyx_k_values), 0, 0, 1, 1},
29794   {&__pyx_n_s_what, __pyx_k_what, sizeof(__pyx_k_what), 0, 0, 1, 1},
29795   {&__pyx_n_s_wrap, __pyx_k_wrap, sizeof(__pyx_k_wrap), 0, 0, 1, 1},
29796   {&__pyx_n_s_wrapper, __pyx_k_wrapper, sizeof(__pyx_k_wrapper), 0, 0, 1, 1},
29797   {&__pyx_n_s_wraps, __pyx_k_wraps, sizeof(__pyx_k_wraps), 0, 0, 1, 1},
29798   {0, 0, 0, 0, 0, 0, 0}
29799 };
__Pyx_InitCachedBuiltins(void)29800 static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
29801   __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(0, 47, __pyx_L1_error)
29802   __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(1, 27, __pyx_L1_error)
29803   __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(1, 39, __pyx_L1_error)
29804   __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(2, 2, __pyx_L1_error)
29805   __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(0, 226, __pyx_L1_error)
29806   __pyx_builtin_eval = __Pyx_GetBuiltinName(__pyx_n_s_eval); if (!__pyx_builtin_eval) __PYX_ERR(0, 451, __pyx_L1_error)
29807   __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 519, __pyx_L1_error)
29808   __pyx_builtin_UnicodeDecodeError = __Pyx_GetBuiltinName(__pyx_n_s_UnicodeDecodeError); if (!__pyx_builtin_UnicodeDecodeError) __PYX_ERR(0, 648, __pyx_L1_error)
29809   __pyx_builtin_object = __Pyx_GetBuiltinName(__pyx_n_s_object); if (!__pyx_builtin_object) __PYX_ERR(0, 663, __pyx_L1_error)
29810   __pyx_builtin_AttributeError = __Pyx_GetBuiltinName(__pyx_n_s_AttributeError); if (!__pyx_builtin_AttributeError) __PYX_ERR(0, 683, __pyx_L1_error)
29811   __pyx_builtin_StopIteration = __Pyx_GetBuiltinName(__pyx_n_s_StopIteration); if (!__pyx_builtin_StopIteration) __PYX_ERR(0, 955, __pyx_L1_error)
29812   __pyx_builtin_BaseException = __Pyx_GetBuiltinName(__pyx_n_s_BaseException); if (!__pyx_builtin_BaseException) __PYX_ERR(0, 1357, __pyx_L1_error)
29813   __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(0, 1367, __pyx_L1_error)
29814   __pyx_builtin_KeyError = __Pyx_GetBuiltinName(__pyx_n_s_KeyError); if (!__pyx_builtin_KeyError) __PYX_ERR(0, 1424, __pyx_L1_error)
29815   return 0;
29816   __pyx_L1_error:;
29817   return -1;
29818 }
29819 
__Pyx_InitCachedConstants(void)29820 static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
29821   __Pyx_RefNannyDeclarations
29822   __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
29823 
29824   /* "lupa/lock.pxi":39
29825  *     def release(self):
29826  *         if self._owner != pythread.PyThread_get_thread_ident():
29827  *             raise RuntimeError("cannot release un-acquired lock")             # <<<<<<<<<<<<<<
29828  *         unlock_lock(self)
29829  *
29830  */
29831   __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_s_cannot_release_un_acquired_lock); if (unlikely(!__pyx_tuple_)) __PYX_ERR(1, 39, __pyx_L1_error)
29832   __Pyx_GOTREF(__pyx_tuple_);
29833   __Pyx_GIVEREF(__pyx_tuple_);
29834 
29835   /* "(tree fragment)":2
29836  * def __reduce_cython__(self):
29837  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
29838  * def __setstate_cython__(self, __pyx_state):
29839  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
29840  */
29841   __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(2, 2, __pyx_L1_error)
29842   __Pyx_GOTREF(__pyx_tuple__2);
29843   __Pyx_GIVEREF(__pyx_tuple__2);
29844 
29845   /* "(tree fragment)":4
29846  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
29847  * def __setstate_cython__(self, __pyx_state):
29848  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
29849  */
29850   __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(2, 4, __pyx_L1_error)
29851   __Pyx_GOTREF(__pyx_tuple__3);
29852   __Pyx_GIVEREF(__pyx_tuple__3);
29853 
29854   /* "lupa/_lupa.pyx":226
29855  *         self._source_encoding = _asciiOrNone(source_encoding) or self._encoding or b'UTF-8'
29856  *         if attribute_filter is not None and not callable(attribute_filter):
29857  *             raise ValueError("attribute_filter must be callable")             # <<<<<<<<<<<<<<
29858  *         self._attribute_filter = attribute_filter
29859  *         self._unpack_returned_tuples = unpack_returned_tuples
29860  */
29861   __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_s_attribute_filter_must_be_callabl); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 226, __pyx_L1_error)
29862   __Pyx_GOTREF(__pyx_tuple__4);
29863   __Pyx_GIVEREF(__pyx_tuple__4);
29864 
29865   /* "lupa/_lupa.pyx":241
29866  *                     raise_error = True
29867  *             if raise_error:
29868  *                 raise ValueError("attribute_handlers must be a sequence of two callables")             # <<<<<<<<<<<<<<
29869  *             if attribute_filter and (getter is not None or setter is not None):
29870  *                 raise ValueError("attribute_filter and attribute_handlers are mutually exclusive")
29871  */
29872   __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_s_attribute_handlers_must_be_a_seq); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 241, __pyx_L1_error)
29873   __Pyx_GOTREF(__pyx_tuple__5);
29874   __Pyx_GIVEREF(__pyx_tuple__5);
29875 
29876   /* "lupa/_lupa.pyx":243
29877  *                 raise ValueError("attribute_handlers must be a sequence of two callables")
29878  *             if attribute_filter and (getter is not None or setter is not None):
29879  *                 raise ValueError("attribute_filter and attribute_handlers are mutually exclusive")             # <<<<<<<<<<<<<<
29880  *             self._attribute_getter, self._attribute_setter = getter, setter
29881  *
29882  */
29883   __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_s_attribute_filter_and_attribute_h); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 243, __pyx_L1_error)
29884   __Pyx_GOTREF(__pyx_tuple__6);
29885   __Pyx_GIVEREF(__pyx_tuple__6);
29886 
29887   /* "lupa/_lupa.pyx":338
29888  *         cdef lua_State *L = self._state
29889  *         if not isinstance(modulename, (bytes, unicode)):
29890  *             raise TypeError("modulename must be a string")             # <<<<<<<<<<<<<<
29891  *         lock_runtime(self)
29892  *         old_top = lua.lua_gettop(L)
29893  */
29894   __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_s_modulename_must_be_a_string); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 338, __pyx_L1_error)
29895   __Pyx_GOTREF(__pyx_tuple__7);
29896   __Pyx_GIVEREF(__pyx_tuple__7);
29897 
29898   /* "(tree fragment)":2
29899  * def __reduce_cython__(self):
29900  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
29901  * def __setstate_cython__(self, __pyx_state):
29902  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
29903  */
29904   __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(2, 2, __pyx_L1_error)
29905   __Pyx_GOTREF(__pyx_tuple__8);
29906   __Pyx_GIVEREF(__pyx_tuple__8);
29907 
29908   /* "(tree fragment)":4
29909  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
29910  * def __setstate_cython__(self, __pyx_state):
29911  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
29912  */
29913   __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(2, 4, __pyx_L1_error)
29914   __Pyx_GOTREF(__pyx_tuple__9);
29915   __Pyx_GIVEREF(__pyx_tuple__9);
29916 
29917   /* "lupa/_lupa.pyx":482
29918  *     """
29919  *     @wraps(func)
29920  *     def wrapper(*args):             # <<<<<<<<<<<<<<
29921  *         args, kwargs = _fix_args_kwargs(args)
29922  *         return func(*args, **kwargs)
29923  */
29924   __pyx_tuple__10 = PyTuple_Pack(2, __pyx_n_s_args, __pyx_n_s_kwargs); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 482, __pyx_L1_error)
29925   __Pyx_GOTREF(__pyx_tuple__10);
29926   __Pyx_GIVEREF(__pyx_tuple__10);
29927   __pyx_codeobj__11 = (PyObject*)__Pyx_PyCode_New(0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__10, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_lupa__lupa_pyx, __pyx_n_s_wrapper, 482, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__11)) __PYX_ERR(0, 482, __pyx_L1_error)
29928 
29929   /* "lupa/_lupa.pyx":494
29930  *     """
29931  *     @wraps(meth)
29932  *     def wrapper(self, *args):             # <<<<<<<<<<<<<<
29933  *         args, kwargs = _fix_args_kwargs(args)
29934  *         return meth(self, *args, **kwargs)
29935  */
29936   __pyx_tuple__12 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_args, __pyx_n_s_kwargs); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 494, __pyx_L1_error)
29937   __Pyx_GOTREF(__pyx_tuple__12);
29938   __Pyx_GIVEREF(__pyx_tuple__12);
29939   __pyx_codeobj__13 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__12, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_lupa__lupa_pyx, __pyx_n_s_wrapper, 494, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__13)) __PYX_ERR(0, 494, __pyx_L1_error)
29940 
29941   /* "lupa/_lupa.pyx":557
29942  *
29943  *     def __init__(self):
29944  *         raise TypeError("Type cannot be instantiated manually")             # <<<<<<<<<<<<<<
29945  *
29946  *     def __dealloc__(self):
29947  */
29948   __pyx_tuple__14 = PyTuple_Pack(1, __pyx_kp_s_Type_cannot_be_instantiated_manu); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(0, 557, __pyx_L1_error)
29949   __Pyx_GOTREF(__pyx_tuple__14);
29950   __Pyx_GIVEREF(__pyx_tuple__14);
29951 
29952   /* "lupa/_lupa.pyx":614
29953  *     def __iter__(self):
29954  *         # if not provided, iteration will try item access and call into Lua
29955  *         raise TypeError("iteration is only supported for tables")             # <<<<<<<<<<<<<<
29956  *
29957  *     def __repr__(self):
29958  */
29959   __pyx_tuple__15 = PyTuple_Pack(1, __pyx_kp_s_iteration_is_only_supported_for); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(0, 614, __pyx_L1_error)
29960   __Pyx_GOTREF(__pyx_tuple__15);
29961   __Pyx_GIVEREF(__pyx_tuple__15);
29962 
29963   /* "(tree fragment)":2
29964  * def __reduce_cython__(self):
29965  *     raise TypeError("self._state cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
29966  * def __setstate_cython__(self, __pyx_state):
29967  *     raise TypeError("self._state cannot be converted to a Python object for pickling")
29968  */
29969   __pyx_tuple__17 = PyTuple_Pack(1, __pyx_kp_s_self__state_cannot_be_converted); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(2, 2, __pyx_L1_error)
29970   __Pyx_GOTREF(__pyx_tuple__17);
29971   __Pyx_GIVEREF(__pyx_tuple__17);
29972 
29973   /* "(tree fragment)":4
29974  *     raise TypeError("self._state cannot be converted to a Python object for pickling")
29975  * def __setstate_cython__(self, __pyx_state):
29976  *     raise TypeError("self._state cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
29977  */
29978   __pyx_tuple__18 = PyTuple_Pack(1, __pyx_kp_s_self__state_cannot_be_converted); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(2, 4, __pyx_L1_error)
29979   __Pyx_GOTREF(__pyx_tuple__18);
29980   __Pyx_GIVEREF(__pyx_tuple__18);
29981 
29982   /* "(tree fragment)":2
29983  * def __reduce_cython__(self):
29984  *     raise TypeError("self._state cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
29985  * def __setstate_cython__(self, __pyx_state):
29986  *     raise TypeError("self._state cannot be converted to a Python object for pickling")
29987  */
29988   __pyx_tuple__19 = PyTuple_Pack(1, __pyx_kp_s_self__state_cannot_be_converted); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(2, 2, __pyx_L1_error)
29989   __Pyx_GOTREF(__pyx_tuple__19);
29990   __Pyx_GIVEREF(__pyx_tuple__19);
29991 
29992   /* "(tree fragment)":4
29993  *     raise TypeError("self._state cannot be converted to a Python object for pickling")
29994  * def __setstate_cython__(self, __pyx_state):
29995  *     raise TypeError("self._state cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
29996  */
29997   __pyx_tuple__20 = PyTuple_Pack(1, __pyx_kp_s_self__state_cannot_be_converted); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(2, 4, __pyx_L1_error)
29998   __Pyx_GOTREF(__pyx_tuple__20);
29999   __Pyx_GIVEREF(__pyx_tuple__20);
30000 
30001   /* "lupa/_lupa.pyx":839
30002  *             self.push_lua_object()
30003  *             if not lua.lua_isfunction(L, -1) or lua.lua_iscfunction(L, -1):
30004  *                 raise TypeError("Lua object is not a function")             # <<<<<<<<<<<<<<
30005  *             # create thread stack and push the function on it
30006  *             co = lua.lua_newthread(L)
30007  */
30008   __pyx_tuple__21 = PyTuple_Pack(1, __pyx_kp_s_Lua_object_is_not_a_function); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(0, 839, __pyx_L1_error)
30009   __Pyx_GOTREF(__pyx_tuple__21);
30010   __Pyx_GIVEREF(__pyx_tuple__21);
30011 
30012   /* "(tree fragment)":2
30013  * def __reduce_cython__(self):
30014  *     raise TypeError("self._state cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
30015  * def __setstate_cython__(self, __pyx_state):
30016  *     raise TypeError("self._state cannot be converted to a Python object for pickling")
30017  */
30018   __pyx_tuple__22 = PyTuple_Pack(1, __pyx_kp_s_self__state_cannot_be_converted); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(2, 2, __pyx_L1_error)
30019   __Pyx_GOTREF(__pyx_tuple__22);
30020   __Pyx_GIVEREF(__pyx_tuple__22);
30021 
30022   /* "(tree fragment)":4
30023  *     raise TypeError("self._state cannot be converted to a Python object for pickling")
30024  * def __setstate_cython__(self, __pyx_state):
30025  *     raise TypeError("self._state cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
30026  */
30027   __pyx_tuple__23 = PyTuple_Pack(1, __pyx_kp_s_self__state_cannot_be_converted); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(2, 4, __pyx_L1_error)
30028   __Pyx_GOTREF(__pyx_tuple__23);
30029   __Pyx_GIVEREF(__pyx_tuple__23);
30030 
30031   /* "(tree fragment)":2
30032  * def __reduce_cython__(self):
30033  *     raise TypeError("self._state cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
30034  * def __setstate_cython__(self, __pyx_state):
30035  *     raise TypeError("self._state cannot be converted to a Python object for pickling")
30036  */
30037   __pyx_tuple__24 = PyTuple_Pack(1, __pyx_kp_s_self__state_cannot_be_converted); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(2, 2, __pyx_L1_error)
30038   __Pyx_GOTREF(__pyx_tuple__24);
30039   __Pyx_GIVEREF(__pyx_tuple__24);
30040 
30041   /* "(tree fragment)":4
30042  *     raise TypeError("self._state cannot be converted to a Python object for pickling")
30043  * def __setstate_cython__(self, __pyx_state):
30044  *     raise TypeError("self._state cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
30045  */
30046   __pyx_tuple__25 = PyTuple_Pack(1, __pyx_kp_s_self__state_cannot_be_converted); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(2, 4, __pyx_L1_error)
30047   __Pyx_GOTREF(__pyx_tuple__25);
30048   __Pyx_GIVEREF(__pyx_tuple__25);
30049 
30050   /* "lupa/_lupa.pyx":898
30051  *         if value is not None:
30052  *             if self._arguments is not None:
30053  *                 raise TypeError("can't send non-None value to a just-started generator")             # <<<<<<<<<<<<<<
30054  *             if not isinstance(value, tuple):
30055  *                 value = (value,)
30056  */
30057   __pyx_tuple__26 = PyTuple_Pack(1, __pyx_kp_s_can_t_send_non_None_value_to_a_j); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(0, 898, __pyx_L1_error)
30058   __Pyx_GOTREF(__pyx_tuple__26);
30059   __Pyx_GIVEREF(__pyx_tuple__26);
30060 
30061   /* "(tree fragment)":2
30062  * def __reduce_cython__(self):
30063  *     raise TypeError("self._co_state,self._state cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
30064  * def __setstate_cython__(self, __pyx_state):
30065  *     raise TypeError("self._co_state,self._state cannot be converted to a Python object for pickling")
30066  */
30067   __pyx_tuple__27 = PyTuple_Pack(1, __pyx_kp_s_self__co_state_self__state_canno); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(2, 2, __pyx_L1_error)
30068   __Pyx_GOTREF(__pyx_tuple__27);
30069   __Pyx_GIVEREF(__pyx_tuple__27);
30070 
30071   /* "(tree fragment)":4
30072  *     raise TypeError("self._co_state,self._state cannot be converted to a Python object for pickling")
30073  * def __setstate_cython__(self, __pyx_state):
30074  *     raise TypeError("self._co_state,self._state cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
30075  */
30076   __pyx_tuple__28 = PyTuple_Pack(1, __pyx_kp_s_self__co_state_self__state_canno); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(2, 4, __pyx_L1_error)
30077   __Pyx_GOTREF(__pyx_tuple__28);
30078   __Pyx_GIVEREF(__pyx_tuple__28);
30079 
30080   /* "(tree fragment)":2
30081  * def __reduce_cython__(self):
30082  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
30083  * def __setstate_cython__(self, __pyx_state):
30084  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
30085  */
30086   __pyx_tuple__29 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(2, 2, __pyx_L1_error)
30087   __Pyx_GOTREF(__pyx_tuple__29);
30088   __Pyx_GIVEREF(__pyx_tuple__29);
30089 
30090   /* "(tree fragment)":4
30091  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
30092  * def __setstate_cython__(self, __pyx_state):
30093  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
30094  */
30095   __pyx_tuple__30 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(2, 4, __pyx_L1_error)
30096   __Pyx_GOTREF(__pyx_tuple__30);
30097   __Pyx_GIVEREF(__pyx_tuple__30);
30098 
30099   /* "lupa/_lupa.pyx":1107
30100  *         self._type_flags = 0
30101  *     def __init__(self):
30102  *         raise TypeError("Type cannot be instantiated from Python")             # <<<<<<<<<<<<<<
30103  *
30104  *
30105  */
30106   __pyx_tuple__31 = PyTuple_Pack(1, __pyx_kp_s_Type_cannot_be_instantiated_from); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(0, 1107, __pyx_L1_error)
30107   __Pyx_GOTREF(__pyx_tuple__31);
30108   __Pyx_GIVEREF(__pyx_tuple__31);
30109 
30110   /* "(tree fragment)":2
30111  * def __reduce_cython__(self):
30112  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
30113  * def __setstate_cython__(self, __pyx_state):
30114  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
30115  */
30116   __pyx_tuple__32 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__32)) __PYX_ERR(2, 2, __pyx_L1_error)
30117   __Pyx_GOTREF(__pyx_tuple__32);
30118   __Pyx_GIVEREF(__pyx_tuple__32);
30119 
30120   /* "(tree fragment)":4
30121  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
30122  * def __setstate_cython__(self, __pyx_state):
30123  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
30124  */
30125   __pyx_tuple__33 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__33)) __PYX_ERR(2, 4, __pyx_L1_error)
30126   __Pyx_GOTREF(__pyx_tuple__33);
30127   __Pyx_GIVEREF(__pyx_tuple__33);
30128 
30129   /* "lupa/_lupa.pyx":1283
30130  *         raise ValueError("expected string, got %s" % type(s))
30131  *     if not _isascii(<bytes>s):
30132  *         raise ValueError("byte string input has unknown encoding, only ASCII is allowed")             # <<<<<<<<<<<<<<
30133  *     return <bytes>s
30134  *
30135  */
30136   __pyx_tuple__34 = PyTuple_Pack(1, __pyx_kp_s_byte_string_input_has_unknown_en); if (unlikely(!__pyx_tuple__34)) __PYX_ERR(0, 1283, __pyx_L1_error)
30137   __Pyx_GOTREF(__pyx_tuple__34);
30138   __Pyx_GIVEREF(__pyx_tuple__34);
30139 
30140   /* "lupa/_lupa.pyx":1451
30141  *
30142  *     if not py_obj:
30143  *         raise TypeError("not a python object")             # <<<<<<<<<<<<<<
30144  *
30145  *     f = <object>py_obj.obj
30146  */
30147   __pyx_tuple__35 = PyTuple_Pack(1, __pyx_kp_s_not_a_python_object); if (unlikely(!__pyx_tuple__35)) __PYX_ERR(0, 1451, __pyx_L1_error)
30148   __Pyx_GOTREF(__pyx_tuple__35);
30149   __Pyx_GIVEREF(__pyx_tuple__35);
30150 
30151   /* "lupa/lock.pxi":34
30152  *             self._real_lock = NULL
30153  *
30154  *     def acquire(self, bint blocking=True):             # <<<<<<<<<<<<<<
30155  *         return lock_lock(self, pythread.PyThread_get_thread_ident(), blocking)
30156  *
30157  */
30158   __pyx_tuple__36 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_blocking); if (unlikely(!__pyx_tuple__36)) __PYX_ERR(1, 34, __pyx_L1_error)
30159   __Pyx_GOTREF(__pyx_tuple__36);
30160   __Pyx_GIVEREF(__pyx_tuple__36);
30161   __pyx_codeobj__37 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__36, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_lupa_lock_pxi, __pyx_n_s_acquire, 34, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__37)) __PYX_ERR(1, 34, __pyx_L1_error)
30162 
30163   /* "lupa/lock.pxi":37
30164  *         return lock_lock(self, pythread.PyThread_get_thread_ident(), blocking)
30165  *
30166  *     def release(self):             # <<<<<<<<<<<<<<
30167  *         if self._owner != pythread.PyThread_get_thread_ident():
30168  *             raise RuntimeError("cannot release un-acquired lock")
30169  */
30170   __pyx_tuple__38 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__38)) __PYX_ERR(1, 37, __pyx_L1_error)
30171   __Pyx_GOTREF(__pyx_tuple__38);
30172   __Pyx_GIVEREF(__pyx_tuple__38);
30173   __pyx_codeobj__39 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 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_lupa_lock_pxi, __pyx_n_s_release, 37, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__39)) __PYX_ERR(1, 37, __pyx_L1_error)
30174 
30175   /* "lupa/lock.pxi":44
30176  *     # compatibility with RLock
30177  *
30178  *     def __enter__(self):             # <<<<<<<<<<<<<<
30179  *         # self.acquire()
30180  *         return lock_lock(self, pythread.PyThread_get_thread_ident(), True)
30181  */
30182   __pyx_tuple__40 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__40)) __PYX_ERR(1, 44, __pyx_L1_error)
30183   __Pyx_GOTREF(__pyx_tuple__40);
30184   __Pyx_GIVEREF(__pyx_tuple__40);
30185   __pyx_codeobj__41 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 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_lupa_lock_pxi, __pyx_n_s_enter, 44, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__41)) __PYX_ERR(1, 44, __pyx_L1_error)
30186 
30187   /* "lupa/lock.pxi":48
30188  *         return lock_lock(self, pythread.PyThread_get_thread_ident(), True)
30189  *
30190  *     def __exit__(self, t, v, tb):             # <<<<<<<<<<<<<<
30191  *         # self.release()
30192  *         if self._owner != pythread.PyThread_get_thread_ident():
30193  */
30194   __pyx_tuple__42 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_t, __pyx_n_s_v, __pyx_n_s_tb); if (unlikely(!__pyx_tuple__42)) __PYX_ERR(1, 48, __pyx_L1_error)
30195   __Pyx_GOTREF(__pyx_tuple__42);
30196   __Pyx_GIVEREF(__pyx_tuple__42);
30197   __pyx_codeobj__43 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 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_lupa_lock_pxi, __pyx_n_s_exit, 48, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__43)) __PYX_ERR(1, 48, __pyx_L1_error)
30198 
30199   /* "lupa/lock.pxi":54
30200  *         unlock_lock(self)
30201  *
30202  *     def _is_owned(self):             # <<<<<<<<<<<<<<
30203  *         return self._owner == pythread.PyThread_get_thread_ident()
30204  *
30205  */
30206   __pyx_tuple__44 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__44)) __PYX_ERR(1, 54, __pyx_L1_error)
30207   __Pyx_GOTREF(__pyx_tuple__44);
30208   __Pyx_GIVEREF(__pyx_tuple__44);
30209   __pyx_codeobj__45 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 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_lupa_lock_pxi, __pyx_n_s_is_owned, 54, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__45)) __PYX_ERR(1, 54, __pyx_L1_error)
30210 
30211   /* "(tree fragment)":1
30212  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
30213  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
30214  * def __setstate_cython__(self, __pyx_state):
30215  */
30216   __pyx_tuple__46 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__46)) __PYX_ERR(2, 1, __pyx_L1_error)
30217   __Pyx_GOTREF(__pyx_tuple__46);
30218   __Pyx_GIVEREF(__pyx_tuple__46);
30219   __pyx_codeobj__47 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__46, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_reduce_cython, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__47)) __PYX_ERR(2, 1, __pyx_L1_error)
30220 
30221   /* "(tree fragment)":3
30222  * def __reduce_cython__(self):
30223  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
30224  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
30225  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
30226  */
30227   __pyx_tuple__48 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_pyx_state); if (unlikely(!__pyx_tuple__48)) __PYX_ERR(2, 3, __pyx_L1_error)
30228   __Pyx_GOTREF(__pyx_tuple__48);
30229   __Pyx_GIVEREF(__pyx_tuple__48);
30230   __pyx_codeobj__49 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 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_stringsource, __pyx_n_s_setstate_cython, 3, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__49)) __PYX_ERR(2, 3, __pyx_L1_error)
30231 
30232   /* "lupa/_lupa.pyx":101
30233  *
30234  *
30235  * def lua_type(obj):             # <<<<<<<<<<<<<<
30236  *     """
30237  *     Return the Lua type name of a wrapped object as string, as provided
30238  */
30239   __pyx_tuple__50 = PyTuple_Pack(6, __pyx_n_s_obj, __pyx_n_s_lua_object, __pyx_n_s_L, __pyx_n_s_old_top, __pyx_n_s_lua_type_name, __pyx_n_s_ltype); if (unlikely(!__pyx_tuple__50)) __PYX_ERR(0, 101, __pyx_L1_error)
30240   __Pyx_GOTREF(__pyx_tuple__50);
30241   __Pyx_GIVEREF(__pyx_tuple__50);
30242   __pyx_codeobj__51 = (PyObject*)__Pyx_PyCode_New(1, 0, 6, 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_lupa__lupa_pyx, __pyx_n_s_lua_type, 101, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__51)) __PYX_ERR(0, 101, __pyx_L1_error)
30243 
30244   /* "lupa/_lupa.pyx":294
30245  *         return 0
30246  *
30247  *     def eval(self, lua_code, *args):             # <<<<<<<<<<<<<<
30248  *         """Evaluate a Lua expression passed in a string.
30249  *         """
30250  */
30251   __pyx_tuple__52 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_lua_code, __pyx_n_s_args); if (unlikely(!__pyx_tuple__52)) __PYX_ERR(0, 294, __pyx_L1_error)
30252   __Pyx_GOTREF(__pyx_tuple__52);
30253   __Pyx_GIVEREF(__pyx_tuple__52);
30254   __pyx_codeobj__53 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__52, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_lupa__lupa_pyx, __pyx_n_s_eval, 294, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__53)) __PYX_ERR(0, 294, __pyx_L1_error)
30255 
30256   /* "lupa/_lupa.pyx":302
30257  *         return run_lua(self, b'return ' + lua_code, args)
30258  *
30259  *     def execute(self, lua_code, *args):             # <<<<<<<<<<<<<<
30260  *         """Execute a Lua program passed in a string.
30261  *         """
30262  */
30263   __pyx_tuple__54 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_lua_code, __pyx_n_s_args); if (unlikely(!__pyx_tuple__54)) __PYX_ERR(0, 302, __pyx_L1_error)
30264   __Pyx_GOTREF(__pyx_tuple__54);
30265   __Pyx_GIVEREF(__pyx_tuple__54);
30266   __pyx_codeobj__55 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__54, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_lupa__lupa_pyx, __pyx_n_s_execute, 302, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__55)) __PYX_ERR(0, 302, __pyx_L1_error)
30267 
30268   /* "lupa/_lupa.pyx":310
30269  *         return run_lua(self, lua_code, args)
30270  *
30271  *     def compile(self, lua_code):             # <<<<<<<<<<<<<<
30272  *         """Compile a Lua program into a callable Lua function.
30273  *         """
30274  */
30275   __pyx_tuple__56 = PyTuple_Pack(8, __pyx_n_s_self, __pyx_n_s_lua_code, __pyx_n_s_err, __pyx_n_s_L, __pyx_n_s_oldtop, __pyx_n_s_size, __pyx_n_s_status, __pyx_n_s_error); if (unlikely(!__pyx_tuple__56)) __PYX_ERR(0, 310, __pyx_L1_error)
30276   __Pyx_GOTREF(__pyx_tuple__56);
30277   __Pyx_GIVEREF(__pyx_tuple__56);
30278   __pyx_codeobj__57 = (PyObject*)__Pyx_PyCode_New(2, 0, 8, 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_lupa__lupa_pyx, __pyx_n_s_compile, 310, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__57)) __PYX_ERR(0, 310, __pyx_L1_error)
30279 
30280   /* "lupa/_lupa.pyx":332
30281  *             unlock_runtime(self)
30282  *
30283  *     def require(self, modulename):             # <<<<<<<<<<<<<<
30284  *         """Load a Lua library into the runtime.
30285  *         """
30286  */
30287   __pyx_tuple__58 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_modulename, __pyx_n_s_L, __pyx_n_s_old_top); if (unlikely(!__pyx_tuple__58)) __PYX_ERR(0, 332, __pyx_L1_error)
30288   __Pyx_GOTREF(__pyx_tuple__58);
30289   __Pyx_GIVEREF(__pyx_tuple__58);
30290   __pyx_codeobj__59 = (PyObject*)__Pyx_PyCode_New(2, 0, 4, 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_lupa__lupa_pyx, __pyx_n_s_require, 332, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__59)) __PYX_ERR(0, 332, __pyx_L1_error)
30291 
30292   /* "lupa/_lupa.pyx":350
30293  *             unlock_runtime(self)
30294  *
30295  *     def globals(self):             # <<<<<<<<<<<<<<
30296  *         """Return the globals defined in this Lua runtime as a Lua
30297  *         table.
30298  */
30299   __pyx_tuple__60 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_L, __pyx_n_s_old_top); if (unlikely(!__pyx_tuple__60)) __PYX_ERR(0, 350, __pyx_L1_error)
30300   __Pyx_GOTREF(__pyx_tuple__60);
30301   __Pyx_GIVEREF(__pyx_tuple__60);
30302   __pyx_codeobj__61 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__60, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_lupa__lupa_pyx, __pyx_n_s_globals, 350, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__61)) __PYX_ERR(0, 350, __pyx_L1_error)
30303 
30304   /* "lupa/_lupa.pyx":367
30305  *             unlock_runtime(self)
30306  *
30307  *     def table(self, *items, **kwargs):             # <<<<<<<<<<<<<<
30308  *         """Create a new table with the provided items.  Positional
30309  *         arguments are placed in the table in order, keyword arguments
30310  */
30311   __pyx_tuple__62 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_items, __pyx_n_s_kwargs); if (unlikely(!__pyx_tuple__62)) __PYX_ERR(0, 367, __pyx_L1_error)
30312   __Pyx_GOTREF(__pyx_tuple__62);
30313   __Pyx_GIVEREF(__pyx_tuple__62);
30314   __pyx_codeobj__63 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__62, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_lupa__lupa_pyx, __pyx_n_s_table, 367, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__63)) __PYX_ERR(0, 367, __pyx_L1_error)
30315 
30316   /* "lupa/_lupa.pyx":374
30317  *         return self.table_from(items, kwargs)
30318  *
30319  *     def table_from(self, *args):             # <<<<<<<<<<<<<<
30320  *         """Create a new table from Python mapping or iterable.
30321  *
30322  */
30323   __pyx_tuple__64 = PyTuple_Pack(9, __pyx_n_s_self, __pyx_n_s_args, __pyx_n_s_L, __pyx_n_s_i, __pyx_n_s_old_top, __pyx_n_s_obj, __pyx_n_s_key, __pyx_n_s_value, __pyx_n_s_arg); if (unlikely(!__pyx_tuple__64)) __PYX_ERR(0, 374, __pyx_L1_error)
30324   __Pyx_GOTREF(__pyx_tuple__64);
30325   __Pyx_GIVEREF(__pyx_tuple__64);
30326   __pyx_codeobj__65 = (PyObject*)__Pyx_PyCode_New(1, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__64, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_lupa__lupa_pyx, __pyx_n_s_table_from, 374, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__65)) __PYX_ERR(0, 374, __pyx_L1_error)
30327 
30328   /* "(tree fragment)":1
30329  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
30330  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
30331  * def __setstate_cython__(self, __pyx_state):
30332  */
30333   __pyx_tuple__66 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__66)) __PYX_ERR(2, 1, __pyx_L1_error)
30334   __Pyx_GOTREF(__pyx_tuple__66);
30335   __Pyx_GIVEREF(__pyx_tuple__66);
30336   __pyx_codeobj__67 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__66, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_reduce_cython, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__67)) __PYX_ERR(2, 1, __pyx_L1_error)
30337 
30338   /* "(tree fragment)":3
30339  * def __reduce_cython__(self):
30340  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
30341  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
30342  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
30343  */
30344   __pyx_tuple__68 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_pyx_state); if (unlikely(!__pyx_tuple__68)) __PYX_ERR(2, 3, __pyx_L1_error)
30345   __Pyx_GOTREF(__pyx_tuple__68);
30346   __Pyx_GIVEREF(__pyx_tuple__68);
30347   __pyx_codeobj__69 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 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_stringsource, __pyx_n_s_setstate_cython, 3, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__69)) __PYX_ERR(2, 3, __pyx_L1_error)
30348 
30349   /* "lupa/_lupa.pyx":462
30350  * # from Lua scripts
30351  *
30352  * def unpacks_lua_table(func):             # <<<<<<<<<<<<<<
30353  *     """
30354  *     A decorator to make the decorated function receive kwargs
30355  */
30356   __pyx_tuple__70 = PyTuple_Pack(3, __pyx_n_s_func, __pyx_n_s_wrapper, __pyx_n_s_wrapper); if (unlikely(!__pyx_tuple__70)) __PYX_ERR(0, 462, __pyx_L1_error)
30357   __Pyx_GOTREF(__pyx_tuple__70);
30358   __Pyx_GIVEREF(__pyx_tuple__70);
30359   __pyx_codeobj__71 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 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_lupa__lupa_pyx, __pyx_n_s_unpacks_lua_table, 462, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__71)) __PYX_ERR(0, 462, __pyx_L1_error)
30360 
30361   /* "lupa/_lupa.pyx":488
30362  *
30363  *
30364  * def unpacks_lua_table_method(meth):             # <<<<<<<<<<<<<<
30365  *     """
30366  *     This is :func:`unpacks_lua_table` for methods
30367  */
30368   __pyx_tuple__72 = PyTuple_Pack(3, __pyx_n_s_meth, __pyx_n_s_wrapper, __pyx_n_s_wrapper); if (unlikely(!__pyx_tuple__72)) __PYX_ERR(0, 488, __pyx_L1_error)
30369   __Pyx_GOTREF(__pyx_tuple__72);
30370   __Pyx_GIVEREF(__pyx_tuple__72);
30371   __pyx_codeobj__73 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 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_lupa__lupa_pyx, __pyx_n_s_unpacks_lua_table_method, 488, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__73)) __PYX_ERR(0, 488, __pyx_L1_error)
30372 
30373   /* "(tree fragment)":1
30374  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
30375  *     raise TypeError("self._state cannot be converted to a Python object for pickling")
30376  * def __setstate_cython__(self, __pyx_state):
30377  */
30378   __pyx_tuple__74 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__74)) __PYX_ERR(2, 1, __pyx_L1_error)
30379   __Pyx_GOTREF(__pyx_tuple__74);
30380   __Pyx_GIVEREF(__pyx_tuple__74);
30381   __pyx_codeobj__75 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 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_stringsource, __pyx_n_s_reduce_cython, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__75)) __PYX_ERR(2, 1, __pyx_L1_error)
30382 
30383   /* "(tree fragment)":3
30384  * def __reduce_cython__(self):
30385  *     raise TypeError("self._state cannot be converted to a Python object for pickling")
30386  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
30387  *     raise TypeError("self._state cannot be converted to a Python object for pickling")
30388  */
30389   __pyx_tuple__76 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_pyx_state); if (unlikely(!__pyx_tuple__76)) __PYX_ERR(2, 3, __pyx_L1_error)
30390   __Pyx_GOTREF(__pyx_tuple__76);
30391   __Pyx_GIVEREF(__pyx_tuple__76);
30392   __pyx_codeobj__77 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__76, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_setstate_cython, 3, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__77)) __PYX_ERR(2, 3, __pyx_L1_error)
30393 
30394   /* "lupa/_lupa.pyx":736
30395  *         return _LuaIter(self, KEYS)
30396  *
30397  *     def keys(self):             # <<<<<<<<<<<<<<
30398  *         """Returns an iterator over the keys of a table that this
30399  *         object represents.  Same as iter(obj).
30400  */
30401   __pyx_tuple__78 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__78)) __PYX_ERR(0, 736, __pyx_L1_error)
30402   __Pyx_GOTREF(__pyx_tuple__78);
30403   __Pyx_GIVEREF(__pyx_tuple__78);
30404   __pyx_codeobj__79 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__78, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_lupa__lupa_pyx, __pyx_n_s_keys, 736, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__79)) __PYX_ERR(0, 736, __pyx_L1_error)
30405 
30406   /* "lupa/_lupa.pyx":742
30407  *         return _LuaIter(self, KEYS)
30408  *
30409  *     def values(self):             # <<<<<<<<<<<<<<
30410  *         """Returns an iterator over the values of a table that this
30411  *         object represents.
30412  */
30413   __pyx_tuple__80 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__80)) __PYX_ERR(0, 742, __pyx_L1_error)
30414   __Pyx_GOTREF(__pyx_tuple__80);
30415   __Pyx_GIVEREF(__pyx_tuple__80);
30416   __pyx_codeobj__81 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 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_lupa__lupa_pyx, __pyx_n_s_values, 742, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__81)) __PYX_ERR(0, 742, __pyx_L1_error)
30417 
30418   /* "lupa/_lupa.pyx":748
30419  *         return _LuaIter(self, VALUES)
30420  *
30421  *     def items(self):             # <<<<<<<<<<<<<<
30422  *         """Returns an iterator over the key-value pairs of a table
30423  *         that this object represents.
30424  */
30425   __pyx_tuple__82 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__82)) __PYX_ERR(0, 748, __pyx_L1_error)
30426   __Pyx_GOTREF(__pyx_tuple__82);
30427   __Pyx_GIVEREF(__pyx_tuple__82);
30428   __pyx_codeobj__83 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__82, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_lupa__lupa_pyx, __pyx_n_s_items, 748, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__83)) __PYX_ERR(0, 748, __pyx_L1_error)
30429 
30430   /* "(tree fragment)":1
30431  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
30432  *     raise TypeError("self._state cannot be converted to a Python object for pickling")
30433  * def __setstate_cython__(self, __pyx_state):
30434  */
30435   __pyx_tuple__84 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__84)) __PYX_ERR(2, 1, __pyx_L1_error)
30436   __Pyx_GOTREF(__pyx_tuple__84);
30437   __Pyx_GIVEREF(__pyx_tuple__84);
30438   __pyx_codeobj__85 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__84, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_reduce_cython, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__85)) __PYX_ERR(2, 1, __pyx_L1_error)
30439 
30440   /* "(tree fragment)":3
30441  * def __reduce_cython__(self):
30442  *     raise TypeError("self._state cannot be converted to a Python object for pickling")
30443  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
30444  *     raise TypeError("self._state cannot be converted to a Python object for pickling")
30445  */
30446   __pyx_tuple__86 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_pyx_state); if (unlikely(!__pyx_tuple__86)) __PYX_ERR(2, 3, __pyx_L1_error)
30447   __Pyx_GOTREF(__pyx_tuple__86);
30448   __Pyx_GIVEREF(__pyx_tuple__86);
30449   __pyx_codeobj__87 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__86, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_setstate_cython, 3, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__87)) __PYX_ERR(2, 3, __pyx_L1_error)
30450 
30451   /* "lupa/_lupa.pyx":826
30452  *     """A Lua function (which may become a coroutine).
30453  *     """
30454  *     def coroutine(self, *args):             # <<<<<<<<<<<<<<
30455  *         """Create a Lua coroutine from a Lua function and call it with
30456  *         the passed parameters to start it up.
30457  */
30458   __pyx_tuple__88 = PyTuple_Pack(6, __pyx_n_s_self, __pyx_n_s_args, __pyx_n_s_L, __pyx_n_s_co, __pyx_n_s_thread, __pyx_n_s_old_top); if (unlikely(!__pyx_tuple__88)) __PYX_ERR(0, 826, __pyx_L1_error)
30459   __Pyx_GOTREF(__pyx_tuple__88);
30460   __Pyx_GIVEREF(__pyx_tuple__88);
30461   __pyx_codeobj__89 = (PyObject*)__Pyx_PyCode_New(1, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__88, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_lupa__lupa_pyx, __pyx_n_s_coroutine, 826, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__89)) __PYX_ERR(0, 826, __pyx_L1_error)
30462 
30463   /* "(tree fragment)":1
30464  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
30465  *     raise TypeError("self._state cannot be converted to a Python object for pickling")
30466  * def __setstate_cython__(self, __pyx_state):
30467  */
30468   __pyx_tuple__90 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__90)) __PYX_ERR(2, 1, __pyx_L1_error)
30469   __Pyx_GOTREF(__pyx_tuple__90);
30470   __Pyx_GIVEREF(__pyx_tuple__90);
30471   __pyx_codeobj__91 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 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_stringsource, __pyx_n_s_reduce_cython, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__91)) __PYX_ERR(2, 1, __pyx_L1_error)
30472 
30473   /* "(tree fragment)":3
30474  * def __reduce_cython__(self):
30475  *     raise TypeError("self._state cannot be converted to a Python object for pickling")
30476  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
30477  *     raise TypeError("self._state cannot be converted to a Python object for pickling")
30478  */
30479   __pyx_tuple__92 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_pyx_state); if (unlikely(!__pyx_tuple__92)) __PYX_ERR(2, 3, __pyx_L1_error)
30480   __Pyx_GOTREF(__pyx_tuple__92);
30481   __Pyx_GIVEREF(__pyx_tuple__92);
30482   __pyx_codeobj__93 = (PyObject*)__Pyx_PyCode_New(2, 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_stringsource, __pyx_n_s_setstate_cython, 3, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__93)) __PYX_ERR(2, 3, __pyx_L1_error)
30483 
30484   /* "(tree fragment)":1
30485  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
30486  *     raise TypeError("self._state cannot be converted to a Python object for pickling")
30487  * def __setstate_cython__(self, __pyx_state):
30488  */
30489   __pyx_tuple__94 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__94)) __PYX_ERR(2, 1, __pyx_L1_error)
30490   __Pyx_GOTREF(__pyx_tuple__94);
30491   __Pyx_GIVEREF(__pyx_tuple__94);
30492   __pyx_codeobj__95 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__94, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_reduce_cython, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__95)) __PYX_ERR(2, 1, __pyx_L1_error)
30493 
30494   /* "(tree fragment)":3
30495  * def __reduce_cython__(self):
30496  *     raise TypeError("self._state cannot be converted to a Python object for pickling")
30497  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
30498  *     raise TypeError("self._state cannot be converted to a Python object for pickling")
30499  */
30500   __pyx_tuple__96 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_pyx_state); if (unlikely(!__pyx_tuple__96)) __PYX_ERR(2, 3, __pyx_L1_error)
30501   __Pyx_GOTREF(__pyx_tuple__96);
30502   __Pyx_GIVEREF(__pyx_tuple__96);
30503   __pyx_codeobj__97 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__96, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_setstate_cython, 3, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__97)) __PYX_ERR(2, 3, __pyx_L1_error)
30504 
30505   /* "lupa/_lupa.pyx":892
30506  *         return resume_lua_thread(self, args)
30507  *
30508  *     def send(self, value):             # <<<<<<<<<<<<<<
30509  *         """Send a value into the coroutine.  If the value is a tuple,
30510  *         send the unpacked elements.
30511  */
30512   __pyx_tuple__98 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_value); if (unlikely(!__pyx_tuple__98)) __PYX_ERR(0, 892, __pyx_L1_error)
30513   __Pyx_GOTREF(__pyx_tuple__98);
30514   __Pyx_GIVEREF(__pyx_tuple__98);
30515   __pyx_codeobj__99 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__98, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_lupa__lupa_pyx, __pyx_n_s_send, 892, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__99)) __PYX_ERR(0, 892, __pyx_L1_error)
30516 
30517   /* "(tree fragment)":1
30518  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
30519  *     raise TypeError("self._co_state,self._state cannot be converted to a Python object for pickling")
30520  * def __setstate_cython__(self, __pyx_state):
30521  */
30522   __pyx_tuple__100 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__100)) __PYX_ERR(2, 1, __pyx_L1_error)
30523   __Pyx_GOTREF(__pyx_tuple__100);
30524   __Pyx_GIVEREF(__pyx_tuple__100);
30525   __pyx_codeobj__101 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__100, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_reduce_cython, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__101)) __PYX_ERR(2, 1, __pyx_L1_error)
30526 
30527   /* "(tree fragment)":3
30528  * def __reduce_cython__(self):
30529  *     raise TypeError("self._co_state,self._state cannot be converted to a Python object for pickling")
30530  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
30531  *     raise TypeError("self._co_state,self._state cannot be converted to a Python object for pickling")
30532  */
30533   __pyx_tuple__102 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_pyx_state); if (unlikely(!__pyx_tuple__102)) __PYX_ERR(2, 3, __pyx_L1_error)
30534   __Pyx_GOTREF(__pyx_tuple__102);
30535   __Pyx_GIVEREF(__pyx_tuple__102);
30536   __pyx_codeobj__103 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__102, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_setstate_cython, 3, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__103)) __PYX_ERR(2, 3, __pyx_L1_error)
30537 
30538   /* "(tree fragment)":1
30539  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
30540  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
30541  * def __setstate_cython__(self, __pyx_state):
30542  */
30543   __pyx_tuple__104 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__104)) __PYX_ERR(2, 1, __pyx_L1_error)
30544   __Pyx_GOTREF(__pyx_tuple__104);
30545   __Pyx_GIVEREF(__pyx_tuple__104);
30546   __pyx_codeobj__105 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__104, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_reduce_cython, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__105)) __PYX_ERR(2, 1, __pyx_L1_error)
30547 
30548   /* "(tree fragment)":3
30549  * def __reduce_cython__(self):
30550  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
30551  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
30552  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
30553  */
30554   __pyx_tuple__106 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_pyx_state); if (unlikely(!__pyx_tuple__106)) __PYX_ERR(2, 3, __pyx_L1_error)
30555   __Pyx_GOTREF(__pyx_tuple__106);
30556   __Pyx_GIVEREF(__pyx_tuple__106);
30557   __pyx_codeobj__107 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__106, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_setstate_cython, 3, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__107)) __PYX_ERR(2, 3, __pyx_L1_error)
30558 
30559   /* "(tree fragment)":1
30560  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
30561  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
30562  * def __setstate_cython__(self, __pyx_state):
30563  */
30564   __pyx_tuple__108 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__108)) __PYX_ERR(2, 1, __pyx_L1_error)
30565   __Pyx_GOTREF(__pyx_tuple__108);
30566   __Pyx_GIVEREF(__pyx_tuple__108);
30567   __pyx_codeobj__109 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__108, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_reduce_cython, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__109)) __PYX_ERR(2, 1, __pyx_L1_error)
30568 
30569   /* "(tree fragment)":3
30570  * def __reduce_cython__(self):
30571  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
30572  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
30573  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
30574  */
30575   __pyx_tuple__110 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_pyx_state); if (unlikely(!__pyx_tuple__110)) __PYX_ERR(2, 3, __pyx_L1_error)
30576   __Pyx_GOTREF(__pyx_tuple__110);
30577   __Pyx_GIVEREF(__pyx_tuple__110);
30578   __pyx_codeobj__111 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 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_stringsource, __pyx_n_s_setstate_cython, 3, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__111)) __PYX_ERR(2, 3, __pyx_L1_error)
30579 
30580   /* "lupa/_lupa.pyx":1110
30581  *
30582  *
30583  * def as_attrgetter(obj):             # <<<<<<<<<<<<<<
30584  *     cdef _PyProtocolWrapper wrap = _PyProtocolWrapper.__new__(_PyProtocolWrapper)
30585  *     wrap._obj = obj
30586  */
30587   __pyx_tuple__112 = PyTuple_Pack(2, __pyx_n_s_obj, __pyx_n_s_wrap); if (unlikely(!__pyx_tuple__112)) __PYX_ERR(0, 1110, __pyx_L1_error)
30588   __Pyx_GOTREF(__pyx_tuple__112);
30589   __Pyx_GIVEREF(__pyx_tuple__112);
30590   __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_lupa__lupa_pyx, __pyx_n_s_as_attrgetter, 1110, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__113)) __PYX_ERR(0, 1110, __pyx_L1_error)
30591 
30592   /* "lupa/_lupa.pyx":1116
30593  *     return wrap
30594  *
30595  * def as_itemgetter(obj):             # <<<<<<<<<<<<<<
30596  *     cdef _PyProtocolWrapper wrap = _PyProtocolWrapper.__new__(_PyProtocolWrapper)
30597  *     wrap._obj = obj
30598  */
30599   __pyx_tuple__114 = PyTuple_Pack(2, __pyx_n_s_obj, __pyx_n_s_wrap); if (unlikely(!__pyx_tuple__114)) __PYX_ERR(0, 1116, __pyx_L1_error)
30600   __Pyx_GOTREF(__pyx_tuple__114);
30601   __Pyx_GIVEREF(__pyx_tuple__114);
30602   __pyx_codeobj__115 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 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_lupa__lupa_pyx, __pyx_n_s_as_itemgetter, 1116, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__115)) __PYX_ERR(0, 1116, __pyx_L1_error)
30603   __Pyx_RefNannyFinishContext();
30604   return 0;
30605   __pyx_L1_error:;
30606   __Pyx_RefNannyFinishContext();
30607   return -1;
30608 }
30609 
__Pyx_InitGlobals(void)30610 static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
30611   __pyx_umethod_PyList_Type_pop.type = (PyObject*)&PyList_Type;
30612   if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
30613   __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error)
30614   return 0;
30615   __pyx_L1_error:;
30616   return -1;
30617 }
30618 
30619 static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
30620 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
30621 static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
30622 static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
30623 static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
30624 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
30625 static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/
30626 
__Pyx_modinit_global_init_code(void)30627 static int __Pyx_modinit_global_init_code(void) {
30628   __Pyx_RefNannyDeclarations
30629   __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
30630   /*--- Global init code ---*/
30631   __pyx_v_4lupa_5_lupa_exc_info = Py_None; Py_INCREF(Py_None);
30632   __pyx_v_4lupa_5_lupa_Mapping = Py_None; Py_INCREF(Py_None);
30633   __pyx_v_4lupa_5_lupa_wraps = Py_None; Py_INCREF(Py_None);
30634   __pyx_v_4lupa_5_lupa_builtins = Py_None; Py_INCREF(Py_None);
30635   __Pyx_RefNannyFinishContext();
30636   return 0;
30637 }
30638 
__Pyx_modinit_variable_export_code(void)30639 static int __Pyx_modinit_variable_export_code(void) {
30640   __Pyx_RefNannyDeclarations
30641   __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
30642   /*--- Variable export code ---*/
30643   __Pyx_RefNannyFinishContext();
30644   return 0;
30645 }
30646 
__Pyx_modinit_function_export_code(void)30647 static int __Pyx_modinit_function_export_code(void) {
30648   __Pyx_RefNannyDeclarations
30649   __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
30650   /*--- Function export code ---*/
30651   __Pyx_RefNannyFinishContext();
30652   return 0;
30653 }
30654 
__Pyx_modinit_type_init_code(void)30655 static int __Pyx_modinit_type_init_code(void) {
30656   __Pyx_RefNannyDeclarations
30657   int __pyx_lineno = 0;
30658   const char *__pyx_filename = NULL;
30659   int __pyx_clineno = 0;
30660   __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
30661   /*--- Type init code ---*/
30662   if (PyType_Ready(&__pyx_type_4lupa_5_lupa_FastRLock) < 0) __PYX_ERR(1, 5, __pyx_L1_error)
30663   #if PY_VERSION_HEX < 0x030800B1
30664   __pyx_type_4lupa_5_lupa_FastRLock.tp_print = 0;
30665   #endif
30666   if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_4lupa_5_lupa_FastRLock.tp_dictoffset && __pyx_type_4lupa_5_lupa_FastRLock.tp_getattro == PyObject_GenericGetAttr)) {
30667     __pyx_type_4lupa_5_lupa_FastRLock.tp_getattro = __Pyx_PyObject_GenericGetAttr;
30668   }
30669   if (PyObject_SetAttr(__pyx_m, __pyx_n_s_FastRLock, (PyObject *)&__pyx_type_4lupa_5_lupa_FastRLock) < 0) __PYX_ERR(1, 5, __pyx_L1_error)
30670   if (__Pyx_setup_reduce((PyObject*)&__pyx_type_4lupa_5_lupa_FastRLock) < 0) __PYX_ERR(1, 5, __pyx_L1_error)
30671   __pyx_ptype_4lupa_5_lupa_FastRLock = &__pyx_type_4lupa_5_lupa_FastRLock;
30672   __pyx_vtabptr_4lupa_5_lupa_LuaRuntime = &__pyx_vtable_4lupa_5_lupa_LuaRuntime;
30673   __pyx_vtable_4lupa_5_lupa_LuaRuntime.reraise_on_exception = (int (*)(struct __pyx_obj_4lupa_5_lupa_LuaRuntime *))__pyx_f_4lupa_5_lupa_10LuaRuntime_reraise_on_exception;
30674   __pyx_vtable_4lupa_5_lupa_LuaRuntime.store_raised_exception = (int (*)(struct __pyx_obj_4lupa_5_lupa_LuaRuntime *, lua_State *, PyObject *))__pyx_f_4lupa_5_lupa_10LuaRuntime_store_raised_exception;
30675   __pyx_vtable_4lupa_5_lupa_LuaRuntime.register_py_object = (int (*)(struct __pyx_obj_4lupa_5_lupa_LuaRuntime *, PyObject *, PyObject *, PyObject *))__pyx_f_4lupa_5_lupa_10LuaRuntime_register_py_object;
30676   __pyx_vtable_4lupa_5_lupa_LuaRuntime.init_python_lib = (int (*)(struct __pyx_obj_4lupa_5_lupa_LuaRuntime *, int, int))__pyx_f_4lupa_5_lupa_10LuaRuntime_init_python_lib;
30677   if (PyType_Ready(&__pyx_type_4lupa_5_lupa_LuaRuntime) < 0) __PYX_ERR(0, 136, __pyx_L1_error)
30678   #if PY_VERSION_HEX < 0x030800B1
30679   __pyx_type_4lupa_5_lupa_LuaRuntime.tp_print = 0;
30680   #endif
30681   if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_4lupa_5_lupa_LuaRuntime.tp_dictoffset && __pyx_type_4lupa_5_lupa_LuaRuntime.tp_getattro == PyObject_GenericGetAttr)) {
30682     __pyx_type_4lupa_5_lupa_LuaRuntime.tp_getattro = __Pyx_PyObject_GenericGetAttr;
30683   }
30684   if (__Pyx_SetVtable(__pyx_type_4lupa_5_lupa_LuaRuntime.tp_dict, __pyx_vtabptr_4lupa_5_lupa_LuaRuntime) < 0) __PYX_ERR(0, 136, __pyx_L1_error)
30685   if (PyObject_SetAttr(__pyx_m, __pyx_n_s_LuaRuntime, (PyObject *)&__pyx_type_4lupa_5_lupa_LuaRuntime) < 0) __PYX_ERR(0, 136, __pyx_L1_error)
30686   if (__Pyx_setup_reduce((PyObject*)&__pyx_type_4lupa_5_lupa_LuaRuntime) < 0) __PYX_ERR(0, 136, __pyx_L1_error)
30687   __pyx_ptype_4lupa_5_lupa_LuaRuntime = &__pyx_type_4lupa_5_lupa_LuaRuntime;
30688   __pyx_vtabptr_4lupa_5_lupa__LuaObject = &__pyx_vtable_4lupa_5_lupa__LuaObject;
30689   __pyx_vtable_4lupa_5_lupa__LuaObject.push_lua_object = (int (*)(struct __pyx_obj_4lupa_5_lupa__LuaObject *))__pyx_f_4lupa_5_lupa_10_LuaObject_push_lua_object;
30690   __pyx_vtable_4lupa_5_lupa__LuaObject._len = (size_t (*)(struct __pyx_obj_4lupa_5_lupa__LuaObject *))__pyx_f_4lupa_5_lupa_10_LuaObject__len;
30691   __pyx_vtable_4lupa_5_lupa__LuaObject._getitem = (PyObject *(*)(struct __pyx_obj_4lupa_5_lupa__LuaObject *, PyObject *, int))__pyx_f_4lupa_5_lupa_10_LuaObject__getitem;
30692   if (PyType_Ready(&__pyx_type_4lupa_5_lupa__LuaObject) < 0) __PYX_ERR(0, 549, __pyx_L1_error)
30693   #if PY_VERSION_HEX < 0x030800B1
30694   __pyx_type_4lupa_5_lupa__LuaObject.tp_print = 0;
30695   #endif
30696   if (__Pyx_SetVtable(__pyx_type_4lupa_5_lupa__LuaObject.tp_dict, __pyx_vtabptr_4lupa_5_lupa__LuaObject) < 0) __PYX_ERR(0, 549, __pyx_L1_error)
30697   if (__Pyx_setup_reduce((PyObject*)&__pyx_type_4lupa_5_lupa__LuaObject) < 0) __PYX_ERR(0, 549, __pyx_L1_error)
30698   __pyx_ptype_4lupa_5_lupa__LuaObject = &__pyx_type_4lupa_5_lupa__LuaObject;
30699   __pyx_vtabptr_4lupa_5_lupa__LuaTable = &__pyx_vtable_4lupa_5_lupa__LuaTable;
30700   __pyx_vtable_4lupa_5_lupa__LuaTable.__pyx_base = *__pyx_vtabptr_4lupa_5_lupa__LuaObject;
30701   __pyx_vtable_4lupa_5_lupa__LuaTable._setitem = (int (*)(struct __pyx_obj_4lupa_5_lupa__LuaTable *, PyObject *, PyObject *))__pyx_f_4lupa_5_lupa_9_LuaTable__setitem;
30702   __pyx_vtable_4lupa_5_lupa__LuaTable._delitem = (PyObject *(*)(struct __pyx_obj_4lupa_5_lupa__LuaTable *, PyObject *))__pyx_f_4lupa_5_lupa_9_LuaTable__delitem;
30703   __pyx_type_4lupa_5_lupa__LuaTable.tp_base = __pyx_ptype_4lupa_5_lupa__LuaObject;
30704   if (PyType_Ready(&__pyx_type_4lupa_5_lupa__LuaTable) < 0) __PYX_ERR(0, 732, __pyx_L1_error)
30705   #if PY_VERSION_HEX < 0x030800B1
30706   __pyx_type_4lupa_5_lupa__LuaTable.tp_print = 0;
30707   #endif
30708   if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_4lupa_5_lupa__LuaTable.tp_dictoffset && __pyx_type_4lupa_5_lupa__LuaTable.tp_getattro == PyObject_GenericGetAttr)) {
30709     __pyx_type_4lupa_5_lupa__LuaTable.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
30710   }
30711   if (__Pyx_SetVtable(__pyx_type_4lupa_5_lupa__LuaTable.tp_dict, __pyx_vtabptr_4lupa_5_lupa__LuaTable) < 0) __PYX_ERR(0, 732, __pyx_L1_error)
30712   if (__Pyx_setup_reduce((PyObject*)&__pyx_type_4lupa_5_lupa__LuaTable) < 0) __PYX_ERR(0, 732, __pyx_L1_error)
30713   __pyx_ptype_4lupa_5_lupa__LuaTable = &__pyx_type_4lupa_5_lupa__LuaTable;
30714   __pyx_vtabptr_4lupa_5_lupa__LuaFunction = &__pyx_vtable_4lupa_5_lupa__LuaFunction;
30715   __pyx_vtable_4lupa_5_lupa__LuaFunction.__pyx_base = *__pyx_vtabptr_4lupa_5_lupa__LuaObject;
30716   __pyx_type_4lupa_5_lupa__LuaFunction.tp_base = __pyx_ptype_4lupa_5_lupa__LuaObject;
30717   if (PyType_Ready(&__pyx_type_4lupa_5_lupa__LuaFunction) < 0) __PYX_ERR(0, 823, __pyx_L1_error)
30718   #if PY_VERSION_HEX < 0x030800B1
30719   __pyx_type_4lupa_5_lupa__LuaFunction.tp_print = 0;
30720   #endif
30721   if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_4lupa_5_lupa__LuaFunction.tp_dictoffset && __pyx_type_4lupa_5_lupa__LuaFunction.tp_getattro == PyObject_GenericGetAttr)) {
30722     __pyx_type_4lupa_5_lupa__LuaFunction.tp_getattro = __Pyx_PyObject_GenericGetAttr;
30723   }
30724   if (__Pyx_SetVtable(__pyx_type_4lupa_5_lupa__LuaFunction.tp_dict, __pyx_vtabptr_4lupa_5_lupa__LuaFunction) < 0) __PYX_ERR(0, 823, __pyx_L1_error)
30725   if (__Pyx_setup_reduce((PyObject*)&__pyx_type_4lupa_5_lupa__LuaFunction) < 0) __PYX_ERR(0, 823, __pyx_L1_error)
30726   __pyx_ptype_4lupa_5_lupa__LuaFunction = &__pyx_type_4lupa_5_lupa__LuaFunction;
30727   __pyx_vtabptr_4lupa_5_lupa__LuaCoroutineFunction = &__pyx_vtable_4lupa_5_lupa__LuaCoroutineFunction;
30728   __pyx_vtable_4lupa_5_lupa__LuaCoroutineFunction.__pyx_base = *__pyx_vtabptr_4lupa_5_lupa__LuaFunction;
30729   __pyx_type_4lupa_5_lupa__LuaCoroutineFunction.tp_base = __pyx_ptype_4lupa_5_lupa__LuaFunction;
30730   if (PyType_Ready(&__pyx_type_4lupa_5_lupa__LuaCoroutineFunction) < 0) __PYX_ERR(0, 862, __pyx_L1_error)
30731   #if PY_VERSION_HEX < 0x030800B1
30732   __pyx_type_4lupa_5_lupa__LuaCoroutineFunction.tp_print = 0;
30733   #endif
30734   if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_4lupa_5_lupa__LuaCoroutineFunction.tp_dictoffset && __pyx_type_4lupa_5_lupa__LuaCoroutineFunction.tp_getattro == PyObject_GenericGetAttr)) {
30735     __pyx_type_4lupa_5_lupa__LuaCoroutineFunction.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
30736   }
30737   if (__Pyx_SetVtable(__pyx_type_4lupa_5_lupa__LuaCoroutineFunction.tp_dict, __pyx_vtabptr_4lupa_5_lupa__LuaCoroutineFunction) < 0) __PYX_ERR(0, 862, __pyx_L1_error)
30738   if (__Pyx_setup_reduce((PyObject*)&__pyx_type_4lupa_5_lupa__LuaCoroutineFunction) < 0) __PYX_ERR(0, 862, __pyx_L1_error)
30739   __pyx_ptype_4lupa_5_lupa__LuaCoroutineFunction = &__pyx_type_4lupa_5_lupa__LuaCoroutineFunction;
30740   __pyx_vtabptr_4lupa_5_lupa__LuaThread = &__pyx_vtable_4lupa_5_lupa__LuaThread;
30741   __pyx_vtable_4lupa_5_lupa__LuaThread.__pyx_base = *__pyx_vtabptr_4lupa_5_lupa__LuaObject;
30742   __pyx_type_4lupa_5_lupa__LuaThread.tp_base = __pyx_ptype_4lupa_5_lupa__LuaObject;
30743   if (PyType_Ready(&__pyx_type_4lupa_5_lupa__LuaThread) < 0) __PYX_ERR(0, 877, __pyx_L1_error)
30744   #if PY_VERSION_HEX < 0x030800B1
30745   __pyx_type_4lupa_5_lupa__LuaThread.tp_print = 0;
30746   #endif
30747   if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_4lupa_5_lupa__LuaThread.tp_dictoffset && __pyx_type_4lupa_5_lupa__LuaThread.tp_getattro == PyObject_GenericGetAttr)) {
30748     __pyx_type_4lupa_5_lupa__LuaThread.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
30749   }
30750   if (__Pyx_SetVtable(__pyx_type_4lupa_5_lupa__LuaThread.tp_dict, __pyx_vtabptr_4lupa_5_lupa__LuaThread) < 0) __PYX_ERR(0, 877, __pyx_L1_error)
30751   if (__Pyx_setup_reduce((PyObject*)&__pyx_type_4lupa_5_lupa__LuaThread) < 0) __PYX_ERR(0, 877, __pyx_L1_error)
30752   __pyx_ptype_4lupa_5_lupa__LuaThread = &__pyx_type_4lupa_5_lupa__LuaThread;
30753   if (PyType_Ready(&__pyx_type_4lupa_5_lupa__LuaIter) < 0) __PYX_ERR(0, 990, __pyx_L1_error)
30754   #if PY_VERSION_HEX < 0x030800B1
30755   __pyx_type_4lupa_5_lupa__LuaIter.tp_print = 0;
30756   #endif
30757   if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_4lupa_5_lupa__LuaIter.tp_dictoffset && __pyx_type_4lupa_5_lupa__LuaIter.tp_getattro == PyObject_GenericGetAttr)) {
30758     __pyx_type_4lupa_5_lupa__LuaIter.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
30759   }
30760   if (__Pyx_setup_reduce((PyObject*)&__pyx_type_4lupa_5_lupa__LuaIter) < 0) __PYX_ERR(0, 990, __pyx_L1_error)
30761   __pyx_ptype_4lupa_5_lupa__LuaIter = &__pyx_type_4lupa_5_lupa__LuaIter;
30762   if (PyType_Ready(&__pyx_type_4lupa_5_lupa__PyProtocolWrapper) < 0) __PYX_ERR(0, 1101, __pyx_L1_error)
30763   #if PY_VERSION_HEX < 0x030800B1
30764   __pyx_type_4lupa_5_lupa__PyProtocolWrapper.tp_print = 0;
30765   #endif
30766   if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_4lupa_5_lupa__PyProtocolWrapper.tp_dictoffset && __pyx_type_4lupa_5_lupa__PyProtocolWrapper.tp_getattro == PyObject_GenericGetAttr)) {
30767     __pyx_type_4lupa_5_lupa__PyProtocolWrapper.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
30768   }
30769   if (__Pyx_setup_reduce((PyObject*)&__pyx_type_4lupa_5_lupa__PyProtocolWrapper) < 0) __PYX_ERR(0, 1101, __pyx_L1_error)
30770   __pyx_ptype_4lupa_5_lupa__PyProtocolWrapper = &__pyx_type_4lupa_5_lupa__PyProtocolWrapper;
30771   if (PyType_Ready(&__pyx_type_4lupa_5_lupa___pyx_scope_struct__unpacks_lua_table) < 0) __PYX_ERR(0, 462, __pyx_L1_error)
30772   #if PY_VERSION_HEX < 0x030800B1
30773   __pyx_type_4lupa_5_lupa___pyx_scope_struct__unpacks_lua_table.tp_print = 0;
30774   #endif
30775   if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_4lupa_5_lupa___pyx_scope_struct__unpacks_lua_table.tp_dictoffset && __pyx_type_4lupa_5_lupa___pyx_scope_struct__unpacks_lua_table.tp_getattro == PyObject_GenericGetAttr)) {
30776     __pyx_type_4lupa_5_lupa___pyx_scope_struct__unpacks_lua_table.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
30777   }
30778   __pyx_ptype_4lupa_5_lupa___pyx_scope_struct__unpacks_lua_table = &__pyx_type_4lupa_5_lupa___pyx_scope_struct__unpacks_lua_table;
30779   if (PyType_Ready(&__pyx_type_4lupa_5_lupa___pyx_scope_struct_1_unpacks_lua_table_method) < 0) __PYX_ERR(0, 488, __pyx_L1_error)
30780   #if PY_VERSION_HEX < 0x030800B1
30781   __pyx_type_4lupa_5_lupa___pyx_scope_struct_1_unpacks_lua_table_method.tp_print = 0;
30782   #endif
30783   if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_4lupa_5_lupa___pyx_scope_struct_1_unpacks_lua_table_method.tp_dictoffset && __pyx_type_4lupa_5_lupa___pyx_scope_struct_1_unpacks_lua_table_method.tp_getattro == PyObject_GenericGetAttr)) {
30784     __pyx_type_4lupa_5_lupa___pyx_scope_struct_1_unpacks_lua_table_method.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
30785   }
30786   __pyx_ptype_4lupa_5_lupa___pyx_scope_struct_1_unpacks_lua_table_method = &__pyx_type_4lupa_5_lupa___pyx_scope_struct_1_unpacks_lua_table_method;
30787   __Pyx_RefNannyFinishContext();
30788   return 0;
30789   __pyx_L1_error:;
30790   __Pyx_RefNannyFinishContext();
30791   return -1;
30792 }
30793 
__Pyx_modinit_type_import_code(void)30794 static int __Pyx_modinit_type_import_code(void) {
30795   __Pyx_RefNannyDeclarations
30796   PyObject *__pyx_t_1 = NULL;
30797   int __pyx_lineno = 0;
30798   const char *__pyx_filename = NULL;
30799   int __pyx_clineno = 0;
30800   __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
30801   /*--- Type import code ---*/
30802   __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 9, __pyx_L1_error)
30803   __Pyx_GOTREF(__pyx_t_1);
30804   __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type",
30805   #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
30806   sizeof(PyTypeObject),
30807   #else
30808   sizeof(PyHeapTypeObject),
30809   #endif
30810   __Pyx_ImportType_CheckSize_Warn);
30811    if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(3, 9, __pyx_L1_error)
30812   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
30813   __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 8, __pyx_L1_error)
30814   __Pyx_GOTREF(__pyx_t_1);
30815   __pyx_ptype_7cpython_4bool_bool = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "bool", sizeof(PyBoolObject), __Pyx_ImportType_CheckSize_Warn);
30816    if (!__pyx_ptype_7cpython_4bool_bool) __PYX_ERR(4, 8, __pyx_L1_error)
30817   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
30818   __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 15, __pyx_L1_error)
30819   __Pyx_GOTREF(__pyx_t_1);
30820   __pyx_ptype_7cpython_7complex_complex = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "complex", sizeof(PyComplexObject), __Pyx_ImportType_CheckSize_Warn);
30821    if (!__pyx_ptype_7cpython_7complex_complex) __PYX_ERR(5, 15, __pyx_L1_error)
30822   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
30823   __Pyx_RefNannyFinishContext();
30824   return 0;
30825   __pyx_L1_error:;
30826   __Pyx_XDECREF(__pyx_t_1);
30827   __Pyx_RefNannyFinishContext();
30828   return -1;
30829 }
30830 
__Pyx_modinit_variable_import_code(void)30831 static int __Pyx_modinit_variable_import_code(void) {
30832   __Pyx_RefNannyDeclarations
30833   __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
30834   /*--- Variable import code ---*/
30835   __Pyx_RefNannyFinishContext();
30836   return 0;
30837 }
30838 
__Pyx_modinit_function_import_code(void)30839 static int __Pyx_modinit_function_import_code(void) {
30840   __Pyx_RefNannyDeclarations
30841   __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
30842   /*--- Function import code ---*/
30843   __Pyx_RefNannyFinishContext();
30844   return 0;
30845 }
30846 
30847 
30848 #ifndef CYTHON_NO_PYINIT_EXPORT
30849 #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
30850 #elif PY_MAJOR_VERSION < 3
30851 #ifdef __cplusplus
30852 #define __Pyx_PyMODINIT_FUNC extern "C" void
30853 #else
30854 #define __Pyx_PyMODINIT_FUNC void
30855 #endif
30856 #else
30857 #ifdef __cplusplus
30858 #define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
30859 #else
30860 #define __Pyx_PyMODINIT_FUNC PyObject *
30861 #endif
30862 #endif
30863 
30864 
30865 #if PY_MAJOR_VERSION < 3
30866 __Pyx_PyMODINIT_FUNC init_lupa(void) CYTHON_SMALL_CODE; /*proto*/
init_lupa(void)30867 __Pyx_PyMODINIT_FUNC init_lupa(void)
30868 #else
30869 __Pyx_PyMODINIT_FUNC PyInit__lupa(void) CYTHON_SMALL_CODE; /*proto*/
30870 __Pyx_PyMODINIT_FUNC PyInit__lupa(void)
30871 #if CYTHON_PEP489_MULTI_PHASE_INIT
30872 {
30873   return PyModuleDef_Init(&__pyx_moduledef);
30874 }
30875 static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
30876     #if PY_VERSION_HEX >= 0x030700A1
30877     static PY_INT64_T main_interpreter_id = -1;
30878     PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
30879     if (main_interpreter_id == -1) {
30880         main_interpreter_id = current_id;
30881         return (unlikely(current_id == -1)) ? -1 : 0;
30882     } else if (unlikely(main_interpreter_id != current_id))
30883     #else
30884     static PyInterpreterState *main_interpreter = NULL;
30885     PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
30886     if (!main_interpreter) {
30887         main_interpreter = current_interpreter;
30888     } else if (unlikely(main_interpreter != current_interpreter))
30889     #endif
30890     {
30891         PyErr_SetString(
30892             PyExc_ImportError,
30893             "Interpreter change detected - this module can only be loaded into one interpreter per process.");
30894         return -1;
30895     }
30896     return 0;
30897 }
30898 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) {
30899     PyObject *value = PyObject_GetAttrString(spec, from_name);
30900     int result = 0;
30901     if (likely(value)) {
30902         if (allow_none || value != Py_None) {
30903             result = PyDict_SetItemString(moddict, to_name, value);
30904         }
30905         Py_DECREF(value);
30906     } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
30907         PyErr_Clear();
30908     } else {
30909         result = -1;
30910     }
30911     return result;
30912 }
30913 static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
30914     PyObject *module = NULL, *moddict, *modname;
30915     if (__Pyx_check_single_interpreter())
30916         return NULL;
30917     if (__pyx_m)
30918         return __Pyx_NewRef(__pyx_m);
30919     modname = PyObject_GetAttrString(spec, "name");
30920     if (unlikely(!modname)) goto bad;
30921     module = PyModule_NewObject(modname);
30922     Py_DECREF(modname);
30923     if (unlikely(!module)) goto bad;
30924     moddict = PyModule_GetDict(module);
30925     if (unlikely(!moddict)) goto bad;
30926     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
30927     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
30928     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
30929     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
30930     return module;
30931 bad:
30932     Py_XDECREF(module);
30933     return NULL;
30934 }
30935 
30936 
30937 static CYTHON_SMALL_CODE int __pyx_pymod_exec__lupa(PyObject *__pyx_pyinit_module)
30938 #endif
30939 #endif
30940 {
30941   PyObject *__pyx_t_1 = NULL;
30942   PyObject *__pyx_t_2 = NULL;
30943   PyObject *__pyx_t_3 = NULL;
30944   PyObject *__pyx_t_4 = NULL;
30945   PyObject *__pyx_t_5 = NULL;
30946   int __pyx_t_6;
30947   PyObject *__pyx_t_7 = NULL;
30948   PyObject *__pyx_t_8 = NULL;
30949   PyObject *__pyx_t_9 = NULL;
30950   luaL_Reg __pyx_t_10;
30951   luaL_Reg __pyx_t_11;
30952   luaL_Reg __pyx_t_12;
30953   luaL_Reg __pyx_t_13;
30954   luaL_Reg __pyx_t_14;
30955   luaL_Reg __pyx_t_15;
30956   static luaL_Reg __pyx_t_16[6];
30957   luaL_Reg __pyx_t_17;
30958   static luaL_Reg __pyx_t_18[7];
30959   int __pyx_lineno = 0;
30960   const char *__pyx_filename = NULL;
30961   int __pyx_clineno = 0;
30962   __Pyx_RefNannyDeclarations
30963   #if CYTHON_PEP489_MULTI_PHASE_INIT
30964   if (__pyx_m) {
30965     if (__pyx_m == __pyx_pyinit_module) return 0;
30966     PyErr_SetString(PyExc_RuntimeError, "Module '_lupa' has already been imported. Re-initialisation is not supported.");
30967     return -1;
30968   }
30969   #elif PY_MAJOR_VERSION >= 3
30970   if (__pyx_m) return __Pyx_NewRef(__pyx_m);
30971   #endif
30972   #if CYTHON_REFNANNY
30973 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
30974 if (!__Pyx_RefNanny) {
30975   PyErr_Clear();
30976   __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
30977   if (!__Pyx_RefNanny)
30978       Py_FatalError("failed to import 'refnanny' module");
30979 }
30980 #endif
30981   __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit__lupa(void)", 0);
30982   if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
30983   #ifdef __Pxy_PyFrame_Initialize_Offsets
30984   __Pxy_PyFrame_Initialize_Offsets();
30985   #endif
30986   __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
30987   __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
30988   __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
30989   #ifdef __Pyx_CyFunction_USED
30990   if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
30991   #endif
30992   #ifdef __Pyx_FusedFunction_USED
30993   if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
30994   #endif
30995   #ifdef __Pyx_Coroutine_USED
30996   if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
30997   #endif
30998   #ifdef __Pyx_Generator_USED
30999   if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
31000   #endif
31001   #ifdef __Pyx_AsyncGen_USED
31002   if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
31003   #endif
31004   #ifdef __Pyx_StopAsyncIteration_USED
31005   if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
31006   #endif
31007   /*--- Library function declarations ---*/
31008   /*--- Threads initialization code ---*/
31009   #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 && defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
31010   PyEval_InitThreads();
31011   #endif
31012   /*--- Module creation code ---*/
31013   #if CYTHON_PEP489_MULTI_PHASE_INIT
31014   __pyx_m = __pyx_pyinit_module;
31015   Py_INCREF(__pyx_m);
31016   #else
31017   #if PY_MAJOR_VERSION < 3
31018   __pyx_m = Py_InitModule4("_lupa", __pyx_methods, __pyx_k_A_fast_Python_wrapper_around_Lu, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
31019   #else
31020   __pyx_m = PyModule_Create(&__pyx_moduledef);
31021   #endif
31022   if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
31023   #endif
31024   __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
31025   Py_INCREF(__pyx_d);
31026   __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
31027   Py_INCREF(__pyx_b);
31028   __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
31029   Py_INCREF(__pyx_cython_runtime);
31030   if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
31031   /*--- Initialize various global constants etc. ---*/
31032   if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
31033   #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
31034   if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
31035   #endif
31036   if (__pyx_module_is_main_lupa___lupa) {
31037     if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
31038   }
31039   #if PY_MAJOR_VERSION >= 3
31040   {
31041     PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
31042     if (!PyDict_GetItemString(modules, "lupa._lupa")) {
31043       if (unlikely(PyDict_SetItemString(modules, "lupa._lupa", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
31044     }
31045   }
31046   #endif
31047   /*--- Builtin init code ---*/
31048   if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
31049   /*--- Constants init code ---*/
31050   if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
31051   /*--- Global type/function init code ---*/
31052   (void)__Pyx_modinit_global_init_code();
31053   (void)__Pyx_modinit_variable_export_code();
31054   (void)__Pyx_modinit_function_export_code();
31055   if (unlikely(__Pyx_modinit_type_init_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
31056   if (unlikely(__Pyx_modinit_type_import_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
31057   (void)__Pyx_modinit_variable_import_code();
31058   (void)__Pyx_modinit_function_import_code();
31059   /*--- Execution code ---*/
31060   #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
31061   if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
31062   #endif
31063 
31064   /* "lupa/_lupa.pyx":42
31065  *
31066  * cdef object exc_info
31067  * from sys import exc_info             # <<<<<<<<<<<<<<
31068  *
31069  * cdef object Mapping
31070  */
31071   __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 42, __pyx_L1_error)
31072   __Pyx_GOTREF(__pyx_t_1);
31073   __Pyx_INCREF(__pyx_n_s_exc_info);
31074   __Pyx_GIVEREF(__pyx_n_s_exc_info);
31075   PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_exc_info);
31076   __pyx_t_2 = __Pyx_Import(__pyx_n_s_sys, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 42, __pyx_L1_error)
31077   __Pyx_GOTREF(__pyx_t_2);
31078   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
31079   __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_exc_info); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 42, __pyx_L1_error)
31080   __Pyx_GOTREF(__pyx_t_1);
31081   __Pyx_INCREF(__pyx_t_1);
31082   __Pyx_XGOTREF(__pyx_v_4lupa_5_lupa_exc_info);
31083   __Pyx_DECREF_SET(__pyx_v_4lupa_5_lupa_exc_info, __pyx_t_1);
31084   __Pyx_GIVEREF(__pyx_t_1);
31085   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
31086   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
31087 
31088   /* "lupa/_lupa.pyx":45
31089  *
31090  * cdef object Mapping
31091  * try:             # <<<<<<<<<<<<<<
31092  *     from collections.abc import Mapping
31093  * except ImportError:
31094  */
31095   {
31096     __Pyx_PyThreadState_declare
31097     __Pyx_PyThreadState_assign
31098     __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
31099     __Pyx_XGOTREF(__pyx_t_3);
31100     __Pyx_XGOTREF(__pyx_t_4);
31101     __Pyx_XGOTREF(__pyx_t_5);
31102     /*try:*/ {
31103 
31104       /* "lupa/_lupa.pyx":46
31105  * cdef object Mapping
31106  * try:
31107  *     from collections.abc import Mapping             # <<<<<<<<<<<<<<
31108  * except ImportError:
31109  *     from collections import Mapping  # Py2
31110  */
31111       __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 46, __pyx_L2_error)
31112       __Pyx_GOTREF(__pyx_t_2);
31113       __Pyx_INCREF(__pyx_n_s_Mapping);
31114       __Pyx_GIVEREF(__pyx_n_s_Mapping);
31115       PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_Mapping);
31116       __pyx_t_1 = __Pyx_Import(__pyx_n_s_collections_abc, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 46, __pyx_L2_error)
31117       __Pyx_GOTREF(__pyx_t_1);
31118       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
31119       __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_Mapping); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 46, __pyx_L2_error)
31120       __Pyx_GOTREF(__pyx_t_2);
31121       __Pyx_INCREF(__pyx_t_2);
31122       __Pyx_XGOTREF(__pyx_v_4lupa_5_lupa_Mapping);
31123       __Pyx_DECREF_SET(__pyx_v_4lupa_5_lupa_Mapping, __pyx_t_2);
31124       __Pyx_GIVEREF(__pyx_t_2);
31125       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
31126       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
31127 
31128       /* "lupa/_lupa.pyx":45
31129  *
31130  * cdef object Mapping
31131  * try:             # <<<<<<<<<<<<<<
31132  *     from collections.abc import Mapping
31133  * except ImportError:
31134  */
31135     }
31136     __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
31137     __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
31138     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
31139     goto __pyx_L7_try_end;
31140     __pyx_L2_error:;
31141     __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
31142     __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
31143 
31144     /* "lupa/_lupa.pyx":47
31145  * try:
31146  *     from collections.abc import Mapping
31147  * except ImportError:             # <<<<<<<<<<<<<<
31148  *     from collections import Mapping  # Py2
31149  *
31150  */
31151     __pyx_t_6 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ImportError);
31152     if (__pyx_t_6) {
31153       __Pyx_AddTraceback("lupa._lupa", __pyx_clineno, __pyx_lineno, __pyx_filename);
31154       if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_2, &__pyx_t_7) < 0) __PYX_ERR(0, 47, __pyx_L4_except_error)
31155       __Pyx_GOTREF(__pyx_t_1);
31156       __Pyx_GOTREF(__pyx_t_2);
31157       __Pyx_GOTREF(__pyx_t_7);
31158 
31159       /* "lupa/_lupa.pyx":48
31160  *     from collections.abc import Mapping
31161  * except ImportError:
31162  *     from collections import Mapping  # Py2             # <<<<<<<<<<<<<<
31163  *
31164  * cdef object wraps
31165  */
31166       __pyx_t_8 = PyList_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 48, __pyx_L4_except_error)
31167       __Pyx_GOTREF(__pyx_t_8);
31168       __Pyx_INCREF(__pyx_n_s_Mapping);
31169       __Pyx_GIVEREF(__pyx_n_s_Mapping);
31170       PyList_SET_ITEM(__pyx_t_8, 0, __pyx_n_s_Mapping);
31171       __pyx_t_9 = __Pyx_Import(__pyx_n_s_collections, __pyx_t_8, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 48, __pyx_L4_except_error)
31172       __Pyx_GOTREF(__pyx_t_9);
31173       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
31174       __pyx_t_8 = __Pyx_ImportFrom(__pyx_t_9, __pyx_n_s_Mapping); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 48, __pyx_L4_except_error)
31175       __Pyx_GOTREF(__pyx_t_8);
31176       __Pyx_INCREF(__pyx_t_8);
31177       __Pyx_XGOTREF(__pyx_v_4lupa_5_lupa_Mapping);
31178       __Pyx_DECREF_SET(__pyx_v_4lupa_5_lupa_Mapping, __pyx_t_8);
31179       __Pyx_GIVEREF(__pyx_t_8);
31180       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
31181       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
31182       __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
31183       __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
31184       __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
31185       goto __pyx_L3_exception_handled;
31186     }
31187     goto __pyx_L4_except_error;
31188     __pyx_L4_except_error:;
31189 
31190     /* "lupa/_lupa.pyx":45
31191  *
31192  * cdef object Mapping
31193  * try:             # <<<<<<<<<<<<<<
31194  *     from collections.abc import Mapping
31195  * except ImportError:
31196  */
31197     __Pyx_XGIVEREF(__pyx_t_3);
31198     __Pyx_XGIVEREF(__pyx_t_4);
31199     __Pyx_XGIVEREF(__pyx_t_5);
31200     __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
31201     goto __pyx_L1_error;
31202     __pyx_L3_exception_handled:;
31203     __Pyx_XGIVEREF(__pyx_t_3);
31204     __Pyx_XGIVEREF(__pyx_t_4);
31205     __Pyx_XGIVEREF(__pyx_t_5);
31206     __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
31207     __pyx_L7_try_end:;
31208   }
31209 
31210   /* "lupa/_lupa.pyx":51
31211  *
31212  * cdef object wraps
31213  * from functools import wraps             # <<<<<<<<<<<<<<
31214  *
31215  *
31216  */
31217   __pyx_t_7 = PyList_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 51, __pyx_L1_error)
31218   __Pyx_GOTREF(__pyx_t_7);
31219   __Pyx_INCREF(__pyx_n_s_wraps);
31220   __Pyx_GIVEREF(__pyx_n_s_wraps);
31221   PyList_SET_ITEM(__pyx_t_7, 0, __pyx_n_s_wraps);
31222   __pyx_t_2 = __Pyx_Import(__pyx_n_s_functools, __pyx_t_7, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 51, __pyx_L1_error)
31223   __Pyx_GOTREF(__pyx_t_2);
31224   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
31225   __pyx_t_7 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_wraps); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 51, __pyx_L1_error)
31226   __Pyx_GOTREF(__pyx_t_7);
31227   __Pyx_INCREF(__pyx_t_7);
31228   __Pyx_XGOTREF(__pyx_v_4lupa_5_lupa_wraps);
31229   __Pyx_DECREF_SET(__pyx_v_4lupa_5_lupa_wraps, __pyx_t_7);
31230   __Pyx_GIVEREF(__pyx_t_7);
31231   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
31232   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
31233 
31234   /* "lupa/_lupa.pyx":54
31235  *
31236  *
31237  * __all__ = ['LUA_VERSION', 'LuaRuntime', 'LuaError', 'LuaSyntaxError',             # <<<<<<<<<<<<<<
31238  *            'as_itemgetter', 'as_attrgetter', 'lua_type',
31239  *            'unpacks_lua_table', 'unpacks_lua_table_method']
31240  */
31241   __pyx_t_2 = PyList_New(9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 54, __pyx_L1_error)
31242   __Pyx_GOTREF(__pyx_t_2);
31243   __Pyx_INCREF(__pyx_n_s_LUA_VERSION);
31244   __Pyx_GIVEREF(__pyx_n_s_LUA_VERSION);
31245   PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_LUA_VERSION);
31246   __Pyx_INCREF(__pyx_n_s_LuaRuntime);
31247   __Pyx_GIVEREF(__pyx_n_s_LuaRuntime);
31248   PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_LuaRuntime);
31249   __Pyx_INCREF(__pyx_n_s_LuaError);
31250   __Pyx_GIVEREF(__pyx_n_s_LuaError);
31251   PyList_SET_ITEM(__pyx_t_2, 2, __pyx_n_s_LuaError);
31252   __Pyx_INCREF(__pyx_n_s_LuaSyntaxError);
31253   __Pyx_GIVEREF(__pyx_n_s_LuaSyntaxError);
31254   PyList_SET_ITEM(__pyx_t_2, 3, __pyx_n_s_LuaSyntaxError);
31255   __Pyx_INCREF(__pyx_n_s_as_itemgetter);
31256   __Pyx_GIVEREF(__pyx_n_s_as_itemgetter);
31257   PyList_SET_ITEM(__pyx_t_2, 4, __pyx_n_s_as_itemgetter);
31258   __Pyx_INCREF(__pyx_n_s_as_attrgetter);
31259   __Pyx_GIVEREF(__pyx_n_s_as_attrgetter);
31260   PyList_SET_ITEM(__pyx_t_2, 5, __pyx_n_s_as_attrgetter);
31261   __Pyx_INCREF(__pyx_n_s_lua_type);
31262   __Pyx_GIVEREF(__pyx_n_s_lua_type);
31263   PyList_SET_ITEM(__pyx_t_2, 6, __pyx_n_s_lua_type);
31264   __Pyx_INCREF(__pyx_n_s_unpacks_lua_table);
31265   __Pyx_GIVEREF(__pyx_n_s_unpacks_lua_table);
31266   PyList_SET_ITEM(__pyx_t_2, 7, __pyx_n_s_unpacks_lua_table);
31267   __Pyx_INCREF(__pyx_n_s_unpacks_lua_table_method);
31268   __Pyx_GIVEREF(__pyx_n_s_unpacks_lua_table_method);
31269   PyList_SET_ITEM(__pyx_t_2, 8, __pyx_n_s_unpacks_lua_table_method);
31270   if (PyDict_SetItem(__pyx_d, __pyx_n_s_all, __pyx_t_2) < 0) __PYX_ERR(0, 54, __pyx_L1_error)
31271   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
31272 
31273   /* "lupa/_lupa.pyx":59
31274  *
31275  * cdef object builtins
31276  * try:             # <<<<<<<<<<<<<<
31277  *     import __builtin__ as builtins
31278  * except ImportError:
31279  */
31280   {
31281     __Pyx_PyThreadState_declare
31282     __Pyx_PyThreadState_assign
31283     __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_4, &__pyx_t_3);
31284     __Pyx_XGOTREF(__pyx_t_5);
31285     __Pyx_XGOTREF(__pyx_t_4);
31286     __Pyx_XGOTREF(__pyx_t_3);
31287     /*try:*/ {
31288 
31289       /* "lupa/_lupa.pyx":60
31290  * cdef object builtins
31291  * try:
31292  *     import __builtin__ as builtins             # <<<<<<<<<<<<<<
31293  * except ImportError:
31294  *     import builtins
31295  */
31296       __pyx_t_2 = __Pyx_Import(__pyx_n_s_builtin, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 60, __pyx_L10_error)
31297       __Pyx_GOTREF(__pyx_t_2);
31298       __Pyx_XGOTREF(__pyx_v_4lupa_5_lupa_builtins);
31299       __Pyx_DECREF_SET(__pyx_v_4lupa_5_lupa_builtins, __pyx_t_2);
31300       __Pyx_GIVEREF(__pyx_t_2);
31301       __pyx_t_2 = 0;
31302 
31303       /* "lupa/_lupa.pyx":59
31304  *
31305  * cdef object builtins
31306  * try:             # <<<<<<<<<<<<<<
31307  *     import __builtin__ as builtins
31308  * except ImportError:
31309  */
31310     }
31311     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
31312     __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
31313     __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
31314     goto __pyx_L15_try_end;
31315     __pyx_L10_error:;
31316     __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
31317     __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
31318     __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
31319     __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
31320     __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
31321 
31322     /* "lupa/_lupa.pyx":61
31323  * try:
31324  *     import __builtin__ as builtins
31325  * except ImportError:             # <<<<<<<<<<<<<<
31326  *     import builtins
31327  *
31328  */
31329     __pyx_t_6 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ImportError);
31330     if (__pyx_t_6) {
31331       __Pyx_AddTraceback("lupa._lupa", __pyx_clineno, __pyx_lineno, __pyx_filename);
31332       if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_7, &__pyx_t_1) < 0) __PYX_ERR(0, 61, __pyx_L12_except_error)
31333       __Pyx_GOTREF(__pyx_t_2);
31334       __Pyx_GOTREF(__pyx_t_7);
31335       __Pyx_GOTREF(__pyx_t_1);
31336 
31337       /* "lupa/_lupa.pyx":62
31338  *     import __builtin__ as builtins
31339  * except ImportError:
31340  *     import builtins             # <<<<<<<<<<<<<<
31341  *
31342  * DEF POBJECT = b"POBJECT" # as used by LunaticPython
31343  */
31344       __pyx_t_9 = __Pyx_Import(__pyx_n_s_builtins, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 62, __pyx_L12_except_error)
31345       __Pyx_GOTREF(__pyx_t_9);
31346       __Pyx_XGOTREF(__pyx_v_4lupa_5_lupa_builtins);
31347       __Pyx_DECREF_SET(__pyx_v_4lupa_5_lupa_builtins, __pyx_t_9);
31348       __Pyx_GIVEREF(__pyx_t_9);
31349       __pyx_t_9 = 0;
31350       __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
31351       __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
31352       __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
31353       goto __pyx_L11_exception_handled;
31354     }
31355     goto __pyx_L12_except_error;
31356     __pyx_L12_except_error:;
31357 
31358     /* "lupa/_lupa.pyx":59
31359  *
31360  * cdef object builtins
31361  * try:             # <<<<<<<<<<<<<<
31362  *     import __builtin__ as builtins
31363  * except ImportError:
31364  */
31365     __Pyx_XGIVEREF(__pyx_t_5);
31366     __Pyx_XGIVEREF(__pyx_t_4);
31367     __Pyx_XGIVEREF(__pyx_t_3);
31368     __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_4, __pyx_t_3);
31369     goto __pyx_L1_error;
31370     __pyx_L11_exception_handled:;
31371     __Pyx_XGIVEREF(__pyx_t_5);
31372     __Pyx_XGIVEREF(__pyx_t_4);
31373     __Pyx_XGIVEREF(__pyx_t_3);
31374     __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_4, __pyx_t_3);
31375     __pyx_L15_try_end:;
31376   }
31377 
31378   /* "lupa/lock.pxi":34
31379  *             self._real_lock = NULL
31380  *
31381  *     def acquire(self, bint blocking=True):             # <<<<<<<<<<<<<<
31382  *         return lock_lock(self, pythread.PyThread_get_thread_ident(), blocking)
31383  *
31384  */
31385   __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_4lupa_5_lupa_9FastRLock_5acquire, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_FastRLock_acquire, NULL, __pyx_n_s_lupa__lupa, __pyx_d, ((PyObject *)__pyx_codeobj__37)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 34, __pyx_L1_error)
31386   __Pyx_GOTREF(__pyx_t_1);
31387   if (PyDict_SetItem((PyObject *)__pyx_ptype_4lupa_5_lupa_FastRLock->tp_dict, __pyx_n_s_acquire, __pyx_t_1) < 0) __PYX_ERR(1, 34, __pyx_L1_error)
31388   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
31389   PyType_Modified(__pyx_ptype_4lupa_5_lupa_FastRLock);
31390 
31391   /* "lupa/lock.pxi":37
31392  *         return lock_lock(self, pythread.PyThread_get_thread_ident(), blocking)
31393  *
31394  *     def release(self):             # <<<<<<<<<<<<<<
31395  *         if self._owner != pythread.PyThread_get_thread_ident():
31396  *             raise RuntimeError("cannot release un-acquired lock")
31397  */
31398   __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_4lupa_5_lupa_9FastRLock_7release, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_FastRLock_release, NULL, __pyx_n_s_lupa__lupa, __pyx_d, ((PyObject *)__pyx_codeobj__39)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 37, __pyx_L1_error)
31399   __Pyx_GOTREF(__pyx_t_1);
31400   if (PyDict_SetItem((PyObject *)__pyx_ptype_4lupa_5_lupa_FastRLock->tp_dict, __pyx_n_s_release, __pyx_t_1) < 0) __PYX_ERR(1, 37, __pyx_L1_error)
31401   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
31402   PyType_Modified(__pyx_ptype_4lupa_5_lupa_FastRLock);
31403 
31404   /* "lupa/lock.pxi":44
31405  *     # compatibility with RLock
31406  *
31407  *     def __enter__(self):             # <<<<<<<<<<<<<<
31408  *         # self.acquire()
31409  *         return lock_lock(self, pythread.PyThread_get_thread_ident(), True)
31410  */
31411   __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_4lupa_5_lupa_9FastRLock_9__enter__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_FastRLock___enter, NULL, __pyx_n_s_lupa__lupa, __pyx_d, ((PyObject *)__pyx_codeobj__41)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 44, __pyx_L1_error)
31412   __Pyx_GOTREF(__pyx_t_1);
31413   if (PyDict_SetItem((PyObject *)__pyx_ptype_4lupa_5_lupa_FastRLock->tp_dict, __pyx_n_s_enter, __pyx_t_1) < 0) __PYX_ERR(1, 44, __pyx_L1_error)
31414   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
31415   PyType_Modified(__pyx_ptype_4lupa_5_lupa_FastRLock);
31416 
31417   /* "lupa/lock.pxi":48
31418  *         return lock_lock(self, pythread.PyThread_get_thread_ident(), True)
31419  *
31420  *     def __exit__(self, t, v, tb):             # <<<<<<<<<<<<<<
31421  *         # self.release()
31422  *         if self._owner != pythread.PyThread_get_thread_ident():
31423  */
31424   __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_4lupa_5_lupa_9FastRLock_11__exit__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_FastRLock___exit, NULL, __pyx_n_s_lupa__lupa, __pyx_d, ((PyObject *)__pyx_codeobj__43)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 48, __pyx_L1_error)
31425   __Pyx_GOTREF(__pyx_t_1);
31426   if (PyDict_SetItem((PyObject *)__pyx_ptype_4lupa_5_lupa_FastRLock->tp_dict, __pyx_n_s_exit, __pyx_t_1) < 0) __PYX_ERR(1, 48, __pyx_L1_error)
31427   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
31428   PyType_Modified(__pyx_ptype_4lupa_5_lupa_FastRLock);
31429 
31430   /* "lupa/lock.pxi":54
31431  *         unlock_lock(self)
31432  *
31433  *     def _is_owned(self):             # <<<<<<<<<<<<<<
31434  *         return self._owner == pythread.PyThread_get_thread_ident()
31435  *
31436  */
31437   __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_4lupa_5_lupa_9FastRLock_13_is_owned, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_FastRLock__is_owned, NULL, __pyx_n_s_lupa__lupa, __pyx_d, ((PyObject *)__pyx_codeobj__45)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 54, __pyx_L1_error)
31438   __Pyx_GOTREF(__pyx_t_1);
31439   if (PyDict_SetItem((PyObject *)__pyx_ptype_4lupa_5_lupa_FastRLock->tp_dict, __pyx_n_s_is_owned, __pyx_t_1) < 0) __PYX_ERR(1, 54, __pyx_L1_error)
31440   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
31441   PyType_Modified(__pyx_ptype_4lupa_5_lupa_FastRLock);
31442 
31443   /* "(tree fragment)":1
31444  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
31445  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
31446  * def __setstate_cython__(self, __pyx_state):
31447  */
31448   __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_4lupa_5_lupa_9FastRLock_15__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_FastRLock___reduce_cython, NULL, __pyx_n_s_lupa__lupa, __pyx_d, ((PyObject *)__pyx_codeobj__47)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1, __pyx_L1_error)
31449   __Pyx_GOTREF(__pyx_t_1);
31450   if (PyDict_SetItem(__pyx_d, __pyx_n_s_reduce_cython, __pyx_t_1) < 0) __PYX_ERR(2, 1, __pyx_L1_error)
31451   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
31452 
31453   /* "(tree fragment)":3
31454  * def __reduce_cython__(self):
31455  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
31456  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
31457  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
31458  */
31459   __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_4lupa_5_lupa_9FastRLock_17__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_FastRLock___setstate_cython, NULL, __pyx_n_s_lupa__lupa, __pyx_d, ((PyObject *)__pyx_codeobj__49)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 3, __pyx_L1_error)
31460   __Pyx_GOTREF(__pyx_t_1);
31461   if (PyDict_SetItem(__pyx_d, __pyx_n_s_setstate_cython, __pyx_t_1) < 0) __PYX_ERR(2, 3, __pyx_L1_error)
31462   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
31463 
31464   /* "lupa/_lupa.pyx":87
31465  *
31466  *
31467  * cdef int _LUA_VERSION = lua.read_lua_version(NULL)             # <<<<<<<<<<<<<<
31468  * LUA_VERSION = (_LUA_VERSION // 100, _LUA_VERSION % 100)
31469  *
31470  */
31471   __pyx_v_4lupa_5_lupa__LUA_VERSION = read_lua_version(NULL);
31472 
31473   /* "lupa/_lupa.pyx":88
31474  *
31475  * cdef int _LUA_VERSION = lua.read_lua_version(NULL)
31476  * LUA_VERSION = (_LUA_VERSION // 100, _LUA_VERSION % 100)             # <<<<<<<<<<<<<<
31477  *
31478  *
31479  */
31480   __pyx_t_1 = __Pyx_PyInt_From_long(__Pyx_div_long(__pyx_v_4lupa_5_lupa__LUA_VERSION, 0x64)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 88, __pyx_L1_error)
31481   __Pyx_GOTREF(__pyx_t_1);
31482   __pyx_t_7 = __Pyx_PyInt_From_long(__Pyx_mod_long(__pyx_v_4lupa_5_lupa__LUA_VERSION, 0x64)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 88, __pyx_L1_error)
31483   __Pyx_GOTREF(__pyx_t_7);
31484   __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 88, __pyx_L1_error)
31485   __Pyx_GOTREF(__pyx_t_2);
31486   __Pyx_GIVEREF(__pyx_t_1);
31487   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
31488   __Pyx_GIVEREF(__pyx_t_7);
31489   PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_7);
31490   __pyx_t_1 = 0;
31491   __pyx_t_7 = 0;
31492   if (PyDict_SetItem(__pyx_d, __pyx_n_s_LUA_VERSION, __pyx_t_2) < 0) __PYX_ERR(0, 88, __pyx_L1_error)
31493   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
31494 
31495   /* "lupa/_lupa.pyx":91
31496  *
31497  *
31498  * class LuaError(Exception):             # <<<<<<<<<<<<<<
31499  *     """Base class for errors in the Lua runtime.
31500  *     """
31501  */
31502   __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 91, __pyx_L1_error)
31503   __Pyx_GOTREF(__pyx_t_2);
31504   __Pyx_INCREF(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
31505   __Pyx_GIVEREF(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
31506   PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
31507   __pyx_t_7 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 91, __pyx_L1_error)
31508   __Pyx_GOTREF(__pyx_t_7);
31509   __pyx_t_1 = __Pyx_Py3MetaclassPrepare(__pyx_t_7, __pyx_t_2, __pyx_n_s_LuaError, __pyx_n_s_LuaError, (PyObject *) NULL, __pyx_n_s_lupa__lupa, __pyx_kp_s_Base_class_for_errors_in_the_Lua); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 91, __pyx_L1_error)
31510   __Pyx_GOTREF(__pyx_t_1);
31511   __pyx_t_9 = __Pyx_Py3ClassCreate(__pyx_t_7, __pyx_n_s_LuaError, __pyx_t_2, __pyx_t_1, NULL, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 91, __pyx_L1_error)
31512   __Pyx_GOTREF(__pyx_t_9);
31513   if (PyDict_SetItem(__pyx_d, __pyx_n_s_LuaError, __pyx_t_9) < 0) __PYX_ERR(0, 91, __pyx_L1_error)
31514   __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
31515   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
31516   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
31517   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
31518 
31519   /* "lupa/_lupa.pyx":96
31520  *
31521  *
31522  * class LuaSyntaxError(LuaError):             # <<<<<<<<<<<<<<
31523  *     """Syntax error in Lua code.
31524  *     """
31525  */
31526   __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_LuaError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 96, __pyx_L1_error)
31527   __Pyx_GOTREF(__pyx_t_2);
31528   __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 96, __pyx_L1_error)
31529   __Pyx_GOTREF(__pyx_t_7);
31530   __Pyx_GIVEREF(__pyx_t_2);
31531   PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2);
31532   __pyx_t_2 = 0;
31533   __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 96, __pyx_L1_error)
31534   __Pyx_GOTREF(__pyx_t_2);
31535   __pyx_t_1 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_t_7, __pyx_n_s_LuaSyntaxError, __pyx_n_s_LuaSyntaxError, (PyObject *) NULL, __pyx_n_s_lupa__lupa, __pyx_kp_s_Syntax_error_in_Lua_code); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 96, __pyx_L1_error)
31536   __Pyx_GOTREF(__pyx_t_1);
31537   __pyx_t_9 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_LuaSyntaxError, __pyx_t_7, __pyx_t_1, NULL, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 96, __pyx_L1_error)
31538   __Pyx_GOTREF(__pyx_t_9);
31539   if (PyDict_SetItem(__pyx_d, __pyx_n_s_LuaSyntaxError, __pyx_t_9) < 0) __PYX_ERR(0, 96, __pyx_L1_error)
31540   __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
31541   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
31542   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
31543   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
31544 
31545   /* "lupa/_lupa.pyx":101
31546  *
31547  *
31548  * def lua_type(obj):             # <<<<<<<<<<<<<<
31549  *     """
31550  *     Return the Lua type name of a wrapped object as string, as provided
31551  */
31552   __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_4lupa_5_lupa_1lua_type, 0, __pyx_n_s_lua_type, NULL, __pyx_n_s_lupa__lupa, __pyx_d, ((PyObject *)__pyx_codeobj__51)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 101, __pyx_L1_error)
31553   __Pyx_GOTREF(__pyx_t_7);
31554   if (PyDict_SetItem(__pyx_d, __pyx_n_s_lua_type, __pyx_t_7) < 0) __PYX_ERR(0, 101, __pyx_L1_error)
31555   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
31556 
31557   /* "lupa/_lupa.pyx":294
31558  *         return 0
31559  *
31560  *     def eval(self, lua_code, *args):             # <<<<<<<<<<<<<<
31561  *         """Evaluate a Lua expression passed in a string.
31562  *         """
31563  */
31564   __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_4lupa_5_lupa_10LuaRuntime_5eval, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_LuaRuntime_eval, NULL, __pyx_n_s_lupa__lupa, __pyx_d, ((PyObject *)__pyx_codeobj__53)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 294, __pyx_L1_error)
31565   __Pyx_GOTREF(__pyx_t_7);
31566   if (PyDict_SetItem((PyObject *)__pyx_ptype_4lupa_5_lupa_LuaRuntime->tp_dict, __pyx_n_s_eval, __pyx_t_7) < 0) __PYX_ERR(0, 294, __pyx_L1_error)
31567   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
31568   PyType_Modified(__pyx_ptype_4lupa_5_lupa_LuaRuntime);
31569 
31570   /* "lupa/_lupa.pyx":302
31571  *         return run_lua(self, b'return ' + lua_code, args)
31572  *
31573  *     def execute(self, lua_code, *args):             # <<<<<<<<<<<<<<
31574  *         """Execute a Lua program passed in a string.
31575  *         """
31576  */
31577   __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_4lupa_5_lupa_10LuaRuntime_7execute, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_LuaRuntime_execute, NULL, __pyx_n_s_lupa__lupa, __pyx_d, ((PyObject *)__pyx_codeobj__55)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 302, __pyx_L1_error)
31578   __Pyx_GOTREF(__pyx_t_7);
31579   if (PyDict_SetItem((PyObject *)__pyx_ptype_4lupa_5_lupa_LuaRuntime->tp_dict, __pyx_n_s_execute, __pyx_t_7) < 0) __PYX_ERR(0, 302, __pyx_L1_error)
31580   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
31581   PyType_Modified(__pyx_ptype_4lupa_5_lupa_LuaRuntime);
31582 
31583   /* "lupa/_lupa.pyx":310
31584  *         return run_lua(self, lua_code, args)
31585  *
31586  *     def compile(self, lua_code):             # <<<<<<<<<<<<<<
31587  *         """Compile a Lua program into a callable Lua function.
31588  *         """
31589  */
31590   __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_4lupa_5_lupa_10LuaRuntime_9compile, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_LuaRuntime_compile, NULL, __pyx_n_s_lupa__lupa, __pyx_d, ((PyObject *)__pyx_codeobj__57)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 310, __pyx_L1_error)
31591   __Pyx_GOTREF(__pyx_t_7);
31592   if (PyDict_SetItem((PyObject *)__pyx_ptype_4lupa_5_lupa_LuaRuntime->tp_dict, __pyx_n_s_compile, __pyx_t_7) < 0) __PYX_ERR(0, 310, __pyx_L1_error)
31593   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
31594   PyType_Modified(__pyx_ptype_4lupa_5_lupa_LuaRuntime);
31595 
31596   /* "lupa/_lupa.pyx":332
31597  *             unlock_runtime(self)
31598  *
31599  *     def require(self, modulename):             # <<<<<<<<<<<<<<
31600  *         """Load a Lua library into the runtime.
31601  *         """
31602  */
31603   __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_4lupa_5_lupa_10LuaRuntime_11require, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_LuaRuntime_require, NULL, __pyx_n_s_lupa__lupa, __pyx_d, ((PyObject *)__pyx_codeobj__59)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 332, __pyx_L1_error)
31604   __Pyx_GOTREF(__pyx_t_7);
31605   if (PyDict_SetItem((PyObject *)__pyx_ptype_4lupa_5_lupa_LuaRuntime->tp_dict, __pyx_n_s_require, __pyx_t_7) < 0) __PYX_ERR(0, 332, __pyx_L1_error)
31606   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
31607   PyType_Modified(__pyx_ptype_4lupa_5_lupa_LuaRuntime);
31608 
31609   /* "lupa/_lupa.pyx":350
31610  *             unlock_runtime(self)
31611  *
31612  *     def globals(self):             # <<<<<<<<<<<<<<
31613  *         """Return the globals defined in this Lua runtime as a Lua
31614  *         table.
31615  */
31616   __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_4lupa_5_lupa_10LuaRuntime_13globals, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_LuaRuntime_globals, NULL, __pyx_n_s_lupa__lupa, __pyx_d, ((PyObject *)__pyx_codeobj__61)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 350, __pyx_L1_error)
31617   __Pyx_GOTREF(__pyx_t_7);
31618   if (PyDict_SetItem((PyObject *)__pyx_ptype_4lupa_5_lupa_LuaRuntime->tp_dict, __pyx_n_s_globals, __pyx_t_7) < 0) __PYX_ERR(0, 350, __pyx_L1_error)
31619   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
31620   PyType_Modified(__pyx_ptype_4lupa_5_lupa_LuaRuntime);
31621 
31622   /* "lupa/_lupa.pyx":367
31623  *             unlock_runtime(self)
31624  *
31625  *     def table(self, *items, **kwargs):             # <<<<<<<<<<<<<<
31626  *         """Create a new table with the provided items.  Positional
31627  *         arguments are placed in the table in order, keyword arguments
31628  */
31629   __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_4lupa_5_lupa_10LuaRuntime_15table, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_LuaRuntime_table, NULL, __pyx_n_s_lupa__lupa, __pyx_d, ((PyObject *)__pyx_codeobj__63)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 367, __pyx_L1_error)
31630   __Pyx_GOTREF(__pyx_t_7);
31631   if (PyDict_SetItem((PyObject *)__pyx_ptype_4lupa_5_lupa_LuaRuntime->tp_dict, __pyx_n_s_table, __pyx_t_7) < 0) __PYX_ERR(0, 367, __pyx_L1_error)
31632   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
31633   PyType_Modified(__pyx_ptype_4lupa_5_lupa_LuaRuntime);
31634 
31635   /* "lupa/_lupa.pyx":374
31636  *         return self.table_from(items, kwargs)
31637  *
31638  *     def table_from(self, *args):             # <<<<<<<<<<<<<<
31639  *         """Create a new table from Python mapping or iterable.
31640  *
31641  */
31642   __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_4lupa_5_lupa_10LuaRuntime_17table_from, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_LuaRuntime_table_from, NULL, __pyx_n_s_lupa__lupa, __pyx_d, ((PyObject *)__pyx_codeobj__65)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 374, __pyx_L1_error)
31643   __Pyx_GOTREF(__pyx_t_7);
31644   if (PyDict_SetItem((PyObject *)__pyx_ptype_4lupa_5_lupa_LuaRuntime->tp_dict, __pyx_n_s_table_from, __pyx_t_7) < 0) __PYX_ERR(0, 374, __pyx_L1_error)
31645   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
31646   PyType_Modified(__pyx_ptype_4lupa_5_lupa_LuaRuntime);
31647 
31648   /* "(tree fragment)":1
31649  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
31650  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
31651  * def __setstate_cython__(self, __pyx_state):
31652  */
31653   __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_4lupa_5_lupa_10LuaRuntime_19__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_LuaRuntime___reduce_cython, NULL, __pyx_n_s_lupa__lupa, __pyx_d, ((PyObject *)__pyx_codeobj__67)); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 1, __pyx_L1_error)
31654   __Pyx_GOTREF(__pyx_t_7);
31655   if (PyDict_SetItem(__pyx_d, __pyx_n_s_reduce_cython, __pyx_t_7) < 0) __PYX_ERR(2, 1, __pyx_L1_error)
31656   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
31657 
31658   /* "(tree fragment)":3
31659  * def __reduce_cython__(self):
31660  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
31661  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
31662  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
31663  */
31664   __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_4lupa_5_lupa_10LuaRuntime_21__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_LuaRuntime___setstate_cython, NULL, __pyx_n_s_lupa__lupa, __pyx_d, ((PyObject *)__pyx_codeobj__69)); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 3, __pyx_L1_error)
31665   __Pyx_GOTREF(__pyx_t_7);
31666   if (PyDict_SetItem(__pyx_d, __pyx_n_s_setstate_cython, __pyx_t_7) < 0) __PYX_ERR(2, 3, __pyx_L1_error)
31667   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
31668 
31669   /* "lupa/_lupa.pyx":462
31670  * # from Lua scripts
31671  *
31672  * def unpacks_lua_table(func):             # <<<<<<<<<<<<<<
31673  *     """
31674  *     A decorator to make the decorated function receive kwargs
31675  */
31676   __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_4lupa_5_lupa_3unpacks_lua_table, 0, __pyx_n_s_unpacks_lua_table, NULL, __pyx_n_s_lupa__lupa, __pyx_d, ((PyObject *)__pyx_codeobj__71)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 462, __pyx_L1_error)
31677   __Pyx_GOTREF(__pyx_t_7);
31678   if (PyDict_SetItem(__pyx_d, __pyx_n_s_unpacks_lua_table, __pyx_t_7) < 0) __PYX_ERR(0, 462, __pyx_L1_error)
31679   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
31680 
31681   /* "lupa/_lupa.pyx":488
31682  *
31683  *
31684  * def unpacks_lua_table_method(meth):             # <<<<<<<<<<<<<<
31685  *     """
31686  *     This is :func:`unpacks_lua_table` for methods
31687  */
31688   __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_4lupa_5_lupa_5unpacks_lua_table_method, 0, __pyx_n_s_unpacks_lua_table_method, NULL, __pyx_n_s_lupa__lupa, __pyx_d, ((PyObject *)__pyx_codeobj__73)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 488, __pyx_L1_error)
31689   __Pyx_GOTREF(__pyx_t_7);
31690   if (PyDict_SetItem(__pyx_d, __pyx_n_s_unpacks_lua_table_method, __pyx_t_7) < 0) __PYX_ERR(0, 488, __pyx_L1_error)
31691   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
31692 
31693   /* "(tree fragment)":1
31694  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
31695  *     raise TypeError("self._state cannot be converted to a Python object for pickling")
31696  * def __setstate_cython__(self, __pyx_state):
31697  */
31698   __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_4lupa_5_lupa_10_LuaObject_21__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_LuaObject___reduce_cython, NULL, __pyx_n_s_lupa__lupa, __pyx_d, ((PyObject *)__pyx_codeobj__75)); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 1, __pyx_L1_error)
31699   __Pyx_GOTREF(__pyx_t_7);
31700   if (PyDict_SetItem(__pyx_d, __pyx_n_s_reduce_cython, __pyx_t_7) < 0) __PYX_ERR(2, 1, __pyx_L1_error)
31701   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
31702 
31703   /* "(tree fragment)":3
31704  * def __reduce_cython__(self):
31705  *     raise TypeError("self._state cannot be converted to a Python object for pickling")
31706  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
31707  *     raise TypeError("self._state cannot be converted to a Python object for pickling")
31708  */
31709   __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_4lupa_5_lupa_10_LuaObject_23__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_LuaObject___setstate_cython, NULL, __pyx_n_s_lupa__lupa, __pyx_d, ((PyObject *)__pyx_codeobj__77)); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 3, __pyx_L1_error)
31710   __Pyx_GOTREF(__pyx_t_7);
31711   if (PyDict_SetItem(__pyx_d, __pyx_n_s_setstate_cython, __pyx_t_7) < 0) __PYX_ERR(2, 3, __pyx_L1_error)
31712   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
31713 
31714   /* "lupa/_lupa.pyx":736
31715  *         return _LuaIter(self, KEYS)
31716  *
31717  *     def keys(self):             # <<<<<<<<<<<<<<
31718  *         """Returns an iterator over the keys of a table that this
31719  *         object represents.  Same as iter(obj).
31720  */
31721   __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_4lupa_5_lupa_9_LuaTable_3keys, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_LuaTable_keys, NULL, __pyx_n_s_lupa__lupa, __pyx_d, ((PyObject *)__pyx_codeobj__79)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 736, __pyx_L1_error)
31722   __Pyx_GOTREF(__pyx_t_7);
31723   if (PyDict_SetItem((PyObject *)__pyx_ptype_4lupa_5_lupa__LuaTable->tp_dict, __pyx_n_s_keys, __pyx_t_7) < 0) __PYX_ERR(0, 736, __pyx_L1_error)
31724   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
31725   PyType_Modified(__pyx_ptype_4lupa_5_lupa__LuaTable);
31726 
31727   /* "lupa/_lupa.pyx":742
31728  *         return _LuaIter(self, KEYS)
31729  *
31730  *     def values(self):             # <<<<<<<<<<<<<<
31731  *         """Returns an iterator over the values of a table that this
31732  *         object represents.
31733  */
31734   __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_4lupa_5_lupa_9_LuaTable_5values, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_LuaTable_values, NULL, __pyx_n_s_lupa__lupa, __pyx_d, ((PyObject *)__pyx_codeobj__81)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 742, __pyx_L1_error)
31735   __Pyx_GOTREF(__pyx_t_7);
31736   if (PyDict_SetItem((PyObject *)__pyx_ptype_4lupa_5_lupa__LuaTable->tp_dict, __pyx_n_s_values, __pyx_t_7) < 0) __PYX_ERR(0, 742, __pyx_L1_error)
31737   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
31738   PyType_Modified(__pyx_ptype_4lupa_5_lupa__LuaTable);
31739 
31740   /* "lupa/_lupa.pyx":748
31741  *         return _LuaIter(self, VALUES)
31742  *
31743  *     def items(self):             # <<<<<<<<<<<<<<
31744  *         """Returns an iterator over the key-value pairs of a table
31745  *         that this object represents.
31746  */
31747   __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_4lupa_5_lupa_9_LuaTable_7items, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_LuaTable_items, NULL, __pyx_n_s_lupa__lupa, __pyx_d, ((PyObject *)__pyx_codeobj__83)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 748, __pyx_L1_error)
31748   __Pyx_GOTREF(__pyx_t_7);
31749   if (PyDict_SetItem((PyObject *)__pyx_ptype_4lupa_5_lupa__LuaTable->tp_dict, __pyx_n_s_items, __pyx_t_7) < 0) __PYX_ERR(0, 748, __pyx_L1_error)
31750   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
31751   PyType_Modified(__pyx_ptype_4lupa_5_lupa__LuaTable);
31752 
31753   /* "(tree fragment)":1
31754  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
31755  *     raise TypeError("self._state cannot be converted to a Python object for pickling")
31756  * def __setstate_cython__(self, __pyx_state):
31757  */
31758   __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_4lupa_5_lupa_9_LuaTable_17__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_LuaTable___reduce_cython, NULL, __pyx_n_s_lupa__lupa, __pyx_d, ((PyObject *)__pyx_codeobj__85)); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 1, __pyx_L1_error)
31759   __Pyx_GOTREF(__pyx_t_7);
31760   if (PyDict_SetItem(__pyx_d, __pyx_n_s_reduce_cython, __pyx_t_7) < 0) __PYX_ERR(2, 1, __pyx_L1_error)
31761   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
31762 
31763   /* "(tree fragment)":3
31764  * def __reduce_cython__(self):
31765  *     raise TypeError("self._state cannot be converted to a Python object for pickling")
31766  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
31767  *     raise TypeError("self._state cannot be converted to a Python object for pickling")
31768  */
31769   __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_4lupa_5_lupa_9_LuaTable_19__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_LuaTable___setstate_cython, NULL, __pyx_n_s_lupa__lupa, __pyx_d, ((PyObject *)__pyx_codeobj__87)); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 3, __pyx_L1_error)
31770   __Pyx_GOTREF(__pyx_t_7);
31771   if (PyDict_SetItem(__pyx_d, __pyx_n_s_setstate_cython, __pyx_t_7) < 0) __PYX_ERR(2, 3, __pyx_L1_error)
31772   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
31773 
31774   /* "lupa/_lupa.pyx":826
31775  *     """A Lua function (which may become a coroutine).
31776  *     """
31777  *     def coroutine(self, *args):             # <<<<<<<<<<<<<<
31778  *         """Create a Lua coroutine from a Lua function and call it with
31779  *         the passed parameters to start it up.
31780  */
31781   __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_4lupa_5_lupa_12_LuaFunction_1coroutine, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_LuaFunction_coroutine, NULL, __pyx_n_s_lupa__lupa, __pyx_d, ((PyObject *)__pyx_codeobj__89)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 826, __pyx_L1_error)
31782   __Pyx_GOTREF(__pyx_t_7);
31783   if (PyDict_SetItem((PyObject *)__pyx_ptype_4lupa_5_lupa__LuaFunction->tp_dict, __pyx_n_s_coroutine, __pyx_t_7) < 0) __PYX_ERR(0, 826, __pyx_L1_error)
31784   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
31785   PyType_Modified(__pyx_ptype_4lupa_5_lupa__LuaFunction);
31786 
31787   /* "(tree fragment)":1
31788  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
31789  *     raise TypeError("self._state cannot be converted to a Python object for pickling")
31790  * def __setstate_cython__(self, __pyx_state):
31791  */
31792   __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_4lupa_5_lupa_12_LuaFunction_3__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_LuaFunction___reduce_cython, NULL, __pyx_n_s_lupa__lupa, __pyx_d, ((PyObject *)__pyx_codeobj__91)); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 1, __pyx_L1_error)
31793   __Pyx_GOTREF(__pyx_t_7);
31794   if (PyDict_SetItem(__pyx_d, __pyx_n_s_reduce_cython, __pyx_t_7) < 0) __PYX_ERR(2, 1, __pyx_L1_error)
31795   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
31796 
31797   /* "(tree fragment)":3
31798  * def __reduce_cython__(self):
31799  *     raise TypeError("self._state cannot be converted to a Python object for pickling")
31800  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
31801  *     raise TypeError("self._state cannot be converted to a Python object for pickling")
31802  */
31803   __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_4lupa_5_lupa_12_LuaFunction_5__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_LuaFunction___setstate_cython, NULL, __pyx_n_s_lupa__lupa, __pyx_d, ((PyObject *)__pyx_codeobj__93)); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 3, __pyx_L1_error)
31804   __Pyx_GOTREF(__pyx_t_7);
31805   if (PyDict_SetItem(__pyx_d, __pyx_n_s_setstate_cython, __pyx_t_7) < 0) __PYX_ERR(2, 3, __pyx_L1_error)
31806   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
31807 
31808   /* "(tree fragment)":1
31809  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
31810  *     raise TypeError("self._state cannot be converted to a Python object for pickling")
31811  * def __setstate_cython__(self, __pyx_state):
31812  */
31813   __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_4lupa_5_lupa_21_LuaCoroutineFunction_3__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_LuaCoroutineFunction___reduce_c, NULL, __pyx_n_s_lupa__lupa, __pyx_d, ((PyObject *)__pyx_codeobj__95)); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 1, __pyx_L1_error)
31814   __Pyx_GOTREF(__pyx_t_7);
31815   if (PyDict_SetItem(__pyx_d, __pyx_n_s_reduce_cython, __pyx_t_7) < 0) __PYX_ERR(2, 1, __pyx_L1_error)
31816   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
31817 
31818   /* "(tree fragment)":3
31819  * def __reduce_cython__(self):
31820  *     raise TypeError("self._state cannot be converted to a Python object for pickling")
31821  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
31822  *     raise TypeError("self._state cannot be converted to a Python object for pickling")
31823  */
31824   __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_4lupa_5_lupa_21_LuaCoroutineFunction_5__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_LuaCoroutineFunction___setstate, NULL, __pyx_n_s_lupa__lupa, __pyx_d, ((PyObject *)__pyx_codeobj__97)); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 3, __pyx_L1_error)
31825   __Pyx_GOTREF(__pyx_t_7);
31826   if (PyDict_SetItem(__pyx_d, __pyx_n_s_setstate_cython, __pyx_t_7) < 0) __PYX_ERR(2, 3, __pyx_L1_error)
31827   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
31828 
31829   /* "lupa/_lupa.pyx":892
31830  *         return resume_lua_thread(self, args)
31831  *
31832  *     def send(self, value):             # <<<<<<<<<<<<<<
31833  *         """Send a value into the coroutine.  If the value is a tuple,
31834  *         send the unpacked elements.
31835  */
31836   __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_4lupa_5_lupa_10_LuaThread_5send, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_LuaThread_send, NULL, __pyx_n_s_lupa__lupa, __pyx_d, ((PyObject *)__pyx_codeobj__99)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 892, __pyx_L1_error)
31837   __Pyx_GOTREF(__pyx_t_7);
31838   if (PyDict_SetItem((PyObject *)__pyx_ptype_4lupa_5_lupa__LuaThread->tp_dict, __pyx_n_s_send, __pyx_t_7) < 0) __PYX_ERR(0, 892, __pyx_L1_error)
31839   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
31840   PyType_Modified(__pyx_ptype_4lupa_5_lupa__LuaThread);
31841 
31842   /* "(tree fragment)":1
31843  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
31844  *     raise TypeError("self._co_state,self._state cannot be converted to a Python object for pickling")
31845  * def __setstate_cython__(self, __pyx_state):
31846  */
31847   __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_4lupa_5_lupa_10_LuaThread_9__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_LuaThread___reduce_cython, NULL, __pyx_n_s_lupa__lupa, __pyx_d, ((PyObject *)__pyx_codeobj__101)); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 1, __pyx_L1_error)
31848   __Pyx_GOTREF(__pyx_t_7);
31849   if (PyDict_SetItem(__pyx_d, __pyx_n_s_reduce_cython, __pyx_t_7) < 0) __PYX_ERR(2, 1, __pyx_L1_error)
31850   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
31851 
31852   /* "(tree fragment)":3
31853  * def __reduce_cython__(self):
31854  *     raise TypeError("self._co_state,self._state cannot be converted to a Python object for pickling")
31855  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
31856  *     raise TypeError("self._co_state,self._state cannot be converted to a Python object for pickling")
31857  */
31858   __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_4lupa_5_lupa_10_LuaThread_11__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_LuaThread___setstate_cython, NULL, __pyx_n_s_lupa__lupa, __pyx_d, ((PyObject *)__pyx_codeobj__103)); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 3, __pyx_L1_error)
31859   __Pyx_GOTREF(__pyx_t_7);
31860   if (PyDict_SetItem(__pyx_d, __pyx_n_s_setstate_cython, __pyx_t_7) < 0) __PYX_ERR(2, 3, __pyx_L1_error)
31861   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
31862 
31863   /* "(tree fragment)":1
31864  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
31865  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
31866  * def __setstate_cython__(self, __pyx_state):
31867  */
31868   __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_4lupa_5_lupa_8_LuaIter_11__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_LuaIter___reduce_cython, NULL, __pyx_n_s_lupa__lupa, __pyx_d, ((PyObject *)__pyx_codeobj__105)); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 1, __pyx_L1_error)
31869   __Pyx_GOTREF(__pyx_t_7);
31870   if (PyDict_SetItem(__pyx_d, __pyx_n_s_reduce_cython, __pyx_t_7) < 0) __PYX_ERR(2, 1, __pyx_L1_error)
31871   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
31872 
31873   /* "(tree fragment)":3
31874  * def __reduce_cython__(self):
31875  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
31876  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
31877  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
31878  */
31879   __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_4lupa_5_lupa_8_LuaIter_13__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_LuaIter___setstate_cython, NULL, __pyx_n_s_lupa__lupa, __pyx_d, ((PyObject *)__pyx_codeobj__107)); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 3, __pyx_L1_error)
31880   __Pyx_GOTREF(__pyx_t_7);
31881   if (PyDict_SetItem(__pyx_d, __pyx_n_s_setstate_cython, __pyx_t_7) < 0) __PYX_ERR(2, 3, __pyx_L1_error)
31882   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
31883 
31884   /* "(tree fragment)":1
31885  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
31886  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
31887  * def __setstate_cython__(self, __pyx_state):
31888  */
31889   __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_4lupa_5_lupa_18_PyProtocolWrapper_5__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_PyProtocolWrapper___reduce_cyth, NULL, __pyx_n_s_lupa__lupa, __pyx_d, ((PyObject *)__pyx_codeobj__109)); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 1, __pyx_L1_error)
31890   __Pyx_GOTREF(__pyx_t_7);
31891   if (PyDict_SetItem(__pyx_d, __pyx_n_s_reduce_cython, __pyx_t_7) < 0) __PYX_ERR(2, 1, __pyx_L1_error)
31892   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
31893 
31894   /* "(tree fragment)":3
31895  * def __reduce_cython__(self):
31896  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
31897  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
31898  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
31899  */
31900   __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_4lupa_5_lupa_18_PyProtocolWrapper_7__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_PyProtocolWrapper___setstate_cy, NULL, __pyx_n_s_lupa__lupa, __pyx_d, ((PyObject *)__pyx_codeobj__111)); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 3, __pyx_L1_error)
31901   __Pyx_GOTREF(__pyx_t_7);
31902   if (PyDict_SetItem(__pyx_d, __pyx_n_s_setstate_cython, __pyx_t_7) < 0) __PYX_ERR(2, 3, __pyx_L1_error)
31903   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
31904 
31905   /* "lupa/_lupa.pyx":1110
31906  *
31907  *
31908  * def as_attrgetter(obj):             # <<<<<<<<<<<<<<
31909  *     cdef _PyProtocolWrapper wrap = _PyProtocolWrapper.__new__(_PyProtocolWrapper)
31910  *     wrap._obj = obj
31911  */
31912   __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_4lupa_5_lupa_7as_attrgetter, 0, __pyx_n_s_as_attrgetter, NULL, __pyx_n_s_lupa__lupa, __pyx_d, ((PyObject *)__pyx_codeobj__113)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1110, __pyx_L1_error)
31913   __Pyx_GOTREF(__pyx_t_7);
31914   if (PyDict_SetItem(__pyx_d, __pyx_n_s_as_attrgetter, __pyx_t_7) < 0) __PYX_ERR(0, 1110, __pyx_L1_error)
31915   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
31916 
31917   /* "lupa/_lupa.pyx":1116
31918  *     return wrap
31919  *
31920  * def as_itemgetter(obj):             # <<<<<<<<<<<<<<
31921  *     cdef _PyProtocolWrapper wrap = _PyProtocolWrapper.__new__(_PyProtocolWrapper)
31922  *     wrap._obj = obj
31923  */
31924   __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_4lupa_5_lupa_9as_itemgetter, 0, __pyx_n_s_as_itemgetter, NULL, __pyx_n_s_lupa__lupa, __pyx_d, ((PyObject *)__pyx_codeobj__115)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1116, __pyx_L1_error)
31925   __Pyx_GOTREF(__pyx_t_7);
31926   if (PyDict_SetItem(__pyx_d, __pyx_n_s_as_itemgetter, __pyx_t_7) < 0) __PYX_ERR(0, 1116, __pyx_L1_error)
31927   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
31928 
31929   /* "lupa/_lupa.pyx":1642
31930  *
31931  * cdef lua.luaL_Reg *py_object_lib = [
31932  *     lua.luaL_Reg(name = "__call",     func = <lua.lua_CFunction> py_object_call),             # <<<<<<<<<<<<<<
31933  *     lua.luaL_Reg(name = "__index",    func = <lua.lua_CFunction> py_object_getindex),
31934  *     lua.luaL_Reg(name = "__newindex", func = <lua.lua_CFunction> py_object_setindex),
31935  */
31936   __pyx_t_10.name = ((char *)"__call");
31937   __pyx_t_10.func = ((lua_CFunction)__pyx_f_4lupa_5_lupa_py_object_call);
31938 
31939   /* "lupa/_lupa.pyx":1643
31940  * cdef lua.luaL_Reg *py_object_lib = [
31941  *     lua.luaL_Reg(name = "__call",     func = <lua.lua_CFunction> py_object_call),
31942  *     lua.luaL_Reg(name = "__index",    func = <lua.lua_CFunction> py_object_getindex),             # <<<<<<<<<<<<<<
31943  *     lua.luaL_Reg(name = "__newindex", func = <lua.lua_CFunction> py_object_setindex),
31944  *     lua.luaL_Reg(name = "__tostring", func = <lua.lua_CFunction> py_object_str),
31945  */
31946   __pyx_t_11.name = ((char *)"__index");
31947   __pyx_t_11.func = ((lua_CFunction)__pyx_f_4lupa_5_lupa_py_object_getindex);
31948 
31949   /* "lupa/_lupa.pyx":1644
31950  *     lua.luaL_Reg(name = "__call",     func = <lua.lua_CFunction> py_object_call),
31951  *     lua.luaL_Reg(name = "__index",    func = <lua.lua_CFunction> py_object_getindex),
31952  *     lua.luaL_Reg(name = "__newindex", func = <lua.lua_CFunction> py_object_setindex),             # <<<<<<<<<<<<<<
31953  *     lua.luaL_Reg(name = "__tostring", func = <lua.lua_CFunction> py_object_str),
31954  *     lua.luaL_Reg(name = "__gc",       func = <lua.lua_CFunction> py_object_gc),
31955  */
31956   __pyx_t_12.name = ((char *)"__newindex");
31957   __pyx_t_12.func = ((lua_CFunction)__pyx_f_4lupa_5_lupa_py_object_setindex);
31958 
31959   /* "lupa/_lupa.pyx":1645
31960  *     lua.luaL_Reg(name = "__index",    func = <lua.lua_CFunction> py_object_getindex),
31961  *     lua.luaL_Reg(name = "__newindex", func = <lua.lua_CFunction> py_object_setindex),
31962  *     lua.luaL_Reg(name = "__tostring", func = <lua.lua_CFunction> py_object_str),             # <<<<<<<<<<<<<<
31963  *     lua.luaL_Reg(name = "__gc",       func = <lua.lua_CFunction> py_object_gc),
31964  *     lua.luaL_Reg(name = NULL, func = NULL),
31965  */
31966   __pyx_t_13.name = ((char *)"__tostring");
31967   __pyx_t_13.func = ((lua_CFunction)__pyx_f_4lupa_5_lupa_py_object_str);
31968 
31969   /* "lupa/_lupa.pyx":1646
31970  *     lua.luaL_Reg(name = "__newindex", func = <lua.lua_CFunction> py_object_setindex),
31971  *     lua.luaL_Reg(name = "__tostring", func = <lua.lua_CFunction> py_object_str),
31972  *     lua.luaL_Reg(name = "__gc",       func = <lua.lua_CFunction> py_object_gc),             # <<<<<<<<<<<<<<
31973  *     lua.luaL_Reg(name = NULL, func = NULL),
31974  * ]
31975  */
31976   __pyx_t_14.name = ((char *)"__gc");
31977   __pyx_t_14.func = ((lua_CFunction)__pyx_f_4lupa_5_lupa_py_object_gc);
31978 
31979   /* "lupa/_lupa.pyx":1647
31980  *     lua.luaL_Reg(name = "__tostring", func = <lua.lua_CFunction> py_object_str),
31981  *     lua.luaL_Reg(name = "__gc",       func = <lua.lua_CFunction> py_object_gc),
31982  *     lua.luaL_Reg(name = NULL, func = NULL),             # <<<<<<<<<<<<<<
31983  * ]
31984  *
31985  */
31986   __pyx_t_15.name = NULL;
31987   __pyx_t_15.func = NULL;
31988 
31989   /* "lupa/_lupa.pyx":1641
31990  * # special methods for Lua wrapped Python objects
31991  *
31992  * cdef lua.luaL_Reg *py_object_lib = [             # <<<<<<<<<<<<<<
31993  *     lua.luaL_Reg(name = "__call",     func = <lua.lua_CFunction> py_object_call),
31994  *     lua.luaL_Reg(name = "__index",    func = <lua.lua_CFunction> py_object_getindex),
31995  */
31996   __pyx_t_16[0] = __pyx_t_10;
31997   __pyx_t_16[1] = __pyx_t_11;
31998   __pyx_t_16[2] = __pyx_t_12;
31999   __pyx_t_16[3] = __pyx_t_13;
32000   __pyx_t_16[4] = __pyx_t_14;
32001   __pyx_t_16[5] = __pyx_t_15;
32002   __pyx_v_4lupa_5_lupa_py_object_lib = __pyx_t_16;
32003 
32004   /* "lupa/_lupa.pyx":1804
32005  *
32006  * cdef lua.luaL_Reg *py_lib = [
32007  *     lua.luaL_Reg(name = "as_attrgetter", func = <lua.lua_CFunction> py_as_attrgetter),             # <<<<<<<<<<<<<<
32008  *     lua.luaL_Reg(name = "as_itemgetter", func = <lua.lua_CFunction> py_as_itemgetter),
32009  *     lua.luaL_Reg(name = "as_function",   func = <lua.lua_CFunction> py_as_function),
32010  */
32011   __pyx_t_15.name = ((char *)"as_attrgetter");
32012   __pyx_t_15.func = ((lua_CFunction)__pyx_f_4lupa_5_lupa_py_as_attrgetter);
32013 
32014   /* "lupa/_lupa.pyx":1805
32015  * cdef lua.luaL_Reg *py_lib = [
32016  *     lua.luaL_Reg(name = "as_attrgetter", func = <lua.lua_CFunction> py_as_attrgetter),
32017  *     lua.luaL_Reg(name = "as_itemgetter", func = <lua.lua_CFunction> py_as_itemgetter),             # <<<<<<<<<<<<<<
32018  *     lua.luaL_Reg(name = "as_function",   func = <lua.lua_CFunction> py_as_function),
32019  *     lua.luaL_Reg(name = "iter",          func = <lua.lua_CFunction> py_iter),
32020  */
32021   __pyx_t_14.name = ((char *)"as_itemgetter");
32022   __pyx_t_14.func = ((lua_CFunction)__pyx_f_4lupa_5_lupa_py_as_itemgetter);
32023 
32024   /* "lupa/_lupa.pyx":1806
32025  *     lua.luaL_Reg(name = "as_attrgetter", func = <lua.lua_CFunction> py_as_attrgetter),
32026  *     lua.luaL_Reg(name = "as_itemgetter", func = <lua.lua_CFunction> py_as_itemgetter),
32027  *     lua.luaL_Reg(name = "as_function",   func = <lua.lua_CFunction> py_as_function),             # <<<<<<<<<<<<<<
32028  *     lua.luaL_Reg(name = "iter",          func = <lua.lua_CFunction> py_iter),
32029  *     lua.luaL_Reg(name = "iterex",        func = <lua.lua_CFunction> py_iterex),
32030  */
32031   __pyx_t_13.name = ((char *)"as_function");
32032   __pyx_t_13.func = ((lua_CFunction)__pyx_f_4lupa_5_lupa_py_as_function);
32033 
32034   /* "lupa/_lupa.pyx":1807
32035  *     lua.luaL_Reg(name = "as_itemgetter", func = <lua.lua_CFunction> py_as_itemgetter),
32036  *     lua.luaL_Reg(name = "as_function",   func = <lua.lua_CFunction> py_as_function),
32037  *     lua.luaL_Reg(name = "iter",          func = <lua.lua_CFunction> py_iter),             # <<<<<<<<<<<<<<
32038  *     lua.luaL_Reg(name = "iterex",        func = <lua.lua_CFunction> py_iterex),
32039  *     lua.luaL_Reg(name = "enumerate",     func = <lua.lua_CFunction> py_enumerate),
32040  */
32041   __pyx_t_12.name = ((char *)"iter");
32042   __pyx_t_12.func = ((lua_CFunction)__pyx_f_4lupa_5_lupa_py_iter);
32043 
32044   /* "lupa/_lupa.pyx":1808
32045  *     lua.luaL_Reg(name = "as_function",   func = <lua.lua_CFunction> py_as_function),
32046  *     lua.luaL_Reg(name = "iter",          func = <lua.lua_CFunction> py_iter),
32047  *     lua.luaL_Reg(name = "iterex",        func = <lua.lua_CFunction> py_iterex),             # <<<<<<<<<<<<<<
32048  *     lua.luaL_Reg(name = "enumerate",     func = <lua.lua_CFunction> py_enumerate),
32049  *     lua.luaL_Reg(name = NULL, func = NULL),
32050  */
32051   __pyx_t_11.name = ((char *)"iterex");
32052   __pyx_t_11.func = ((lua_CFunction)__pyx_f_4lupa_5_lupa_py_iterex);
32053 
32054   /* "lupa/_lupa.pyx":1809
32055  *     lua.luaL_Reg(name = "iter",          func = <lua.lua_CFunction> py_iter),
32056  *     lua.luaL_Reg(name = "iterex",        func = <lua.lua_CFunction> py_iterex),
32057  *     lua.luaL_Reg(name = "enumerate",     func = <lua.lua_CFunction> py_enumerate),             # <<<<<<<<<<<<<<
32058  *     lua.luaL_Reg(name = NULL, func = NULL),
32059  * ]
32060  */
32061   __pyx_t_10.name = ((char *)"enumerate");
32062   __pyx_t_10.func = ((lua_CFunction)__pyx_f_4lupa_5_lupa_py_enumerate);
32063 
32064   /* "lupa/_lupa.pyx":1810
32065  *     lua.luaL_Reg(name = "iterex",        func = <lua.lua_CFunction> py_iterex),
32066  *     lua.luaL_Reg(name = "enumerate",     func = <lua.lua_CFunction> py_enumerate),
32067  *     lua.luaL_Reg(name = NULL, func = NULL),             # <<<<<<<<<<<<<<
32068  * ]
32069  *
32070  */
32071   __pyx_t_17.name = NULL;
32072   __pyx_t_17.func = NULL;
32073 
32074   /* "lupa/_lupa.pyx":1803
32075  * # 'python' module functions in Lua
32076  *
32077  * cdef lua.luaL_Reg *py_lib = [             # <<<<<<<<<<<<<<
32078  *     lua.luaL_Reg(name = "as_attrgetter", func = <lua.lua_CFunction> py_as_attrgetter),
32079  *     lua.luaL_Reg(name = "as_itemgetter", func = <lua.lua_CFunction> py_as_itemgetter),
32080  */
32081   __pyx_t_18[0] = __pyx_t_15;
32082   __pyx_t_18[1] = __pyx_t_14;
32083   __pyx_t_18[2] = __pyx_t_13;
32084   __pyx_t_18[3] = __pyx_t_12;
32085   __pyx_t_18[4] = __pyx_t_11;
32086   __pyx_t_18[5] = __pyx_t_10;
32087   __pyx_t_18[6] = __pyx_t_17;
32088   __pyx_v_4lupa_5_lupa_py_lib = __pyx_t_18;
32089 
32090   /* "lupa/_lupa.pyx":1
32091  * # cython: embedsignature=True, binding=True, language_level=3str             # <<<<<<<<<<<<<<
32092  *
32093  * """
32094  */
32095   __pyx_t_7 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1, __pyx_L1_error)
32096   __Pyx_GOTREF(__pyx_t_7);
32097   if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_7) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
32098   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
32099 
32100   /*--- Wrapped vars code ---*/
32101 
32102   goto __pyx_L0;
32103   __pyx_L1_error:;
32104   __Pyx_XDECREF(__pyx_t_1);
32105   __Pyx_XDECREF(__pyx_t_2);
32106   __Pyx_XDECREF(__pyx_t_7);
32107   __Pyx_XDECREF(__pyx_t_8);
32108   __Pyx_XDECREF(__pyx_t_9);
32109   if (__pyx_m) {
32110     if (__pyx_d) {
32111       __Pyx_AddTraceback("init lupa._lupa", __pyx_clineno, __pyx_lineno, __pyx_filename);
32112     }
32113     Py_CLEAR(__pyx_m);
32114   } else if (!PyErr_Occurred()) {
32115     PyErr_SetString(PyExc_ImportError, "init lupa._lupa");
32116   }
32117   __pyx_L0:;
32118   __Pyx_RefNannyFinishContext();
32119   #if CYTHON_PEP489_MULTI_PHASE_INIT
32120   return (__pyx_m != NULL) ? 0 : -1;
32121   #elif PY_MAJOR_VERSION >= 3
32122   return __pyx_m;
32123   #else
32124   return;
32125   #endif
32126 }
32127 
32128 /* --- Runtime support code --- */
32129 /* Refnanny */
32130 #if CYTHON_REFNANNY
__Pyx_RefNannyImportAPI(const char * modname)32131 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
32132     PyObject *m = NULL, *p = NULL;
32133     void *r = NULL;
32134     m = PyImport_ImportModule(modname);
32135     if (!m) goto end;
32136     p = PyObject_GetAttrString(m, "RefNannyAPI");
32137     if (!p) goto end;
32138     r = PyLong_AsVoidPtr(p);
32139 end:
32140     Py_XDECREF(p);
32141     Py_XDECREF(m);
32142     return (__Pyx_RefNannyAPIStruct *)r;
32143 }
32144 #endif
32145 
32146 /* PyObjectGetAttrStr */
32147 #if CYTHON_USE_TYPE_SLOTS
__Pyx_PyObject_GetAttrStr(PyObject * obj,PyObject * attr_name)32148 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
32149     PyTypeObject* tp = Py_TYPE(obj);
32150     if (likely(tp->tp_getattro))
32151         return tp->tp_getattro(obj, attr_name);
32152 #if PY_MAJOR_VERSION < 3
32153     if (likely(tp->tp_getattr))
32154         return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
32155 #endif
32156     return PyObject_GetAttr(obj, attr_name);
32157 }
32158 #endif
32159 
32160 /* GetBuiltinName */
__Pyx_GetBuiltinName(PyObject * name)32161 static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
32162     PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
32163     if (unlikely(!result)) {
32164         PyErr_Format(PyExc_NameError,
32165 #if PY_MAJOR_VERSION >= 3
32166             "name '%U' is not defined", name);
32167 #else
32168             "name '%.200s' is not defined", PyString_AS_STRING(name));
32169 #endif
32170     }
32171     return result;
32172 }
32173 
32174 /* RaiseArgTupleInvalid */
__Pyx_RaiseArgtupleInvalid(const char * func_name,int exact,Py_ssize_t num_min,Py_ssize_t num_max,Py_ssize_t num_found)32175 static void __Pyx_RaiseArgtupleInvalid(
32176     const char* func_name,
32177     int exact,
32178     Py_ssize_t num_min,
32179     Py_ssize_t num_max,
32180     Py_ssize_t num_found)
32181 {
32182     Py_ssize_t num_expected;
32183     const char *more_or_less;
32184     if (num_found < num_min) {
32185         num_expected = num_min;
32186         more_or_less = "at least";
32187     } else {
32188         num_expected = num_max;
32189         more_or_less = "at most";
32190     }
32191     if (exact) {
32192         more_or_less = "exactly";
32193     }
32194     PyErr_Format(PyExc_TypeError,
32195                  "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
32196                  func_name, more_or_less, num_expected,
32197                  (num_expected == 1) ? "" : "s", num_found);
32198 }
32199 
32200 /* KeywordStringCheck */
__Pyx_CheckKeywordStrings(PyObject * kwdict,const char * function_name,int kw_allowed)32201 static int __Pyx_CheckKeywordStrings(
32202     PyObject *kwdict,
32203     const char* function_name,
32204     int kw_allowed)
32205 {
32206     PyObject* key = 0;
32207     Py_ssize_t pos = 0;
32208 #if CYTHON_COMPILING_IN_PYPY
32209     if (!kw_allowed && PyDict_Next(kwdict, &pos, &key, 0))
32210         goto invalid_keyword;
32211     return 1;
32212 #else
32213     while (PyDict_Next(kwdict, &pos, &key, 0)) {
32214         #if PY_MAJOR_VERSION < 3
32215         if (unlikely(!PyString_Check(key)))
32216         #endif
32217             if (unlikely(!PyUnicode_Check(key)))
32218                 goto invalid_keyword_type;
32219     }
32220     if ((!kw_allowed) && unlikely(key))
32221         goto invalid_keyword;
32222     return 1;
32223 invalid_keyword_type:
32224     PyErr_Format(PyExc_TypeError,
32225         "%.200s() keywords must be strings", function_name);
32226     return 0;
32227 #endif
32228 invalid_keyword:
32229     PyErr_Format(PyExc_TypeError,
32230     #if PY_MAJOR_VERSION < 3
32231         "%.200s() got an unexpected keyword argument '%.200s'",
32232         function_name, PyString_AsString(key));
32233     #else
32234         "%s() got an unexpected keyword argument '%U'",
32235         function_name, key);
32236     #endif
32237     return 0;
32238 }
32239 
32240 /* RaiseDoubleKeywords */
__Pyx_RaiseDoubleKeywordsError(const char * func_name,PyObject * kw_name)32241 static void __Pyx_RaiseDoubleKeywordsError(
32242     const char* func_name,
32243     PyObject* kw_name)
32244 {
32245     PyErr_Format(PyExc_TypeError,
32246         #if PY_MAJOR_VERSION >= 3
32247         "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
32248         #else
32249         "%s() got multiple values for keyword argument '%s'", func_name,
32250         PyString_AsString(kw_name));
32251         #endif
32252 }
32253 
32254 /* ParseKeywords */
__Pyx_ParseOptionalKeywords(PyObject * kwds,PyObject ** argnames[],PyObject * kwds2,PyObject * values[],Py_ssize_t num_pos_args,const char * function_name)32255 static int __Pyx_ParseOptionalKeywords(
32256     PyObject *kwds,
32257     PyObject **argnames[],
32258     PyObject *kwds2,
32259     PyObject *values[],
32260     Py_ssize_t num_pos_args,
32261     const char* function_name)
32262 {
32263     PyObject *key = 0, *value = 0;
32264     Py_ssize_t pos = 0;
32265     PyObject*** name;
32266     PyObject*** first_kw_arg = argnames + num_pos_args;
32267     while (PyDict_Next(kwds, &pos, &key, &value)) {
32268         name = first_kw_arg;
32269         while (*name && (**name != key)) name++;
32270         if (*name) {
32271             values[name-argnames] = value;
32272             continue;
32273         }
32274         name = first_kw_arg;
32275         #if PY_MAJOR_VERSION < 3
32276         if (likely(PyString_Check(key))) {
32277             while (*name) {
32278                 if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
32279                         && _PyString_Eq(**name, key)) {
32280                     values[name-argnames] = value;
32281                     break;
32282                 }
32283                 name++;
32284             }
32285             if (*name) continue;
32286             else {
32287                 PyObject*** argname = argnames;
32288                 while (argname != first_kw_arg) {
32289                     if ((**argname == key) || (
32290                             (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
32291                              && _PyString_Eq(**argname, key))) {
32292                         goto arg_passed_twice;
32293                     }
32294                     argname++;
32295                 }
32296             }
32297         } else
32298         #endif
32299         if (likely(PyUnicode_Check(key))) {
32300             while (*name) {
32301                 int cmp = (**name == key) ? 0 :
32302                 #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
32303                     (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
32304                 #endif
32305                     PyUnicode_Compare(**name, key);
32306                 if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
32307                 if (cmp == 0) {
32308                     values[name-argnames] = value;
32309                     break;
32310                 }
32311                 name++;
32312             }
32313             if (*name) continue;
32314             else {
32315                 PyObject*** argname = argnames;
32316                 while (argname != first_kw_arg) {
32317                     int cmp = (**argname == key) ? 0 :
32318                     #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
32319                         (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
32320                     #endif
32321                         PyUnicode_Compare(**argname, key);
32322                     if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
32323                     if (cmp == 0) goto arg_passed_twice;
32324                     argname++;
32325                 }
32326             }
32327         } else
32328             goto invalid_keyword_type;
32329         if (kwds2) {
32330             if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
32331         } else {
32332             goto invalid_keyword;
32333         }
32334     }
32335     return 0;
32336 arg_passed_twice:
32337     __Pyx_RaiseDoubleKeywordsError(function_name, key);
32338     goto bad;
32339 invalid_keyword_type:
32340     PyErr_Format(PyExc_TypeError,
32341         "%.200s() keywords must be strings", function_name);
32342     goto bad;
32343 invalid_keyword:
32344     PyErr_Format(PyExc_TypeError,
32345     #if PY_MAJOR_VERSION < 3
32346         "%.200s() got an unexpected keyword argument '%.200s'",
32347         function_name, PyString_AsString(key));
32348     #else
32349         "%s() got an unexpected keyword argument '%U'",
32350         function_name, key);
32351     #endif
32352 bad:
32353     return -1;
32354 }
32355 
32356 /* PyObjectCall */
32357 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_PyObject_Call(PyObject * func,PyObject * arg,PyObject * kw)32358 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
32359     PyObject *result;
32360     ternaryfunc call = Py_TYPE(func)->tp_call;
32361     if (unlikely(!call))
32362         return PyObject_Call(func, arg, kw);
32363     if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
32364         return NULL;
32365     result = (*call)(func, arg, kw);
32366     Py_LeaveRecursiveCall();
32367     if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
32368         PyErr_SetString(
32369             PyExc_SystemError,
32370             "NULL result without error in PyObject_Call");
32371     }
32372     return result;
32373 }
32374 #endif
32375 
32376 /* PyErrFetchRestore */
32377 #if CYTHON_FAST_THREAD_STATE
__Pyx_ErrRestoreInState(PyThreadState * tstate,PyObject * type,PyObject * value,PyObject * tb)32378 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
32379     PyObject *tmp_type, *tmp_value, *tmp_tb;
32380     tmp_type = tstate->curexc_type;
32381     tmp_value = tstate->curexc_value;
32382     tmp_tb = tstate->curexc_traceback;
32383     tstate->curexc_type = type;
32384     tstate->curexc_value = value;
32385     tstate->curexc_traceback = tb;
32386     Py_XDECREF(tmp_type);
32387     Py_XDECREF(tmp_value);
32388     Py_XDECREF(tmp_tb);
32389 }
__Pyx_ErrFetchInState(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)32390 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
32391     *type = tstate->curexc_type;
32392     *value = tstate->curexc_value;
32393     *tb = tstate->curexc_traceback;
32394     tstate->curexc_type = 0;
32395     tstate->curexc_value = 0;
32396     tstate->curexc_traceback = 0;
32397 }
32398 #endif
32399 
32400 /* RaiseException */
32401 #if PY_MAJOR_VERSION < 3
__Pyx_Raise(PyObject * type,PyObject * value,PyObject * tb,CYTHON_UNUSED PyObject * cause)32402 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
32403                         CYTHON_UNUSED PyObject *cause) {
32404     __Pyx_PyThreadState_declare
32405     Py_XINCREF(type);
32406     if (!value || value == Py_None)
32407         value = NULL;
32408     else
32409         Py_INCREF(value);
32410     if (!tb || tb == Py_None)
32411         tb = NULL;
32412     else {
32413         Py_INCREF(tb);
32414         if (!PyTraceBack_Check(tb)) {
32415             PyErr_SetString(PyExc_TypeError,
32416                 "raise: arg 3 must be a traceback or None");
32417             goto raise_error;
32418         }
32419     }
32420     if (PyType_Check(type)) {
32421 #if CYTHON_COMPILING_IN_PYPY
32422         if (!value) {
32423             Py_INCREF(Py_None);
32424             value = Py_None;
32425         }
32426 #endif
32427         PyErr_NormalizeException(&type, &value, &tb);
32428     } else {
32429         if (value) {
32430             PyErr_SetString(PyExc_TypeError,
32431                 "instance exception may not have a separate value");
32432             goto raise_error;
32433         }
32434         value = type;
32435         type = (PyObject*) Py_TYPE(type);
32436         Py_INCREF(type);
32437         if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
32438             PyErr_SetString(PyExc_TypeError,
32439                 "raise: exception class must be a subclass of BaseException");
32440             goto raise_error;
32441         }
32442     }
32443     __Pyx_PyThreadState_assign
32444     __Pyx_ErrRestore(type, value, tb);
32445     return;
32446 raise_error:
32447     Py_XDECREF(value);
32448     Py_XDECREF(type);
32449     Py_XDECREF(tb);
32450     return;
32451 }
32452 #else
__Pyx_Raise(PyObject * type,PyObject * value,PyObject * tb,PyObject * cause)32453 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
32454     PyObject* owned_instance = NULL;
32455     if (tb == Py_None) {
32456         tb = 0;
32457     } else if (tb && !PyTraceBack_Check(tb)) {
32458         PyErr_SetString(PyExc_TypeError,
32459             "raise: arg 3 must be a traceback or None");
32460         goto bad;
32461     }
32462     if (value == Py_None)
32463         value = 0;
32464     if (PyExceptionInstance_Check(type)) {
32465         if (value) {
32466             PyErr_SetString(PyExc_TypeError,
32467                 "instance exception may not have a separate value");
32468             goto bad;
32469         }
32470         value = type;
32471         type = (PyObject*) Py_TYPE(value);
32472     } else if (PyExceptionClass_Check(type)) {
32473         PyObject *instance_class = NULL;
32474         if (value && PyExceptionInstance_Check(value)) {
32475             instance_class = (PyObject*) Py_TYPE(value);
32476             if (instance_class != type) {
32477                 int is_subclass = PyObject_IsSubclass(instance_class, type);
32478                 if (!is_subclass) {
32479                     instance_class = NULL;
32480                 } else if (unlikely(is_subclass == -1)) {
32481                     goto bad;
32482                 } else {
32483                     type = instance_class;
32484                 }
32485             }
32486         }
32487         if (!instance_class) {
32488             PyObject *args;
32489             if (!value)
32490                 args = PyTuple_New(0);
32491             else if (PyTuple_Check(value)) {
32492                 Py_INCREF(value);
32493                 args = value;
32494             } else
32495                 args = PyTuple_Pack(1, value);
32496             if (!args)
32497                 goto bad;
32498             owned_instance = PyObject_Call(type, args, NULL);
32499             Py_DECREF(args);
32500             if (!owned_instance)
32501                 goto bad;
32502             value = owned_instance;
32503             if (!PyExceptionInstance_Check(value)) {
32504                 PyErr_Format(PyExc_TypeError,
32505                              "calling %R should have returned an instance of "
32506                              "BaseException, not %R",
32507                              type, Py_TYPE(value));
32508                 goto bad;
32509             }
32510         }
32511     } else {
32512         PyErr_SetString(PyExc_TypeError,
32513             "raise: exception class must be a subclass of BaseException");
32514         goto bad;
32515     }
32516     if (cause) {
32517         PyObject *fixed_cause;
32518         if (cause == Py_None) {
32519             fixed_cause = NULL;
32520         } else if (PyExceptionClass_Check(cause)) {
32521             fixed_cause = PyObject_CallObject(cause, NULL);
32522             if (fixed_cause == NULL)
32523                 goto bad;
32524         } else if (PyExceptionInstance_Check(cause)) {
32525             fixed_cause = cause;
32526             Py_INCREF(fixed_cause);
32527         } else {
32528             PyErr_SetString(PyExc_TypeError,
32529                             "exception causes must derive from "
32530                             "BaseException");
32531             goto bad;
32532         }
32533         PyException_SetCause(value, fixed_cause);
32534     }
32535     PyErr_SetObject(type, value);
32536     if (tb) {
32537 #if CYTHON_COMPILING_IN_PYPY
32538         PyObject *tmp_type, *tmp_value, *tmp_tb;
32539         PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
32540         Py_INCREF(tb);
32541         PyErr_Restore(tmp_type, tmp_value, tb);
32542         Py_XDECREF(tmp_tb);
32543 #else
32544         PyThreadState *tstate = __Pyx_PyThreadState_Current;
32545         PyObject* tmp_tb = tstate->curexc_traceback;
32546         if (tb != tmp_tb) {
32547             Py_INCREF(tb);
32548             tstate->curexc_traceback = tb;
32549             Py_XDECREF(tmp_tb);
32550         }
32551 #endif
32552     }
32553 bad:
32554     Py_XDECREF(owned_instance);
32555     return;
32556 }
32557 #endif
32558 
32559 /* decode_c_string */
__Pyx_decode_c_string(const char * cstring,Py_ssize_t start,Py_ssize_t stop,const char * encoding,const char * errors,PyObject * (* decode_func)(const char * s,Py_ssize_t size,const char * errors))32560 static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
32561          const char* cstring, Py_ssize_t start, Py_ssize_t stop,
32562          const char* encoding, const char* errors,
32563          PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) {
32564     Py_ssize_t length;
32565     if (unlikely((start < 0) | (stop < 0))) {
32566         size_t slen = strlen(cstring);
32567         if (unlikely(slen > (size_t) PY_SSIZE_T_MAX)) {
32568             PyErr_SetString(PyExc_OverflowError,
32569                             "c-string too long to convert to Python");
32570             return NULL;
32571         }
32572         length = (Py_ssize_t) slen;
32573         if (start < 0) {
32574             start += length;
32575             if (start < 0)
32576                 start = 0;
32577         }
32578         if (stop < 0)
32579             stop += length;
32580     }
32581     if (unlikely(stop <= start))
32582         return __Pyx_NewRef(__pyx_empty_unicode);
32583     length = stop - start;
32584     cstring += start;
32585     if (decode_func) {
32586         return decode_func(cstring, length, errors);
32587     } else {
32588         return PyUnicode_Decode(cstring, length, encoding, errors);
32589     }
32590 }
32591 
32592 /* GetException */
32593 #if CYTHON_FAST_THREAD_STATE
__Pyx__GetException(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)32594 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
32595 #else
32596 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
32597 #endif
32598 {
32599     PyObject *local_type, *local_value, *local_tb;
32600 #if CYTHON_FAST_THREAD_STATE
32601     PyObject *tmp_type, *tmp_value, *tmp_tb;
32602     local_type = tstate->curexc_type;
32603     local_value = tstate->curexc_value;
32604     local_tb = tstate->curexc_traceback;
32605     tstate->curexc_type = 0;
32606     tstate->curexc_value = 0;
32607     tstate->curexc_traceback = 0;
32608 #else
32609     PyErr_Fetch(&local_type, &local_value, &local_tb);
32610 #endif
32611     PyErr_NormalizeException(&local_type, &local_value, &local_tb);
32612 #if CYTHON_FAST_THREAD_STATE
32613     if (unlikely(tstate->curexc_type))
32614 #else
32615     if (unlikely(PyErr_Occurred()))
32616 #endif
32617         goto bad;
32618     #if PY_MAJOR_VERSION >= 3
32619     if (local_tb) {
32620         if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
32621             goto bad;
32622     }
32623     #endif
32624     Py_XINCREF(local_tb);
32625     Py_XINCREF(local_type);
32626     Py_XINCREF(local_value);
32627     *type = local_type;
32628     *value = local_value;
32629     *tb = local_tb;
32630 #if CYTHON_FAST_THREAD_STATE
32631     #if CYTHON_USE_EXC_INFO_STACK
32632     {
32633         _PyErr_StackItem *exc_info = tstate->exc_info;
32634         tmp_type = exc_info->exc_type;
32635         tmp_value = exc_info->exc_value;
32636         tmp_tb = exc_info->exc_traceback;
32637         exc_info->exc_type = local_type;
32638         exc_info->exc_value = local_value;
32639         exc_info->exc_traceback = local_tb;
32640     }
32641     #else
32642     tmp_type = tstate->exc_type;
32643     tmp_value = tstate->exc_value;
32644     tmp_tb = tstate->exc_traceback;
32645     tstate->exc_type = local_type;
32646     tstate->exc_value = local_value;
32647     tstate->exc_traceback = local_tb;
32648     #endif
32649     Py_XDECREF(tmp_type);
32650     Py_XDECREF(tmp_value);
32651     Py_XDECREF(tmp_tb);
32652 #else
32653     PyErr_SetExcInfo(local_type, local_value, local_tb);
32654 #endif
32655     return 0;
32656 bad:
32657     *type = 0;
32658     *value = 0;
32659     *tb = 0;
32660     Py_XDECREF(local_type);
32661     Py_XDECREF(local_value);
32662     Py_XDECREF(local_tb);
32663     return -1;
32664 }
32665 
32666 /* SwapException */
32667 #if CYTHON_FAST_THREAD_STATE
__Pyx__ExceptionSwap(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)32668 static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
32669     PyObject *tmp_type, *tmp_value, *tmp_tb;
32670     #if CYTHON_USE_EXC_INFO_STACK
32671     _PyErr_StackItem *exc_info = tstate->exc_info;
32672     tmp_type = exc_info->exc_type;
32673     tmp_value = exc_info->exc_value;
32674     tmp_tb = exc_info->exc_traceback;
32675     exc_info->exc_type = *type;
32676     exc_info->exc_value = *value;
32677     exc_info->exc_traceback = *tb;
32678     #else
32679     tmp_type = tstate->exc_type;
32680     tmp_value = tstate->exc_value;
32681     tmp_tb = tstate->exc_traceback;
32682     tstate->exc_type = *type;
32683     tstate->exc_value = *value;
32684     tstate->exc_traceback = *tb;
32685     #endif
32686     *type = tmp_type;
32687     *value = tmp_value;
32688     *tb = tmp_tb;
32689 }
32690 #else
__Pyx_ExceptionSwap(PyObject ** type,PyObject ** value,PyObject ** tb)32691 static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) {
32692     PyObject *tmp_type, *tmp_value, *tmp_tb;
32693     PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb);
32694     PyErr_SetExcInfo(*type, *value, *tb);
32695     *type = tmp_type;
32696     *value = tmp_value;
32697     *tb = tmp_tb;
32698 }
32699 #endif
32700 
32701 /* GetTopmostException */
32702 #if CYTHON_USE_EXC_INFO_STACK
32703 static _PyErr_StackItem *
__Pyx_PyErr_GetTopmostException(PyThreadState * tstate)32704 __Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
32705 {
32706     _PyErr_StackItem *exc_info = tstate->exc_info;
32707     while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) &&
32708            exc_info->previous_item != NULL)
32709     {
32710         exc_info = exc_info->previous_item;
32711     }
32712     return exc_info;
32713 }
32714 #endif
32715 
32716 /* SaveResetException */
32717 #if CYTHON_FAST_THREAD_STATE
__Pyx__ExceptionSave(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)32718 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
32719     #if CYTHON_USE_EXC_INFO_STACK
32720     _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
32721     *type = exc_info->exc_type;
32722     *value = exc_info->exc_value;
32723     *tb = exc_info->exc_traceback;
32724     #else
32725     *type = tstate->exc_type;
32726     *value = tstate->exc_value;
32727     *tb = tstate->exc_traceback;
32728     #endif
32729     Py_XINCREF(*type);
32730     Py_XINCREF(*value);
32731     Py_XINCREF(*tb);
32732 }
__Pyx__ExceptionReset(PyThreadState * tstate,PyObject * type,PyObject * value,PyObject * tb)32733 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
32734     PyObject *tmp_type, *tmp_value, *tmp_tb;
32735     #if CYTHON_USE_EXC_INFO_STACK
32736     _PyErr_StackItem *exc_info = tstate->exc_info;
32737     tmp_type = exc_info->exc_type;
32738     tmp_value = exc_info->exc_value;
32739     tmp_tb = exc_info->exc_traceback;
32740     exc_info->exc_type = type;
32741     exc_info->exc_value = value;
32742     exc_info->exc_traceback = tb;
32743     #else
32744     tmp_type = tstate->exc_type;
32745     tmp_value = tstate->exc_value;
32746     tmp_tb = tstate->exc_traceback;
32747     tstate->exc_type = type;
32748     tstate->exc_value = value;
32749     tstate->exc_traceback = tb;
32750     #endif
32751     Py_XDECREF(tmp_type);
32752     Py_XDECREF(tmp_value);
32753     Py_XDECREF(tmp_tb);
32754 }
32755 #endif
32756 
32757 /* PyDictVersioning */
32758 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
__Pyx_get_tp_dict_version(PyObject * obj)32759 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
32760     PyObject *dict = Py_TYPE(obj)->tp_dict;
32761     return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
32762 }
__Pyx_get_object_dict_version(PyObject * obj)32763 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
32764     PyObject **dictptr = NULL;
32765     Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
32766     if (offset) {
32767 #if CYTHON_COMPILING_IN_CPYTHON
32768         dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
32769 #else
32770         dictptr = _PyObject_GetDictPtr(obj);
32771 #endif
32772     }
32773     return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
32774 }
__Pyx_object_dict_version_matches(PyObject * obj,PY_UINT64_T tp_dict_version,PY_UINT64_T obj_dict_version)32775 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
32776     PyObject *dict = Py_TYPE(obj)->tp_dict;
32777     if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
32778         return 0;
32779     return obj_dict_version == __Pyx_get_object_dict_version(obj);
32780 }
32781 #endif
32782 
32783 /* GetModuleGlobalName */
32784 #if CYTHON_USE_DICT_VERSIONS
__Pyx__GetModuleGlobalName(PyObject * name,PY_UINT64_T * dict_version,PyObject ** dict_cached_value)32785 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
32786 #else
32787 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
32788 #endif
32789 {
32790     PyObject *result;
32791 #if !CYTHON_AVOID_BORROWED_REFS
32792 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
32793     result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
32794     __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
32795     if (likely(result)) {
32796         return __Pyx_NewRef(result);
32797     } else if (unlikely(PyErr_Occurred())) {
32798         return NULL;
32799     }
32800 #else
32801     result = PyDict_GetItem(__pyx_d, name);
32802     __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
32803     if (likely(result)) {
32804         return __Pyx_NewRef(result);
32805     }
32806 #endif
32807 #else
32808     result = PyObject_GetItem(__pyx_d, name);
32809     __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
32810     if (likely(result)) {
32811         return __Pyx_NewRef(result);
32812     }
32813     PyErr_Clear();
32814 #endif
32815     return __Pyx_GetBuiltinName(name);
32816 }
32817 
32818 /* PyCFunctionFastCall */
32819 #if CYTHON_FAST_PYCCALL
__Pyx_PyCFunction_FastCall(PyObject * func_obj,PyObject ** args,Py_ssize_t nargs)32820 static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
32821     PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
32822     PyCFunction meth = PyCFunction_GET_FUNCTION(func);
32823     PyObject *self = PyCFunction_GET_SELF(func);
32824     int flags = PyCFunction_GET_FLAGS(func);
32825     assert(PyCFunction_Check(func));
32826     assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)));
32827     assert(nargs >= 0);
32828     assert(nargs == 0 || args != NULL);
32829     /* _PyCFunction_FastCallDict() must not be called with an exception set,
32830        because it may clear it (directly or indirectly) and so the
32831        caller loses its exception */
32832     assert(!PyErr_Occurred());
32833     if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
32834         return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL);
32835     } else {
32836         return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs);
32837     }
32838 }
32839 #endif
32840 
32841 /* PyFunctionFastCall */
32842 #if CYTHON_FAST_PYCALL
__Pyx_PyFunction_FastCallNoKw(PyCodeObject * co,PyObject ** args,Py_ssize_t na,PyObject * globals)32843 static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
32844                                                PyObject *globals) {
32845     PyFrameObject *f;
32846     PyThreadState *tstate = __Pyx_PyThreadState_Current;
32847     PyObject **fastlocals;
32848     Py_ssize_t i;
32849     PyObject *result;
32850     assert(globals != NULL);
32851     /* XXX Perhaps we should create a specialized
32852        PyFrame_New() that doesn't take locals, but does
32853        take builtins without sanity checking them.
32854        */
32855     assert(tstate != NULL);
32856     f = PyFrame_New(tstate, co, globals, NULL);
32857     if (f == NULL) {
32858         return NULL;
32859     }
32860     fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
32861     for (i = 0; i < na; i++) {
32862         Py_INCREF(*args);
32863         fastlocals[i] = *args++;
32864     }
32865     result = PyEval_EvalFrameEx(f,0);
32866     ++tstate->recursion_depth;
32867     Py_DECREF(f);
32868     --tstate->recursion_depth;
32869     return result;
32870 }
32871 #if 1 || PY_VERSION_HEX < 0x030600B1
__Pyx_PyFunction_FastCallDict(PyObject * func,PyObject ** args,Py_ssize_t nargs,PyObject * kwargs)32872 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) {
32873     PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
32874     PyObject *globals = PyFunction_GET_GLOBALS(func);
32875     PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
32876     PyObject *closure;
32877 #if PY_MAJOR_VERSION >= 3
32878     PyObject *kwdefs;
32879 #endif
32880     PyObject *kwtuple, **k;
32881     PyObject **d;
32882     Py_ssize_t nd;
32883     Py_ssize_t nk;
32884     PyObject *result;
32885     assert(kwargs == NULL || PyDict_Check(kwargs));
32886     nk = kwargs ? PyDict_Size(kwargs) : 0;
32887     if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
32888         return NULL;
32889     }
32890     if (
32891 #if PY_MAJOR_VERSION >= 3
32892             co->co_kwonlyargcount == 0 &&
32893 #endif
32894             likely(kwargs == NULL || nk == 0) &&
32895             co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
32896         if (argdefs == NULL && co->co_argcount == nargs) {
32897             result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
32898             goto done;
32899         }
32900         else if (nargs == 0 && argdefs != NULL
32901                  && co->co_argcount == Py_SIZE(argdefs)) {
32902             /* function called with no arguments, but all parameters have
32903                a default value: use default values as arguments .*/
32904             args = &PyTuple_GET_ITEM(argdefs, 0);
32905             result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
32906             goto done;
32907         }
32908     }
32909     if (kwargs != NULL) {
32910         Py_ssize_t pos, i;
32911         kwtuple = PyTuple_New(2 * nk);
32912         if (kwtuple == NULL) {
32913             result = NULL;
32914             goto done;
32915         }
32916         k = &PyTuple_GET_ITEM(kwtuple, 0);
32917         pos = i = 0;
32918         while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
32919             Py_INCREF(k[i]);
32920             Py_INCREF(k[i+1]);
32921             i += 2;
32922         }
32923         nk = i / 2;
32924     }
32925     else {
32926         kwtuple = NULL;
32927         k = NULL;
32928     }
32929     closure = PyFunction_GET_CLOSURE(func);
32930 #if PY_MAJOR_VERSION >= 3
32931     kwdefs = PyFunction_GET_KW_DEFAULTS(func);
32932 #endif
32933     if (argdefs != NULL) {
32934         d = &PyTuple_GET_ITEM(argdefs, 0);
32935         nd = Py_SIZE(argdefs);
32936     }
32937     else {
32938         d = NULL;
32939         nd = 0;
32940     }
32941 #if PY_MAJOR_VERSION >= 3
32942     result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
32943                                args, (int)nargs,
32944                                k, (int)nk,
32945                                d, (int)nd, kwdefs, closure);
32946 #else
32947     result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
32948                                args, (int)nargs,
32949                                k, (int)nk,
32950                                d, (int)nd, closure);
32951 #endif
32952     Py_XDECREF(kwtuple);
32953 done:
32954     Py_LeaveRecursiveCall();
32955     return result;
32956 }
32957 #endif
32958 #endif
32959 
32960 /* PyObjectCall2Args */
__Pyx_PyObject_Call2Args(PyObject * function,PyObject * arg1,PyObject * arg2)32961 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) {
32962     PyObject *args, *result = NULL;
32963     #if CYTHON_FAST_PYCALL
32964     if (PyFunction_Check(function)) {
32965         PyObject *args[2] = {arg1, arg2};
32966         return __Pyx_PyFunction_FastCall(function, args, 2);
32967     }
32968     #endif
32969     #if CYTHON_FAST_PYCCALL
32970     if (__Pyx_PyFastCFunction_Check(function)) {
32971         PyObject *args[2] = {arg1, arg2};
32972         return __Pyx_PyCFunction_FastCall(function, args, 2);
32973     }
32974     #endif
32975     args = PyTuple_New(2);
32976     if (unlikely(!args)) goto done;
32977     Py_INCREF(arg1);
32978     PyTuple_SET_ITEM(args, 0, arg1);
32979     Py_INCREF(arg2);
32980     PyTuple_SET_ITEM(args, 1, arg2);
32981     Py_INCREF(function);
32982     result = __Pyx_PyObject_Call(function, args, NULL);
32983     Py_DECREF(args);
32984     Py_DECREF(function);
32985 done:
32986     return result;
32987 }
32988 
32989 /* PyObjectCallMethO */
32990 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_PyObject_CallMethO(PyObject * func,PyObject * arg)32991 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
32992     PyObject *self, *result;
32993     PyCFunction cfunc;
32994     cfunc = PyCFunction_GET_FUNCTION(func);
32995     self = PyCFunction_GET_SELF(func);
32996     if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
32997         return NULL;
32998     result = cfunc(self, arg);
32999     Py_LeaveRecursiveCall();
33000     if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
33001         PyErr_SetString(
33002             PyExc_SystemError,
33003             "NULL result without error in PyObject_Call");
33004     }
33005     return result;
33006 }
33007 #endif
33008 
33009 /* PyObjectCallOneArg */
33010 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx__PyObject_CallOneArg(PyObject * func,PyObject * arg)33011 static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
33012     PyObject *result;
33013     PyObject *args = PyTuple_New(1);
33014     if (unlikely(!args)) return NULL;
33015     Py_INCREF(arg);
33016     PyTuple_SET_ITEM(args, 0, arg);
33017     result = __Pyx_PyObject_Call(func, args, NULL);
33018     Py_DECREF(args);
33019     return result;
33020 }
__Pyx_PyObject_CallOneArg(PyObject * func,PyObject * arg)33021 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
33022 #if CYTHON_FAST_PYCALL
33023     if (PyFunction_Check(func)) {
33024         return __Pyx_PyFunction_FastCall(func, &arg, 1);
33025     }
33026 #endif
33027     if (likely(PyCFunction_Check(func))) {
33028         if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
33029             return __Pyx_PyObject_CallMethO(func, arg);
33030 #if CYTHON_FAST_PYCCALL
33031         } else if (__Pyx_PyFastCFunction_Check(func)) {
33032             return __Pyx_PyCFunction_FastCall(func, &arg, 1);
33033 #endif
33034         }
33035     }
33036     return __Pyx__PyObject_CallOneArg(func, arg);
33037 }
33038 #else
__Pyx_PyObject_CallOneArg(PyObject * func,PyObject * arg)33039 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
33040     PyObject *result;
33041     PyObject *args = PyTuple_Pack(1, arg);
33042     if (unlikely(!args)) return NULL;
33043     result = __Pyx_PyObject_Call(func, args, NULL);
33044     Py_DECREF(args);
33045     return result;
33046 }
33047 #endif
33048 
33049 /* PyObjectCallNoArg */
33050 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_PyObject_CallNoArg(PyObject * func)33051 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
33052 #if CYTHON_FAST_PYCALL
33053     if (PyFunction_Check(func)) {
33054         return __Pyx_PyFunction_FastCall(func, NULL, 0);
33055     }
33056 #endif
33057 #ifdef __Pyx_CyFunction_USED
33058     if (likely(PyCFunction_Check(func) || __Pyx_CyFunction_Check(func)))
33059 #else
33060     if (likely(PyCFunction_Check(func)))
33061 #endif
33062     {
33063         if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
33064             return __Pyx_PyObject_CallMethO(func, NULL);
33065         }
33066     }
33067     return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
33068 }
33069 #endif
33070 
33071 /* RaiseTooManyValuesToUnpack */
__Pyx_RaiseTooManyValuesError(Py_ssize_t expected)33072 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
33073     PyErr_Format(PyExc_ValueError,
33074                  "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
33075 }
33076 
33077 /* RaiseNeedMoreValuesToUnpack */
__Pyx_RaiseNeedMoreValuesError(Py_ssize_t index)33078 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
33079     PyErr_Format(PyExc_ValueError,
33080                  "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
33081                  index, (index == 1) ? "" : "s");
33082 }
33083 
33084 /* IterFinish */
__Pyx_IterFinish(void)33085 static CYTHON_INLINE int __Pyx_IterFinish(void) {
33086 #if CYTHON_FAST_THREAD_STATE
33087     PyThreadState *tstate = __Pyx_PyThreadState_Current;
33088     PyObject* exc_type = tstate->curexc_type;
33089     if (unlikely(exc_type)) {
33090         if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) {
33091             PyObject *exc_value, *exc_tb;
33092             exc_value = tstate->curexc_value;
33093             exc_tb = tstate->curexc_traceback;
33094             tstate->curexc_type = 0;
33095             tstate->curexc_value = 0;
33096             tstate->curexc_traceback = 0;
33097             Py_DECREF(exc_type);
33098             Py_XDECREF(exc_value);
33099             Py_XDECREF(exc_tb);
33100             return 0;
33101         } else {
33102             return -1;
33103         }
33104     }
33105     return 0;
33106 #else
33107     if (unlikely(PyErr_Occurred())) {
33108         if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
33109             PyErr_Clear();
33110             return 0;
33111         } else {
33112             return -1;
33113         }
33114     }
33115     return 0;
33116 #endif
33117 }
33118 
33119 /* UnpackItemEndCheck */
__Pyx_IternextUnpackEndCheck(PyObject * retval,Py_ssize_t expected)33120 static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
33121     if (unlikely(retval)) {
33122         Py_DECREF(retval);
33123         __Pyx_RaiseTooManyValuesError(expected);
33124         return -1;
33125     } else {
33126         return __Pyx_IterFinish();
33127     }
33128     return 0;
33129 }
33130 
33131 /* PyErrExceptionMatches */
33132 #if CYTHON_FAST_THREAD_STATE
__Pyx_PyErr_ExceptionMatchesTuple(PyObject * exc_type,PyObject * tuple)33133 static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
33134     Py_ssize_t i, n;
33135     n = PyTuple_GET_SIZE(tuple);
33136 #if PY_MAJOR_VERSION >= 3
33137     for (i=0; i<n; i++) {
33138         if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
33139     }
33140 #endif
33141     for (i=0; i<n; i++) {
33142         if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
33143     }
33144     return 0;
33145 }
__Pyx_PyErr_ExceptionMatchesInState(PyThreadState * tstate,PyObject * err)33146 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
33147     PyObject *exc_type = tstate->curexc_type;
33148     if (exc_type == err) return 1;
33149     if (unlikely(!exc_type)) return 0;
33150     if (unlikely(PyTuple_Check(err)))
33151         return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
33152     return __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
33153 }
33154 #endif
33155 
33156 /* None */
__Pyx_RaiseUnboundLocalError(const char * varname)33157 static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) {
33158     PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname);
33159 }
33160 
33161 /* None */
__Pyx_div_long(long a,long b)33162 static CYTHON_INLINE long __Pyx_div_long(long a, long b) {
33163     long q = a / b;
33164     long r = a - q*b;
33165     q -= ((r != 0) & ((r ^ b) < 0));
33166     return q;
33167 }
33168 
33169 /* None */
__Pyx_mod_long(long a,long b)33170 static CYTHON_INLINE long __Pyx_mod_long(long a, long b) {
33171     long r = a % b;
33172     r += ((r != 0) & ((r ^ b) < 0)) * b;
33173     return r;
33174 }
33175 
33176 /* GetItemInt */
__Pyx_GetItemInt_Generic(PyObject * o,PyObject * j)33177 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
33178     PyObject *r;
33179     if (!j) return NULL;
33180     r = PyObject_GetItem(o, j);
33181     Py_DECREF(j);
33182     return r;
33183 }
__Pyx_GetItemInt_List_Fast(PyObject * o,Py_ssize_t i,CYTHON_NCP_UNUSED int wraparound,CYTHON_NCP_UNUSED int boundscheck)33184 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
33185                                                               CYTHON_NCP_UNUSED int wraparound,
33186                                                               CYTHON_NCP_UNUSED int boundscheck) {
33187 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
33188     Py_ssize_t wrapped_i = i;
33189     if (wraparound & unlikely(i < 0)) {
33190         wrapped_i += PyList_GET_SIZE(o);
33191     }
33192     if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) {
33193         PyObject *r = PyList_GET_ITEM(o, wrapped_i);
33194         Py_INCREF(r);
33195         return r;
33196     }
33197     return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
33198 #else
33199     return PySequence_GetItem(o, i);
33200 #endif
33201 }
__Pyx_GetItemInt_Tuple_Fast(PyObject * o,Py_ssize_t i,CYTHON_NCP_UNUSED int wraparound,CYTHON_NCP_UNUSED int boundscheck)33202 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
33203                                                               CYTHON_NCP_UNUSED int wraparound,
33204                                                               CYTHON_NCP_UNUSED int boundscheck) {
33205 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
33206     Py_ssize_t wrapped_i = i;
33207     if (wraparound & unlikely(i < 0)) {
33208         wrapped_i += PyTuple_GET_SIZE(o);
33209     }
33210     if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) {
33211         PyObject *r = PyTuple_GET_ITEM(o, wrapped_i);
33212         Py_INCREF(r);
33213         return r;
33214     }
33215     return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
33216 #else
33217     return PySequence_GetItem(o, i);
33218 #endif
33219 }
__Pyx_GetItemInt_Fast(PyObject * o,Py_ssize_t i,int is_list,CYTHON_NCP_UNUSED int wraparound,CYTHON_NCP_UNUSED int boundscheck)33220 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
33221                                                      CYTHON_NCP_UNUSED int wraparound,
33222                                                      CYTHON_NCP_UNUSED int boundscheck) {
33223 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
33224     if (is_list || PyList_CheckExact(o)) {
33225         Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
33226         if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) {
33227             PyObject *r = PyList_GET_ITEM(o, n);
33228             Py_INCREF(r);
33229             return r;
33230         }
33231     }
33232     else if (PyTuple_CheckExact(o)) {
33233         Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
33234         if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) {
33235             PyObject *r = PyTuple_GET_ITEM(o, n);
33236             Py_INCREF(r);
33237             return r;
33238         }
33239     } else {
33240         PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
33241         if (likely(m && m->sq_item)) {
33242             if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
33243                 Py_ssize_t l = m->sq_length(o);
33244                 if (likely(l >= 0)) {
33245                     i += l;
33246                 } else {
33247                     if (!PyErr_ExceptionMatches(PyExc_OverflowError))
33248                         return NULL;
33249                     PyErr_Clear();
33250                 }
33251             }
33252             return m->sq_item(o, i);
33253         }
33254     }
33255 #else
33256     if (is_list || PySequence_Check(o)) {
33257         return PySequence_GetItem(o, i);
33258     }
33259 #endif
33260     return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
33261 }
33262 
33263 /* PyObjectGetMethod */
__Pyx_PyObject_GetMethod(PyObject * obj,PyObject * name,PyObject ** method)33264 static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method) {
33265     PyObject *attr;
33266 #if CYTHON_UNPACK_METHODS && CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_PYTYPE_LOOKUP
33267     PyTypeObject *tp = Py_TYPE(obj);
33268     PyObject *descr;
33269     descrgetfunc f = NULL;
33270     PyObject **dictptr, *dict;
33271     int meth_found = 0;
33272     assert (*method == NULL);
33273     if (unlikely(tp->tp_getattro != PyObject_GenericGetAttr)) {
33274         attr = __Pyx_PyObject_GetAttrStr(obj, name);
33275         goto try_unpack;
33276     }
33277     if (unlikely(tp->tp_dict == NULL) && unlikely(PyType_Ready(tp) < 0)) {
33278         return 0;
33279     }
33280     descr = _PyType_Lookup(tp, name);
33281     if (likely(descr != NULL)) {
33282         Py_INCREF(descr);
33283 #if PY_MAJOR_VERSION >= 3
33284         #ifdef __Pyx_CyFunction_USED
33285         if (likely(PyFunction_Check(descr) || (Py_TYPE(descr) == &PyMethodDescr_Type) || __Pyx_CyFunction_Check(descr)))
33286         #else
33287         if (likely(PyFunction_Check(descr) || (Py_TYPE(descr) == &PyMethodDescr_Type)))
33288         #endif
33289 #else
33290         #ifdef __Pyx_CyFunction_USED
33291         if (likely(PyFunction_Check(descr) || __Pyx_CyFunction_Check(descr)))
33292         #else
33293         if (likely(PyFunction_Check(descr)))
33294         #endif
33295 #endif
33296         {
33297             meth_found = 1;
33298         } else {
33299             f = Py_TYPE(descr)->tp_descr_get;
33300             if (f != NULL && PyDescr_IsData(descr)) {
33301                 attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
33302                 Py_DECREF(descr);
33303                 goto try_unpack;
33304             }
33305         }
33306     }
33307     dictptr = _PyObject_GetDictPtr(obj);
33308     if (dictptr != NULL && (dict = *dictptr) != NULL) {
33309         Py_INCREF(dict);
33310         attr = __Pyx_PyDict_GetItemStr(dict, name);
33311         if (attr != NULL) {
33312             Py_INCREF(attr);
33313             Py_DECREF(dict);
33314             Py_XDECREF(descr);
33315             goto try_unpack;
33316         }
33317         Py_DECREF(dict);
33318     }
33319     if (meth_found) {
33320         *method = descr;
33321         return 1;
33322     }
33323     if (f != NULL) {
33324         attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
33325         Py_DECREF(descr);
33326         goto try_unpack;
33327     }
33328     if (descr != NULL) {
33329         *method = descr;
33330         return 0;
33331     }
33332     PyErr_Format(PyExc_AttributeError,
33333 #if PY_MAJOR_VERSION >= 3
33334                  "'%.50s' object has no attribute '%U'",
33335                  tp->tp_name, name);
33336 #else
33337                  "'%.50s' object has no attribute '%.400s'",
33338                  tp->tp_name, PyString_AS_STRING(name));
33339 #endif
33340     return 0;
33341 #else
33342     attr = __Pyx_PyObject_GetAttrStr(obj, name);
33343     goto try_unpack;
33344 #endif
33345 try_unpack:
33346 #if CYTHON_UNPACK_METHODS
33347     if (likely(attr) && PyMethod_Check(attr) && likely(PyMethod_GET_SELF(attr) == obj)) {
33348         PyObject *function = PyMethod_GET_FUNCTION(attr);
33349         Py_INCREF(function);
33350         Py_DECREF(attr);
33351         *method = function;
33352         return 1;
33353     }
33354 #endif
33355     *method = attr;
33356     return 0;
33357 }
33358 
33359 /* PyObjectCallMethod0 */
__Pyx_PyObject_CallMethod0(PyObject * obj,PyObject * method_name)33360 static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name) {
33361     PyObject *method = NULL, *result = NULL;
33362     int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
33363     if (likely(is_method)) {
33364         result = __Pyx_PyObject_CallOneArg(method, obj);
33365         Py_DECREF(method);
33366         return result;
33367     }
33368     if (unlikely(!method)) goto bad;
33369     result = __Pyx_PyObject_CallNoArg(method);
33370     Py_DECREF(method);
33371 bad:
33372     return result;
33373 }
33374 
33375 /* RaiseNoneIterError */
__Pyx_RaiseNoneNotIterableError(void)33376 static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
33377     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
33378 }
33379 
33380 /* UnpackTupleError */
__Pyx_UnpackTupleError(PyObject * t,Py_ssize_t index)33381 static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) {
33382     if (t == Py_None) {
33383       __Pyx_RaiseNoneNotIterableError();
33384     } else if (PyTuple_GET_SIZE(t) < index) {
33385       __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(t));
33386     } else {
33387       __Pyx_RaiseTooManyValuesError(index);
33388     }
33389 }
33390 
33391 /* UnpackTuple2 */
__Pyx_unpack_tuple2_exact(PyObject * tuple,PyObject ** pvalue1,PyObject ** pvalue2,int decref_tuple)33392 static CYTHON_INLINE int __Pyx_unpack_tuple2_exact(
33393         PyObject* tuple, PyObject** pvalue1, PyObject** pvalue2, int decref_tuple) {
33394     PyObject *value1 = NULL, *value2 = NULL;
33395 #if CYTHON_COMPILING_IN_PYPY
33396     value1 = PySequence_ITEM(tuple, 0);  if (unlikely(!value1)) goto bad;
33397     value2 = PySequence_ITEM(tuple, 1);  if (unlikely(!value2)) goto bad;
33398 #else
33399     value1 = PyTuple_GET_ITEM(tuple, 0);  Py_INCREF(value1);
33400     value2 = PyTuple_GET_ITEM(tuple, 1);  Py_INCREF(value2);
33401 #endif
33402     if (decref_tuple) {
33403         Py_DECREF(tuple);
33404     }
33405     *pvalue1 = value1;
33406     *pvalue2 = value2;
33407     return 0;
33408 #if CYTHON_COMPILING_IN_PYPY
33409 bad:
33410     Py_XDECREF(value1);
33411     Py_XDECREF(value2);
33412     if (decref_tuple) { Py_XDECREF(tuple); }
33413     return -1;
33414 #endif
33415 }
__Pyx_unpack_tuple2_generic(PyObject * tuple,PyObject ** pvalue1,PyObject ** pvalue2,int has_known_size,int decref_tuple)33416 static int __Pyx_unpack_tuple2_generic(PyObject* tuple, PyObject** pvalue1, PyObject** pvalue2,
33417                                        int has_known_size, int decref_tuple) {
33418     Py_ssize_t index;
33419     PyObject *value1 = NULL, *value2 = NULL, *iter = NULL;
33420     iternextfunc iternext;
33421     iter = PyObject_GetIter(tuple);
33422     if (unlikely(!iter)) goto bad;
33423     if (decref_tuple) { Py_DECREF(tuple); tuple = NULL; }
33424     iternext = Py_TYPE(iter)->tp_iternext;
33425     value1 = iternext(iter); if (unlikely(!value1)) { index = 0; goto unpacking_failed; }
33426     value2 = iternext(iter); if (unlikely(!value2)) { index = 1; goto unpacking_failed; }
33427     if (!has_known_size && unlikely(__Pyx_IternextUnpackEndCheck(iternext(iter), 2))) goto bad;
33428     Py_DECREF(iter);
33429     *pvalue1 = value1;
33430     *pvalue2 = value2;
33431     return 0;
33432 unpacking_failed:
33433     if (!has_known_size && __Pyx_IterFinish() == 0)
33434         __Pyx_RaiseNeedMoreValuesError(index);
33435 bad:
33436     Py_XDECREF(iter);
33437     Py_XDECREF(value1);
33438     Py_XDECREF(value2);
33439     if (decref_tuple) { Py_XDECREF(tuple); }
33440     return -1;
33441 }
33442 
33443 /* dict_iter */
__Pyx_dict_iterator(PyObject * iterable,int is_dict,PyObject * method_name,Py_ssize_t * p_orig_length,int * p_source_is_dict)33444 static CYTHON_INLINE PyObject* __Pyx_dict_iterator(PyObject* iterable, int is_dict, PyObject* method_name,
33445                                                    Py_ssize_t* p_orig_length, int* p_source_is_dict) {
33446     is_dict = is_dict || likely(PyDict_CheckExact(iterable));
33447     *p_source_is_dict = is_dict;
33448     if (is_dict) {
33449 #if !CYTHON_COMPILING_IN_PYPY
33450         *p_orig_length = PyDict_Size(iterable);
33451         Py_INCREF(iterable);
33452         return iterable;
33453 #elif PY_MAJOR_VERSION >= 3
33454         static PyObject *py_items = NULL, *py_keys = NULL, *py_values = NULL;
33455         PyObject **pp = NULL;
33456         if (method_name) {
33457             const char *name = PyUnicode_AsUTF8(method_name);
33458             if (strcmp(name, "iteritems") == 0) pp = &py_items;
33459             else if (strcmp(name, "iterkeys") == 0) pp = &py_keys;
33460             else if (strcmp(name, "itervalues") == 0) pp = &py_values;
33461             if (pp) {
33462                 if (!*pp) {
33463                     *pp = PyUnicode_FromString(name + 4);
33464                     if (!*pp)
33465                         return NULL;
33466                 }
33467                 method_name = *pp;
33468             }
33469         }
33470 #endif
33471     }
33472     *p_orig_length = 0;
33473     if (method_name) {
33474         PyObject* iter;
33475         iterable = __Pyx_PyObject_CallMethod0(iterable, method_name);
33476         if (!iterable)
33477             return NULL;
33478 #if !CYTHON_COMPILING_IN_PYPY
33479         if (PyTuple_CheckExact(iterable) || PyList_CheckExact(iterable))
33480             return iterable;
33481 #endif
33482         iter = PyObject_GetIter(iterable);
33483         Py_DECREF(iterable);
33484         return iter;
33485     }
33486     return PyObject_GetIter(iterable);
33487 }
__Pyx_dict_iter_next(PyObject * iter_obj,CYTHON_NCP_UNUSED Py_ssize_t orig_length,CYTHON_NCP_UNUSED Py_ssize_t * ppos,PyObject ** pkey,PyObject ** pvalue,PyObject ** pitem,int source_is_dict)33488 static CYTHON_INLINE int __Pyx_dict_iter_next(
33489         PyObject* iter_obj, CYTHON_NCP_UNUSED Py_ssize_t orig_length, CYTHON_NCP_UNUSED Py_ssize_t* ppos,
33490         PyObject** pkey, PyObject** pvalue, PyObject** pitem, int source_is_dict) {
33491     PyObject* next_item;
33492 #if !CYTHON_COMPILING_IN_PYPY
33493     if (source_is_dict) {
33494         PyObject *key, *value;
33495         if (unlikely(orig_length != PyDict_Size(iter_obj))) {
33496             PyErr_SetString(PyExc_RuntimeError, "dictionary changed size during iteration");
33497             return -1;
33498         }
33499         if (unlikely(!PyDict_Next(iter_obj, ppos, &key, &value))) {
33500             return 0;
33501         }
33502         if (pitem) {
33503             PyObject* tuple = PyTuple_New(2);
33504             if (unlikely(!tuple)) {
33505                 return -1;
33506             }
33507             Py_INCREF(key);
33508             Py_INCREF(value);
33509             PyTuple_SET_ITEM(tuple, 0, key);
33510             PyTuple_SET_ITEM(tuple, 1, value);
33511             *pitem = tuple;
33512         } else {
33513             if (pkey) {
33514                 Py_INCREF(key);
33515                 *pkey = key;
33516             }
33517             if (pvalue) {
33518                 Py_INCREF(value);
33519                 *pvalue = value;
33520             }
33521         }
33522         return 1;
33523     } else if (PyTuple_CheckExact(iter_obj)) {
33524         Py_ssize_t pos = *ppos;
33525         if (unlikely(pos >= PyTuple_GET_SIZE(iter_obj))) return 0;
33526         *ppos = pos + 1;
33527         next_item = PyTuple_GET_ITEM(iter_obj, pos);
33528         Py_INCREF(next_item);
33529     } else if (PyList_CheckExact(iter_obj)) {
33530         Py_ssize_t pos = *ppos;
33531         if (unlikely(pos >= PyList_GET_SIZE(iter_obj))) return 0;
33532         *ppos = pos + 1;
33533         next_item = PyList_GET_ITEM(iter_obj, pos);
33534         Py_INCREF(next_item);
33535     } else
33536 #endif
33537     {
33538         next_item = PyIter_Next(iter_obj);
33539         if (unlikely(!next_item)) {
33540             return __Pyx_IterFinish();
33541         }
33542     }
33543     if (pitem) {
33544         *pitem = next_item;
33545     } else if (pkey && pvalue) {
33546         if (__Pyx_unpack_tuple2(next_item, pkey, pvalue, source_is_dict, source_is_dict, 1))
33547             return -1;
33548     } else if (pkey) {
33549         *pkey = next_item;
33550     } else {
33551         *pvalue = next_item;
33552     }
33553     return 1;
33554 }
33555 
33556 /* ObjectGetItem */
33557 #if CYTHON_USE_TYPE_SLOTS
__Pyx_PyObject_GetIndex(PyObject * obj,PyObject * index)33558 static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) {
33559     PyObject *runerr;
33560     Py_ssize_t key_value;
33561     PySequenceMethods *m = Py_TYPE(obj)->tp_as_sequence;
33562     if (unlikely(!(m && m->sq_item))) {
33563         PyErr_Format(PyExc_TypeError, "'%.200s' object is not subscriptable", Py_TYPE(obj)->tp_name);
33564         return NULL;
33565     }
33566     key_value = __Pyx_PyIndex_AsSsize_t(index);
33567     if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) {
33568         return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1);
33569     }
33570     if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) {
33571         PyErr_Clear();
33572         PyErr_Format(PyExc_IndexError, "cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name);
33573     }
33574     return NULL;
33575 }
__Pyx_PyObject_GetItem(PyObject * obj,PyObject * key)33576 static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) {
33577     PyMappingMethods *m = Py_TYPE(obj)->tp_as_mapping;
33578     if (likely(m && m->mp_subscript)) {
33579         return m->mp_subscript(obj, key);
33580     }
33581     return __Pyx_PyObject_GetIndex(obj, key);
33582 }
33583 #endif
33584 
33585 /* None */
__Pyx_RaiseClosureNameError(const char * varname)33586 static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname) {
33587     PyErr_Format(PyExc_NameError, "free variable '%s' referenced before assignment in enclosing scope", varname);
33588 }
33589 
33590 /* FetchCommonType */
__Pyx_FetchCommonType(PyTypeObject * type)33591 static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) {
33592     PyObject* fake_module;
33593     PyTypeObject* cached_type = NULL;
33594     fake_module = PyImport_AddModule((char*) "_cython_" CYTHON_ABI);
33595     if (!fake_module) return NULL;
33596     Py_INCREF(fake_module);
33597     cached_type = (PyTypeObject*) PyObject_GetAttrString(fake_module, type->tp_name);
33598     if (cached_type) {
33599         if (!PyType_Check((PyObject*)cached_type)) {
33600             PyErr_Format(PyExc_TypeError,
33601                 "Shared Cython type %.200s is not a type object",
33602                 type->tp_name);
33603             goto bad;
33604         }
33605         if (cached_type->tp_basicsize != type->tp_basicsize) {
33606             PyErr_Format(PyExc_TypeError,
33607                 "Shared Cython type %.200s has the wrong size, try recompiling",
33608                 type->tp_name);
33609             goto bad;
33610         }
33611     } else {
33612         if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad;
33613         PyErr_Clear();
33614         if (PyType_Ready(type) < 0) goto bad;
33615         if (PyObject_SetAttrString(fake_module, type->tp_name, (PyObject*) type) < 0)
33616             goto bad;
33617         Py_INCREF(type);
33618         cached_type = type;
33619     }
33620 done:
33621     Py_DECREF(fake_module);
33622     return cached_type;
33623 bad:
33624     Py_XDECREF(cached_type);
33625     cached_type = NULL;
33626     goto done;
33627 }
33628 
33629 /* CythonFunctionShared */
33630 #include <structmember.h>
33631 static PyObject *
__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject * op,CYTHON_UNUSED void * closure)33632 __Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure)
33633 {
33634     if (unlikely(op->func_doc == NULL)) {
33635         if (op->func.m_ml->ml_doc) {
33636 #if PY_MAJOR_VERSION >= 3
33637             op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc);
33638 #else
33639             op->func_doc = PyString_FromString(op->func.m_ml->ml_doc);
33640 #endif
33641             if (unlikely(op->func_doc == NULL))
33642                 return NULL;
33643         } else {
33644             Py_INCREF(Py_None);
33645             return Py_None;
33646         }
33647     }
33648     Py_INCREF(op->func_doc);
33649     return op->func_doc;
33650 }
33651 static int
__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject * op,PyObject * value,CYTHON_UNUSED void * context)33652 __Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
33653 {
33654     PyObject *tmp = op->func_doc;
33655     if (value == NULL) {
33656         value = Py_None;
33657     }
33658     Py_INCREF(value);
33659     op->func_doc = value;
33660     Py_XDECREF(tmp);
33661     return 0;
33662 }
33663 static PyObject *
__Pyx_CyFunction_get_name(__pyx_CyFunctionObject * op,CYTHON_UNUSED void * context)33664 __Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
33665 {
33666     if (unlikely(op->func_name == NULL)) {
33667 #if PY_MAJOR_VERSION >= 3
33668         op->func_name = PyUnicode_InternFromString(op->func.m_ml->ml_name);
33669 #else
33670         op->func_name = PyString_InternFromString(op->func.m_ml->ml_name);
33671 #endif
33672         if (unlikely(op->func_name == NULL))
33673             return NULL;
33674     }
33675     Py_INCREF(op->func_name);
33676     return op->func_name;
33677 }
33678 static int
__Pyx_CyFunction_set_name(__pyx_CyFunctionObject * op,PyObject * value,CYTHON_UNUSED void * context)33679 __Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
33680 {
33681     PyObject *tmp;
33682 #if PY_MAJOR_VERSION >= 3
33683     if (unlikely(value == NULL || !PyUnicode_Check(value)))
33684 #else
33685     if (unlikely(value == NULL || !PyString_Check(value)))
33686 #endif
33687     {
33688         PyErr_SetString(PyExc_TypeError,
33689                         "__name__ must be set to a string object");
33690         return -1;
33691     }
33692     tmp = op->func_name;
33693     Py_INCREF(value);
33694     op->func_name = value;
33695     Py_XDECREF(tmp);
33696     return 0;
33697 }
33698 static PyObject *
__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject * op,CYTHON_UNUSED void * context)33699 __Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
33700 {
33701     Py_INCREF(op->func_qualname);
33702     return op->func_qualname;
33703 }
33704 static int
__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject * op,PyObject * value,CYTHON_UNUSED void * context)33705 __Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
33706 {
33707     PyObject *tmp;
33708 #if PY_MAJOR_VERSION >= 3
33709     if (unlikely(value == NULL || !PyUnicode_Check(value)))
33710 #else
33711     if (unlikely(value == NULL || !PyString_Check(value)))
33712 #endif
33713     {
33714         PyErr_SetString(PyExc_TypeError,
33715                         "__qualname__ must be set to a string object");
33716         return -1;
33717     }
33718     tmp = op->func_qualname;
33719     Py_INCREF(value);
33720     op->func_qualname = value;
33721     Py_XDECREF(tmp);
33722     return 0;
33723 }
33724 static PyObject *
__Pyx_CyFunction_get_self(__pyx_CyFunctionObject * m,CYTHON_UNUSED void * closure)33725 __Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED void *closure)
33726 {
33727     PyObject *self;
33728     self = m->func_closure;
33729     if (self == NULL)
33730         self = Py_None;
33731     Py_INCREF(self);
33732     return self;
33733 }
33734 static PyObject *
__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject * op,CYTHON_UNUSED void * context)33735 __Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
33736 {
33737     if (unlikely(op->func_dict == NULL)) {
33738         op->func_dict = PyDict_New();
33739         if (unlikely(op->func_dict == NULL))
33740             return NULL;
33741     }
33742     Py_INCREF(op->func_dict);
33743     return op->func_dict;
33744 }
33745 static int
__Pyx_CyFunction_set_dict(__pyx_CyFunctionObject * op,PyObject * value,CYTHON_UNUSED void * context)33746 __Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
33747 {
33748     PyObject *tmp;
33749     if (unlikely(value == NULL)) {
33750         PyErr_SetString(PyExc_TypeError,
33751                "function's dictionary may not be deleted");
33752         return -1;
33753     }
33754     if (unlikely(!PyDict_Check(value))) {
33755         PyErr_SetString(PyExc_TypeError,
33756                "setting function's dictionary to a non-dict");
33757         return -1;
33758     }
33759     tmp = op->func_dict;
33760     Py_INCREF(value);
33761     op->func_dict = value;
33762     Py_XDECREF(tmp);
33763     return 0;
33764 }
33765 static PyObject *
__Pyx_CyFunction_get_globals(__pyx_CyFunctionObject * op,CYTHON_UNUSED void * context)33766 __Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
33767 {
33768     Py_INCREF(op->func_globals);
33769     return op->func_globals;
33770 }
33771 static PyObject *
__Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject * op,CYTHON_UNUSED void * context)33772 __Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
33773 {
33774     Py_INCREF(Py_None);
33775     return Py_None;
33776 }
33777 static PyObject *
__Pyx_CyFunction_get_code(__pyx_CyFunctionObject * op,CYTHON_UNUSED void * context)33778 __Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
33779 {
33780     PyObject* result = (op->func_code) ? op->func_code : Py_None;
33781     Py_INCREF(result);
33782     return result;
33783 }
33784 static int
__Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject * op)33785 __Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) {
33786     int result = 0;
33787     PyObject *res = op->defaults_getter((PyObject *) op);
33788     if (unlikely(!res))
33789         return -1;
33790     #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
33791     op->defaults_tuple = PyTuple_GET_ITEM(res, 0);
33792     Py_INCREF(op->defaults_tuple);
33793     op->defaults_kwdict = PyTuple_GET_ITEM(res, 1);
33794     Py_INCREF(op->defaults_kwdict);
33795     #else
33796     op->defaults_tuple = PySequence_ITEM(res, 0);
33797     if (unlikely(!op->defaults_tuple)) result = -1;
33798     else {
33799         op->defaults_kwdict = PySequence_ITEM(res, 1);
33800         if (unlikely(!op->defaults_kwdict)) result = -1;
33801     }
33802     #endif
33803     Py_DECREF(res);
33804     return result;
33805 }
33806 static int
__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject * op,PyObject * value,CYTHON_UNUSED void * context)33807 __Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) {
33808     PyObject* tmp;
33809     if (!value) {
33810         value = Py_None;
33811     } else if (value != Py_None && !PyTuple_Check(value)) {
33812         PyErr_SetString(PyExc_TypeError,
33813                         "__defaults__ must be set to a tuple object");
33814         return -1;
33815     }
33816     Py_INCREF(value);
33817     tmp = op->defaults_tuple;
33818     op->defaults_tuple = value;
33819     Py_XDECREF(tmp);
33820     return 0;
33821 }
33822 static PyObject *
__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject * op,CYTHON_UNUSED void * context)33823 __Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) {
33824     PyObject* result = op->defaults_tuple;
33825     if (unlikely(!result)) {
33826         if (op->defaults_getter) {
33827             if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
33828             result = op->defaults_tuple;
33829         } else {
33830             result = Py_None;
33831         }
33832     }
33833     Py_INCREF(result);
33834     return result;
33835 }
33836 static int
__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject * op,PyObject * value,CYTHON_UNUSED void * context)33837 __Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) {
33838     PyObject* tmp;
33839     if (!value) {
33840         value = Py_None;
33841     } else if (value != Py_None && !PyDict_Check(value)) {
33842         PyErr_SetString(PyExc_TypeError,
33843                         "__kwdefaults__ must be set to a dict object");
33844         return -1;
33845     }
33846     Py_INCREF(value);
33847     tmp = op->defaults_kwdict;
33848     op->defaults_kwdict = value;
33849     Py_XDECREF(tmp);
33850     return 0;
33851 }
33852 static PyObject *
__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject * op,CYTHON_UNUSED void * context)33853 __Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) {
33854     PyObject* result = op->defaults_kwdict;
33855     if (unlikely(!result)) {
33856         if (op->defaults_getter) {
33857             if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
33858             result = op->defaults_kwdict;
33859         } else {
33860             result = Py_None;
33861         }
33862     }
33863     Py_INCREF(result);
33864     return result;
33865 }
33866 static int
__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject * op,PyObject * value,CYTHON_UNUSED void * context)33867 __Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) {
33868     PyObject* tmp;
33869     if (!value || value == Py_None) {
33870         value = NULL;
33871     } else if (!PyDict_Check(value)) {
33872         PyErr_SetString(PyExc_TypeError,
33873                         "__annotations__ must be set to a dict object");
33874         return -1;
33875     }
33876     Py_XINCREF(value);
33877     tmp = op->func_annotations;
33878     op->func_annotations = value;
33879     Py_XDECREF(tmp);
33880     return 0;
33881 }
33882 static PyObject *
__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject * op,CYTHON_UNUSED void * context)33883 __Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) {
33884     PyObject* result = op->func_annotations;
33885     if (unlikely(!result)) {
33886         result = PyDict_New();
33887         if (unlikely(!result)) return NULL;
33888         op->func_annotations = result;
33889     }
33890     Py_INCREF(result);
33891     return result;
33892 }
33893 static PyGetSetDef __pyx_CyFunction_getsets[] = {
33894     {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
33895     {(char *) "__doc__",  (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
33896     {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
33897     {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
33898     {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0},
33899     {(char *) "__self__", (getter)__Pyx_CyFunction_get_self, 0, 0, 0},
33900     {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
33901     {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
33902     {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
33903     {(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
33904     {(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
33905     {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
33906     {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
33907     {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
33908     {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
33909     {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
33910     {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0},
33911     {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0},
33912     {0, 0, 0, 0, 0}
33913 };
33914 static PyMemberDef __pyx_CyFunction_members[] = {
33915     {(char *) "__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), PY_WRITE_RESTRICTED, 0},
33916     {0, 0, 0,  0, 0}
33917 };
33918 static PyObject *
__Pyx_CyFunction_reduce(__pyx_CyFunctionObject * m,CYTHON_UNUSED PyObject * args)33919 __Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args)
33920 {
33921 #if PY_MAJOR_VERSION >= 3
33922     Py_INCREF(m->func_qualname);
33923     return m->func_qualname;
33924 #else
33925     return PyString_FromString(m->func.m_ml->ml_name);
33926 #endif
33927 }
33928 static PyMethodDef __pyx_CyFunction_methods[] = {
33929     {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
33930     {0, 0, 0, 0}
33931 };
33932 #if PY_VERSION_HEX < 0x030500A0
33933 #define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist)
33934 #else
33935 #define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func.m_weakreflist)
33936 #endif
__Pyx_CyFunction_Init(__pyx_CyFunctionObject * op,PyMethodDef * ml,int flags,PyObject * qualname,PyObject * closure,PyObject * module,PyObject * globals,PyObject * code)33937 static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef *ml, int flags, PyObject* qualname,
33938                                        PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
33939     if (unlikely(op == NULL))
33940         return NULL;
33941     op->flags = flags;
33942     __Pyx_CyFunction_weakreflist(op) = NULL;
33943     op->func.m_ml = ml;
33944     op->func.m_self = (PyObject *) op;
33945     Py_XINCREF(closure);
33946     op->func_closure = closure;
33947     Py_XINCREF(module);
33948     op->func.m_module = module;
33949     op->func_dict = NULL;
33950     op->func_name = NULL;
33951     Py_INCREF(qualname);
33952     op->func_qualname = qualname;
33953     op->func_doc = NULL;
33954     op->func_classobj = NULL;
33955     op->func_globals = globals;
33956     Py_INCREF(op->func_globals);
33957     Py_XINCREF(code);
33958     op->func_code = code;
33959     op->defaults_pyobjects = 0;
33960     op->defaults_size = 0;
33961     op->defaults = NULL;
33962     op->defaults_tuple = NULL;
33963     op->defaults_kwdict = NULL;
33964     op->defaults_getter = NULL;
33965     op->func_annotations = NULL;
33966     return (PyObject *) op;
33967 }
33968 static int
__Pyx_CyFunction_clear(__pyx_CyFunctionObject * m)33969 __Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
33970 {
33971     Py_CLEAR(m->func_closure);
33972     Py_CLEAR(m->func.m_module);
33973     Py_CLEAR(m->func_dict);
33974     Py_CLEAR(m->func_name);
33975     Py_CLEAR(m->func_qualname);
33976     Py_CLEAR(m->func_doc);
33977     Py_CLEAR(m->func_globals);
33978     Py_CLEAR(m->func_code);
33979     Py_CLEAR(m->func_classobj);
33980     Py_CLEAR(m->defaults_tuple);
33981     Py_CLEAR(m->defaults_kwdict);
33982     Py_CLEAR(m->func_annotations);
33983     if (m->defaults) {
33984         PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
33985         int i;
33986         for (i = 0; i < m->defaults_pyobjects; i++)
33987             Py_XDECREF(pydefaults[i]);
33988         PyObject_Free(m->defaults);
33989         m->defaults = NULL;
33990     }
33991     return 0;
33992 }
__Pyx__CyFunction_dealloc(__pyx_CyFunctionObject * m)33993 static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m)
33994 {
33995     if (__Pyx_CyFunction_weakreflist(m) != NULL)
33996         PyObject_ClearWeakRefs((PyObject *) m);
33997     __Pyx_CyFunction_clear(m);
33998     PyObject_GC_Del(m);
33999 }
__Pyx_CyFunction_dealloc(__pyx_CyFunctionObject * m)34000 static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m)
34001 {
34002     PyObject_GC_UnTrack(m);
34003     __Pyx__CyFunction_dealloc(m);
34004 }
__Pyx_CyFunction_traverse(__pyx_CyFunctionObject * m,visitproc visit,void * arg)34005 static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg)
34006 {
34007     Py_VISIT(m->func_closure);
34008     Py_VISIT(m->func.m_module);
34009     Py_VISIT(m->func_dict);
34010     Py_VISIT(m->func_name);
34011     Py_VISIT(m->func_qualname);
34012     Py_VISIT(m->func_doc);
34013     Py_VISIT(m->func_globals);
34014     Py_VISIT(m->func_code);
34015     Py_VISIT(m->func_classobj);
34016     Py_VISIT(m->defaults_tuple);
34017     Py_VISIT(m->defaults_kwdict);
34018     if (m->defaults) {
34019         PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
34020         int i;
34021         for (i = 0; i < m->defaults_pyobjects; i++)
34022             Py_VISIT(pydefaults[i]);
34023     }
34024     return 0;
34025 }
__Pyx_CyFunction_descr_get(PyObject * func,PyObject * obj,PyObject * type)34026 static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type)
34027 {
34028 #if PY_MAJOR_VERSION < 3
34029     __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
34030     if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) {
34031         Py_INCREF(func);
34032         return func;
34033     }
34034     if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) {
34035         if (type == NULL)
34036             type = (PyObject *)(Py_TYPE(obj));
34037         return __Pyx_PyMethod_New(func, type, (PyObject *)(Py_TYPE(type)));
34038     }
34039     if (obj == Py_None)
34040         obj = NULL;
34041 #endif
34042     return __Pyx_PyMethod_New(func, obj, type);
34043 }
34044 static PyObject*
__Pyx_CyFunction_repr(__pyx_CyFunctionObject * op)34045 __Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
34046 {
34047 #if PY_MAJOR_VERSION >= 3
34048     return PyUnicode_FromFormat("<cyfunction %U at %p>",
34049                                 op->func_qualname, (void *)op);
34050 #else
34051     return PyString_FromFormat("<cyfunction %s at %p>",
34052                                PyString_AsString(op->func_qualname), (void *)op);
34053 #endif
34054 }
__Pyx_CyFunction_CallMethod(PyObject * func,PyObject * self,PyObject * arg,PyObject * kw)34055 static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) {
34056     PyCFunctionObject* f = (PyCFunctionObject*)func;
34057     PyCFunction meth = f->m_ml->ml_meth;
34058     Py_ssize_t size;
34059     switch (f->m_ml->ml_flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) {
34060     case METH_VARARGS:
34061         if (likely(kw == NULL || PyDict_Size(kw) == 0))
34062             return (*meth)(self, arg);
34063         break;
34064     case METH_VARARGS | METH_KEYWORDS:
34065         return (*(PyCFunctionWithKeywords)(void*)meth)(self, arg, kw);
34066     case METH_NOARGS:
34067         if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
34068             size = PyTuple_GET_SIZE(arg);
34069             if (likely(size == 0))
34070                 return (*meth)(self, NULL);
34071             PyErr_Format(PyExc_TypeError,
34072                 "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)",
34073                 f->m_ml->ml_name, size);
34074             return NULL;
34075         }
34076         break;
34077     case METH_O:
34078         if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
34079             size = PyTuple_GET_SIZE(arg);
34080             if (likely(size == 1)) {
34081                 PyObject *result, *arg0;
34082                 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
34083                 arg0 = PyTuple_GET_ITEM(arg, 0);
34084                 #else
34085                 arg0 = PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL;
34086                 #endif
34087                 result = (*meth)(self, arg0);
34088                 #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
34089                 Py_DECREF(arg0);
34090                 #endif
34091                 return result;
34092             }
34093             PyErr_Format(PyExc_TypeError,
34094                 "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)",
34095                 f->m_ml->ml_name, size);
34096             return NULL;
34097         }
34098         break;
34099     default:
34100         PyErr_SetString(PyExc_SystemError, "Bad call flags in "
34101                         "__Pyx_CyFunction_Call. METH_OLDARGS is no "
34102                         "longer supported!");
34103         return NULL;
34104     }
34105     PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments",
34106                  f->m_ml->ml_name);
34107     return NULL;
34108 }
__Pyx_CyFunction_Call(PyObject * func,PyObject * arg,PyObject * kw)34109 static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
34110     return __Pyx_CyFunction_CallMethod(func, ((PyCFunctionObject*)func)->m_self, arg, kw);
34111 }
__Pyx_CyFunction_CallAsMethod(PyObject * func,PyObject * args,PyObject * kw)34112 static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) {
34113     PyObject *result;
34114     __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func;
34115     if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) {
34116         Py_ssize_t argc;
34117         PyObject *new_args;
34118         PyObject *self;
34119         argc = PyTuple_GET_SIZE(args);
34120         new_args = PyTuple_GetSlice(args, 1, argc);
34121         if (unlikely(!new_args))
34122             return NULL;
34123         self = PyTuple_GetItem(args, 0);
34124         if (unlikely(!self)) {
34125             Py_DECREF(new_args);
34126             return NULL;
34127         }
34128         result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw);
34129         Py_DECREF(new_args);
34130     } else {
34131         result = __Pyx_CyFunction_Call(func, args, kw);
34132     }
34133     return result;
34134 }
34135 static PyTypeObject __pyx_CyFunctionType_type = {
34136     PyVarObject_HEAD_INIT(0, 0)
34137     "cython_function_or_method",
34138     sizeof(__pyx_CyFunctionObject),
34139     0,
34140     (destructor) __Pyx_CyFunction_dealloc,
34141     0,
34142     0,
34143     0,
34144 #if PY_MAJOR_VERSION < 3
34145     0,
34146 #else
34147     0,
34148 #endif
34149     (reprfunc) __Pyx_CyFunction_repr,
34150     0,
34151     0,
34152     0,
34153     0,
34154     __Pyx_CyFunction_CallAsMethod,
34155     0,
34156     0,
34157     0,
34158     0,
34159     Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
34160     0,
34161     (traverseproc) __Pyx_CyFunction_traverse,
34162     (inquiry) __Pyx_CyFunction_clear,
34163     0,
34164 #if PY_VERSION_HEX < 0x030500A0
34165     offsetof(__pyx_CyFunctionObject, func_weakreflist),
34166 #else
34167     offsetof(PyCFunctionObject, m_weakreflist),
34168 #endif
34169     0,
34170     0,
34171     __pyx_CyFunction_methods,
34172     __pyx_CyFunction_members,
34173     __pyx_CyFunction_getsets,
34174     0,
34175     0,
34176     __Pyx_CyFunction_descr_get,
34177     0,
34178     offsetof(__pyx_CyFunctionObject, func_dict),
34179     0,
34180     0,
34181     0,
34182     0,
34183     0,
34184     0,
34185     0,
34186     0,
34187     0,
34188     0,
34189     0,
34190     0,
34191 #if PY_VERSION_HEX >= 0x030400a1
34192     0,
34193 #endif
34194 #if PY_VERSION_HEX >= 0x030800b1
34195     0,
34196 #endif
34197 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
34198     0,
34199 #endif
34200 };
__pyx_CyFunction_init(void)34201 static int __pyx_CyFunction_init(void) {
34202     __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type);
34203     if (unlikely(__pyx_CyFunctionType == NULL)) {
34204         return -1;
34205     }
34206     return 0;
34207 }
__Pyx_CyFunction_InitDefaults(PyObject * func,size_t size,int pyobjects)34208 static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) {
34209     __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
34210     m->defaults = PyObject_Malloc(size);
34211     if (unlikely(!m->defaults))
34212         return PyErr_NoMemory();
34213     memset(m->defaults, 0, size);
34214     m->defaults_pyobjects = pyobjects;
34215     m->defaults_size = size;
34216     return m->defaults;
34217 }
__Pyx_CyFunction_SetDefaultsTuple(PyObject * func,PyObject * tuple)34218 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) {
34219     __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
34220     m->defaults_tuple = tuple;
34221     Py_INCREF(tuple);
34222 }
__Pyx_CyFunction_SetDefaultsKwDict(PyObject * func,PyObject * dict)34223 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) {
34224     __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
34225     m->defaults_kwdict = dict;
34226     Py_INCREF(dict);
34227 }
__Pyx_CyFunction_SetAnnotationsDict(PyObject * func,PyObject * dict)34228 static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) {
34229     __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
34230     m->func_annotations = dict;
34231     Py_INCREF(dict);
34232 }
34233 
34234 /* CythonFunction */
__Pyx_CyFunction_New(PyMethodDef * ml,int flags,PyObject * qualname,PyObject * closure,PyObject * module,PyObject * globals,PyObject * code)34235 static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qualname,
34236                                       PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
34237     PyObject *op = __Pyx_CyFunction_Init(
34238         PyObject_GC_New(__pyx_CyFunctionObject, __pyx_CyFunctionType),
34239         ml, flags, qualname, closure, module, globals, code
34240     );
34241     if (likely(op)) {
34242         PyObject_GC_Track(op);
34243     }
34244     return op;
34245 }
34246 
34247 /* decode_c_bytes */
__Pyx_decode_c_bytes(const char * cstring,Py_ssize_t length,Py_ssize_t start,Py_ssize_t stop,const char * encoding,const char * errors,PyObject * (* decode_func)(const char * s,Py_ssize_t size,const char * errors))34248 static CYTHON_INLINE PyObject* __Pyx_decode_c_bytes(
34249          const char* cstring, Py_ssize_t length, Py_ssize_t start, Py_ssize_t stop,
34250          const char* encoding, const char* errors,
34251          PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) {
34252     if (unlikely((start < 0) | (stop < 0))) {
34253         if (start < 0) {
34254             start += length;
34255             if (start < 0)
34256                 start = 0;
34257         }
34258         if (stop < 0)
34259             stop += length;
34260     }
34261     if (stop > length)
34262         stop = length;
34263     if (unlikely(stop <= start))
34264         return __Pyx_NewRef(__pyx_empty_unicode);
34265     length = stop - start;
34266     cstring += start;
34267     if (decode_func) {
34268         return decode_func(cstring, length, errors);
34269     } else {
34270         return PyUnicode_Decode(cstring, length, encoding, errors);
34271     }
34272 }
34273 
34274 /* WriteUnraisableException */
__Pyx_WriteUnraisable(const char * name,CYTHON_UNUSED int clineno,CYTHON_UNUSED int lineno,CYTHON_UNUSED const char * filename,int full_traceback,CYTHON_UNUSED int nogil)34275 static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno,
34276                                   CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename,
34277                                   int full_traceback, CYTHON_UNUSED int nogil) {
34278     PyObject *old_exc, *old_val, *old_tb;
34279     PyObject *ctx;
34280     __Pyx_PyThreadState_declare
34281 #ifdef WITH_THREAD
34282     PyGILState_STATE state;
34283     if (nogil)
34284         state = PyGILState_Ensure();
34285 #ifdef _MSC_VER
34286     else state = (PyGILState_STATE)-1;
34287 #endif
34288 #endif
34289     __Pyx_PyThreadState_assign
34290     __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
34291     if (full_traceback) {
34292         Py_XINCREF(old_exc);
34293         Py_XINCREF(old_val);
34294         Py_XINCREF(old_tb);
34295         __Pyx_ErrRestore(old_exc, old_val, old_tb);
34296         PyErr_PrintEx(1);
34297     }
34298     #if PY_MAJOR_VERSION < 3
34299     ctx = PyString_FromString(name);
34300     #else
34301     ctx = PyUnicode_FromString(name);
34302     #endif
34303     __Pyx_ErrRestore(old_exc, old_val, old_tb);
34304     if (!ctx) {
34305         PyErr_WriteUnraisable(Py_None);
34306     } else {
34307         PyErr_WriteUnraisable(ctx);
34308         Py_DECREF(ctx);
34309     }
34310 #ifdef WITH_THREAD
34311     if (nogil)
34312         PyGILState_Release(state);
34313 #endif
34314 }
34315 
34316 /* PyIntBinop */
34317 #if !CYTHON_COMPILING_IN_PYPY
__Pyx_PyInt_AddObjC(PyObject * op1,PyObject * op2,CYTHON_UNUSED long intval,int inplace,int zerodivision_check)34318 static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) {
34319     (void)inplace;
34320     (void)zerodivision_check;
34321     #if PY_MAJOR_VERSION < 3
34322     if (likely(PyInt_CheckExact(op1))) {
34323         const long b = intval;
34324         long x;
34325         long a = PyInt_AS_LONG(op1);
34326             x = (long)((unsigned long)a + b);
34327             if (likely((x^a) >= 0 || (x^b) >= 0))
34328                 return PyInt_FromLong(x);
34329             return PyLong_Type.tp_as_number->nb_add(op1, op2);
34330     }
34331     #endif
34332     #if CYTHON_USE_PYLONG_INTERNALS
34333     if (likely(PyLong_CheckExact(op1))) {
34334         const long b = intval;
34335         long a, x;
34336 #ifdef HAVE_LONG_LONG
34337         const PY_LONG_LONG llb = intval;
34338         PY_LONG_LONG lla, llx;
34339 #endif
34340         const digit* digits = ((PyLongObject*)op1)->ob_digit;
34341         const Py_ssize_t size = Py_SIZE(op1);
34342         if (likely(__Pyx_sst_abs(size) <= 1)) {
34343             a = likely(size) ? digits[0] : 0;
34344             if (size == -1) a = -a;
34345         } else {
34346             switch (size) {
34347                 case -2:
34348                     if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
34349                         a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
34350                         break;
34351 #ifdef HAVE_LONG_LONG
34352                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
34353                         lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
34354                         goto long_long;
34355 #endif
34356                     }
34357                     CYTHON_FALLTHROUGH;
34358                 case 2:
34359                     if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
34360                         a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
34361                         break;
34362 #ifdef HAVE_LONG_LONG
34363                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
34364                         lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
34365                         goto long_long;
34366 #endif
34367                     }
34368                     CYTHON_FALLTHROUGH;
34369                 case -3:
34370                     if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
34371                         a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
34372                         break;
34373 #ifdef HAVE_LONG_LONG
34374                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
34375                         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]));
34376                         goto long_long;
34377 #endif
34378                     }
34379                     CYTHON_FALLTHROUGH;
34380                 case 3:
34381                     if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
34382                         a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
34383                         break;
34384 #ifdef HAVE_LONG_LONG
34385                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
34386                         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]));
34387                         goto long_long;
34388 #endif
34389                     }
34390                     CYTHON_FALLTHROUGH;
34391                 case -4:
34392                     if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
34393                         a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
34394                         break;
34395 #ifdef HAVE_LONG_LONG
34396                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
34397                         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]));
34398                         goto long_long;
34399 #endif
34400                     }
34401                     CYTHON_FALLTHROUGH;
34402                 case 4:
34403                     if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
34404                         a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
34405                         break;
34406 #ifdef HAVE_LONG_LONG
34407                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
34408                         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]));
34409                         goto long_long;
34410 #endif
34411                     }
34412                     CYTHON_FALLTHROUGH;
34413                 default: return PyLong_Type.tp_as_number->nb_add(op1, op2);
34414             }
34415         }
34416                 x = a + b;
34417             return PyLong_FromLong(x);
34418 #ifdef HAVE_LONG_LONG
34419         long_long:
34420                 llx = lla + llb;
34421             return PyLong_FromLongLong(llx);
34422 #endif
34423 
34424 
34425     }
34426     #endif
34427     if (PyFloat_CheckExact(op1)) {
34428         const long b = intval;
34429         double a = PyFloat_AS_DOUBLE(op1);
34430             double result;
34431             PyFPE_START_PROTECT("add", return NULL)
34432             result = ((double)a) + (double)b;
34433             PyFPE_END_PROTECT(result)
34434             return PyFloat_FromDouble(result);
34435     }
34436     return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
34437 }
34438 #endif
34439 
34440 /* unicode_tailmatch */
__Pyx_PyUnicode_TailmatchTuple(PyObject * s,PyObject * substrings,Py_ssize_t start,Py_ssize_t end,int direction)34441 static int __Pyx_PyUnicode_TailmatchTuple(PyObject* s, PyObject* substrings,
34442                                           Py_ssize_t start, Py_ssize_t end, int direction) {
34443     Py_ssize_t i, count = PyTuple_GET_SIZE(substrings);
34444     for (i = 0; i < count; i++) {
34445         Py_ssize_t result;
34446 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
34447         result = PyUnicode_Tailmatch(s, PyTuple_GET_ITEM(substrings, i),
34448                                      start, end, direction);
34449 #else
34450         PyObject* sub = PySequence_ITEM(substrings, i);
34451         if (unlikely(!sub)) return -1;
34452         result = PyUnicode_Tailmatch(s, sub, start, end, direction);
34453         Py_DECREF(sub);
34454 #endif
34455         if (result) {
34456             return (int) result;
34457         }
34458     }
34459     return 0;
34460 }
__Pyx_PyUnicode_Tailmatch(PyObject * s,PyObject * substr,Py_ssize_t start,Py_ssize_t end,int direction)34461 static int __Pyx_PyUnicode_Tailmatch(PyObject* s, PyObject* substr,
34462                                      Py_ssize_t start, Py_ssize_t end, int direction) {
34463     if (unlikely(PyTuple_Check(substr))) {
34464         return __Pyx_PyUnicode_TailmatchTuple(s, substr, start, end, direction);
34465     }
34466     return (int) PyUnicode_Tailmatch(s, substr, start, end, direction);
34467 }
34468 
34469 /* bytes_tailmatch */
__Pyx_PyBytes_SingleTailmatch(PyObject * self,PyObject * arg,Py_ssize_t start,Py_ssize_t end,int direction)34470 static int __Pyx_PyBytes_SingleTailmatch(PyObject* self, PyObject* arg,
34471                                          Py_ssize_t start, Py_ssize_t end, int direction) {
34472     const char* self_ptr = PyBytes_AS_STRING(self);
34473     Py_ssize_t self_len = PyBytes_GET_SIZE(self);
34474     const char* sub_ptr;
34475     Py_ssize_t sub_len;
34476     int retval;
34477     Py_buffer view;
34478     view.obj = NULL;
34479     if ( PyBytes_Check(arg) ) {
34480         sub_ptr = PyBytes_AS_STRING(arg);
34481         sub_len = PyBytes_GET_SIZE(arg);
34482     }
34483 #if PY_MAJOR_VERSION < 3
34484     else if ( PyUnicode_Check(arg) ) {
34485         return (int) PyUnicode_Tailmatch(self, arg, start, end, direction);
34486     }
34487 #endif
34488     else {
34489         if (unlikely(PyObject_GetBuffer(self, &view, PyBUF_SIMPLE) == -1))
34490             return -1;
34491         sub_ptr = (const char*) view.buf;
34492         sub_len = view.len;
34493     }
34494     if (end > self_len)
34495         end = self_len;
34496     else if (end < 0)
34497         end += self_len;
34498     if (end < 0)
34499         end = 0;
34500     if (start < 0)
34501         start += self_len;
34502     if (start < 0)
34503         start = 0;
34504     if (direction > 0) {
34505         if (end-sub_len > start)
34506             start = end - sub_len;
34507     }
34508     if (start + sub_len <= end)
34509         retval = !memcmp(self_ptr+start, sub_ptr, (size_t)sub_len);
34510     else
34511         retval = 0;
34512     if (view.obj)
34513         PyBuffer_Release(&view);
34514     return retval;
34515 }
__Pyx_PyBytes_TailmatchTuple(PyObject * self,PyObject * substrings,Py_ssize_t start,Py_ssize_t end,int direction)34516 static int __Pyx_PyBytes_TailmatchTuple(PyObject* self, PyObject* substrings,
34517                                         Py_ssize_t start, Py_ssize_t end, int direction) {
34518     Py_ssize_t i, count = PyTuple_GET_SIZE(substrings);
34519     for (i = 0; i < count; i++) {
34520         int result;
34521 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
34522         result = __Pyx_PyBytes_SingleTailmatch(self, PyTuple_GET_ITEM(substrings, i),
34523                                                start, end, direction);
34524 #else
34525         PyObject* sub = PySequence_ITEM(substrings, i);
34526         if (unlikely(!sub)) return -1;
34527         result = __Pyx_PyBytes_SingleTailmatch(self, sub, start, end, direction);
34528         Py_DECREF(sub);
34529 #endif
34530         if (result) {
34531             return result;
34532         }
34533     }
34534     return 0;
34535 }
__Pyx_PyBytes_Tailmatch(PyObject * self,PyObject * substr,Py_ssize_t start,Py_ssize_t end,int direction)34536 static int __Pyx_PyBytes_Tailmatch(PyObject* self, PyObject* substr,
34537                                    Py_ssize_t start, Py_ssize_t end, int direction) {
34538     if (unlikely(PyTuple_Check(substr))) {
34539         return __Pyx_PyBytes_TailmatchTuple(self, substr, start, end, direction);
34540     }
34541     return __Pyx_PyBytes_SingleTailmatch(self, substr, start, end, direction);
34542 }
34543 
34544 /* ArgTypeTest */
__Pyx__ArgTypeTest(PyObject * obj,PyTypeObject * type,const char * name,int exact)34545 static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact)
34546 {
34547     if (unlikely(!type)) {
34548         PyErr_SetString(PyExc_SystemError, "Missing type object");
34549         return 0;
34550     }
34551     else if (exact) {
34552         #if PY_MAJOR_VERSION == 2
34553         if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
34554         #endif
34555     }
34556     else {
34557         if (likely(__Pyx_TypeCheck(obj, type))) return 1;
34558     }
34559     PyErr_Format(PyExc_TypeError,
34560         "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
34561         name, type->tp_name, Py_TYPE(obj)->tp_name);
34562     return 0;
34563 }
34564 
34565 /* GetAttr */
__Pyx_GetAttr(PyObject * o,PyObject * n)34566 static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) {
34567 #if CYTHON_USE_TYPE_SLOTS
34568 #if PY_MAJOR_VERSION >= 3
34569     if (likely(PyUnicode_Check(n)))
34570 #else
34571     if (likely(PyString_Check(n)))
34572 #endif
34573         return __Pyx_PyObject_GetAttrStr(o, n);
34574 #endif
34575     return PyObject_GetAttr(o, n);
34576 }
34577 
34578 /* HasAttr */
__Pyx_HasAttr(PyObject * o,PyObject * n)34579 static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) {
34580     PyObject *r;
34581     if (unlikely(!__Pyx_PyBaseString_Check(n))) {
34582         PyErr_SetString(PyExc_TypeError,
34583                         "hasattr(): attribute name must be string");
34584         return -1;
34585     }
34586     r = __Pyx_GetAttr(o, n);
34587     if (unlikely(!r)) {
34588         PyErr_Clear();
34589         return 0;
34590     } else {
34591         Py_DECREF(r);
34592         return 1;
34593     }
34594 }
34595 
34596 /* PyObjectCallMethod1 */
__Pyx__PyObject_CallMethod1(PyObject * method,PyObject * arg)34597 static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) {
34598     PyObject *result = __Pyx_PyObject_CallOneArg(method, arg);
34599     Py_DECREF(method);
34600     return result;
34601 }
__Pyx_PyObject_CallMethod1(PyObject * obj,PyObject * method_name,PyObject * arg)34602 static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) {
34603     PyObject *method = NULL, *result;
34604     int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
34605     if (likely(is_method)) {
34606         result = __Pyx_PyObject_Call2Args(method, obj, arg);
34607         Py_DECREF(method);
34608         return result;
34609     }
34610     if (unlikely(!method)) return NULL;
34611     return __Pyx__PyObject_CallMethod1(method, arg);
34612 }
34613 
34614 /* append */
__Pyx_PyObject_Append(PyObject * L,PyObject * x)34615 static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x) {
34616     if (likely(PyList_CheckExact(L))) {
34617         if (unlikely(__Pyx_PyList_Append(L, x) < 0)) return -1;
34618     } else {
34619         PyObject* retval = __Pyx_PyObject_CallMethod1(L, __pyx_n_s_append, x);
34620         if (unlikely(!retval))
34621             return -1;
34622         Py_DECREF(retval);
34623     }
34624     return 0;
34625 }
34626 
34627 /* DictGetItem */
34628 #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
__Pyx_PyDict_GetItem(PyObject * d,PyObject * key)34629 static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
34630     PyObject *value;
34631     value = PyDict_GetItemWithError(d, key);
34632     if (unlikely(!value)) {
34633         if (!PyErr_Occurred()) {
34634             if (unlikely(PyTuple_Check(key))) {
34635                 PyObject* args = PyTuple_Pack(1, key);
34636                 if (likely(args)) {
34637                     PyErr_SetObject(PyExc_KeyError, args);
34638                     Py_DECREF(args);
34639                 }
34640             } else {
34641                 PyErr_SetObject(PyExc_KeyError, key);
34642             }
34643         }
34644         return NULL;
34645     }
34646     Py_INCREF(value);
34647     return value;
34648 }
34649 #endif
34650 
34651 /* UnpackUnboundCMethod */
__Pyx_TryUnpackUnboundCMethod(__Pyx_CachedCFunction * target)34652 static int __Pyx_TryUnpackUnboundCMethod(__Pyx_CachedCFunction* target) {
34653     PyObject *method;
34654     method = __Pyx_PyObject_GetAttrStr(target->type, *target->method_name);
34655     if (unlikely(!method))
34656         return -1;
34657     target->method = method;
34658 #if CYTHON_COMPILING_IN_CPYTHON
34659     #if PY_MAJOR_VERSION >= 3
34660     if (likely(__Pyx_TypeCheck(method, &PyMethodDescr_Type)))
34661     #endif
34662     {
34663         PyMethodDescrObject *descr = (PyMethodDescrObject*) method;
34664         target->func = descr->d_method->ml_meth;
34665         target->flag = descr->d_method->ml_flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_STACKLESS);
34666     }
34667 #endif
34668     return 0;
34669 }
34670 
34671 /* CallUnboundCMethod0 */
__Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction * cfunc,PyObject * self)34672 static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self) {
34673     PyObject *args, *result = NULL;
34674     if (unlikely(!cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL;
34675 #if CYTHON_ASSUME_SAFE_MACROS
34676     args = PyTuple_New(1);
34677     if (unlikely(!args)) goto bad;
34678     Py_INCREF(self);
34679     PyTuple_SET_ITEM(args, 0, self);
34680 #else
34681     args = PyTuple_Pack(1, self);
34682     if (unlikely(!args)) goto bad;
34683 #endif
34684     result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
34685     Py_DECREF(args);
34686 bad:
34687     return result;
34688 }
34689 
34690 /* pop */
__Pyx__PyObject_Pop(PyObject * L)34691 static CYTHON_INLINE PyObject* __Pyx__PyObject_Pop(PyObject* L) {
34692     if (Py_TYPE(L) == &PySet_Type) {
34693         return PySet_Pop(L);
34694     }
34695     return __Pyx_PyObject_CallMethod0(L, __pyx_n_s_pop);
34696 }
34697 #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
__Pyx_PyList_Pop(PyObject * L)34698 static CYTHON_INLINE PyObject* __Pyx_PyList_Pop(PyObject* L) {
34699     if (likely(PyList_GET_SIZE(L) > (((PyListObject*)L)->allocated >> 1))) {
34700         __Pyx_SET_SIZE(L, Py_SIZE(L) - 1);
34701         return PyList_GET_ITEM(L, PyList_GET_SIZE(L));
34702     }
34703     return __Pyx_CallUnboundCMethod0(&__pyx_umethod_PyList_Type_pop, L);
34704 }
34705 #endif
34706 
34707 /* IterNext */
__Pyx_PyIter_Next2Default(PyObject * defval)34708 static PyObject *__Pyx_PyIter_Next2Default(PyObject* defval) {
34709     PyObject* exc_type;
34710     __Pyx_PyThreadState_declare
34711     __Pyx_PyThreadState_assign
34712     exc_type = __Pyx_PyErr_Occurred();
34713     if (unlikely(exc_type)) {
34714         if (!defval || unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))
34715             return NULL;
34716         __Pyx_PyErr_Clear();
34717         Py_INCREF(defval);
34718         return defval;
34719     }
34720     if (defval) {
34721         Py_INCREF(defval);
34722         return defval;
34723     }
34724     __Pyx_PyErr_SetNone(PyExc_StopIteration);
34725     return NULL;
34726 }
__Pyx_PyIter_Next_ErrorNoIterator(PyObject * iterator)34727 static void __Pyx_PyIter_Next_ErrorNoIterator(PyObject *iterator) {
34728     PyErr_Format(PyExc_TypeError,
34729         "%.200s object is not an iterator", Py_TYPE(iterator)->tp_name);
34730 }
__Pyx_PyIter_Next2(PyObject * iterator,PyObject * defval)34731 static CYTHON_INLINE PyObject *__Pyx_PyIter_Next2(PyObject* iterator, PyObject* defval) {
34732     PyObject* next;
34733     iternextfunc iternext = Py_TYPE(iterator)->tp_iternext;
34734     if (likely(iternext)) {
34735 #if CYTHON_USE_TYPE_SLOTS
34736         next = iternext(iterator);
34737         if (likely(next))
34738             return next;
34739         #if PY_VERSION_HEX >= 0x02070000
34740         if (unlikely(iternext == &_PyObject_NextNotImplemented))
34741             return NULL;
34742         #endif
34743 #else
34744         next = PyIter_Next(iterator);
34745         if (likely(next))
34746             return next;
34747 #endif
34748     } else if (CYTHON_USE_TYPE_SLOTS || unlikely(!PyIter_Check(iterator))) {
34749         __Pyx_PyIter_Next_ErrorNoIterator(iterator);
34750         return NULL;
34751     }
34752 #if !CYTHON_USE_TYPE_SLOTS
34753     else {
34754         next = PyIter_Next(iterator);
34755         if (likely(next))
34756             return next;
34757     }
34758 #endif
34759     return __Pyx_PyIter_Next2Default(defval);
34760 }
34761 
34762 /* PyObject_GenericGetAttrNoDict */
34763 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
__Pyx_RaiseGenericGetAttributeError(PyTypeObject * tp,PyObject * attr_name)34764 static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) {
34765     PyErr_Format(PyExc_AttributeError,
34766 #if PY_MAJOR_VERSION >= 3
34767                  "'%.50s' object has no attribute '%U'",
34768                  tp->tp_name, attr_name);
34769 #else
34770                  "'%.50s' object has no attribute '%.400s'",
34771                  tp->tp_name, PyString_AS_STRING(attr_name));
34772 #endif
34773     return NULL;
34774 }
__Pyx_PyObject_GenericGetAttrNoDict(PyObject * obj,PyObject * attr_name)34775 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) {
34776     PyObject *descr;
34777     PyTypeObject *tp = Py_TYPE(obj);
34778     if (unlikely(!PyString_Check(attr_name))) {
34779         return PyObject_GenericGetAttr(obj, attr_name);
34780     }
34781     assert(!tp->tp_dictoffset);
34782     descr = _PyType_Lookup(tp, attr_name);
34783     if (unlikely(!descr)) {
34784         return __Pyx_RaiseGenericGetAttributeError(tp, attr_name);
34785     }
34786     Py_INCREF(descr);
34787     #if PY_MAJOR_VERSION < 3
34788     if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS)))
34789     #endif
34790     {
34791         descrgetfunc f = Py_TYPE(descr)->tp_descr_get;
34792         if (unlikely(f)) {
34793             PyObject *res = f(descr, obj, (PyObject *)tp);
34794             Py_DECREF(descr);
34795             return res;
34796         }
34797     }
34798     return descr;
34799 }
34800 #endif
34801 
34802 /* PyObject_GenericGetAttr */
34803 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
__Pyx_PyObject_GenericGetAttr(PyObject * obj,PyObject * attr_name)34804 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) {
34805     if (unlikely(Py_TYPE(obj)->tp_dictoffset)) {
34806         return PyObject_GenericGetAttr(obj, attr_name);
34807     }
34808     return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name);
34809 }
34810 #endif
34811 
34812 /* PyObjectGetAttrStrNoError */
__Pyx_PyObject_GetAttrStr_ClearAttributeError(void)34813 static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) {
34814     __Pyx_PyThreadState_declare
34815     __Pyx_PyThreadState_assign
34816     if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
34817         __Pyx_PyErr_Clear();
34818 }
__Pyx_PyObject_GetAttrStrNoError(PyObject * obj,PyObject * attr_name)34819 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) {
34820     PyObject *result;
34821 #if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1
34822     PyTypeObject* tp = Py_TYPE(obj);
34823     if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) {
34824         return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1);
34825     }
34826 #endif
34827     result = __Pyx_PyObject_GetAttrStr(obj, attr_name);
34828     if (unlikely(!result)) {
34829         __Pyx_PyObject_GetAttrStr_ClearAttributeError();
34830     }
34831     return result;
34832 }
34833 
34834 /* SetupReduce */
__Pyx_setup_reduce_is_named(PyObject * meth,PyObject * name)34835 static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) {
34836   int ret;
34837   PyObject *name_attr;
34838   name_attr = __Pyx_PyObject_GetAttrStr(meth, __pyx_n_s_name);
34839   if (likely(name_attr)) {
34840       ret = PyObject_RichCompareBool(name_attr, name, Py_EQ);
34841   } else {
34842       ret = -1;
34843   }
34844   if (unlikely(ret < 0)) {
34845       PyErr_Clear();
34846       ret = 0;
34847   }
34848   Py_XDECREF(name_attr);
34849   return ret;
34850 }
__Pyx_setup_reduce(PyObject * type_obj)34851 static int __Pyx_setup_reduce(PyObject* type_obj) {
34852     int ret = 0;
34853     PyObject *object_reduce = NULL;
34854     PyObject *object_reduce_ex = NULL;
34855     PyObject *reduce = NULL;
34856     PyObject *reduce_ex = NULL;
34857     PyObject *reduce_cython = NULL;
34858     PyObject *setstate = NULL;
34859     PyObject *setstate_cython = NULL;
34860 #if CYTHON_USE_PYTYPE_LOOKUP
34861     if (_PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate)) goto __PYX_GOOD;
34862 #else
34863     if (PyObject_HasAttr(type_obj, __pyx_n_s_getstate)) goto __PYX_GOOD;
34864 #endif
34865 #if CYTHON_USE_PYTYPE_LOOKUP
34866     object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
34867 #else
34868     object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
34869 #endif
34870     reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex); if (unlikely(!reduce_ex)) goto __PYX_BAD;
34871     if (reduce_ex == object_reduce_ex) {
34872 #if CYTHON_USE_PYTYPE_LOOKUP
34873         object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD;
34874 #else
34875         object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD;
34876 #endif
34877         reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce); if (unlikely(!reduce)) goto __PYX_BAD;
34878         if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) {
34879             reduce_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_reduce_cython);
34880             if (likely(reduce_cython)) {
34881                 ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
34882                 ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
34883             } else if (reduce == object_reduce || PyErr_Occurred()) {
34884                 goto __PYX_BAD;
34885             }
34886             setstate = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate);
34887             if (!setstate) PyErr_Clear();
34888             if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) {
34889                 setstate_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_setstate_cython);
34890                 if (likely(setstate_cython)) {
34891                     ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
34892                     ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
34893                 } else if (!setstate || PyErr_Occurred()) {
34894                     goto __PYX_BAD;
34895                 }
34896             }
34897             PyType_Modified((PyTypeObject*)type_obj);
34898         }
34899     }
34900     goto __PYX_GOOD;
34901 __PYX_BAD:
34902     if (!PyErr_Occurred())
34903         PyErr_Format(PyExc_RuntimeError, "Unable to initialize pickling for %s", ((PyTypeObject*)type_obj)->tp_name);
34904     ret = -1;
34905 __PYX_GOOD:
34906 #if !CYTHON_USE_PYTYPE_LOOKUP
34907     Py_XDECREF(object_reduce);
34908     Py_XDECREF(object_reduce_ex);
34909 #endif
34910     Py_XDECREF(reduce);
34911     Py_XDECREF(reduce_ex);
34912     Py_XDECREF(reduce_cython);
34913     Py_XDECREF(setstate);
34914     Py_XDECREF(setstate_cython);
34915     return ret;
34916 }
34917 
34918 /* SetVTable */
__Pyx_SetVtable(PyObject * dict,void * vtable)34919 static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
34920 #if PY_VERSION_HEX >= 0x02070000
34921     PyObject *ob = PyCapsule_New(vtable, 0, 0);
34922 #else
34923     PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
34924 #endif
34925     if (!ob)
34926         goto bad;
34927     if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0)
34928         goto bad;
34929     Py_DECREF(ob);
34930     return 0;
34931 bad:
34932     Py_XDECREF(ob);
34933     return -1;
34934 }
34935 
34936 /* TypeImport */
34937 #ifndef __PYX_HAVE_RT_ImportType
34938 #define __PYX_HAVE_RT_ImportType
__Pyx_ImportType(PyObject * module,const char * module_name,const char * class_name,size_t size,enum __Pyx_ImportType_CheckSize check_size)34939 static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, const char *class_name,
34940     size_t size, enum __Pyx_ImportType_CheckSize check_size)
34941 {
34942     PyObject *result = 0;
34943     char warning[200];
34944     Py_ssize_t basicsize;
34945 #ifdef Py_LIMITED_API
34946     PyObject *py_basicsize;
34947 #endif
34948     result = PyObject_GetAttrString(module, class_name);
34949     if (!result)
34950         goto bad;
34951     if (!PyType_Check(result)) {
34952         PyErr_Format(PyExc_TypeError,
34953             "%.200s.%.200s is not a type object",
34954             module_name, class_name);
34955         goto bad;
34956     }
34957 #ifndef Py_LIMITED_API
34958     basicsize = ((PyTypeObject *)result)->tp_basicsize;
34959 #else
34960     py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
34961     if (!py_basicsize)
34962         goto bad;
34963     basicsize = PyLong_AsSsize_t(py_basicsize);
34964     Py_DECREF(py_basicsize);
34965     py_basicsize = 0;
34966     if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
34967         goto bad;
34968 #endif
34969     if ((size_t)basicsize < size) {
34970         PyErr_Format(PyExc_ValueError,
34971             "%.200s.%.200s size changed, may indicate binary incompatibility. "
34972             "Expected %zd from C header, got %zd from PyObject",
34973             module_name, class_name, size, basicsize);
34974         goto bad;
34975     }
34976     if (check_size == __Pyx_ImportType_CheckSize_Error && (size_t)basicsize != size) {
34977         PyErr_Format(PyExc_ValueError,
34978             "%.200s.%.200s size changed, may indicate binary incompatibility. "
34979             "Expected %zd from C header, got %zd from PyObject",
34980             module_name, class_name, size, basicsize);
34981         goto bad;
34982     }
34983     else if (check_size == __Pyx_ImportType_CheckSize_Warn && (size_t)basicsize > size) {
34984         PyOS_snprintf(warning, sizeof(warning),
34985             "%s.%s size changed, may indicate binary incompatibility. "
34986             "Expected %zd from C header, got %zd from PyObject",
34987             module_name, class_name, size, basicsize);
34988         if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
34989     }
34990     return (PyTypeObject *)result;
34991 bad:
34992     Py_XDECREF(result);
34993     return NULL;
34994 }
34995 #endif
34996 
34997 /* Import */
__Pyx_Import(PyObject * name,PyObject * from_list,int level)34998 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
34999     PyObject *empty_list = 0;
35000     PyObject *module = 0;
35001     PyObject *global_dict = 0;
35002     PyObject *empty_dict = 0;
35003     PyObject *list;
35004     #if PY_MAJOR_VERSION < 3
35005     PyObject *py_import;
35006     py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
35007     if (!py_import)
35008         goto bad;
35009     #endif
35010     if (from_list)
35011         list = from_list;
35012     else {
35013         empty_list = PyList_New(0);
35014         if (!empty_list)
35015             goto bad;
35016         list = empty_list;
35017     }
35018     global_dict = PyModule_GetDict(__pyx_m);
35019     if (!global_dict)
35020         goto bad;
35021     empty_dict = PyDict_New();
35022     if (!empty_dict)
35023         goto bad;
35024     {
35025         #if PY_MAJOR_VERSION >= 3
35026         if (level == -1) {
35027             if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) {
35028                 module = PyImport_ImportModuleLevelObject(
35029                     name, global_dict, empty_dict, list, 1);
35030                 if (!module) {
35031                     if (!PyErr_ExceptionMatches(PyExc_ImportError))
35032                         goto bad;
35033                     PyErr_Clear();
35034                 }
35035             }
35036             level = 0;
35037         }
35038         #endif
35039         if (!module) {
35040             #if PY_MAJOR_VERSION < 3
35041             PyObject *py_level = PyInt_FromLong(level);
35042             if (!py_level)
35043                 goto bad;
35044             module = PyObject_CallFunctionObjArgs(py_import,
35045                 name, global_dict, empty_dict, list, py_level, (PyObject *)NULL);
35046             Py_DECREF(py_level);
35047             #else
35048             module = PyImport_ImportModuleLevelObject(
35049                 name, global_dict, empty_dict, list, level);
35050             #endif
35051         }
35052     }
35053 bad:
35054     #if PY_MAJOR_VERSION < 3
35055     Py_XDECREF(py_import);
35056     #endif
35057     Py_XDECREF(empty_list);
35058     Py_XDECREF(empty_dict);
35059     return module;
35060 }
35061 
35062 /* ImportFrom */
__Pyx_ImportFrom(PyObject * module,PyObject * name)35063 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
35064     PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
35065     if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
35066         PyErr_Format(PyExc_ImportError,
35067         #if PY_MAJOR_VERSION < 3
35068             "cannot import name %.230s", PyString_AS_STRING(name));
35069         #else
35070             "cannot import name %S", name);
35071         #endif
35072     }
35073     return value;
35074 }
35075 
35076 /* CalculateMetaclass */
__Pyx_CalculateMetaclass(PyTypeObject * metaclass,PyObject * bases)35077 static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases) {
35078     Py_ssize_t i, nbases = PyTuple_GET_SIZE(bases);
35079     for (i=0; i < nbases; i++) {
35080         PyTypeObject *tmptype;
35081         PyObject *tmp = PyTuple_GET_ITEM(bases, i);
35082         tmptype = Py_TYPE(tmp);
35083 #if PY_MAJOR_VERSION < 3
35084         if (tmptype == &PyClass_Type)
35085             continue;
35086 #endif
35087         if (!metaclass) {
35088             metaclass = tmptype;
35089             continue;
35090         }
35091         if (PyType_IsSubtype(metaclass, tmptype))
35092             continue;
35093         if (PyType_IsSubtype(tmptype, metaclass)) {
35094             metaclass = tmptype;
35095             continue;
35096         }
35097         PyErr_SetString(PyExc_TypeError,
35098                         "metaclass conflict: "
35099                         "the metaclass of a derived class "
35100                         "must be a (non-strict) subclass "
35101                         "of the metaclasses of all its bases");
35102         return NULL;
35103     }
35104     if (!metaclass) {
35105 #if PY_MAJOR_VERSION < 3
35106         metaclass = &PyClass_Type;
35107 #else
35108         metaclass = &PyType_Type;
35109 #endif
35110     }
35111     Py_INCREF((PyObject*) metaclass);
35112     return (PyObject*) metaclass;
35113 }
35114 
35115 /* Py3ClassCreate */
__Pyx_Py3MetaclassPrepare(PyObject * metaclass,PyObject * bases,PyObject * name,PyObject * qualname,PyObject * mkw,PyObject * modname,PyObject * doc)35116 static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name,
35117                                            PyObject *qualname, PyObject *mkw, PyObject *modname, PyObject *doc) {
35118     PyObject *ns;
35119     if (metaclass) {
35120         PyObject *prep = __Pyx_PyObject_GetAttrStr(metaclass, __pyx_n_s_prepare);
35121         if (prep) {
35122             PyObject *pargs = PyTuple_Pack(2, name, bases);
35123             if (unlikely(!pargs)) {
35124                 Py_DECREF(prep);
35125                 return NULL;
35126             }
35127             ns = PyObject_Call(prep, pargs, mkw);
35128             Py_DECREF(prep);
35129             Py_DECREF(pargs);
35130         } else {
35131             if (unlikely(!PyErr_ExceptionMatches(PyExc_AttributeError)))
35132                 return NULL;
35133             PyErr_Clear();
35134             ns = PyDict_New();
35135         }
35136     } else {
35137         ns = PyDict_New();
35138     }
35139     if (unlikely(!ns))
35140         return NULL;
35141     if (unlikely(PyObject_SetItem(ns, __pyx_n_s_module, modname) < 0)) goto bad;
35142     if (unlikely(PyObject_SetItem(ns, __pyx_n_s_qualname, qualname) < 0)) goto bad;
35143     if (unlikely(doc && PyObject_SetItem(ns, __pyx_n_s_doc, doc) < 0)) goto bad;
35144     return ns;
35145 bad:
35146     Py_DECREF(ns);
35147     return NULL;
35148 }
__Pyx_Py3ClassCreate(PyObject * metaclass,PyObject * name,PyObject * bases,PyObject * dict,PyObject * mkw,int calculate_metaclass,int allow_py2_metaclass)35149 static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases,
35150                                       PyObject *dict, PyObject *mkw,
35151                                       int calculate_metaclass, int allow_py2_metaclass) {
35152     PyObject *result, *margs;
35153     PyObject *owned_metaclass = NULL;
35154     if (allow_py2_metaclass) {
35155         owned_metaclass = PyObject_GetItem(dict, __pyx_n_s_metaclass);
35156         if (owned_metaclass) {
35157             metaclass = owned_metaclass;
35158         } else if (likely(PyErr_ExceptionMatches(PyExc_KeyError))) {
35159             PyErr_Clear();
35160         } else {
35161             return NULL;
35162         }
35163     }
35164     if (calculate_metaclass && (!metaclass || PyType_Check(metaclass))) {
35165         metaclass = __Pyx_CalculateMetaclass((PyTypeObject*) metaclass, bases);
35166         Py_XDECREF(owned_metaclass);
35167         if (unlikely(!metaclass))
35168             return NULL;
35169         owned_metaclass = metaclass;
35170     }
35171     margs = PyTuple_Pack(3, name, bases, dict);
35172     if (unlikely(!margs)) {
35173         result = NULL;
35174     } else {
35175         result = PyObject_Call(metaclass, margs, mkw);
35176         Py_DECREF(margs);
35177     }
35178     Py_XDECREF(owned_metaclass);
35179     return result;
35180 }
35181 
35182 /* CLineInTraceback */
35183 #ifndef CYTHON_CLINE_IN_TRACEBACK
__Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState * tstate,int c_line)35184 static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int c_line) {
35185     PyObject *use_cline;
35186     PyObject *ptype, *pvalue, *ptraceback;
35187 #if CYTHON_COMPILING_IN_CPYTHON
35188     PyObject **cython_runtime_dict;
35189 #endif
35190     if (unlikely(!__pyx_cython_runtime)) {
35191         return c_line;
35192     }
35193     __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
35194 #if CYTHON_COMPILING_IN_CPYTHON
35195     cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
35196     if (likely(cython_runtime_dict)) {
35197         __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
35198             use_cline, *cython_runtime_dict,
35199             __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
35200     } else
35201 #endif
35202     {
35203       PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
35204       if (use_cline_obj) {
35205         use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
35206         Py_DECREF(use_cline_obj);
35207       } else {
35208         PyErr_Clear();
35209         use_cline = NULL;
35210       }
35211     }
35212     if (!use_cline) {
35213         c_line = 0;
35214         PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
35215     }
35216     else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
35217         c_line = 0;
35218     }
35219     __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
35220     return c_line;
35221 }
35222 #endif
35223 
35224 /* CodeObjectCache */
__pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry * entries,int count,int code_line)35225 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
35226     int start = 0, mid = 0, end = count - 1;
35227     if (end >= 0 && code_line > entries[end].code_line) {
35228         return count;
35229     }
35230     while (start < end) {
35231         mid = start + (end - start) / 2;
35232         if (code_line < entries[mid].code_line) {
35233             end = mid;
35234         } else if (code_line > entries[mid].code_line) {
35235              start = mid + 1;
35236         } else {
35237             return mid;
35238         }
35239     }
35240     if (code_line <= entries[mid].code_line) {
35241         return mid;
35242     } else {
35243         return mid + 1;
35244     }
35245 }
__pyx_find_code_object(int code_line)35246 static PyCodeObject *__pyx_find_code_object(int code_line) {
35247     PyCodeObject* code_object;
35248     int pos;
35249     if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
35250         return NULL;
35251     }
35252     pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
35253     if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
35254         return NULL;
35255     }
35256     code_object = __pyx_code_cache.entries[pos].code_object;
35257     Py_INCREF(code_object);
35258     return code_object;
35259 }
__pyx_insert_code_object(int code_line,PyCodeObject * code_object)35260 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
35261     int pos, i;
35262     __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
35263     if (unlikely(!code_line)) {
35264         return;
35265     }
35266     if (unlikely(!entries)) {
35267         entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
35268         if (likely(entries)) {
35269             __pyx_code_cache.entries = entries;
35270             __pyx_code_cache.max_count = 64;
35271             __pyx_code_cache.count = 1;
35272             entries[0].code_line = code_line;
35273             entries[0].code_object = code_object;
35274             Py_INCREF(code_object);
35275         }
35276         return;
35277     }
35278     pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
35279     if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
35280         PyCodeObject* tmp = entries[pos].code_object;
35281         entries[pos].code_object = code_object;
35282         Py_DECREF(tmp);
35283         return;
35284     }
35285     if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
35286         int new_max = __pyx_code_cache.max_count + 64;
35287         entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
35288             __pyx_code_cache.entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry));
35289         if (unlikely(!entries)) {
35290             return;
35291         }
35292         __pyx_code_cache.entries = entries;
35293         __pyx_code_cache.max_count = new_max;
35294     }
35295     for (i=__pyx_code_cache.count; i>pos; i--) {
35296         entries[i] = entries[i-1];
35297     }
35298     entries[pos].code_line = code_line;
35299     entries[pos].code_object = code_object;
35300     __pyx_code_cache.count++;
35301     Py_INCREF(code_object);
35302 }
35303 
35304 /* AddTraceback */
35305 #include "compile.h"
35306 #include "frameobject.h"
35307 #include "traceback.h"
__Pyx_CreateCodeObjectForTraceback(const char * funcname,int c_line,int py_line,const char * filename)35308 static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
35309             const char *funcname, int c_line,
35310             int py_line, const char *filename) {
35311     PyCodeObject *py_code = 0;
35312     PyObject *py_srcfile = 0;
35313     PyObject *py_funcname = 0;
35314     #if PY_MAJOR_VERSION < 3
35315     py_srcfile = PyString_FromString(filename);
35316     #else
35317     py_srcfile = PyUnicode_FromString(filename);
35318     #endif
35319     if (!py_srcfile) goto bad;
35320     if (c_line) {
35321         #if PY_MAJOR_VERSION < 3
35322         py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
35323         #else
35324         py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
35325         #endif
35326     }
35327     else {
35328         #if PY_MAJOR_VERSION < 3
35329         py_funcname = PyString_FromString(funcname);
35330         #else
35331         py_funcname = PyUnicode_FromString(funcname);
35332         #endif
35333     }
35334     if (!py_funcname) goto bad;
35335     py_code = __Pyx_PyCode_New(
35336         0,
35337         0,
35338         0,
35339         0,
35340         0,
35341         __pyx_empty_bytes, /*PyObject *code,*/
35342         __pyx_empty_tuple, /*PyObject *consts,*/
35343         __pyx_empty_tuple, /*PyObject *names,*/
35344         __pyx_empty_tuple, /*PyObject *varnames,*/
35345         __pyx_empty_tuple, /*PyObject *freevars,*/
35346         __pyx_empty_tuple, /*PyObject *cellvars,*/
35347         py_srcfile,   /*PyObject *filename,*/
35348         py_funcname,  /*PyObject *name,*/
35349         py_line,
35350         __pyx_empty_bytes  /*PyObject *lnotab*/
35351     );
35352     Py_DECREF(py_srcfile);
35353     Py_DECREF(py_funcname);
35354     return py_code;
35355 bad:
35356     Py_XDECREF(py_srcfile);
35357     Py_XDECREF(py_funcname);
35358     return NULL;
35359 }
__Pyx_AddTraceback(const char * funcname,int c_line,int py_line,const char * filename)35360 static void __Pyx_AddTraceback(const char *funcname, int c_line,
35361                                int py_line, const char *filename) {
35362     PyCodeObject *py_code = 0;
35363     PyFrameObject *py_frame = 0;
35364     PyThreadState *tstate = __Pyx_PyThreadState_Current;
35365     if (c_line) {
35366         c_line = __Pyx_CLineForTraceback(tstate, c_line);
35367     }
35368     py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
35369     if (!py_code) {
35370         py_code = __Pyx_CreateCodeObjectForTraceback(
35371             funcname, c_line, py_line, filename);
35372         if (!py_code) goto bad;
35373         __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
35374     }
35375     py_frame = PyFrame_New(
35376         tstate,            /*PyThreadState *tstate,*/
35377         py_code,           /*PyCodeObject *code,*/
35378         __pyx_d,    /*PyObject *globals,*/
35379         0                  /*PyObject *locals*/
35380     );
35381     if (!py_frame) goto bad;
35382     __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
35383     PyTraceBack_Here(py_frame);
35384 bad:
35385     Py_XDECREF(py_code);
35386     Py_XDECREF(py_frame);
35387 }
35388 
35389 /* CIntFromPyVerify */
35390 #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
35391     __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
35392 #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
35393     __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
35394 #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
35395     {\
35396         func_type value = func_value;\
35397         if (sizeof(target_type) < sizeof(func_type)) {\
35398             if (unlikely(value != (func_type) (target_type) value)) {\
35399                 func_type zero = 0;\
35400                 if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
35401                     return (target_type) -1;\
35402                 if (is_unsigned && unlikely(value < zero))\
35403                     goto raise_neg_overflow;\
35404                 else\
35405                     goto raise_overflow;\
35406             }\
35407         }\
35408         return (target_type) value;\
35409     }
35410 
35411 /* CIntToPy */
__Pyx_PyInt_From_long(long value)35412 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
35413 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
35414 #pragma GCC diagnostic push
35415 #pragma GCC diagnostic ignored "-Wconversion"
35416 #endif
35417     const long neg_one = (long) -1, const_zero = (long) 0;
35418 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
35419 #pragma GCC diagnostic pop
35420 #endif
35421     const int is_unsigned = neg_one > const_zero;
35422     if (is_unsigned) {
35423         if (sizeof(long) < sizeof(long)) {
35424             return PyInt_FromLong((long) value);
35425         } else if (sizeof(long) <= sizeof(unsigned long)) {
35426             return PyLong_FromUnsignedLong((unsigned long) value);
35427 #ifdef HAVE_LONG_LONG
35428         } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
35429             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
35430 #endif
35431         }
35432     } else {
35433         if (sizeof(long) <= sizeof(long)) {
35434             return PyInt_FromLong((long) value);
35435 #ifdef HAVE_LONG_LONG
35436         } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
35437             return PyLong_FromLongLong((PY_LONG_LONG) value);
35438 #endif
35439         }
35440     }
35441     {
35442         int one = 1; int little = (int)*(unsigned char *)&one;
35443         unsigned char *bytes = (unsigned char *)&value;
35444         return _PyLong_FromByteArray(bytes, sizeof(long),
35445                                      little, !is_unsigned);
35446     }
35447 }
35448 
35449 /* CIntFromPy */
__Pyx_PyInt_As_int(PyObject * x)35450 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
35451 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
35452 #pragma GCC diagnostic push
35453 #pragma GCC diagnostic ignored "-Wconversion"
35454 #endif
35455     const int neg_one = (int) -1, const_zero = (int) 0;
35456 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
35457 #pragma GCC diagnostic pop
35458 #endif
35459     const int is_unsigned = neg_one > const_zero;
35460 #if PY_MAJOR_VERSION < 3
35461     if (likely(PyInt_Check(x))) {
35462         if (sizeof(int) < sizeof(long)) {
35463             __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
35464         } else {
35465             long val = PyInt_AS_LONG(x);
35466             if (is_unsigned && unlikely(val < 0)) {
35467                 goto raise_neg_overflow;
35468             }
35469             return (int) val;
35470         }
35471     } else
35472 #endif
35473     if (likely(PyLong_Check(x))) {
35474         if (is_unsigned) {
35475 #if CYTHON_USE_PYLONG_INTERNALS
35476             const digit* digits = ((PyLongObject*)x)->ob_digit;
35477             switch (Py_SIZE(x)) {
35478                 case  0: return (int) 0;
35479                 case  1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
35480                 case 2:
35481                     if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
35482                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
35483                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
35484                         } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
35485                             return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
35486                         }
35487                     }
35488                     break;
35489                 case 3:
35490                     if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
35491                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
35492                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
35493                         } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
35494                             return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
35495                         }
35496                     }
35497                     break;
35498                 case 4:
35499                     if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
35500                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
35501                             __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])))
35502                         } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
35503                             return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
35504                         }
35505                     }
35506                     break;
35507             }
35508 #endif
35509 #if CYTHON_COMPILING_IN_CPYTHON
35510             if (unlikely(Py_SIZE(x) < 0)) {
35511                 goto raise_neg_overflow;
35512             }
35513 #else
35514             {
35515                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
35516                 if (unlikely(result < 0))
35517                     return (int) -1;
35518                 if (unlikely(result == 1))
35519                     goto raise_neg_overflow;
35520             }
35521 #endif
35522             if (sizeof(int) <= sizeof(unsigned long)) {
35523                 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
35524 #ifdef HAVE_LONG_LONG
35525             } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
35526                 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
35527 #endif
35528             }
35529         } else {
35530 #if CYTHON_USE_PYLONG_INTERNALS
35531             const digit* digits = ((PyLongObject*)x)->ob_digit;
35532             switch (Py_SIZE(x)) {
35533                 case  0: return (int) 0;
35534                 case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
35535                 case  1: __PYX_VERIFY_RETURN_INT(int,  digit, +digits[0])
35536                 case -2:
35537                     if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
35538                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
35539                             __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
35540                         } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
35541                             return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
35542                         }
35543                     }
35544                     break;
35545                 case 2:
35546                     if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
35547                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
35548                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
35549                         } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
35550                             return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
35551                         }
35552                     }
35553                     break;
35554                 case -3:
35555                     if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
35556                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
35557                             __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
35558                         } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
35559                             return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
35560                         }
35561                     }
35562                     break;
35563                 case 3:
35564                     if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
35565                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
35566                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
35567                         } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
35568                             return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
35569                         }
35570                     }
35571                     break;
35572                 case -4:
35573                     if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
35574                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
35575                             __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])))
35576                         } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
35577                             return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
35578                         }
35579                     }
35580                     break;
35581                 case 4:
35582                     if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
35583                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
35584                             __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])))
35585                         } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
35586                             return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
35587                         }
35588                     }
35589                     break;
35590             }
35591 #endif
35592             if (sizeof(int) <= sizeof(long)) {
35593                 __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
35594 #ifdef HAVE_LONG_LONG
35595             } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
35596                 __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
35597 #endif
35598             }
35599         }
35600         {
35601 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
35602             PyErr_SetString(PyExc_RuntimeError,
35603                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
35604 #else
35605             int val;
35606             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
35607  #if PY_MAJOR_VERSION < 3
35608             if (likely(v) && !PyLong_Check(v)) {
35609                 PyObject *tmp = v;
35610                 v = PyNumber_Long(tmp);
35611                 Py_DECREF(tmp);
35612             }
35613  #endif
35614             if (likely(v)) {
35615                 int one = 1; int is_little = (int)*(unsigned char *)&one;
35616                 unsigned char *bytes = (unsigned char *)&val;
35617                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
35618                                               bytes, sizeof(val),
35619                                               is_little, !is_unsigned);
35620                 Py_DECREF(v);
35621                 if (likely(!ret))
35622                     return val;
35623             }
35624 #endif
35625             return (int) -1;
35626         }
35627     } else {
35628         int val;
35629         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
35630         if (!tmp) return (int) -1;
35631         val = __Pyx_PyInt_As_int(tmp);
35632         Py_DECREF(tmp);
35633         return val;
35634     }
35635 raise_overflow:
35636     PyErr_SetString(PyExc_OverflowError,
35637         "value too large to convert to int");
35638     return (int) -1;
35639 raise_neg_overflow:
35640     PyErr_SetString(PyExc_OverflowError,
35641         "can't convert negative value to int");
35642     return (int) -1;
35643 }
35644 
35645 /* CIntFromPy */
__Pyx_PyInt_As_size_t(PyObject * x)35646 static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *x) {
35647 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
35648 #pragma GCC diagnostic push
35649 #pragma GCC diagnostic ignored "-Wconversion"
35650 #endif
35651     const size_t neg_one = (size_t) -1, const_zero = (size_t) 0;
35652 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
35653 #pragma GCC diagnostic pop
35654 #endif
35655     const int is_unsigned = neg_one > const_zero;
35656 #if PY_MAJOR_VERSION < 3
35657     if (likely(PyInt_Check(x))) {
35658         if (sizeof(size_t) < sizeof(long)) {
35659             __PYX_VERIFY_RETURN_INT(size_t, long, PyInt_AS_LONG(x))
35660         } else {
35661             long val = PyInt_AS_LONG(x);
35662             if (is_unsigned && unlikely(val < 0)) {
35663                 goto raise_neg_overflow;
35664             }
35665             return (size_t) val;
35666         }
35667     } else
35668 #endif
35669     if (likely(PyLong_Check(x))) {
35670         if (is_unsigned) {
35671 #if CYTHON_USE_PYLONG_INTERNALS
35672             const digit* digits = ((PyLongObject*)x)->ob_digit;
35673             switch (Py_SIZE(x)) {
35674                 case  0: return (size_t) 0;
35675                 case  1: __PYX_VERIFY_RETURN_INT(size_t, digit, digits[0])
35676                 case 2:
35677                     if (8 * sizeof(size_t) > 1 * PyLong_SHIFT) {
35678                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
35679                             __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
35680                         } else if (8 * sizeof(size_t) >= 2 * PyLong_SHIFT) {
35681                             return (size_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
35682                         }
35683                     }
35684                     break;
35685                 case 3:
35686                     if (8 * sizeof(size_t) > 2 * PyLong_SHIFT) {
35687                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
35688                             __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
35689                         } else if (8 * sizeof(size_t) >= 3 * PyLong_SHIFT) {
35690                             return (size_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
35691                         }
35692                     }
35693                     break;
35694                 case 4:
35695                     if (8 * sizeof(size_t) > 3 * PyLong_SHIFT) {
35696                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
35697                             __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
35698                         } else if (8 * sizeof(size_t) >= 4 * PyLong_SHIFT) {
35699                             return (size_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
35700                         }
35701                     }
35702                     break;
35703             }
35704 #endif
35705 #if CYTHON_COMPILING_IN_CPYTHON
35706             if (unlikely(Py_SIZE(x) < 0)) {
35707                 goto raise_neg_overflow;
35708             }
35709 #else
35710             {
35711                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
35712                 if (unlikely(result < 0))
35713                     return (size_t) -1;
35714                 if (unlikely(result == 1))
35715                     goto raise_neg_overflow;
35716             }
35717 #endif
35718             if (sizeof(size_t) <= sizeof(unsigned long)) {
35719                 __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned long, PyLong_AsUnsignedLong(x))
35720 #ifdef HAVE_LONG_LONG
35721             } else if (sizeof(size_t) <= sizeof(unsigned PY_LONG_LONG)) {
35722                 __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
35723 #endif
35724             }
35725         } else {
35726 #if CYTHON_USE_PYLONG_INTERNALS
35727             const digit* digits = ((PyLongObject*)x)->ob_digit;
35728             switch (Py_SIZE(x)) {
35729                 case  0: return (size_t) 0;
35730                 case -1: __PYX_VERIFY_RETURN_INT(size_t, sdigit, (sdigit) (-(sdigit)digits[0]))
35731                 case  1: __PYX_VERIFY_RETURN_INT(size_t,  digit, +digits[0])
35732                 case -2:
35733                     if (8 * sizeof(size_t) - 1 > 1 * PyLong_SHIFT) {
35734                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
35735                             __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
35736                         } else if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) {
35737                             return (size_t) (((size_t)-1)*(((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
35738                         }
35739                     }
35740                     break;
35741                 case 2:
35742                     if (8 * sizeof(size_t) > 1 * PyLong_SHIFT) {
35743                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
35744                             __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
35745                         } else if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) {
35746                             return (size_t) ((((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
35747                         }
35748                     }
35749                     break;
35750                 case -3:
35751                     if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) {
35752                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
35753                             __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
35754                         } else if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) {
35755                             return (size_t) (((size_t)-1)*(((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
35756                         }
35757                     }
35758                     break;
35759                 case 3:
35760                     if (8 * sizeof(size_t) > 2 * PyLong_SHIFT) {
35761                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
35762                             __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
35763                         } else if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) {
35764                             return (size_t) ((((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
35765                         }
35766                     }
35767                     break;
35768                 case -4:
35769                     if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) {
35770                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
35771                             __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
35772                         } else if (8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT) {
35773                             return (size_t) (((size_t)-1)*(((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
35774                         }
35775                     }
35776                     break;
35777                 case 4:
35778                     if (8 * sizeof(size_t) > 3 * PyLong_SHIFT) {
35779                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
35780                             __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
35781                         } else if (8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT) {
35782                             return (size_t) ((((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
35783                         }
35784                     }
35785                     break;
35786             }
35787 #endif
35788             if (sizeof(size_t) <= sizeof(long)) {
35789                 __PYX_VERIFY_RETURN_INT_EXC(size_t, long, PyLong_AsLong(x))
35790 #ifdef HAVE_LONG_LONG
35791             } else if (sizeof(size_t) <= sizeof(PY_LONG_LONG)) {
35792                 __PYX_VERIFY_RETURN_INT_EXC(size_t, PY_LONG_LONG, PyLong_AsLongLong(x))
35793 #endif
35794             }
35795         }
35796         {
35797 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
35798             PyErr_SetString(PyExc_RuntimeError,
35799                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
35800 #else
35801             size_t val;
35802             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
35803  #if PY_MAJOR_VERSION < 3
35804             if (likely(v) && !PyLong_Check(v)) {
35805                 PyObject *tmp = v;
35806                 v = PyNumber_Long(tmp);
35807                 Py_DECREF(tmp);
35808             }
35809  #endif
35810             if (likely(v)) {
35811                 int one = 1; int is_little = (int)*(unsigned char *)&one;
35812                 unsigned char *bytes = (unsigned char *)&val;
35813                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
35814                                               bytes, sizeof(val),
35815                                               is_little, !is_unsigned);
35816                 Py_DECREF(v);
35817                 if (likely(!ret))
35818                     return val;
35819             }
35820 #endif
35821             return (size_t) -1;
35822         }
35823     } else {
35824         size_t val;
35825         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
35826         if (!tmp) return (size_t) -1;
35827         val = __Pyx_PyInt_As_size_t(tmp);
35828         Py_DECREF(tmp);
35829         return val;
35830     }
35831 raise_overflow:
35832     PyErr_SetString(PyExc_OverflowError,
35833         "value too large to convert to size_t");
35834     return (size_t) -1;
35835 raise_neg_overflow:
35836     PyErr_SetString(PyExc_OverflowError,
35837         "can't convert negative value to size_t");
35838     return (size_t) -1;
35839 }
35840 
35841 /* CIntToPy */
__Pyx_PyInt_From_int(int value)35842 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
35843 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
35844 #pragma GCC diagnostic push
35845 #pragma GCC diagnostic ignored "-Wconversion"
35846 #endif
35847     const int neg_one = (int) -1, const_zero = (int) 0;
35848 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
35849 #pragma GCC diagnostic pop
35850 #endif
35851     const int is_unsigned = neg_one > const_zero;
35852     if (is_unsigned) {
35853         if (sizeof(int) < sizeof(long)) {
35854             return PyInt_FromLong((long) value);
35855         } else if (sizeof(int) <= sizeof(unsigned long)) {
35856             return PyLong_FromUnsignedLong((unsigned long) value);
35857 #ifdef HAVE_LONG_LONG
35858         } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
35859             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
35860 #endif
35861         }
35862     } else {
35863         if (sizeof(int) <= sizeof(long)) {
35864             return PyInt_FromLong((long) value);
35865 #ifdef HAVE_LONG_LONG
35866         } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
35867             return PyLong_FromLongLong((PY_LONG_LONG) value);
35868 #endif
35869         }
35870     }
35871     {
35872         int one = 1; int little = (int)*(unsigned char *)&one;
35873         unsigned char *bytes = (unsigned char *)&value;
35874         return _PyLong_FromByteArray(bytes, sizeof(int),
35875                                      little, !is_unsigned);
35876     }
35877 }
35878 
35879 /* CIntFromPy */
__Pyx_PyInt_As_long(PyObject * x)35880 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
35881 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
35882 #pragma GCC diagnostic push
35883 #pragma GCC diagnostic ignored "-Wconversion"
35884 #endif
35885     const long neg_one = (long) -1, const_zero = (long) 0;
35886 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
35887 #pragma GCC diagnostic pop
35888 #endif
35889     const int is_unsigned = neg_one > const_zero;
35890 #if PY_MAJOR_VERSION < 3
35891     if (likely(PyInt_Check(x))) {
35892         if (sizeof(long) < sizeof(long)) {
35893             __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
35894         } else {
35895             long val = PyInt_AS_LONG(x);
35896             if (is_unsigned && unlikely(val < 0)) {
35897                 goto raise_neg_overflow;
35898             }
35899             return (long) val;
35900         }
35901     } else
35902 #endif
35903     if (likely(PyLong_Check(x))) {
35904         if (is_unsigned) {
35905 #if CYTHON_USE_PYLONG_INTERNALS
35906             const digit* digits = ((PyLongObject*)x)->ob_digit;
35907             switch (Py_SIZE(x)) {
35908                 case  0: return (long) 0;
35909                 case  1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
35910                 case 2:
35911                     if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
35912                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
35913                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
35914                         } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
35915                             return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
35916                         }
35917                     }
35918                     break;
35919                 case 3:
35920                     if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
35921                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
35922                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
35923                         } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
35924                             return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
35925                         }
35926                     }
35927                     break;
35928                 case 4:
35929                     if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
35930                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
35931                             __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])))
35932                         } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
35933                             return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
35934                         }
35935                     }
35936                     break;
35937             }
35938 #endif
35939 #if CYTHON_COMPILING_IN_CPYTHON
35940             if (unlikely(Py_SIZE(x) < 0)) {
35941                 goto raise_neg_overflow;
35942             }
35943 #else
35944             {
35945                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
35946                 if (unlikely(result < 0))
35947                     return (long) -1;
35948                 if (unlikely(result == 1))
35949                     goto raise_neg_overflow;
35950             }
35951 #endif
35952             if (sizeof(long) <= sizeof(unsigned long)) {
35953                 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
35954 #ifdef HAVE_LONG_LONG
35955             } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
35956                 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
35957 #endif
35958             }
35959         } else {
35960 #if CYTHON_USE_PYLONG_INTERNALS
35961             const digit* digits = ((PyLongObject*)x)->ob_digit;
35962             switch (Py_SIZE(x)) {
35963                 case  0: return (long) 0;
35964                 case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
35965                 case  1: __PYX_VERIFY_RETURN_INT(long,  digit, +digits[0])
35966                 case -2:
35967                     if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
35968                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
35969                             __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
35970                         } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
35971                             return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
35972                         }
35973                     }
35974                     break;
35975                 case 2:
35976                     if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
35977                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
35978                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
35979                         } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
35980                             return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
35981                         }
35982                     }
35983                     break;
35984                 case -3:
35985                     if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
35986                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
35987                             __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
35988                         } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
35989                             return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
35990                         }
35991                     }
35992                     break;
35993                 case 3:
35994                     if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
35995                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
35996                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
35997                         } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
35998                             return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
35999                         }
36000                     }
36001                     break;
36002                 case -4:
36003                     if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
36004                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
36005                             __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])))
36006                         } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
36007                             return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
36008                         }
36009                     }
36010                     break;
36011                 case 4:
36012                     if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
36013                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
36014                             __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])))
36015                         } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
36016                             return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
36017                         }
36018                     }
36019                     break;
36020             }
36021 #endif
36022             if (sizeof(long) <= sizeof(long)) {
36023                 __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
36024 #ifdef HAVE_LONG_LONG
36025             } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
36026                 __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
36027 #endif
36028             }
36029         }
36030         {
36031 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
36032             PyErr_SetString(PyExc_RuntimeError,
36033                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
36034 #else
36035             long val;
36036             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
36037  #if PY_MAJOR_VERSION < 3
36038             if (likely(v) && !PyLong_Check(v)) {
36039                 PyObject *tmp = v;
36040                 v = PyNumber_Long(tmp);
36041                 Py_DECREF(tmp);
36042             }
36043  #endif
36044             if (likely(v)) {
36045                 int one = 1; int is_little = (int)*(unsigned char *)&one;
36046                 unsigned char *bytes = (unsigned char *)&val;
36047                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
36048                                               bytes, sizeof(val),
36049                                               is_little, !is_unsigned);
36050                 Py_DECREF(v);
36051                 if (likely(!ret))
36052                     return val;
36053             }
36054 #endif
36055             return (long) -1;
36056         }
36057     } else {
36058         long val;
36059         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
36060         if (!tmp) return (long) -1;
36061         val = __Pyx_PyInt_As_long(tmp);
36062         Py_DECREF(tmp);
36063         return val;
36064     }
36065 raise_overflow:
36066     PyErr_SetString(PyExc_OverflowError,
36067         "value too large to convert to long");
36068     return (long) -1;
36069 raise_neg_overflow:
36070     PyErr_SetString(PyExc_OverflowError,
36071         "can't convert negative value to long");
36072     return (long) -1;
36073 }
36074 
36075 /* FastTypeChecks */
36076 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_InBases(PyTypeObject * a,PyTypeObject * b)36077 static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
36078     while (a) {
36079         a = a->tp_base;
36080         if (a == b)
36081             return 1;
36082     }
36083     return b == &PyBaseObject_Type;
36084 }
__Pyx_IsSubtype(PyTypeObject * a,PyTypeObject * b)36085 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
36086     PyObject *mro;
36087     if (a == b) return 1;
36088     mro = a->tp_mro;
36089     if (likely(mro)) {
36090         Py_ssize_t i, n;
36091         n = PyTuple_GET_SIZE(mro);
36092         for (i = 0; i < n; i++) {
36093             if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
36094                 return 1;
36095         }
36096         return 0;
36097     }
36098     return __Pyx_InBases(a, b);
36099 }
36100 #if PY_MAJOR_VERSION == 2
__Pyx_inner_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)36101 static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
36102     PyObject *exception, *value, *tb;
36103     int res;
36104     __Pyx_PyThreadState_declare
36105     __Pyx_PyThreadState_assign
36106     __Pyx_ErrFetch(&exception, &value, &tb);
36107     res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
36108     if (unlikely(res == -1)) {
36109         PyErr_WriteUnraisable(err);
36110         res = 0;
36111     }
36112     if (!res) {
36113         res = PyObject_IsSubclass(err, exc_type2);
36114         if (unlikely(res == -1)) {
36115             PyErr_WriteUnraisable(err);
36116             res = 0;
36117         }
36118     }
36119     __Pyx_ErrRestore(exception, value, tb);
36120     return res;
36121 }
36122 #else
__Pyx_inner_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)36123 static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
36124     int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
36125     if (!res) {
36126         res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
36127     }
36128     return res;
36129 }
36130 #endif
__Pyx_PyErr_GivenExceptionMatchesTuple(PyObject * exc_type,PyObject * tuple)36131 static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
36132     Py_ssize_t i, n;
36133     assert(PyExceptionClass_Check(exc_type));
36134     n = PyTuple_GET_SIZE(tuple);
36135 #if PY_MAJOR_VERSION >= 3
36136     for (i=0; i<n; i++) {
36137         if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
36138     }
36139 #endif
36140     for (i=0; i<n; i++) {
36141         PyObject *t = PyTuple_GET_ITEM(tuple, i);
36142         #if PY_MAJOR_VERSION < 3
36143         if (likely(exc_type == t)) return 1;
36144         #endif
36145         if (likely(PyExceptionClass_Check(t))) {
36146             if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
36147         } else {
36148         }
36149     }
36150     return 0;
36151 }
__Pyx_PyErr_GivenExceptionMatches(PyObject * err,PyObject * exc_type)36152 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
36153     if (likely(err == exc_type)) return 1;
36154     if (likely(PyExceptionClass_Check(err))) {
36155         if (likely(PyExceptionClass_Check(exc_type))) {
36156             return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
36157         } else if (likely(PyTuple_Check(exc_type))) {
36158             return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
36159         } else {
36160         }
36161     }
36162     return PyErr_GivenExceptionMatches(err, exc_type);
36163 }
__Pyx_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)36164 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
36165     assert(PyExceptionClass_Check(exc_type1));
36166     assert(PyExceptionClass_Check(exc_type2));
36167     if (likely(err == exc_type1 || err == exc_type2)) return 1;
36168     if (likely(PyExceptionClass_Check(err))) {
36169         return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
36170     }
36171     return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
36172 }
36173 #endif
36174 
36175 /* CheckBinaryVersion */
__Pyx_check_binary_version(void)36176 static int __Pyx_check_binary_version(void) {
36177     char ctversion[4], rtversion[4];
36178     PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
36179     PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
36180     if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
36181         char message[200];
36182         PyOS_snprintf(message, sizeof(message),
36183                       "compiletime version %s of module '%.100s' "
36184                       "does not match runtime version %s",
36185                       ctversion, __Pyx_MODULE_NAME, rtversion);
36186         return PyErr_WarnEx(NULL, message, 1);
36187     }
36188     return 0;
36189 }
36190 
36191 /* InitStrings */
__Pyx_InitStrings(__Pyx_StringTabEntry * t)36192 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
36193     while (t->p) {
36194         #if PY_MAJOR_VERSION < 3
36195         if (t->is_unicode) {
36196             *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
36197         } else if (t->intern) {
36198             *t->p = PyString_InternFromString(t->s);
36199         } else {
36200             *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
36201         }
36202         #else
36203         if (t->is_unicode | t->is_str) {
36204             if (t->intern) {
36205                 *t->p = PyUnicode_InternFromString(t->s);
36206             } else if (t->encoding) {
36207                 *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
36208             } else {
36209                 *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
36210             }
36211         } else {
36212             *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
36213         }
36214         #endif
36215         if (!*t->p)
36216             return -1;
36217         if (PyObject_Hash(*t->p) == -1)
36218             return -1;
36219         ++t;
36220     }
36221     return 0;
36222 }
36223 
__Pyx_PyUnicode_FromString(const char * c_str)36224 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
36225     return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
36226 }
__Pyx_PyObject_AsString(PyObject * o)36227 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
36228     Py_ssize_t ignore;
36229     return __Pyx_PyObject_AsStringAndSize(o, &ignore);
36230 }
36231 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
36232 #if !CYTHON_PEP393_ENABLED
__Pyx_PyUnicode_AsStringAndSize(PyObject * o,Py_ssize_t * length)36233 static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
36234     char* defenc_c;
36235     PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
36236     if (!defenc) return NULL;
36237     defenc_c = PyBytes_AS_STRING(defenc);
36238 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
36239     {
36240         char* end = defenc_c + PyBytes_GET_SIZE(defenc);
36241         char* c;
36242         for (c = defenc_c; c < end; c++) {
36243             if ((unsigned char) (*c) >= 128) {
36244                 PyUnicode_AsASCIIString(o);
36245                 return NULL;
36246             }
36247         }
36248     }
36249 #endif
36250     *length = PyBytes_GET_SIZE(defenc);
36251     return defenc_c;
36252 }
36253 #else
__Pyx_PyUnicode_AsStringAndSize(PyObject * o,Py_ssize_t * length)36254 static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
36255     if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
36256 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
36257     if (likely(PyUnicode_IS_ASCII(o))) {
36258         *length = PyUnicode_GET_LENGTH(o);
36259         return PyUnicode_AsUTF8(o);
36260     } else {
36261         PyUnicode_AsASCIIString(o);
36262         return NULL;
36263     }
36264 #else
36265     return PyUnicode_AsUTF8AndSize(o, length);
36266 #endif
36267 }
36268 #endif
36269 #endif
__Pyx_PyObject_AsStringAndSize(PyObject * o,Py_ssize_t * length)36270 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
36271 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
36272     if (
36273 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
36274             __Pyx_sys_getdefaultencoding_not_ascii &&
36275 #endif
36276             PyUnicode_Check(o)) {
36277         return __Pyx_PyUnicode_AsStringAndSize(o, length);
36278     } else
36279 #endif
36280 #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
36281     if (PyByteArray_Check(o)) {
36282         *length = PyByteArray_GET_SIZE(o);
36283         return PyByteArray_AS_STRING(o);
36284     } else
36285 #endif
36286     {
36287         char* result;
36288         int r = PyBytes_AsStringAndSize(o, &result, length);
36289         if (unlikely(r < 0)) {
36290             return NULL;
36291         } else {
36292             return result;
36293         }
36294     }
36295 }
__Pyx_PyObject_IsTrue(PyObject * x)36296 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
36297    int is_true = x == Py_True;
36298    if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
36299    else return PyObject_IsTrue(x);
36300 }
__Pyx_PyObject_IsTrueAndDecref(PyObject * x)36301 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
36302     int retval;
36303     if (unlikely(!x)) return -1;
36304     retval = __Pyx_PyObject_IsTrue(x);
36305     Py_DECREF(x);
36306     return retval;
36307 }
__Pyx_PyNumber_IntOrLongWrongResultType(PyObject * result,const char * type_name)36308 static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
36309 #if PY_MAJOR_VERSION >= 3
36310     if (PyLong_Check(result)) {
36311         if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
36312                 "__int__ returned non-int (type %.200s).  "
36313                 "The ability to return an instance of a strict subclass of int "
36314                 "is deprecated, and may be removed in a future version of Python.",
36315                 Py_TYPE(result)->tp_name)) {
36316             Py_DECREF(result);
36317             return NULL;
36318         }
36319         return result;
36320     }
36321 #endif
36322     PyErr_Format(PyExc_TypeError,
36323                  "__%.4s__ returned non-%.4s (type %.200s)",
36324                  type_name, type_name, Py_TYPE(result)->tp_name);
36325     Py_DECREF(result);
36326     return NULL;
36327 }
__Pyx_PyNumber_IntOrLong(PyObject * x)36328 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
36329 #if CYTHON_USE_TYPE_SLOTS
36330   PyNumberMethods *m;
36331 #endif
36332   const char *name = NULL;
36333   PyObject *res = NULL;
36334 #if PY_MAJOR_VERSION < 3
36335   if (likely(PyInt_Check(x) || PyLong_Check(x)))
36336 #else
36337   if (likely(PyLong_Check(x)))
36338 #endif
36339     return __Pyx_NewRef(x);
36340 #if CYTHON_USE_TYPE_SLOTS
36341   m = Py_TYPE(x)->tp_as_number;
36342   #if PY_MAJOR_VERSION < 3
36343   if (m && m->nb_int) {
36344     name = "int";
36345     res = m->nb_int(x);
36346   }
36347   else if (m && m->nb_long) {
36348     name = "long";
36349     res = m->nb_long(x);
36350   }
36351   #else
36352   if (likely(m && m->nb_int)) {
36353     name = "int";
36354     res = m->nb_int(x);
36355   }
36356   #endif
36357 #else
36358   if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
36359     res = PyNumber_Int(x);
36360   }
36361 #endif
36362   if (likely(res)) {
36363 #if PY_MAJOR_VERSION < 3
36364     if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
36365 #else
36366     if (unlikely(!PyLong_CheckExact(res))) {
36367 #endif
36368         return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
36369     }
36370   }
36371   else if (!PyErr_Occurred()) {
36372     PyErr_SetString(PyExc_TypeError,
36373                     "an integer is required");
36374   }
36375   return res;
36376 }
36377 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
36378   Py_ssize_t ival;
36379   PyObject *x;
36380 #if PY_MAJOR_VERSION < 3
36381   if (likely(PyInt_CheckExact(b))) {
36382     if (sizeof(Py_ssize_t) >= sizeof(long))
36383         return PyInt_AS_LONG(b);
36384     else
36385         return PyInt_AsSsize_t(b);
36386   }
36387 #endif
36388   if (likely(PyLong_CheckExact(b))) {
36389     #if CYTHON_USE_PYLONG_INTERNALS
36390     const digit* digits = ((PyLongObject*)b)->ob_digit;
36391     const Py_ssize_t size = Py_SIZE(b);
36392     if (likely(__Pyx_sst_abs(size) <= 1)) {
36393         ival = likely(size) ? digits[0] : 0;
36394         if (size == -1) ival = -ival;
36395         return ival;
36396     } else {
36397       switch (size) {
36398          case 2:
36399            if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
36400              return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
36401            }
36402            break;
36403          case -2:
36404            if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
36405              return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
36406            }
36407            break;
36408          case 3:
36409            if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
36410              return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
36411            }
36412            break;
36413          case -3:
36414            if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
36415              return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
36416            }
36417            break;
36418          case 4:
36419            if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
36420              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]));
36421            }
36422            break;
36423          case -4:
36424            if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
36425              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]));
36426            }
36427            break;
36428       }
36429     }
36430     #endif
36431     return PyLong_AsSsize_t(b);
36432   }
36433   x = PyNumber_Index(b);
36434   if (!x) return -1;
36435   ival = PyInt_AsSsize_t(x);
36436   Py_DECREF(x);
36437   return ival;
36438 }
36439 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
36440   return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
36441 }
36442 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
36443     return PyInt_FromSize_t(ival);
36444 }
36445 
36446 
36447 #endif /* Py_PYTHON_H */
36448