Generated by Cython 0.17pre on Wed Oct 10 09:42:43 2012
Raw output: _mnt_sagenb_notebook_sagenb_home_wstein_1_code_sage97_spyx_0.c
1:
2: include "interrupt.pxi" # ctrl-c interrupt block support
3: include "stdsage.pxi" # ctrl-c interrupt block support
4:
5: include "cdefs.pxi"
6: def cython_sum2(long n):
/* "_mnt_sagenb_notebook_sagenb_home_wstein_1_code_sage97_spyx_0.pyx":6 * * include "cdefs.pxi" * def cython_sum2(long n): #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* cdef long long i * return sum(i*i for i in range(1,n+1)) */ static PyObject *__pyx_pf_60_mnt_sagenb_notebook_sagenb_home_wstein_1_code_sage97_spyx_0_cython_sum2(CYTHON_UNUSED PyObject *__pyx_self, long __pyx_v_n) { struct __pyx_obj_60_mnt_sagenb_notebook_sagenb_home_wstein_1_code_sage97_spyx_0___pyx_scope_struct__cython_sum2 *__pyx_cur_scope; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("cython_sum2", 0); __pyx_cur_scope = (struct __pyx_obj_60_mnt_sagenb_notebook_sagenb_home_wstein_1_code_sage97_spyx_0___pyx_scope_struct__cython_sum2 *)__pyx_ptype_60_mnt_sagenb_notebook_sagenb_home_wstein_1_code_sage97_spyx_0___pyx_scope_struct__cython_sum2->tp_new(__pyx_ptype_60_mnt_sagenb_notebook_sagenb_home_wstein_1_code_sage97_spyx_0___pyx_scope_struct__cython_sum2, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_cur_scope)) { __Pyx_RefNannyFinishContext(); return NULL; } __Pyx_GOTREF(__pyx_cur_scope); __pyx_cur_scope->__pyx_v_n = __pyx_v_n; /* "_mnt_sagenb_notebook_sagenb_home_wstein_1_code_sage97_spyx_0.pyx":6 * * include "cdefs.pxi" * def cython_sum2(long n): #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* cdef long long i * return sum(i*i for i in range(1,n+1)) */ __pyx_k_tuple_2 = PyTuple_New(5); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_2); __Pyx_INCREF(((PyObject *)__pyx_n_s__n)); PyTuple_SET_ITEM(__pyx_k_tuple_2, 0, ((PyObject *)__pyx_n_s__n)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n)); __Pyx_INCREF(((PyObject *)__pyx_n_s__n)); PyTuple_SET_ITEM(__pyx_k_tuple_2, 1, ((PyObject *)__pyx_n_s__n)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n)); __Pyx_INCREF(((PyObject *)__pyx_n_s__i)); PyTuple_SET_ITEM(__pyx_k_tuple_2, 2, ((PyObject *)__pyx_n_s__i)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i)); __Pyx_INCREF(((PyObject *)__pyx_n_s__genexpr)); PyTuple_SET_ITEM(__pyx_k_tuple_2, 3, ((PyObject *)__pyx_n_s__genexpr)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__genexpr)); __Pyx_INCREF(((PyObject *)__pyx_n_s__genexpr)); PyTuple_SET_ITEM(__pyx_k_tuple_2, 4, ((PyObject *)__pyx_n_s__genexpr)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__genexpr)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_2)); /* "_mnt_sagenb_notebook_sagenb_home_wstein_1_code_sage97_spyx_0.pyx":6 * * include "cdefs.pxi" * def cython_sum2(long n): #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* cdef long long i * return sum(i*i for i in range(1,n+1)) */ __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_60_mnt_sagenb_notebook_sagenb_home_wstein_1_code_sage97_spyx_0_1cython_sum2, NULL, __pyx_n_s_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__cython_sum2, __pyx_t_1)<
0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "_mnt_sagenb_notebook_sagenb_home_wstein_1_code_sage97_spyx_0.pyx":6 * * include "cdefs.pxi" * def cython_sum2(long n): #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* cdef long long i * return sum(i*i for i in range(1,n+1)) */ struct __pyx_obj_60_mnt_sagenb_notebook_sagenb_home_wstein_1_code_sage97_spyx_0___pyx_scope_struct__cython_sum2 { PyObject_HEAD long __pyx_v_n; };
7: cdef long long i
8: return sum(i*i for i in range(1,n+1))
/* "_mnt_sagenb_notebook_sagenb_home_wstein_1_code_sage97_spyx_0.pyx":8 * def cython_sum2(long n): * cdef long long i * return sum(i*i for i in range(1,n+1)) #<
<
<
<
<
<
<
<
<
<
<
<
<
<
*/ static PyObject *__pyx_pf_60_mnt_sagenb_notebook_sagenb_home_wstein_1_code_sage97_spyx_0_11cython_sum2_genexpr(PyObject *__pyx_self) { struct __pyx_obj_60_mnt_sagenb_notebook_sagenb_home_wstein_1_code_sage97_spyx_0___pyx_scope_struct_1_genexpr *__pyx_cur_scope; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("genexpr", 0); __pyx_cur_scope = (struct __pyx_obj_60_mnt_sagenb_notebook_sagenb_home_wstein_1_code_sage97_spyx_0___pyx_scope_struct_1_genexpr *)__pyx_ptype_60_mnt_sagenb_notebook_sagenb_home_wstein_1_code_sage97_spyx_0___pyx_scope_struct_1_genexpr->tp_new(__pyx_ptype_60_mnt_sagenb_notebook_sagenb_home_wstein_1_code_sage97_spyx_0___pyx_scope_struct_1_genexpr, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_cur_scope)) { __Pyx_RefNannyFinishContext(); return NULL; } __Pyx_GOTREF(__pyx_cur_scope); __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_60_mnt_sagenb_notebook_sagenb_home_wstein_1_code_sage97_spyx_0___pyx_scope_struct__cython_sum2 *) __pyx_self; __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope)); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope); { __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_60_mnt_sagenb_notebook_sagenb_home_wstein_1_code_sage97_spyx_0_11cython_sum2_2generator, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; } __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_AddTraceback("_mnt_sagenb_notebook_sagenb_home_wstein_1_code_sage97_spyx_0.cython_sum2.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; static PyObject *__pyx_gb_60_mnt_sagenb_notebook_sagenb_home_wstein_1_code_sage97_spyx_0_11cython_sum2_2generator(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("None", 0); __pyx_L3_first_run:; if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_1 = PyInt_FromLong((__pyx_cur_scope->__pyx_outer_scope->__pyx_v_n + 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_int_1); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_int_1); __Pyx_GIVEREF(__pyx_int_1); PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyObject_Call(__pyx_builtin_range, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; if (PyList_CheckExact(__pyx_t_1) || PyTuple_CheckExact(__pyx_t_1)) { __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0; __pyx_t_4 = NULL; } else { __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; for (;;) { if (!__pyx_t_4 && PyList_CheckExact(__pyx_t_2)) { if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break; __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; } else if (!__pyx_t_4 && PyTuple_CheckExact(__pyx_t_2)) { if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break; __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; } else { __pyx_t_1 = __pyx_t_4(__pyx_t_2); if (unlikely(!__pyx_t_1)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } __Pyx_GOTREF(__pyx_t_1); } __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_i); __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_i); __Pyx_GIVEREF(__pyx_t_1); __pyx_cur_scope->__pyx_v_i = __pyx_t_1; __pyx_t_1 = 0; __pyx_t_1 = PyNumber_Multiply(__pyx_cur_scope->__pyx_v_i, __pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; __Pyx_XGIVEREF(__pyx_t_2); __pyx_cur_scope->__pyx_t_0 = __pyx_t_2; __pyx_cur_scope->__pyx_t_1 = __pyx_t_3; __pyx_cur_scope->__pyx_t_2 = __pyx_t_4; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); /* return from generator, yielding value */ __pyx_generator->resume_label = 1; return __pyx_r; __pyx_L6_resume_from_yield:; __pyx_t_2 = __pyx_cur_scope->__pyx_t_0; __pyx_cur_scope->__pyx_t_0 = 0; __Pyx_XGOTREF(__pyx_t_2); __pyx_t_3 = __pyx_cur_scope->__pyx_t_1; __pyx_t_4 = __pyx_cur_scope->__pyx_t_2; if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyErr_SetNone(PyExc_StopIteration); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_L0:; __Pyx_XDECREF(__pyx_r); __pyx_generator->resume_label = -1; __Pyx_Generator_clear((PyObject*)__pyx_generator); __Pyx_RefNannyFinishContext(); return NULL; } /* "_mnt_sagenb_notebook_sagenb_home_wstein_1_code_sage97_spyx_0.pyx":8 * def cython_sum2(long n): * cdef long long i * return sum(i*i for i in range(1,n+1)) #<
<
<
<
<
<
<
<
<
<
<
<
<
<
*/ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __pyx_pf_60_mnt_sagenb_notebook_sagenb_home_wstein_1_code_sage97_spyx_0_11cython_sum2_genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyObject_Call(__pyx_builtin_sum, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("_mnt_sagenb_notebook_sagenb_home_wstein_1_code_sage97_spyx_0.cython_sum2", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }