static int __Pyx_PrintOne(PyObject *o) { int res; PyObject* arg_tuple = PyTuple_New(1); if (unlikely(!arg_tuple)) return -1; Py_INCREF(o); PyTuple_SET_ITEM(arg_tuple, 0, o); res = __Pyx_Print(arg_tuple, 1); Py_DECREF(arg_tuple); return res; }
static int __Pyx_PrintOne(PyObject *o) { PyObject *f; if (!(f = __Pyx_GetStdout())) return -1; if (PyFile_SoftSpace(f, 0)) { if (PyFile_WriteString(" ", f) < 0) return -1; } if (PyFile_WriteObject(o, f, Py_PRINT_RAW) < 0) return -1; if (PyFile_WriteString("\n", f) < 0) return -1; return 0; /* the line below is just to avoid compiler * compiler warnings about unused functions */ return __Pyx_Print(NULL, 0); }
static PyObject *__pyx_pf_3fib_fib(PyObject *__pyx_self, PyObject *__pyx_v_n) { PyObject *__pyx_v_a = NULL; PyObject *__pyx_v_b = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; int __pyx_t_3; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("fib"); __pyx_self = __pyx_self; /* "fib.pyx":2 * def fib(n): * a ,b = 0,1 # <<<<<<<<<<<<<< * while b<n: * print b, */ __pyx_t_1 = __pyx_int_0; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = __pyx_int_1; __Pyx_INCREF(__pyx_t_2); __pyx_v_a = __pyx_t_1; __pyx_t_1 = 0; __pyx_v_b = __pyx_t_2; __pyx_t_2 = 0; /* "fib.pyx":3 * def fib(n): * a ,b = 0,1 * while b<n: # <<<<<<<<<<<<<< * print b, * a,b = b,b+a */ while (1) { __pyx_t_2 = PyObject_RichCompare(__pyx_v_b, __pyx_v_n, Py_LT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (!__pyx_t_3) break; /* "fib.pyx":4 * a ,b = 0,1 * while b<n: * print b, # <<<<<<<<<<<<<< * a,b = b,b+a */ __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); __Pyx_INCREF(__pyx_v_b); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_b); __Pyx_GIVEREF(__pyx_v_b); if (__Pyx_Print(0, ((PyObject *)__pyx_t_2), 0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; /* "fib.pyx":5 * while b<n: * print b, * a,b = b,b+a # <<<<<<<<<<<<<< */ __pyx_t_2 = __pyx_v_b; __Pyx_INCREF(__pyx_t_2); __pyx_t_1 = PyNumber_Add(__pyx_v_b, __pyx_v_a); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_v_a); __pyx_v_a = __pyx_t_2; __pyx_t_2 = 0; __Pyx_DECREF(__pyx_v_b); __pyx_v_b = __pyx_t_1; __pyx_t_1 = 0; } __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("fib.fib", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_a); __Pyx_XDECREF(__pyx_v_b); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }