1 /* Generated by Cython 0.14.1 on Tue Mar 8 19:41:56 2011 */
3 #define PY_SSIZE_T_CLEAN
6 #error Python headers needed to compile C extensions, please install development version of Python.
9 #include <stddef.h> /* For offsetof */
11 #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
14 #if !defined(WIN32) && !defined(MS_WINDOWS)
27 #define DL_IMPORT(t) t
30 #define DL_EXPORT(t) t
34 #define PY_LONG_LONG LONG_LONG
37 #if PY_VERSION_HEX < 0x02040000
38 #define METH_COEXIST 0
39 #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type)
40 #define PyDict_Contains(d,o) PySequence_Contains(d,o)
43 #if PY_VERSION_HEX < 0x02050000
44 typedef int Py_ssize_t;
45 #define PY_SSIZE_T_MAX INT_MAX
46 #define PY_SSIZE_T_MIN INT_MIN
47 #define PY_FORMAT_SIZE_T ""
48 #define PyInt_FromSsize_t(z) PyInt_FromLong(z)
49 #define PyInt_AsSsize_t(o) PyInt_AsLong(o)
50 #define PyNumber_Index(o) PyNumber_Int(o)
51 #define PyIndex_Check(o) PyNumber_Check(o)
52 #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message)
55 #if PY_VERSION_HEX < 0x02060000
56 #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt)
57 #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type)
58 #define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size)
59 #define PyVarObject_HEAD_INIT(type, size) \
60 PyObject_HEAD_INIT(type) size,
61 #define PyType_Modified(t)
73 Py_ssize_t *suboffsets;
77 #define PyBUF_SIMPLE 0
78 #define PyBUF_WRITABLE 0x0001
79 #define PyBUF_FORMAT 0x0004
80 #define PyBUF_ND 0x0008
81 #define PyBUF_STRIDES (0x0010 | PyBUF_ND)
82 #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES)
83 #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES)
84 #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES)
85 #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES)
89 #if PY_MAJOR_VERSION < 3
90 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
92 #define __Pyx_BUILTIN_MODULE_NAME "builtins"
95 #if PY_MAJOR_VERSION >= 3
96 #define Py_TPFLAGS_CHECKTYPES 0
97 #define Py_TPFLAGS_HAVE_INDEX 0
100 #if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3)
101 #define Py_TPFLAGS_HAVE_NEWBUFFER 0
104 #if PY_MAJOR_VERSION >= 3
105 #define PyBaseString_Type PyUnicode_Type
106 #define PyStringObject PyUnicodeObject
107 #define PyString_Type PyUnicode_Type
108 #define PyString_Check PyUnicode_Check
109 #define PyString_CheckExact PyUnicode_CheckExact
112 #if PY_VERSION_HEX < 0x02060000
113 #define PyBytesObject PyStringObject
114 #define PyBytes_Type PyString_Type
115 #define PyBytes_Check PyString_Check
116 #define PyBytes_CheckExact PyString_CheckExact
117 #define PyBytes_FromString PyString_FromString
118 #define PyBytes_FromStringAndSize PyString_FromStringAndSize
119 #define PyBytes_FromFormat PyString_FromFormat
120 #define PyBytes_DecodeEscape PyString_DecodeEscape
121 #define PyBytes_AsString PyString_AsString
122 #define PyBytes_AsStringAndSize PyString_AsStringAndSize
123 #define PyBytes_Size PyString_Size
124 #define PyBytes_AS_STRING PyString_AS_STRING
125 #define PyBytes_GET_SIZE PyString_GET_SIZE
126 #define PyBytes_Repr PyString_Repr
127 #define PyBytes_Concat PyString_Concat
128 #define PyBytes_ConcatAndDel PyString_ConcatAndDel
131 #if PY_VERSION_HEX < 0x02060000
132 #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type)
133 #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type)
135 #ifndef PySet_CheckExact
136 #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
139 #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
141 #if PY_MAJOR_VERSION >= 3
142 #define PyIntObject PyLongObject
143 #define PyInt_Type PyLong_Type
144 #define PyInt_Check(op) PyLong_Check(op)
145 #define PyInt_CheckExact(op) PyLong_CheckExact(op)
146 #define PyInt_FromString PyLong_FromString
147 #define PyInt_FromUnicode PyLong_FromUnicode
148 #define PyInt_FromLong PyLong_FromLong
149 #define PyInt_FromSize_t PyLong_FromSize_t
150 #define PyInt_FromSsize_t PyLong_FromSsize_t
151 #define PyInt_AsLong PyLong_AsLong
152 #define PyInt_AS_LONG PyLong_AS_LONG
153 #define PyInt_AsSsize_t PyLong_AsSsize_t
154 #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
155 #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
158 #if PY_MAJOR_VERSION >= 3
159 #define PyBoolObject PyLongObject
163 #if PY_MAJOR_VERSION >= 3
164 #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
165 #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
167 #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
168 #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
171 #if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300)
172 #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b)
173 #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value)
174 #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b)
176 #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \
177 (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \
178 (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \
179 (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0)))
180 #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \
181 (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
182 (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \
183 (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1)))
184 #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \
185 (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
186 (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \
187 (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1)))
190 #if PY_MAJOR_VERSION >= 3
191 #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
194 #if PY_VERSION_HEX < 0x02050000
195 #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n)))
196 #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a))
197 #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n)))
199 #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n))
200 #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a))
201 #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n))
204 #if PY_VERSION_HEX < 0x02050000
205 #define __Pyx_NAMESTR(n) ((char *)(n))
206 #define __Pyx_DOCSTR(n) ((char *)(n))
208 #define __Pyx_NAMESTR(n) (n)
209 #define __Pyx_DOCSTR(n) (n)
213 #define __PYX_EXTERN_C extern "C"
215 #define __PYX_EXTERN_C extern
218 #if defined(WIN32) || defined(MS_WINDOWS)
219 #define _USE_MATH_DEFINES
222 #define __PYX_HAVE_API__twisted__test__raiser
224 #ifdef PYREX_WITHOUT_ASSERTIONS
225 #define CYTHON_WITHOUT_ASSERTIONS
229 /* inline attribute */
230 #ifndef CYTHON_INLINE
231 #if defined(__GNUC__)
232 #define CYTHON_INLINE __inline__
233 #elif defined(_MSC_VER)
234 #define CYTHON_INLINE __inline
235 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
236 #define CYTHON_INLINE inline
238 #define CYTHON_INLINE
242 /* unused attribute */
243 #ifndef CYTHON_UNUSED
244 # if defined(__GNUC__)
245 # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
246 # define CYTHON_UNUSED __attribute__ ((__unused__))
248 # define CYTHON_UNUSED
250 # elif defined(__ICC) || defined(__INTEL_COMPILER)
251 # define CYTHON_UNUSED __attribute__ ((__unused__))
253 # define CYTHON_UNUSED
257 typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/
260 /* Type Conversion Predeclarations */
262 #define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s)
263 #define __Pyx_PyBytes_AsUString(s) ((unsigned char*) PyBytes_AsString(s))
265 #define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False))
266 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
267 static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x);
269 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
270 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
271 static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*);
273 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
277 /* Test for GCC > 2.95 */
278 #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))
279 #define likely(x) __builtin_expect(!!(x), 1)
280 #define unlikely(x) __builtin_expect(!!(x), 0)
281 #else /* __GNUC__ > 2 ... */
282 #define likely(x) (x)
283 #define unlikely(x) (x)
284 #endif /* __GNUC__ > 2 ... */
286 #define likely(x) (x)
287 #define unlikely(x) (x)
288 #endif /* __GNUC__ */
290 static PyObject *__pyx_m;
291 static PyObject *__pyx_b;
292 static PyObject *__pyx_empty_tuple;
293 static PyObject *__pyx_empty_bytes;
294 static int __pyx_lineno;
295 static int __pyx_clineno = 0;
296 static const char * __pyx_cfilenm= __FILE__;
297 static const char *__pyx_filename;
300 static const char *__pyx_f[] = {
304 /* Type declarations */
306 #ifndef CYTHON_REFNANNY
307 #define CYTHON_REFNANNY 0
312 void (*INCREF)(void*, PyObject*, int);
313 void (*DECREF)(void*, PyObject*, int);
314 void (*GOTREF)(void*, PyObject*, int);
315 void (*GIVEREF)(void*, PyObject*, int);
316 void* (*SetupContext)(const char*, int, const char*);
317 void (*FinishContext)(void**);
318 } __Pyx_RefNannyAPIStruct;
319 static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
320 static __Pyx_RefNannyAPIStruct * __Pyx_RefNannyImportAPI(const char *modname) {
321 PyObject *m = NULL, *p = NULL;
323 m = PyImport_ImportModule((char *)modname);
325 p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
327 r = PyLong_AsVoidPtr(p);
331 return (__Pyx_RefNannyAPIStruct *)r;
333 #define __Pyx_RefNannySetupContext(name) void *__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
334 #define __Pyx_RefNannyFinishContext() __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
335 #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
336 #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
337 #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
338 #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
339 #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r);} } while(0)
341 #define __Pyx_RefNannySetupContext(name)
342 #define __Pyx_RefNannyFinishContext()
343 #define __Pyx_INCREF(r) Py_INCREF(r)
344 #define __Pyx_DECREF(r) Py_DECREF(r)
345 #define __Pyx_GOTREF(r)
346 #define __Pyx_GIVEREF(r)
347 #define __Pyx_XDECREF(r) Py_XDECREF(r)
348 #endif /* CYTHON_REFNANNY */
349 #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);} } while(0)
350 #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r);} } while(0)
352 static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/
354 static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
355 static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
357 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
359 static PyObject *__Pyx_FindPy2Metaclass(PyObject *bases); /*proto*/
361 static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name,
362 PyObject *modname); /*proto*/
364 static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *);
366 static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *);
368 static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *);
370 static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *);
372 static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *);
374 static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *);
376 static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *);
378 static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *);
380 static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *);
382 static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *);
384 static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *);
386 static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *);
388 static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *);
390 static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *);
392 static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *);
394 static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *);
396 static void __Pyx_AddTraceback(const char *funcname); /*proto*/
398 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
399 /* Module declarations from twisted.test.raiser */
401 #define __Pyx_MODULE_NAME "twisted.test.raiser"
402 static int __pyx_module_is_main_twisted__test__raiser = 0;
404 /* Implementation of twisted.test.raiser */
405 static PyObject *__pyx_builtin_Exception;
406 static char __pyx_k_1[] = "This function is intentionally broken";
407 static char __pyx_k_3[] = "\nA trivial extension that just raises an exception.\nSee L{twisted.test.test_failure.test_failureConstructionWithMungedStackSucceeds}.\n";
408 static char __pyx_k_4[] = "\n A speficic exception only used to be identified in tests.\n ";
409 static char __pyx_k_5[] = "twisted.test.raiser";
410 static char __pyx_k____main__[] = "__main__";
411 static char __pyx_k____test__[] = "__test__";
412 static char __pyx_k__Exception[] = "Exception";
413 static char __pyx_k__raiseException[] = "raiseException";
414 static char __pyx_k__RaiserException[] = "RaiserException";
415 static PyObject *__pyx_kp_s_1;
416 static PyObject *__pyx_kp_s_4;
417 static PyObject *__pyx_n_s_5;
418 static PyObject *__pyx_n_s__Exception;
419 static PyObject *__pyx_n_s__RaiserException;
420 static PyObject *__pyx_n_s____main__;
421 static PyObject *__pyx_n_s____test__;
422 static PyObject *__pyx_n_s__raiseException;
423 static PyObject *__pyx_k_tuple_2;
425 /* "twisted/test/raiser.pyx":17
428 * def raiseException(): # <<<<<<<<<<<<<<
430 * Raise L{RaiserException}.
433 static PyObject *__pyx_pf_7twisted_4test_6raiser_raiseException(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
434 static char __pyx_doc_7twisted_4test_6raiser_raiseException[] = "\n Raise L{RaiserException}.\n ";
435 static PyMethodDef __pyx_mdef_7twisted_4test_6raiser_raiseException = {__Pyx_NAMESTR("raiseException"), (PyCFunction)__pyx_pf_7twisted_4test_6raiser_raiseException, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_7twisted_4test_6raiser_raiseException)};
436 static PyObject *__pyx_pf_7twisted_4test_6raiser_raiseException(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
437 PyObject *__pyx_r = NULL;
438 PyObject *__pyx_t_1 = NULL;
439 PyObject *__pyx_t_2 = NULL;
440 __Pyx_RefNannySetupContext("raiseException");
441 __pyx_self = __pyx_self;
443 /* "twisted/test/raiser.pyx":21
444 * Raise L{RaiserException}.
446 * raise RaiserException("This function is intentionally broken") # <<<<<<<<<<<<<<
448 __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__RaiserException); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
449 __Pyx_GOTREF(__pyx_t_1);
450 __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_2), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
451 __Pyx_GOTREF(__pyx_t_2);
452 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
453 __Pyx_Raise(__pyx_t_2, 0, 0);
454 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
455 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
457 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
460 __Pyx_XDECREF(__pyx_t_1);
461 __Pyx_XDECREF(__pyx_t_2);
462 __Pyx_AddTraceback("twisted.test.raiser.raiseException");
465 __Pyx_XGIVEREF(__pyx_r);
466 __Pyx_RefNannyFinishContext();
470 static PyMethodDef __pyx_methods[] = {
474 #if PY_MAJOR_VERSION >= 3
475 static struct PyModuleDef __pyx_moduledef = {
476 PyModuleDef_HEAD_INIT,
477 __Pyx_NAMESTR("raiser"),
478 __Pyx_DOCSTR(__pyx_k_3), /* m_doc */
480 __pyx_methods /* m_methods */,
482 NULL, /* m_traverse */
488 static __Pyx_StringTabEntry __pyx_string_tab[] = {
489 {&__pyx_kp_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 0},
490 {&__pyx_kp_s_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 0, 1, 0},
491 {&__pyx_n_s_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 0, 1, 1},
492 {&__pyx_n_s__Exception, __pyx_k__Exception, sizeof(__pyx_k__Exception), 0, 0, 1, 1},
493 {&__pyx_n_s__RaiserException, __pyx_k__RaiserException, sizeof(__pyx_k__RaiserException), 0, 0, 1, 1},
494 {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1},
495 {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1},
496 {&__pyx_n_s__raiseException, __pyx_k__raiseException, sizeof(__pyx_k__raiseException), 0, 0, 1, 1},
497 {0, 0, 0, 0, 0, 0, 0}
499 static int __Pyx_InitCachedBuiltins(void) {
500 __pyx_builtin_Exception = __Pyx_GetName(__pyx_b, __pyx_n_s__Exception); if (!__pyx_builtin_Exception) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
506 static int __Pyx_InitCachedConstants(void) {
507 __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants");
509 /* "twisted/test/raiser.pyx":21
510 * Raise L{RaiserException}.
512 * raise RaiserException("This function is intentionally broken") # <<<<<<<<<<<<<<
514 __pyx_k_tuple_2 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
515 __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_2));
516 __Pyx_INCREF(((PyObject *)__pyx_kp_s_1));
517 PyTuple_SET_ITEM(__pyx_k_tuple_2, 0, ((PyObject *)__pyx_kp_s_1));
518 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_1));
519 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_2));
520 __Pyx_RefNannyFinishContext();
523 __Pyx_RefNannyFinishContext();
527 static int __Pyx_InitGlobals(void) {
528 if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
534 #if PY_MAJOR_VERSION < 3
535 PyMODINIT_FUNC initraiser(void); /*proto*/
536 PyMODINIT_FUNC initraiser(void)
538 PyMODINIT_FUNC PyInit_raiser(void); /*proto*/
539 PyMODINIT_FUNC PyInit_raiser(void)
542 PyObject *__pyx_t_1 = NULL;
543 PyObject *__pyx_t_2 = NULL;
544 PyObject *__pyx_t_3 = NULL;
546 void* __pyx_refnanny = NULL;
547 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
548 if (!__Pyx_RefNanny) {
550 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
552 Py_FatalError("failed to import 'refnanny' module");
554 __pyx_refnanny = __Pyx_RefNanny->SetupContext("PyMODINIT_FUNC PyInit_raiser(void)", __LINE__, __FILE__);
556 __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
557 __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
558 #ifdef __pyx_binding_PyCFunctionType_USED
559 if (__pyx_binding_PyCFunctionType_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
561 /*--- Library function declarations ---*/
562 /*--- Threads initialization code ---*/
563 #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
564 #ifdef WITH_THREAD /* Python build with threading support? */
565 PyEval_InitThreads();
568 /*--- Module creation code ---*/
569 #if PY_MAJOR_VERSION < 3
570 __pyx_m = Py_InitModule4(__Pyx_NAMESTR("raiser"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_3), 0, PYTHON_API_VERSION);
572 __pyx_m = PyModule_Create(&__pyx_moduledef);
574 if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
575 #if PY_MAJOR_VERSION < 3
578 __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME));
579 if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
580 if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
581 /*--- Initialize various global constants etc. ---*/
582 if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
583 if (__pyx_module_is_main_twisted__test__raiser) {
584 if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
586 /*--- Builtin init code ---*/
587 if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
588 /*--- Constants init code ---*/
589 if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
590 /*--- Global init code ---*/
591 /*--- Function export code ---*/
592 /*--- Type init code ---*/
593 /*--- Type import code ---*/
594 /*--- Function import code ---*/
595 /*--- Execution code ---*/
597 /* "twisted/test/raiser.pyx":11
600 * class RaiserException(Exception): # <<<<<<<<<<<<<<
602 * A speficic exception only used to be identified in tests.
604 __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
605 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
606 __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
607 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
608 __Pyx_INCREF(__pyx_builtin_Exception);
609 PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_builtin_Exception);
610 __Pyx_GIVEREF(__pyx_builtin_Exception);
611 if (PyDict_SetItemString(((PyObject *)__pyx_t_1), "__doc__", ((PyObject *)__pyx_kp_s_4)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
612 __pyx_t_3 = __Pyx_CreateClass(((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_1), __pyx_n_s__RaiserException, __pyx_n_s_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
613 __Pyx_GOTREF(__pyx_t_3);
614 __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
615 if (PyObject_SetAttr(__pyx_m, __pyx_n_s__RaiserException, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
616 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
617 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
619 /* "twisted/test/raiser.pyx":17
622 * def raiseException(): # <<<<<<<<<<<<<<
624 * Raise L{RaiserException}.
626 __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7twisted_4test_6raiser_raiseException, NULL, __pyx_n_s_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
627 __Pyx_GOTREF(__pyx_t_1);
628 if (PyObject_SetAttr(__pyx_m, __pyx_n_s__raiseException, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
629 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
631 /* "twisted/test/raiser.pyx":1
632 * # Copyright (c) Twisted Matrix Laboratories. # <<<<<<<<<<<<<<
633 * # See LICENSE for details.
636 __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
637 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
638 if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
639 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
642 __Pyx_XDECREF(__pyx_t_1);
643 __Pyx_XDECREF(__pyx_t_2);
644 __Pyx_XDECREF(__pyx_t_3);
646 __Pyx_AddTraceback("init twisted.test.raiser");
647 Py_DECREF(__pyx_m); __pyx_m = 0;
648 } else if (!PyErr_Occurred()) {
649 PyErr_SetString(PyExc_ImportError, "init twisted.test.raiser");
652 __Pyx_RefNannyFinishContext();
653 #if PY_MAJOR_VERSION < 3
660 /* Runtime support code */
662 static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) {
664 result = PyObject_GetAttr(dict, name);
666 PyErr_SetObject(PyExc_NameError, name);
670 static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) {
671 PyObject *tmp_type, *tmp_value, *tmp_tb;
672 PyThreadState *tstate = PyThreadState_GET();
674 tmp_type = tstate->curexc_type;
675 tmp_value = tstate->curexc_value;
676 tmp_tb = tstate->curexc_traceback;
677 tstate->curexc_type = type;
678 tstate->curexc_value = value;
679 tstate->curexc_traceback = tb;
680 Py_XDECREF(tmp_type);
681 Py_XDECREF(tmp_value);
685 static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) {
686 PyThreadState *tstate = PyThreadState_GET();
687 *type = tstate->curexc_type;
688 *value = tstate->curexc_value;
689 *tb = tstate->curexc_traceback;
691 tstate->curexc_type = 0;
692 tstate->curexc_value = 0;
693 tstate->curexc_traceback = 0;
697 #if PY_MAJOR_VERSION < 3
698 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) {
702 /* First, check the traceback argument, replacing None with NULL. */
707 else if (tb != NULL && !PyTraceBack_Check(tb)) {
708 PyErr_SetString(PyExc_TypeError,
709 "raise: arg 3 must be a traceback or None");
712 /* Next, replace a missing value with None */
717 #if PY_VERSION_HEX < 0x02050000
718 if (!PyClass_Check(type))
720 if (!PyType_Check(type))
723 /* Raising an instance. The value should be a dummy. */
724 if (value != Py_None) {
725 PyErr_SetString(PyExc_TypeError,
726 "instance exception may not have a separate value");
729 /* Normalize to raise <class>, <instance> */
732 #if PY_VERSION_HEX < 0x02050000
733 if (PyInstance_Check(type)) {
734 type = (PyObject*) ((PyInstanceObject*)type)->in_class;
739 PyErr_SetString(PyExc_TypeError,
740 "raise: exception must be an old-style class or instance");
744 type = (PyObject*) Py_TYPE(type);
746 if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
747 PyErr_SetString(PyExc_TypeError,
748 "raise: exception class must be a subclass of BaseException");
754 __Pyx_ErrRestore(type, value, tb);
763 #else /* Python 3+ */
765 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) {
768 } else if (tb && !PyTraceBack_Check(tb)) {
769 PyErr_SetString(PyExc_TypeError,
770 "raise: arg 3 must be a traceback or None");
773 if (value == Py_None)
776 if (PyExceptionInstance_Check(type)) {
778 PyErr_SetString(PyExc_TypeError,
779 "instance exception may not have a separate value");
783 type = (PyObject*) Py_TYPE(value);
784 } else if (!PyExceptionClass_Check(type)) {
785 PyErr_SetString(PyExc_TypeError,
786 "raise: exception class must be a subclass of BaseException");
790 PyErr_SetObject(type, value);
793 PyThreadState *tstate = PyThreadState_GET();
794 PyObject* tmp_tb = tstate->curexc_traceback;
797 tstate->curexc_traceback = tb;
807 static PyObject *__Pyx_FindPy2Metaclass(PyObject *bases) {
809 /* Default metaclass */
810 #if PY_MAJOR_VERSION < 3
811 if (PyTuple_Check(bases) && PyTuple_GET_SIZE(bases) > 0) {
812 PyObject *base = PyTuple_GET_ITEM(bases, 0);
813 metaclass = PyObject_GetAttrString(base, "__class__");
816 metaclass = (PyObject*) Py_TYPE(base);
819 metaclass = (PyObject *) &PyClass_Type;
822 if (PyTuple_Check(bases) && PyTuple_GET_SIZE(bases) > 0) {
823 PyObject *base = PyTuple_GET_ITEM(bases, 0);
824 metaclass = (PyObject*) Py_TYPE(base);
826 metaclass = (PyObject *) &PyType_Type;
829 Py_INCREF(metaclass);
833 static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name,
838 if (PyDict_SetItemString(dict, "__module__", modname) < 0)
841 /* Python2 __metaclass__ */
842 metaclass = PyDict_GetItemString(dict, "__metaclass__");
844 Py_INCREF(metaclass);
846 metaclass = __Pyx_FindPy2Metaclass(bases);
848 result = PyObject_CallFunctionObjArgs(metaclass, name, bases, dict, NULL);
849 Py_DECREF(metaclass);
853 static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) {
854 const unsigned char neg_one = (unsigned char)-1, const_zero = 0;
855 const int is_unsigned = neg_one > const_zero;
856 if (sizeof(unsigned char) < sizeof(long)) {
857 long val = __Pyx_PyInt_AsLong(x);
858 if (unlikely(val != (long)(unsigned char)val)) {
859 if (!unlikely(val == -1 && PyErr_Occurred())) {
860 PyErr_SetString(PyExc_OverflowError,
861 (is_unsigned && unlikely(val < 0)) ?
862 "can't convert negative value to unsigned char" :
863 "value too large to convert to unsigned char");
865 return (unsigned char)-1;
867 return (unsigned char)val;
869 return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x);
872 static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) {
873 const unsigned short neg_one = (unsigned short)-1, const_zero = 0;
874 const int is_unsigned = neg_one > const_zero;
875 if (sizeof(unsigned short) < sizeof(long)) {
876 long val = __Pyx_PyInt_AsLong(x);
877 if (unlikely(val != (long)(unsigned short)val)) {
878 if (!unlikely(val == -1 && PyErr_Occurred())) {
879 PyErr_SetString(PyExc_OverflowError,
880 (is_unsigned && unlikely(val < 0)) ?
881 "can't convert negative value to unsigned short" :
882 "value too large to convert to unsigned short");
884 return (unsigned short)-1;
886 return (unsigned short)val;
888 return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x);
891 static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) {
892 const unsigned int neg_one = (unsigned int)-1, const_zero = 0;
893 const int is_unsigned = neg_one > const_zero;
894 if (sizeof(unsigned int) < sizeof(long)) {
895 long val = __Pyx_PyInt_AsLong(x);
896 if (unlikely(val != (long)(unsigned int)val)) {
897 if (!unlikely(val == -1 && PyErr_Occurred())) {
898 PyErr_SetString(PyExc_OverflowError,
899 (is_unsigned && unlikely(val < 0)) ?
900 "can't convert negative value to unsigned int" :
901 "value too large to convert to unsigned int");
903 return (unsigned int)-1;
905 return (unsigned int)val;
907 return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x);
910 static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) {
911 const char neg_one = (char)-1, const_zero = 0;
912 const int is_unsigned = neg_one > const_zero;
913 if (sizeof(char) < sizeof(long)) {
914 long val = __Pyx_PyInt_AsLong(x);
915 if (unlikely(val != (long)(char)val)) {
916 if (!unlikely(val == -1 && PyErr_Occurred())) {
917 PyErr_SetString(PyExc_OverflowError,
918 (is_unsigned && unlikely(val < 0)) ?
919 "can't convert negative value to char" :
920 "value too large to convert to char");
926 return (char)__Pyx_PyInt_AsLong(x);
929 static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) {
930 const short neg_one = (short)-1, const_zero = 0;
931 const int is_unsigned = neg_one > const_zero;
932 if (sizeof(short) < sizeof(long)) {
933 long val = __Pyx_PyInt_AsLong(x);
934 if (unlikely(val != (long)(short)val)) {
935 if (!unlikely(val == -1 && PyErr_Occurred())) {
936 PyErr_SetString(PyExc_OverflowError,
937 (is_unsigned && unlikely(val < 0)) ?
938 "can't convert negative value to short" :
939 "value too large to convert to short");
945 return (short)__Pyx_PyInt_AsLong(x);
948 static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) {
949 const int neg_one = (int)-1, const_zero = 0;
950 const int is_unsigned = neg_one > const_zero;
951 if (sizeof(int) < sizeof(long)) {
952 long val = __Pyx_PyInt_AsLong(x);
953 if (unlikely(val != (long)(int)val)) {
954 if (!unlikely(val == -1 && PyErr_Occurred())) {
955 PyErr_SetString(PyExc_OverflowError,
956 (is_unsigned && unlikely(val < 0)) ?
957 "can't convert negative value to int" :
958 "value too large to convert to int");
964 return (int)__Pyx_PyInt_AsLong(x);
967 static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) {
968 const signed char neg_one = (signed char)-1, const_zero = 0;
969 const int is_unsigned = neg_one > const_zero;
970 if (sizeof(signed char) < sizeof(long)) {
971 long val = __Pyx_PyInt_AsLong(x);
972 if (unlikely(val != (long)(signed char)val)) {
973 if (!unlikely(val == -1 && PyErr_Occurred())) {
974 PyErr_SetString(PyExc_OverflowError,
975 (is_unsigned && unlikely(val < 0)) ?
976 "can't convert negative value to signed char" :
977 "value too large to convert to signed char");
979 return (signed char)-1;
981 return (signed char)val;
983 return (signed char)__Pyx_PyInt_AsSignedLong(x);
986 static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) {
987 const signed short neg_one = (signed short)-1, const_zero = 0;
988 const int is_unsigned = neg_one > const_zero;
989 if (sizeof(signed short) < sizeof(long)) {
990 long val = __Pyx_PyInt_AsLong(x);
991 if (unlikely(val != (long)(signed short)val)) {
992 if (!unlikely(val == -1 && PyErr_Occurred())) {
993 PyErr_SetString(PyExc_OverflowError,
994 (is_unsigned && unlikely(val < 0)) ?
995 "can't convert negative value to signed short" :
996 "value too large to convert to signed short");
998 return (signed short)-1;
1000 return (signed short)val;
1002 return (signed short)__Pyx_PyInt_AsSignedLong(x);
1005 static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) {
1006 const signed int neg_one = (signed int)-1, const_zero = 0;
1007 const int is_unsigned = neg_one > const_zero;
1008 if (sizeof(signed int) < sizeof(long)) {
1009 long val = __Pyx_PyInt_AsLong(x);
1010 if (unlikely(val != (long)(signed int)val)) {
1011 if (!unlikely(val == -1 && PyErr_Occurred())) {
1012 PyErr_SetString(PyExc_OverflowError,
1013 (is_unsigned && unlikely(val < 0)) ?
1014 "can't convert negative value to signed int" :
1015 "value too large to convert to signed int");
1017 return (signed int)-1;
1019 return (signed int)val;
1021 return (signed int)__Pyx_PyInt_AsSignedLong(x);
1024 static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) {
1025 const int neg_one = (int)-1, const_zero = 0;
1026 const int is_unsigned = neg_one > const_zero;
1027 if (sizeof(int) < sizeof(long)) {
1028 long val = __Pyx_PyInt_AsLong(x);
1029 if (unlikely(val != (long)(int)val)) {
1030 if (!unlikely(val == -1 && PyErr_Occurred())) {
1031 PyErr_SetString(PyExc_OverflowError,
1032 (is_unsigned && unlikely(val < 0)) ?
1033 "can't convert negative value to int" :
1034 "value too large to convert to int");
1040 return (int)__Pyx_PyInt_AsLong(x);
1043 static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) {
1044 const unsigned long neg_one = (unsigned long)-1, const_zero = 0;
1045 const int is_unsigned = neg_one > const_zero;
1046 #if PY_VERSION_HEX < 0x03000000
1047 if (likely(PyInt_Check(x))) {
1048 long val = PyInt_AS_LONG(x);
1049 if (is_unsigned && unlikely(val < 0)) {
1050 PyErr_SetString(PyExc_OverflowError,
1051 "can't convert negative value to unsigned long");
1052 return (unsigned long)-1;
1054 return (unsigned long)val;
1057 if (likely(PyLong_Check(x))) {
1059 if (unlikely(Py_SIZE(x) < 0)) {
1060 PyErr_SetString(PyExc_OverflowError,
1061 "can't convert negative value to unsigned long");
1062 return (unsigned long)-1;
1064 return PyLong_AsUnsignedLong(x);
1066 return PyLong_AsLong(x);
1070 PyObject *tmp = __Pyx_PyNumber_Int(x);
1071 if (!tmp) return (unsigned long)-1;
1072 val = __Pyx_PyInt_AsUnsignedLong(tmp);
1078 static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) {
1079 const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0;
1080 const int is_unsigned = neg_one > const_zero;
1081 #if PY_VERSION_HEX < 0x03000000
1082 if (likely(PyInt_Check(x))) {
1083 long val = PyInt_AS_LONG(x);
1084 if (is_unsigned && unlikely(val < 0)) {
1085 PyErr_SetString(PyExc_OverflowError,
1086 "can't convert negative value to unsigned PY_LONG_LONG");
1087 return (unsigned PY_LONG_LONG)-1;
1089 return (unsigned PY_LONG_LONG)val;
1092 if (likely(PyLong_Check(x))) {
1094 if (unlikely(Py_SIZE(x) < 0)) {
1095 PyErr_SetString(PyExc_OverflowError,
1096 "can't convert negative value to unsigned PY_LONG_LONG");
1097 return (unsigned PY_LONG_LONG)-1;
1099 return PyLong_AsUnsignedLongLong(x);
1101 return PyLong_AsLongLong(x);
1104 unsigned PY_LONG_LONG val;
1105 PyObject *tmp = __Pyx_PyNumber_Int(x);
1106 if (!tmp) return (unsigned PY_LONG_LONG)-1;
1107 val = __Pyx_PyInt_AsUnsignedLongLong(tmp);
1113 static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) {
1114 const long neg_one = (long)-1, const_zero = 0;
1115 const int is_unsigned = neg_one > const_zero;
1116 #if PY_VERSION_HEX < 0x03000000
1117 if (likely(PyInt_Check(x))) {
1118 long val = PyInt_AS_LONG(x);
1119 if (is_unsigned && unlikely(val < 0)) {
1120 PyErr_SetString(PyExc_OverflowError,
1121 "can't convert negative value to long");
1127 if (likely(PyLong_Check(x))) {
1129 if (unlikely(Py_SIZE(x) < 0)) {
1130 PyErr_SetString(PyExc_OverflowError,
1131 "can't convert negative value to long");
1134 return PyLong_AsUnsignedLong(x);
1136 return PyLong_AsLong(x);
1140 PyObject *tmp = __Pyx_PyNumber_Int(x);
1141 if (!tmp) return (long)-1;
1142 val = __Pyx_PyInt_AsLong(tmp);
1148 static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) {
1149 const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0;
1150 const int is_unsigned = neg_one > const_zero;
1151 #if PY_VERSION_HEX < 0x03000000
1152 if (likely(PyInt_Check(x))) {
1153 long val = PyInt_AS_LONG(x);
1154 if (is_unsigned && unlikely(val < 0)) {
1155 PyErr_SetString(PyExc_OverflowError,
1156 "can't convert negative value to PY_LONG_LONG");
1157 return (PY_LONG_LONG)-1;
1159 return (PY_LONG_LONG)val;
1162 if (likely(PyLong_Check(x))) {
1164 if (unlikely(Py_SIZE(x) < 0)) {
1165 PyErr_SetString(PyExc_OverflowError,
1166 "can't convert negative value to PY_LONG_LONG");
1167 return (PY_LONG_LONG)-1;
1169 return PyLong_AsUnsignedLongLong(x);
1171 return PyLong_AsLongLong(x);
1175 PyObject *tmp = __Pyx_PyNumber_Int(x);
1176 if (!tmp) return (PY_LONG_LONG)-1;
1177 val = __Pyx_PyInt_AsLongLong(tmp);
1183 static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) {
1184 const signed long neg_one = (signed long)-1, const_zero = 0;
1185 const int is_unsigned = neg_one > const_zero;
1186 #if PY_VERSION_HEX < 0x03000000
1187 if (likely(PyInt_Check(x))) {
1188 long val = PyInt_AS_LONG(x);
1189 if (is_unsigned && unlikely(val < 0)) {
1190 PyErr_SetString(PyExc_OverflowError,
1191 "can't convert negative value to signed long");
1192 return (signed long)-1;
1194 return (signed long)val;
1197 if (likely(PyLong_Check(x))) {
1199 if (unlikely(Py_SIZE(x) < 0)) {
1200 PyErr_SetString(PyExc_OverflowError,
1201 "can't convert negative value to signed long");
1202 return (signed long)-1;
1204 return PyLong_AsUnsignedLong(x);
1206 return PyLong_AsLong(x);
1210 PyObject *tmp = __Pyx_PyNumber_Int(x);
1211 if (!tmp) return (signed long)-1;
1212 val = __Pyx_PyInt_AsSignedLong(tmp);
1218 static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) {
1219 const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0;
1220 const int is_unsigned = neg_one > const_zero;
1221 #if PY_VERSION_HEX < 0x03000000
1222 if (likely(PyInt_Check(x))) {
1223 long val = PyInt_AS_LONG(x);
1224 if (is_unsigned && unlikely(val < 0)) {
1225 PyErr_SetString(PyExc_OverflowError,
1226 "can't convert negative value to signed PY_LONG_LONG");
1227 return (signed PY_LONG_LONG)-1;
1229 return (signed PY_LONG_LONG)val;
1232 if (likely(PyLong_Check(x))) {
1234 if (unlikely(Py_SIZE(x) < 0)) {
1235 PyErr_SetString(PyExc_OverflowError,
1236 "can't convert negative value to signed PY_LONG_LONG");
1237 return (signed PY_LONG_LONG)-1;
1239 return PyLong_AsUnsignedLongLong(x);
1241 return PyLong_AsLongLong(x);
1244 signed PY_LONG_LONG val;
1245 PyObject *tmp = __Pyx_PyNumber_Int(x);
1246 if (!tmp) return (signed PY_LONG_LONG)-1;
1247 val = __Pyx_PyInt_AsSignedLongLong(tmp);
1253 #include "compile.h"
1254 #include "frameobject.h"
1255 #include "traceback.h"
1257 static void __Pyx_AddTraceback(const char *funcname) {
1258 PyObject *py_srcfile = 0;
1259 PyObject *py_funcname = 0;
1260 PyObject *py_globals = 0;
1261 PyCodeObject *py_code = 0;
1262 PyFrameObject *py_frame = 0;
1264 #if PY_MAJOR_VERSION < 3
1265 py_srcfile = PyString_FromString(__pyx_filename);
1267 py_srcfile = PyUnicode_FromString(__pyx_filename);
1269 if (!py_srcfile) goto bad;
1270 if (__pyx_clineno) {
1271 #if PY_MAJOR_VERSION < 3
1272 py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno);
1274 py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno);
1278 #if PY_MAJOR_VERSION < 3
1279 py_funcname = PyString_FromString(funcname);
1281 py_funcname = PyUnicode_FromString(funcname);
1284 if (!py_funcname) goto bad;
1285 py_globals = PyModule_GetDict(__pyx_m);
1286 if (!py_globals) goto bad;
1287 py_code = PyCode_New(
1288 0, /*int argcount,*/
1289 #if PY_MAJOR_VERSION >= 3
1290 0, /*int kwonlyargcount,*/
1293 0, /*int stacksize,*/
1295 __pyx_empty_bytes, /*PyObject *code,*/
1296 __pyx_empty_tuple, /*PyObject *consts,*/
1297 __pyx_empty_tuple, /*PyObject *names,*/
1298 __pyx_empty_tuple, /*PyObject *varnames,*/
1299 __pyx_empty_tuple, /*PyObject *freevars,*/
1300 __pyx_empty_tuple, /*PyObject *cellvars,*/
1301 py_srcfile, /*PyObject *filename,*/
1302 py_funcname, /*PyObject *name,*/
1303 __pyx_lineno, /*int firstlineno,*/
1304 __pyx_empty_bytes /*PyObject *lnotab*/
1306 if (!py_code) goto bad;
1307 py_frame = PyFrame_New(
1308 PyThreadState_GET(), /*PyThreadState *tstate,*/
1309 py_code, /*PyCodeObject *code,*/
1310 py_globals, /*PyObject *globals,*/
1311 0 /*PyObject *locals*/
1313 if (!py_frame) goto bad;
1314 py_frame->f_lineno = __pyx_lineno;
1315 PyTraceBack_Here(py_frame);
1317 Py_XDECREF(py_srcfile);
1318 Py_XDECREF(py_funcname);
1319 Py_XDECREF(py_code);
1320 Py_XDECREF(py_frame);
1323 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
1325 #if PY_MAJOR_VERSION < 3
1326 if (t->is_unicode) {
1327 *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
1328 } else if (t->intern) {
1329 *t->p = PyString_InternFromString(t->s);
1331 *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
1333 #else /* Python 3+ has unicode identifiers */
1334 if (t->is_unicode | t->is_str) {
1336 *t->p = PyUnicode_InternFromString(t->s);
1337 } else if (t->encoding) {
1338 *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
1340 *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
1343 *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
1353 /* Type Conversion Functions */
1355 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
1356 int is_true = x == Py_True;
1357 if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
1358 else return PyObject_IsTrue(x);
1361 static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
1363 const char *name = NULL;
1364 PyObject *res = NULL;
1365 #if PY_VERSION_HEX < 0x03000000
1366 if (PyInt_Check(x) || PyLong_Check(x))
1368 if (PyLong_Check(x))
1370 return Py_INCREF(x), x;
1371 m = Py_TYPE(x)->tp_as_number;
1372 #if PY_VERSION_HEX < 0x03000000
1373 if (m && m->nb_int) {
1375 res = PyNumber_Int(x);
1377 else if (m && m->nb_long) {
1379 res = PyNumber_Long(x);
1382 if (m && m->nb_int) {
1384 res = PyNumber_Long(x);
1388 #if PY_VERSION_HEX < 0x03000000
1389 if (!PyInt_Check(res) && !PyLong_Check(res)) {
1391 if (!PyLong_Check(res)) {
1393 PyErr_Format(PyExc_TypeError,
1394 "__%s__ returned non-%s (type %.200s)",
1395 name, name, Py_TYPE(res)->tp_name);
1400 else if (!PyErr_Occurred()) {
1401 PyErr_SetString(PyExc_TypeError,
1402 "an integer is required");
1407 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
1409 PyObject* x = PyNumber_Index(b);
1411 ival = PyInt_AsSsize_t(x);
1416 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
1417 #if PY_VERSION_HEX < 0x02050000
1418 if (ival <= LONG_MAX)
1419 return PyInt_FromLong((long)ival);
1421 unsigned char *bytes = (unsigned char *) &ival;
1422 int one = 1; int little = (int)*(unsigned char*)&one;
1423 return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0);
1426 return PyInt_FromSize_t(ival);
1430 static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) {
1431 unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x);
1432 if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) {
1434 } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) {
1435 PyErr_SetString(PyExc_OverflowError,
1436 "value too large to convert to size_t");
1443 #endif /* Py_PYTHON_H */