/* Generated by Cython 0.10.3 on Mon Mar  2 23:58:25 2009 */

#define PY_SSIZE_T_CLEAN
#include "Python.h"
#include "structmember.h"
#ifndef PY_LONG_LONG
  #define PY_LONG_LONG LONG_LONG
#endif
#ifndef DL_EXPORT
  #define DL_EXPORT(t) t
#endif
#if PY_VERSION_HEX < 0x02040000
  #define METH_COEXIST 0
#endif
#if PY_VERSION_HEX < 0x02050000
  typedef int Py_ssize_t;
  #define PY_SSIZE_T_MAX INT_MAX
  #define PY_SSIZE_T_MIN INT_MIN
  #define PyInt_FromSsize_t(z) PyInt_FromLong(z)
  #define PyInt_AsSsize_t(o)   PyInt_AsLong(o)
  #define PyNumber_Index(o)    PyNumber_Int(o)
  #define PyIndex_Check(o)     PyNumber_Check(o)
#endif
#if PY_VERSION_HEX < 0x02060000
  #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt)
  #define Py_TYPE(ob)   (((PyObject*)(ob))->ob_type)
  #define Py_SIZE(ob)   (((PyVarObject*)(ob))->ob_size)
  #define PyVarObject_HEAD_INIT(type, size) \
          PyObject_HEAD_INIT(type) size,
  #define PyType_Modified(t)

  typedef struct {
       void *buf;
       PyObject *obj;
       Py_ssize_t len;
       Py_ssize_t itemsize;
       int readonly;
       int ndim;
       char *format;
       Py_ssize_t *shape;
       Py_ssize_t *strides;
       Py_ssize_t *suboffsets;
       void *internal;
  } Py_buffer;

  #define PyBUF_SIMPLE 0
  #define PyBUF_WRITABLE 0x0001
  #define PyBUF_LOCK 0x0002
  #define PyBUF_FORMAT 0x0004
  #define PyBUF_ND 0x0008
  #define PyBUF_STRIDES (0x0010 | PyBUF_ND)
  #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES)
  #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES)
  #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES)
  #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES)

#endif
#if PY_MAJOR_VERSION < 3
  #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
#else
  #define __Pyx_BUILTIN_MODULE_NAME "builtins"
#endif
#if PY_MAJOR_VERSION >= 3
  #define Py_TPFLAGS_CHECKTYPES 0
  #define Py_TPFLAGS_HAVE_INDEX 0
#endif
#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3)
  #define Py_TPFLAGS_HAVE_NEWBUFFER 0
#endif
#if PY_MAJOR_VERSION >= 3
  #define PyBaseString_Type            PyUnicode_Type
  #define PyString_Type                PyBytes_Type
  #define PyInt_Type                   PyLong_Type
  #define PyInt_Check(op)              PyLong_Check(op)
  #define PyInt_CheckExact(op)         PyLong_CheckExact(op)
  #define PyInt_FromString             PyLong_FromString
  #define PyInt_FromUnicode            PyLong_FromUnicode
  #define PyInt_FromLong               PyLong_FromLong
  #define PyInt_FromSize_t             PyLong_FromSize_t
  #define PyInt_FromSsize_t            PyLong_FromSsize_t
  #define PyInt_AsLong                 PyLong_AsLong
  #define PyInt_AS_LONG                PyLong_AS_LONG
  #define PyInt_AsSsize_t              PyLong_AsSsize_t
  #define PyInt_AsUnsignedLongMask     PyLong_AsUnsignedLongMask
  #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
#else
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_Divide(x,y)
  #define PyBytes_Type                 PyString_Type
#endif
#if PY_MAJOR_VERSION >= 3
  #define PyMethod_New(func, self, klass) PyInstanceMethod_New(func)
#endif
#if !defined(WIN32) && !defined(MS_WINDOWS)
  #ifndef __stdcall
    #define __stdcall
  #endif
  #ifndef __cdecl
    #define __cdecl
  #endif
#else
  #define _USE_MATH_DEFINES
#endif
#ifdef __cplusplus
#define __PYX_EXTERN_C extern "C"
#else
#define __PYX_EXTERN_C extern
#endif
#include <math.h>
#define __PYX_HAVE_API__tailspin__fast_h


#ifdef __GNUC__
#define INLINE __inline__
#elif _WIN32
#define INLINE __inline
#else
#define INLINE 
#endif

typedef struct {PyObject **p; char *s; long n; char is_unicode; char intern; char is_identifier;} __Pyx_StringTabEntry; /*proto*/



static int __pyx_skip_dispatch = 0;


/* Type Conversion Predeclarations */

#if PY_MAJOR_VERSION < 3
#define __Pyx_PyBytes_FromString PyString_FromString
#define __Pyx_PyBytes_AsString   PyString_AsString
#else
#define __Pyx_PyBytes_FromString PyBytes_FromString
#define __Pyx_PyBytes_AsString   PyBytes_AsString
#endif

#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False))
static INLINE int __Pyx_PyObject_IsTrue(PyObject* x);
static INLINE PY_LONG_LONG __pyx_PyInt_AsLongLong(PyObject* x);
static INLINE unsigned PY_LONG_LONG __pyx_PyInt_AsUnsignedLongLong(PyObject* x);
static INLINE Py_ssize_t __pyx_PyIndex_AsSsize_t(PyObject* b);

#define __pyx_PyInt_AsLong(x) (PyInt_CheckExact(x) ? PyInt_AS_LONG(x) : PyInt_AsLong(x))
#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))

static INLINE unsigned char __pyx_PyInt_unsigned_char(PyObject* x);
static INLINE unsigned short __pyx_PyInt_unsigned_short(PyObject* x);
static INLINE char __pyx_PyInt_char(PyObject* x);
static INLINE short __pyx_PyInt_short(PyObject* x);
static INLINE int __pyx_PyInt_int(PyObject* x);
static INLINE long __pyx_PyInt_long(PyObject* x);
static INLINE signed char __pyx_PyInt_signed_char(PyObject* x);
static INLINE signed short __pyx_PyInt_signed_short(PyObject* x);
static INLINE signed int __pyx_PyInt_signed_int(PyObject* x);
static INLINE signed long __pyx_PyInt_signed_long(PyObject* x);
static INLINE long double __pyx_PyInt_long_double(PyObject* x);
#ifdef __GNUC__
/* Test for GCC > 2.95 */
#if __GNUC__ > 2 ||               (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) 
#define likely(x)   __builtin_expect(!!(x), 1)
#define unlikely(x) __builtin_expect(!!(x), 0)
#else /* __GNUC__ > 2 ... */
#define likely(x)   (x)
#define unlikely(x) (x)
#endif /* __GNUC__ > 2 ... */
#else /* __GNUC__ */
#define likely(x)   (x)
#define unlikely(x) (x)
#endif /* __GNUC__ */
    
static PyObject *__pyx_m;
static PyObject *__pyx_b;
static PyObject *__pyx_empty_tuple;
static int __pyx_lineno;
static int __pyx_clineno = 0;
static const char * __pyx_cfilenm= __FILE__;
static const char *__pyx_filename;
static const char **__pyx_f;

static void __Pyx_RaiseDoubleKeywordsError(
    const char* func_name, PyObject* kw_name); /*proto*/

static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
    Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/

static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],     PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,     const char* function_name); /*proto*/

static INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
static INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/

static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/

static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/

static void __Pyx_AddTraceback(const char *funcname); /*proto*/

static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/

/* Type declarations */

/* "/Users/xavid/Documents/tailspin/src/tailspin/fast_h.pyx":9
 *         return o
 * 
 * cdef class tailfish:             # <<<<<<<<<<<<<<
 *     cdef object func
 *     cdef object args
 */

struct __pyx_obj_8tailspin_6fast_h_tailfish {
  PyObject_HEAD
  struct __pyx_vtabstruct_8tailspin_6fast_h_tailfish *__pyx_vtab;
  PyObject *func;
  PyObject *args;
  PyObject *kw;
};


struct __pyx_vtabstruct_8tailspin_6fast_h_tailfish {
  PyObject *(*force)(struct __pyx_obj_8tailspin_6fast_h_tailfish *);
};
static struct __pyx_vtabstruct_8tailspin_6fast_h_tailfish *__pyx_vtabptr_8tailspin_6fast_h_tailfish;
/* Module declarations from tailspin.fast_h */

static PyTypeObject *__pyx_ptype_8tailspin_6fast_h_tailfish = 0;


/* Implementation of tailspin.fast_h */
static char __pyx_k___cinit__[] = "__cinit__";
static PyObject *__pyx_kp___cinit__;
static char __pyx_k_o[] = "o";
static PyObject *__pyx_kp_o;
static char __pyx_k_func[] = "func";
static PyObject *__pyx_kp_func;
static char __pyx_k_args[] = "args";
static PyObject *__pyx_kp_args;
static char __pyx_k_kw[] = "kw";
static PyObject *__pyx_kp_kw;
static char __pyx_k_threading[] = "threading";
static PyObject *__pyx_kp_threading;
static char __pyx_k_recur[] = "recur";
static PyObject *__pyx_kp_recur;

/* "/Users/xavid/Documents/tailspin/src/tailspin/fast_h.pyx":3
 * import threading
 * 
 * def force(o):             # <<<<<<<<<<<<<<
 *     if isinstance(o,tailfish):
 *         return (<tailfish>o).force()
 */

static PyObject *__pyx_pf_8tailspin_6fast_h_force(PyObject *__pyx_self, PyObject *__pyx_v_o); /*proto*/
static PyObject *__pyx_pf_8tailspin_6fast_h_force(PyObject *__pyx_self, PyObject *__pyx_v_o) {
  PyObject *__pyx_r;
  int __pyx_1;
  PyObject *__pyx_2 = 0;
  __pyx_self = __pyx_self;

  /* "/Users/xavid/Documents/tailspin/src/tailspin/fast_h.pyx":4
 * 
 * def force(o):
 *     if isinstance(o,tailfish):             # <<<<<<<<<<<<<<
 *         return (<tailfish>o).force()
 *     else:
 */
  __pyx_1 = PyObject_TypeCheck(__pyx_v_o, ((PyTypeObject *)((PyObject*)__pyx_ptype_8tailspin_6fast_h_tailfish))); 
  if (__pyx_1) {

    /* "/Users/xavid/Documents/tailspin/src/tailspin/fast_h.pyx":5
 * def force(o):
 *     if isinstance(o,tailfish):
 *         return (<tailfish>o).force()             # <<<<<<<<<<<<<<
 *     else:
 *         return o
 */
    __pyx_2 = ((struct __pyx_vtabstruct_8tailspin_6fast_h_tailfish *)((struct __pyx_obj_8tailspin_6fast_h_tailfish *)__pyx_v_o)->__pyx_vtab)->force(((struct __pyx_obj_8tailspin_6fast_h_tailfish *)__pyx_v_o)); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_r = __pyx_2;
    __pyx_2 = 0;
    goto __pyx_L0;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "/Users/xavid/Documents/tailspin/src/tailspin/fast_h.pyx":7
 *         return (<tailfish>o).force()
 *     else:
 *         return o             # <<<<<<<<<<<<<<
 * 
 * cdef class tailfish:
 */
    Py_INCREF(__pyx_v_o);
    __pyx_r = __pyx_v_o;
    goto __pyx_L0;
  }
  __pyx_L5:;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  Py_XDECREF(__pyx_2);
  __Pyx_AddTraceback("tailspin.fast_h.force");
  __pyx_r = NULL;
  __pyx_L0:;
  return __pyx_r;
}

/* "/Users/xavid/Documents/tailspin/src/tailspin/fast_h.pyx":13
 *     cdef object args
 *     cdef object kw
 *     def __cinit__(self,func,args,kw):             # <<<<<<<<<<<<<<
 *         self.func = func
 *         self.args = args
 */

static int __pyx_pf_8tailspin_6fast_h_8tailfish___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_8tailspin_6fast_h_8tailfish___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_func = 0;
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_kw = 0;
  int __pyx_r;
  static PyObject **__pyx_pyargnames[] = {&__pyx_kp_func,&__pyx_kp_args,&__pyx_kp_kw,0};
  if (unlikely(__pyx_kwds)) {
    PyObject* values[3] = {0,0,0};
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_func);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_args);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  2:
      values[2] = PyDict_GetItem(__pyx_kwds, __pyx_kp_kw);
      if (likely(values[2])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_func = values[0];
    __pyx_v_args = values[1];
    __pyx_v_kw = values[2];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_func = PyTuple_GET_ITEM(__pyx_args, 0);
    __pyx_v_args = PyTuple_GET_ITEM(__pyx_args, 1);
    __pyx_v_kw = PyTuple_GET_ITEM(__pyx_args, 2);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("tailspin.fast_h.tailfish.__cinit__");
  return -1;
  __pyx_L4_argument_unpacking_done:;

  /* "/Users/xavid/Documents/tailspin/src/tailspin/fast_h.pyx":14
 *     cdef object kw
 *     def __cinit__(self,func,args,kw):
 *         self.func = func             # <<<<<<<<<<<<<<
 *         self.args = args
 *         self.kw = kw
 */
  Py_INCREF(__pyx_v_func);
  Py_DECREF(((struct __pyx_obj_8tailspin_6fast_h_tailfish *)__pyx_v_self)->func);
  ((struct __pyx_obj_8tailspin_6fast_h_tailfish *)__pyx_v_self)->func = __pyx_v_func;

  /* "/Users/xavid/Documents/tailspin/src/tailspin/fast_h.pyx":15
 *     def __cinit__(self,func,args,kw):
 *         self.func = func
 *         self.args = args             # <<<<<<<<<<<<<<
 *         self.kw = kw
 *     cdef force(self):
 */
  Py_INCREF(__pyx_v_args);
  Py_DECREF(((struct __pyx_obj_8tailspin_6fast_h_tailfish *)__pyx_v_self)->args);
  ((struct __pyx_obj_8tailspin_6fast_h_tailfish *)__pyx_v_self)->args = __pyx_v_args;

  /* "/Users/xavid/Documents/tailspin/src/tailspin/fast_h.pyx":16
 *         self.func = func
 *         self.args = args
 *         self.kw = kw             # <<<<<<<<<<<<<<
 *     cdef force(self):
 *         return self.func(*self.args,**self.kw)
 */
  Py_INCREF(__pyx_v_kw);
  Py_DECREF(((struct __pyx_obj_8tailspin_6fast_h_tailfish *)__pyx_v_self)->kw);
  ((struct __pyx_obj_8tailspin_6fast_h_tailfish *)__pyx_v_self)->kw = __pyx_v_kw;

  __pyx_r = 0;
  return __pyx_r;
}

/* "/Users/xavid/Documents/tailspin/src/tailspin/fast_h.pyx":17
 *         self.args = args
 *         self.kw = kw
 *     cdef force(self):             # <<<<<<<<<<<<<<
 *         return self.func(*self.args,**self.kw)
 * 
 */

static  PyObject *__pyx_f_8tailspin_6fast_h_8tailfish_force(struct __pyx_obj_8tailspin_6fast_h_tailfish *__pyx_v_self) {
  PyObject *__pyx_r;
  PyObject *__pyx_1 = 0;
  PyObject *__pyx_2 = 0;

  /* "/Users/xavid/Documents/tailspin/src/tailspin/fast_h.pyx":18
 *         self.kw = kw
 *     cdef force(self):
 *         return self.func(*self.args,**self.kw)             # <<<<<<<<<<<<<<
 * 
 * def helper(func,args,kw):
 */
  __pyx_1 = PySequence_Tuple(__pyx_v_self->args); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_2 = PyEval_CallObjectWithKeywords(__pyx_v_self->func, __pyx_1, __pyx_v_self->kw); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  __pyx_r = __pyx_2;
  __pyx_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  Py_XDECREF(__pyx_1);
  Py_XDECREF(__pyx_2);
  __Pyx_AddTraceback("tailspin.fast_h.tailfish.force");
  __pyx_r = 0;
  __pyx_L0:;
  return __pyx_r;
}

/* "/Users/xavid/Documents/tailspin/src/tailspin/fast_h.pyx":20
 *         return self.func(*self.args,**self.kw)
 * 
 * def helper(func,args,kw):             # <<<<<<<<<<<<<<
 *     if not func.recur:
 *         func.recur = True
 */

static PyObject *__pyx_pf_8tailspin_6fast_h_helper(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_8tailspin_6fast_h_helper(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_func = 0;
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_kw = 0;
  PyObject *__pyx_v_f;
  PyObject *__pyx_v_ret;
  PyObject *__pyx_r;
  PyObject *__pyx_1 = 0;
  int __pyx_2;
  int __pyx_3;
  PyObject *__pyx_4 = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_kp_func,&__pyx_kp_args,&__pyx_kp_kw,0};
  __pyx_self = __pyx_self;
  if (unlikely(__pyx_kwds)) {
    PyObject* values[3] = {0,0,0};
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_func);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_args);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("helper", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  2:
      values[2] = PyDict_GetItem(__pyx_kwds, __pyx_kp_kw);
      if (likely(values[2])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("helper", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "helper") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_func = values[0];
    __pyx_v_args = values[1];
    __pyx_v_kw = values[2];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_func = PyTuple_GET_ITEM(__pyx_args, 0);
    __pyx_v_args = PyTuple_GET_ITEM(__pyx_args, 1);
    __pyx_v_kw = PyTuple_GET_ITEM(__pyx_args, 2);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("helper", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("tailspin.fast_h.helper");
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  Py_INCREF(__pyx_v_args);
  Py_INCREF(__pyx_v_kw);
  __pyx_v_f = Py_None; Py_INCREF(Py_None);
  __pyx_v_ret = Py_None; Py_INCREF(Py_None);

  /* "/Users/xavid/Documents/tailspin/src/tailspin/fast_h.pyx":21
 * 
 * def helper(func,args,kw):
 *     if not func.recur:             # <<<<<<<<<<<<<<
 *         func.recur = True
 *     else:
 */
  __pyx_1 = PyObject_GetAttr(__pyx_v_func, __pyx_kp_recur); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_2 = __Pyx_PyObject_IsTrue(__pyx_1); if (unlikely(__pyx_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  __pyx_3 = (!__pyx_2);
  if (__pyx_3) {

    /* "/Users/xavid/Documents/tailspin/src/tailspin/fast_h.pyx":22
 * def helper(func,args,kw):
 *     if not func.recur:
 *         func.recur = True             # <<<<<<<<<<<<<<
 *     else:
 *         return tailfish(func,args,kw)
 */
    __pyx_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (PyObject_SetAttr(__pyx_v_func, __pyx_kp_recur, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    Py_DECREF(__pyx_1); __pyx_1 = 0;
    goto __pyx_L6;
  }
  /*else*/ {

    /* "/Users/xavid/Documents/tailspin/src/tailspin/fast_h.pyx":24
 *         func.recur = True
 *     else:
 *         return tailfish(func,args,kw)             # <<<<<<<<<<<<<<
 *     f = func
 *     try:
 */
    __pyx_1 = PyTuple_New(3); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    Py_INCREF(__pyx_v_func);
    PyTuple_SET_ITEM(__pyx_1, 0, __pyx_v_func);
    Py_INCREF(__pyx_v_args);
    PyTuple_SET_ITEM(__pyx_1, 1, __pyx_v_args);
    Py_INCREF(__pyx_v_kw);
    PyTuple_SET_ITEM(__pyx_1, 2, __pyx_v_kw);
    __pyx_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_8tailspin_6fast_h_tailfish)), ((PyObject *)__pyx_1), NULL); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    Py_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0;
    __pyx_r = __pyx_4;
    __pyx_4 = 0;
    goto __pyx_L0;
  }
  __pyx_L6:;

  /* "/Users/xavid/Documents/tailspin/src/tailspin/fast_h.pyx":25
 *     else:
 *         return tailfish(func,args,kw)
 *     f = func             # <<<<<<<<<<<<<<
 *     try:
 *         while True:
 */
  Py_INCREF(__pyx_v_func);
  Py_DECREF(__pyx_v_f);
  __pyx_v_f = __pyx_v_func;

  /* "/Users/xavid/Documents/tailspin/src/tailspin/fast_h.pyx":26
 *         return tailfish(func,args,kw)
 *     f = func
 *     try:             # <<<<<<<<<<<<<<
 *         while True:
 *             ret = f(*args,**kw)
 */
  /*try:*/ {

    /* "/Users/xavid/Documents/tailspin/src/tailspin/fast_h.pyx":27
 *     f = func
 *     try:
 *         while True:             # <<<<<<<<<<<<<<
 *             ret = f(*args,**kw)
 *             if isinstance(ret,tailfish):
 */
    while (1) {
      __pyx_2 = 1;
      if (!__pyx_2) break;

      /* "/Users/xavid/Documents/tailspin/src/tailspin/fast_h.pyx":28
 *     try:
 *         while True:
 *             ret = f(*args,**kw)             # <<<<<<<<<<<<<<
 *             if isinstance(ret,tailfish):
 *                 f = (<tailfish>ret).func
 */
      __pyx_1 = PySequence_Tuple(__pyx_v_args); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L8;}
      __pyx_4 = PyEval_CallObjectWithKeywords(__pyx_v_f, __pyx_1, __pyx_v_kw); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L8;}
      Py_DECREF(__pyx_1); __pyx_1 = 0;
      Py_DECREF(__pyx_v_ret);
      __pyx_v_ret = __pyx_4;
      __pyx_4 = 0;

      /* "/Users/xavid/Documents/tailspin/src/tailspin/fast_h.pyx":29
 *         while True:
 *             ret = f(*args,**kw)
 *             if isinstance(ret,tailfish):             # <<<<<<<<<<<<<<
 *                 f = (<tailfish>ret).func
 *                 args = (<tailfish>ret).args
 */
      __pyx_3 = PyObject_TypeCheck(__pyx_v_ret, ((PyTypeObject *)((PyObject*)__pyx_ptype_8tailspin_6fast_h_tailfish))); 
      if (__pyx_3) {

        /* "/Users/xavid/Documents/tailspin/src/tailspin/fast_h.pyx":30
 *             ret = f(*args,**kw)
 *             if isinstance(ret,tailfish):
 *                 f = (<tailfish>ret).func             # <<<<<<<<<<<<<<
 *                 args = (<tailfish>ret).args
 *                 kw = (<tailfish>ret).kw
 */
        Py_INCREF(((struct __pyx_obj_8tailspin_6fast_h_tailfish *)__pyx_v_ret)->func);
        Py_DECREF(__pyx_v_f);
        __pyx_v_f = ((struct __pyx_obj_8tailspin_6fast_h_tailfish *)__pyx_v_ret)->func;

        /* "/Users/xavid/Documents/tailspin/src/tailspin/fast_h.pyx":31
 *             if isinstance(ret,tailfish):
 *                 f = (<tailfish>ret).func
 *                 args = (<tailfish>ret).args             # <<<<<<<<<<<<<<
 *                 kw = (<tailfish>ret).kw
 *             else:
 */
        Py_INCREF(((struct __pyx_obj_8tailspin_6fast_h_tailfish *)__pyx_v_ret)->args);
        Py_DECREF(__pyx_v_args);
        __pyx_v_args = ((struct __pyx_obj_8tailspin_6fast_h_tailfish *)__pyx_v_ret)->args;

        /* "/Users/xavid/Documents/tailspin/src/tailspin/fast_h.pyx":32
 *                 f = (<tailfish>ret).func
 *                 args = (<tailfish>ret).args
 *                 kw = (<tailfish>ret).kw             # <<<<<<<<<<<<<<
 *             else:
 *                 return ret
 */
        Py_INCREF(((struct __pyx_obj_8tailspin_6fast_h_tailfish *)__pyx_v_ret)->kw);
        Py_DECREF(__pyx_v_kw);
        __pyx_v_kw = ((struct __pyx_obj_8tailspin_6fast_h_tailfish *)__pyx_v_ret)->kw;
        goto __pyx_L12;
      }
      /*else*/ {

        /* "/Users/xavid/Documents/tailspin/src/tailspin/fast_h.pyx":34
 *                 kw = (<tailfish>ret).kw
 *             else:
 *                 return ret             # <<<<<<<<<<<<<<
 *     finally:
 *         func.recur = False
 */
        Py_INCREF(__pyx_v_ret);
        __pyx_r = __pyx_v_ret;
        goto __pyx_L7;
      }
      __pyx_L12:;
    }
  }
  /*finally:*/ {
    int __pyx_why;
    PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb;
    int __pyx_exc_lineno;
    __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
    __pyx_why = 0; goto __pyx_L9;
    __pyx_L7: __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
    __pyx_why = 3; goto __pyx_L9;
    __pyx_L8: {
      __pyx_why = 4;
      Py_XDECREF(__pyx_1); __pyx_1 = 0;
      Py_XDECREF(__pyx_4); __pyx_4 = 0;
      __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
      __pyx_exc_lineno = __pyx_lineno;
      goto __pyx_L9;
    }
    __pyx_L9:;

    /* "/Users/xavid/Documents/tailspin/src/tailspin/fast_h.pyx":36
 *                 return ret
 *     finally:
 *         func.recur = False             # <<<<<<<<<<<<<<
 */
    __pyx_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L13_error;}
    if (PyObject_SetAttr(__pyx_v_func, __pyx_kp_recur, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L13_error;}
    Py_DECREF(__pyx_1); __pyx_1 = 0;
    goto __pyx_L14;
    __pyx_L13_error:;
    if (__pyx_why == 4) {
      Py_XDECREF(__pyx_exc_type);
      Py_XDECREF(__pyx_exc_value);
      Py_XDECREF(__pyx_exc_tb);
    }
    goto __pyx_L1_error;
    __pyx_L14:;
    switch (__pyx_why) {
      case 3: goto __pyx_L0;
      case 4: {
        __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb);
        __pyx_lineno = __pyx_exc_lineno;
        __pyx_exc_type = 0;
        __pyx_exc_value = 0;
        __pyx_exc_tb = 0;
        goto __pyx_L1_error;
      }
    }
  }

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  Py_XDECREF(__pyx_1);
  Py_XDECREF(__pyx_4);
  __Pyx_AddTraceback("tailspin.fast_h.helper");
  __pyx_r = NULL;
  __pyx_L0:;
  Py_DECREF(__pyx_v_f);
  Py_DECREF(__pyx_v_ret);
  Py_DECREF(__pyx_v_args);
  Py_DECREF(__pyx_v_kw);
  return __pyx_r;
}
static struct __pyx_vtabstruct_8tailspin_6fast_h_tailfish __pyx_vtable_8tailspin_6fast_h_tailfish;

static PyObject *__pyx_tp_new_8tailspin_6fast_h_tailfish(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_8tailspin_6fast_h_tailfish *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_8tailspin_6fast_h_tailfish *)o);
  p->__pyx_vtab = __pyx_vtabptr_8tailspin_6fast_h_tailfish;
  p->func = Py_None; Py_INCREF(Py_None);
  p->args = Py_None; Py_INCREF(Py_None);
  p->kw = Py_None; Py_INCREF(Py_None);
  if (__pyx_pf_8tailspin_6fast_h_8tailfish___cinit__(o, a, k) < 0) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_8tailspin_6fast_h_tailfish(PyObject *o) {
  struct __pyx_obj_8tailspin_6fast_h_tailfish *p = (struct __pyx_obj_8tailspin_6fast_h_tailfish *)o;
  Py_XDECREF(p->func);
  Py_XDECREF(p->args);
  Py_XDECREF(p->kw);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_8tailspin_6fast_h_tailfish(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_8tailspin_6fast_h_tailfish *p = (struct __pyx_obj_8tailspin_6fast_h_tailfish *)o;
  if (p->func) {
    e = (*v)(p->func, a); if (e) return e;
  }
  if (p->args) {
    e = (*v)(p->args, a); if (e) return e;
  }
  if (p->kw) {
    e = (*v)(p->kw, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_8tailspin_6fast_h_tailfish(PyObject *o) {
  struct __pyx_obj_8tailspin_6fast_h_tailfish *p = (struct __pyx_obj_8tailspin_6fast_h_tailfish *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->func);
  p->func = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->args);
  p->args = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->kw);
  p->kw = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static struct PyMethodDef __pyx_methods_8tailspin_6fast_h_tailfish[] = {
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_tailfish = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  0, /*nb_long*/
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if (PY_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX)
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_tailfish = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_tailfish = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_tailfish = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

PyTypeObject __pyx_type_8tailspin_6fast_h_tailfish = {
  PyVarObject_HEAD_INIT(0, 0)
  "tailspin.fast_h.tailfish", /*tp_name*/
  sizeof(struct __pyx_obj_8tailspin_6fast_h_tailfish), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_8tailspin_6fast_h_tailfish, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_compare*/
  0, /*tp_repr*/
  &__pyx_tp_as_number_tailfish, /*tp_as_number*/
  &__pyx_tp_as_sequence_tailfish, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_tailfish, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_tailfish, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_8tailspin_6fast_h_tailfish, /*tp_traverse*/
  __pyx_tp_clear_8tailspin_6fast_h_tailfish, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_8tailspin_6fast_h_tailfish, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_8tailspin_6fast_h_tailfish, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
};

static struct PyMethodDef __pyx_methods[] = {
  {"force", (PyCFunction)__pyx_pf_8tailspin_6fast_h_force, METH_O, 0},
  {"helper", (PyCFunction)__pyx_pf_8tailspin_6fast_h_helper, METH_VARARGS|METH_KEYWORDS, 0},
  {0, 0, 0, 0}
};

static void __pyx_init_filenames(void); /*proto*/

#if PY_MAJOR_VERSION >= 3
static struct PyModuleDef __pyx_moduledef = {
    PyModuleDef_HEAD_INIT,
    "fast_h",
    0, /* m_doc */
    -1, /* m_size */
    __pyx_methods /* m_methods */,
    NULL, /* m_reload */
    NULL, /* m_traverse */
    NULL, /* m_clear */
    NULL /* m_free */
};
#endif

static __Pyx_StringTabEntry __pyx_string_tab[] = {
  {&__pyx_kp___cinit__, __pyx_k___cinit__, sizeof(__pyx_k___cinit__), 1, 1, 1},
  {&__pyx_kp_o, __pyx_k_o, sizeof(__pyx_k_o), 1, 1, 1},
  {&__pyx_kp_func, __pyx_k_func, sizeof(__pyx_k_func), 1, 1, 1},
  {&__pyx_kp_args, __pyx_k_args, sizeof(__pyx_k_args), 1, 1, 1},
  {&__pyx_kp_kw, __pyx_k_kw, sizeof(__pyx_k_kw), 1, 1, 1},
  {&__pyx_kp_threading, __pyx_k_threading, sizeof(__pyx_k_threading), 1, 1, 1},
  {&__pyx_kp_recur, __pyx_k_recur, sizeof(__pyx_k_recur), 1, 1, 1},
  {0, 0, 0, 0, 0, 0}
};
static int __Pyx_InitCachedBuiltins(void) {
  return 0;
  return -1;
}

static int __Pyx_InitGlobals(void) {
  if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  return 0;
  __pyx_L1_error:;
  return -1;
}

#if PY_MAJOR_VERSION < 3
PyMODINIT_FUNC initfast_h(void); /*proto*/
PyMODINIT_FUNC initfast_h(void)
#else
PyMODINIT_FUNC PyInit_fast_h(void); /*proto*/
PyMODINIT_FUNC PyInit_fast_h(void)
#endif
{
  PyObject *__pyx_1 = 0;
  __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;}
  /*--- Library function declarations ---*/
  __pyx_init_filenames();
  /*--- Initialize various global constants etc. ---*/
  if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  /*--- Module creation code ---*/
  #if PY_MAJOR_VERSION < 3
  __pyx_m = Py_InitModule4("fast_h", __pyx_methods, 0, 0, PYTHON_API_VERSION);
  #else
  __pyx_m = PyModule_Create(&__pyx_moduledef);
  #endif
  if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  #if PY_MAJOR_VERSION < 3
  Py_INCREF(__pyx_m);
  #endif
  __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME);
  if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  /*--- Builtin init code ---*/
  if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_skip_dispatch = 0;
  /*--- Global init code ---*/
  /*--- Function export code ---*/
  /*--- Type init code ---*/
  __pyx_vtabptr_8tailspin_6fast_h_tailfish = &__pyx_vtable_8tailspin_6fast_h_tailfish;
  *(void(**)(void))&__pyx_vtable_8tailspin_6fast_h_tailfish.force = (void(*)(void))__pyx_f_8tailspin_6fast_h_8tailfish_force;
  if (PyType_Ready(&__pyx_type_8tailspin_6fast_h_tailfish) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_8tailspin_6fast_h_tailfish.tp_dict, __pyx_vtabptr_8tailspin_6fast_h_tailfish) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyObject_SetAttrString(__pyx_m, "tailfish", (PyObject *)&__pyx_type_8tailspin_6fast_h_tailfish) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_8tailspin_6fast_h_tailfish = &__pyx_type_8tailspin_6fast_h_tailfish;
  /*--- Type import code ---*/
  /*--- Function import code ---*/
  /*--- Execution code ---*/

  /* "/Users/xavid/Documents/tailspin/src/tailspin/fast_h.pyx":1
 * import threading             # <<<<<<<<<<<<<<
 * 
 * def force(o):
 */
  __pyx_1 = __Pyx_Import(__pyx_kp_threading, 0); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyObject_SetAttr(__pyx_m, __pyx_kp_threading, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;

  /* "/Users/xavid/Documents/tailspin/src/tailspin/fast_h.pyx":20
 *         return self.func(*self.args,**self.kw)
 * 
 * def helper(func,args,kw):             # <<<<<<<<<<<<<<
 *     if not func.recur:
 *         func.recur = True
 */
  #if PY_MAJOR_VERSION < 3
  return;
  #else
  return __pyx_m;
  #endif
  __pyx_L1_error:;
  Py_XDECREF(__pyx_1);
  __Pyx_AddTraceback("tailspin.fast_h");
  #if PY_MAJOR_VERSION >= 3
  return NULL;
  #endif
}

static const char *__pyx_filenames[] = {
  "fast_h.pyx",
};

/* Runtime support code */

static void __pyx_init_filenames(void) {
  __pyx_f = __pyx_filenames;
}

static void __Pyx_RaiseDoubleKeywordsError(
    const char* func_name,
    PyObject* kw_name)
{
    PyErr_Format(PyExc_TypeError,
        #if PY_MAJOR_VERSION >= 3
        "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
        #else
        "%s() got multiple values for keyword argument '%s'", func_name,
        PyString_AS_STRING(kw_name));
        #endif
}

static void __Pyx_RaiseArgtupleInvalid(
    const char* func_name,
    int exact,
    Py_ssize_t num_min,
    Py_ssize_t num_max,
    Py_ssize_t num_found)
{
    Py_ssize_t num_expected;
    const char *number, *more_or_less;

    if (num_found < num_min) {
        num_expected = num_min;
        more_or_less = "at least";
    } else {
        num_expected = num_max;
        more_or_less = "at most";
    }
    if (exact) {
        more_or_less = "exactly";
    }
    number = (num_expected == 1) ? "" : "s";
    PyErr_Format(PyExc_TypeError,
        #if PY_VERSION_HEX < 0x02050000
            "%s() takes %s %d positional argument%s (%d given)",
        #else
            "%s() takes %s %zd positional argument%s (%zd given)",
        #endif
        func_name, more_or_less, num_expected, number, num_found);
}

static int __Pyx_ParseOptionalKeywords(
    PyObject *kwds,
    PyObject **argnames[],
    PyObject *kwds2,
    PyObject *values[],
    Py_ssize_t num_pos_args,
    const char* function_name)
{
    PyObject *key = 0, *value = 0;
    Py_ssize_t pos = 0;
    PyObject*** name;
    PyObject*** first_kw_arg = argnames + num_pos_args;

    while (PyDict_Next(kwds, &pos, &key, &value)) {
        #if PY_MAJOR_VERSION < 3
        if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) {
        #else
        if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) {
        #endif
            goto invalid_keyword_type;
        } else {
            name = argnames;
            while (*name && (**name != key)) name++;
            if (*name) {
                if (name < first_kw_arg) goto arg_passed_twice;
                values[name-argnames] = value;
            } else {
                for (name = first_kw_arg; *name; name++) {
                    #if PY_MAJOR_VERSION >= 3
                    if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) &&
                        PyUnicode_Compare(**name, key) == 0) break;
                    #else
                    if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) &&
                        strcmp(PyString_AS_STRING(**name),
                               PyString_AS_STRING(key)) == 0) break;
                    #endif
                }
                if (*name) {
                    values[name-argnames] = value;
                } else {
                    /* unexpected keyword found */
                    for (name=argnames; name != first_kw_arg; name++) {
                        if (**name == key) goto arg_passed_twice;
                        #if PY_MAJOR_VERSION >= 3
                        if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) &&
                            PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice;
                        #else
                        if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) &&
                            strcmp(PyString_AS_STRING(**name),
                                   PyString_AS_STRING(key)) == 0) goto arg_passed_twice;
                        #endif
                    }
                    if (kwds2) {
                        if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
                    } else {
                        goto invalid_keyword;
                    }
                }
            }
        }
    }
    return 0;
arg_passed_twice:
    __Pyx_RaiseDoubleKeywordsError(function_name, **name);
    goto bad;
invalid_keyword_type:
    PyErr_Format(PyExc_TypeError,
        "%s() keywords must be strings", function_name);
    goto bad;
invalid_keyword:
    PyErr_Format(PyExc_TypeError,
    #if PY_MAJOR_VERSION < 3
        "%s() got an unexpected keyword argument '%s'",
        function_name, PyString_AsString(key));
    #else
        "%s() got an unexpected keyword argument '%U'",
        function_name, key);
    #endif
bad:
    return -1;
}

static INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    PyThreadState *tstate = PyThreadState_GET();

    tmp_type = tstate->curexc_type;
    tmp_value = tstate->curexc_value;
    tmp_tb = tstate->curexc_traceback;
    tstate->curexc_type = type;
    tstate->curexc_value = value;
    tstate->curexc_traceback = tb;
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
}

static INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) {
    PyThreadState *tstate = PyThreadState_GET();
    *type = tstate->curexc_type;
    *value = tstate->curexc_value;
    *tb = tstate->curexc_traceback;

    tstate->curexc_type = 0;
    tstate->curexc_value = 0;
    tstate->curexc_traceback = 0;
}


static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list) {
    PyObject *__import__ = 0;
    PyObject *empty_list = 0;
    PyObject *module = 0;
    PyObject *global_dict = 0;
    PyObject *empty_dict = 0;
    PyObject *list;
    __import__ = PyObject_GetAttrString(__pyx_b, "__import__");
    if (!__import__)
        goto bad;
    if (from_list)
        list = from_list;
    else {
        empty_list = PyList_New(0);
        if (!empty_list)
            goto bad;
        list = empty_list;
    }
    global_dict = PyModule_GetDict(__pyx_m);
    if (!global_dict)
        goto bad;
    empty_dict = PyDict_New();
    if (!empty_dict)
        goto bad;
    module = PyObject_CallFunction(__import__, "OOOO",
        name, global_dict, empty_dict, list);
bad:
    Py_XDECREF(empty_list);
    Py_XDECREF(__import__);
    Py_XDECREF(empty_dict);
    return module;
}

static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
    PyObject *pycobj = 0;
    int result;
    
    pycobj = PyCObject_FromVoidPtr(vtable, 0);
    if (!pycobj)
        goto bad;
    if (PyDict_SetItemString(dict, "__pyx_vtable__", pycobj) < 0)
        goto bad;
    result = 0;
    goto done;

bad:
    result = -1;
done:
    Py_XDECREF(pycobj);
    return result;
}

#include "compile.h"
#include "frameobject.h"
#include "traceback.h"

static void __Pyx_AddTraceback(const char *funcname) {
    PyObject *py_srcfile = 0;
    PyObject *py_funcname = 0;
    PyObject *py_globals = 0;
    PyObject *empty_string = 0;
    PyCodeObject *py_code = 0;
    PyFrameObject *py_frame = 0;

    #if PY_MAJOR_VERSION < 3
    py_srcfile = PyString_FromString(__pyx_filename);
    #else
    py_srcfile = PyUnicode_FromString(__pyx_filename);
    #endif
    if (!py_srcfile) goto bad;
    if (__pyx_clineno) {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno);
        #else
        py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno);
        #endif
    }
    else {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromString(funcname);
        #else
        py_funcname = PyUnicode_FromString(funcname);
        #endif
    }
    if (!py_funcname) goto bad;
    py_globals = PyModule_GetDict(__pyx_m);
    if (!py_globals) goto bad;
    #if PY_MAJOR_VERSION < 3
    empty_string = PyString_FromStringAndSize("", 0);
    #else
    empty_string = PyBytes_FromStringAndSize("", 0);
    #endif
    if (!empty_string) goto bad;
    py_code = PyCode_New(
        0,            /*int argcount,*/
        #if PY_MAJOR_VERSION >= 3
        0,            /*int kwonlyargcount,*/
        #endif
        0,            /*int nlocals,*/
        0,            /*int stacksize,*/
        0,            /*int flags,*/
        empty_string, /*PyObject *code,*/
        __pyx_empty_tuple,  /*PyObject *consts,*/
        __pyx_empty_tuple,  /*PyObject *names,*/
        __pyx_empty_tuple,  /*PyObject *varnames,*/
        __pyx_empty_tuple,  /*PyObject *freevars,*/
        __pyx_empty_tuple,  /*PyObject *cellvars,*/
        py_srcfile,   /*PyObject *filename,*/
        py_funcname,  /*PyObject *name,*/
        __pyx_lineno,   /*int firstlineno,*/
        empty_string  /*PyObject *lnotab*/
    );
    if (!py_code) goto bad;
    py_frame = PyFrame_New(
        PyThreadState_GET(), /*PyThreadState *tstate,*/
        py_code,             /*PyCodeObject *code,*/
        py_globals,          /*PyObject *globals,*/
        0                    /*PyObject *locals*/
    );
    if (!py_frame) goto bad;
    py_frame->f_lineno = __pyx_lineno;
    PyTraceBack_Here(py_frame);
bad:
    Py_XDECREF(py_srcfile);
    Py_XDECREF(py_funcname);
    Py_XDECREF(empty_string);
    Py_XDECREF(py_code);
    Py_XDECREF(py_frame);
}

static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
    while (t->p) {
        #if PY_MAJOR_VERSION < 3
        if (t->is_unicode && (!t->is_identifier)) {
            *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
        } else if (t->intern) {
            *t->p = PyString_InternFromString(t->s);
        } else {
            *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
        }
        #else  /* Python 3+ has unicode identifiers */
        if (t->is_identifier || (t->is_unicode && t->intern)) {
            *t->p = PyUnicode_InternFromString(t->s);
        } else if (t->is_unicode) {
            *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
        } else {
            *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
        }
        #endif
        if (!*t->p)
            return -1;
        ++t;
    }
    return 0;
}

/* Type Conversion Functions */

static INLINE Py_ssize_t __pyx_PyIndex_AsSsize_t(PyObject* b) {
  Py_ssize_t ival;
  PyObject* x = PyNumber_Index(b);
  if (!x) return -1;
  ival = PyInt_AsSsize_t(x);
  Py_DECREF(x);
  return ival;
}

static INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
   if (x == Py_True) return 1;
   else if (x == Py_False) return 0;
   else return PyObject_IsTrue(x);
}

static INLINE PY_LONG_LONG __pyx_PyInt_AsLongLong(PyObject* x) {
    if (PyInt_CheckExact(x)) {
        return PyInt_AS_LONG(x);
    }
    else if (PyLong_CheckExact(x)) {
        return PyLong_AsLongLong(x);
    }
    else {
        PY_LONG_LONG val;
        PyObject* tmp = PyNumber_Int(x); if (!tmp) return (PY_LONG_LONG)-1;
        val = __pyx_PyInt_AsLongLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static INLINE unsigned PY_LONG_LONG __pyx_PyInt_AsUnsignedLongLong(PyObject* x) {
    if (PyInt_CheckExact(x)) {
        long val = PyInt_AS_LONG(x);
        if (unlikely(val < 0)) {
            PyErr_SetString(PyExc_TypeError, "Negative assignment to unsigned type.");
            return (unsigned PY_LONG_LONG)-1;
        }
        return val;
    }
    else if (PyLong_CheckExact(x)) {
        return PyLong_AsUnsignedLongLong(x);
    }
    else {
        PY_LONG_LONG val;
        PyObject* tmp = PyNumber_Int(x); if (!tmp) return (PY_LONG_LONG)-1;
        val = __pyx_PyInt_AsUnsignedLongLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}


static INLINE unsigned char __pyx_PyInt_unsigned_char(PyObject* x) {
    if (sizeof(unsigned char) < sizeof(long)) {
        long long_val = __pyx_PyInt_AsLong(x);
        unsigned char val = (unsigned char)long_val;
        if (unlikely((val != long_val)  || (long_val < 0))) {
            PyErr_SetString(PyExc_OverflowError, "value too large to convert to unsigned char");
            return (unsigned char)-1;
        }
        return val;
    }
    else {
        return __pyx_PyInt_AsLong(x);
    }
}

static INLINE unsigned short __pyx_PyInt_unsigned_short(PyObject* x) {
    if (sizeof(unsigned short) < sizeof(long)) {
        long long_val = __pyx_PyInt_AsLong(x);
        unsigned short val = (unsigned short)long_val;
        if (unlikely((val != long_val)  || (long_val < 0))) {
            PyErr_SetString(PyExc_OverflowError, "value too large to convert to unsigned short");
            return (unsigned short)-1;
        }
        return val;
    }
    else {
        return __pyx_PyInt_AsLong(x);
    }
}

static INLINE char __pyx_PyInt_char(PyObject* x) {
    if (sizeof(char) < sizeof(long)) {
        long long_val = __pyx_PyInt_AsLong(x);
        char val = (char)long_val;
        if (unlikely((val != long_val) )) {
            PyErr_SetString(PyExc_OverflowError, "value too large to convert to char");
            return (char)-1;
        }
        return val;
    }
    else {
        return __pyx_PyInt_AsLong(x);
    }
}

static INLINE short __pyx_PyInt_short(PyObject* x) {
    if (sizeof(short) < sizeof(long)) {
        long long_val = __pyx_PyInt_AsLong(x);
        short val = (short)long_val;
        if (unlikely((val != long_val) )) {
            PyErr_SetString(PyExc_OverflowError, "value too large to convert to short");
            return (short)-1;
        }
        return val;
    }
    else {
        return __pyx_PyInt_AsLong(x);
    }
}

static INLINE int __pyx_PyInt_int(PyObject* x) {
    if (sizeof(int) < sizeof(long)) {
        long long_val = __pyx_PyInt_AsLong(x);
        int val = (int)long_val;
        if (unlikely((val != long_val) )) {
            PyErr_SetString(PyExc_OverflowError, "value too large to convert to int");
            return (int)-1;
        }
        return val;
    }
    else {
        return __pyx_PyInt_AsLong(x);
    }
}

static INLINE long __pyx_PyInt_long(PyObject* x) {
    if (sizeof(long) < sizeof(long)) {
        long long_val = __pyx_PyInt_AsLong(x);
        long val = (long)long_val;
        if (unlikely((val != long_val) )) {
            PyErr_SetString(PyExc_OverflowError, "value too large to convert to long");
            return (long)-1;
        }
        return val;
    }
    else {
        return __pyx_PyInt_AsLong(x);
    }
}

static INLINE signed char __pyx_PyInt_signed_char(PyObject* x) {
    if (sizeof(signed char) < sizeof(long)) {
        long long_val = __pyx_PyInt_AsLong(x);
        signed char val = (signed char)long_val;
        if (unlikely((val != long_val) )) {
            PyErr_SetString(PyExc_OverflowError, "value too large to convert to signed char");
            return (signed char)-1;
        }
        return val;
    }
    else {
        return __pyx_PyInt_AsLong(x);
    }
}

static INLINE signed short __pyx_PyInt_signed_short(PyObject* x) {
    if (sizeof(signed short) < sizeof(long)) {
        long long_val = __pyx_PyInt_AsLong(x);
        signed short val = (signed short)long_val;
        if (unlikely((val != long_val) )) {
            PyErr_SetString(PyExc_OverflowError, "value too large to convert to signed short");
            return (signed short)-1;
        }
        return val;
    }
    else {
        return __pyx_PyInt_AsLong(x);
    }
}

static INLINE signed int __pyx_PyInt_signed_int(PyObject* x) {
    if (sizeof(signed int) < sizeof(long)) {
        long long_val = __pyx_PyInt_AsLong(x);
        signed int val = (signed int)long_val;
        if (unlikely((val != long_val) )) {
            PyErr_SetString(PyExc_OverflowError, "value too large to convert to signed int");
            return (signed int)-1;
        }
        return val;
    }
    else {
        return __pyx_PyInt_AsLong(x);
    }
}

static INLINE signed long __pyx_PyInt_signed_long(PyObject* x) {
    if (sizeof(signed long) < sizeof(long)) {
        long long_val = __pyx_PyInt_AsLong(x);
        signed long val = (signed long)long_val;
        if (unlikely((val != long_val) )) {
            PyErr_SetString(PyExc_OverflowError, "value too large to convert to signed long");
            return (signed long)-1;
        }
        return val;
    }
    else {
        return __pyx_PyInt_AsLong(x);
    }
}

static INLINE long double __pyx_PyInt_long_double(PyObject* x) {
    if (sizeof(long double) < sizeof(long)) {
        long long_val = __pyx_PyInt_AsLong(x);
        long double val = (long double)long_val;
        if (unlikely((val != long_val) )) {
            PyErr_SetString(PyExc_OverflowError, "value too large to convert to long double");
            return (long double)-1;
        }
        return val;
    }
    else {
        return __pyx_PyInt_AsLong(x);
    }
}

