/* Generated by Cython 0.25.2 */

/* BEGIN: Cython Metadata
{
    "distutils": {
        "depends": [
            "third_party/msgpuck/msgpuck.h"
        ],
        "include_dirs": [
            "-Ithird_party"
        ]
    },
    "module_name": "asynctnt.iproto.protocol"
}
END: Cython Metadata */

#define PY_SSIZE_T_CLEAN
#include "Python.h"
#ifndef Py_PYTHON_H
    #error Python headers needed to compile C extensions, please install development version of Python.
#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03020000)
    #error Cython requires Python 2.6+ or Python 3.2+.
#else
#define CYTHON_ABI "0_25_2"
#include <stddef.h>
#ifndef offsetof
  #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
#endif
#if !defined(WIN32) && !defined(MS_WINDOWS)
  #ifndef __stdcall
    #define __stdcall
  #endif
  #ifndef __cdecl
    #define __cdecl
  #endif
  #ifndef __fastcall
    #define __fastcall
  #endif
#endif
#ifndef DL_IMPORT
  #define DL_IMPORT(t) t
#endif
#ifndef DL_EXPORT
  #define DL_EXPORT(t) t
#endif
#ifndef HAVE_LONG_LONG
  #if PY_VERSION_HEX >= 0x03030000 || (PY_MAJOR_VERSION == 2 && PY_VERSION_HEX >= 0x02070000)
    #define HAVE_LONG_LONG
  #endif
#endif
#ifndef PY_LONG_LONG
  #define PY_LONG_LONG LONG_LONG
#endif
#ifndef Py_HUGE_VAL
  #define Py_HUGE_VAL HUGE_VAL
#endif
#ifdef PYPY_VERSION
  #define CYTHON_COMPILING_IN_PYPY 1
  #define CYTHON_COMPILING_IN_PYSTON 0
  #define CYTHON_COMPILING_IN_CPYTHON 0
  #undef CYTHON_USE_TYPE_SLOTS
  #define CYTHON_USE_TYPE_SLOTS 0
  #undef CYTHON_USE_ASYNC_SLOTS
  #define CYTHON_USE_ASYNC_SLOTS 0
  #undef CYTHON_USE_PYLIST_INTERNALS
  #define CYTHON_USE_PYLIST_INTERNALS 0
  #undef CYTHON_USE_UNICODE_INTERNALS
  #define CYTHON_USE_UNICODE_INTERNALS 0
  #undef CYTHON_USE_UNICODE_WRITER
  #define CYTHON_USE_UNICODE_WRITER 0
  #undef CYTHON_USE_PYLONG_INTERNALS
  #define CYTHON_USE_PYLONG_INTERNALS 0
  #undef CYTHON_AVOID_BORROWED_REFS
  #define CYTHON_AVOID_BORROWED_REFS 1
  #undef CYTHON_ASSUME_SAFE_MACROS
  #define CYTHON_ASSUME_SAFE_MACROS 0
  #undef CYTHON_UNPACK_METHODS
  #define CYTHON_UNPACK_METHODS 0
  #undef CYTHON_FAST_THREAD_STATE
  #define CYTHON_FAST_THREAD_STATE 0
  #undef CYTHON_FAST_PYCALL
  #define CYTHON_FAST_PYCALL 0
#elif defined(PYSTON_VERSION)
  #define CYTHON_COMPILING_IN_PYPY 0
  #define CYTHON_COMPILING_IN_PYSTON 1
  #define CYTHON_COMPILING_IN_CPYTHON 0
  #ifndef CYTHON_USE_TYPE_SLOTS
    #define CYTHON_USE_TYPE_SLOTS 1
  #endif
  #undef CYTHON_USE_ASYNC_SLOTS
  #define CYTHON_USE_ASYNC_SLOTS 0
  #undef CYTHON_USE_PYLIST_INTERNALS
  #define CYTHON_USE_PYLIST_INTERNALS 0
  #ifndef CYTHON_USE_UNICODE_INTERNALS
    #define CYTHON_USE_UNICODE_INTERNALS 1
  #endif
  #undef CYTHON_USE_UNICODE_WRITER
  #define CYTHON_USE_UNICODE_WRITER 0
  #undef CYTHON_USE_PYLONG_INTERNALS
  #define CYTHON_USE_PYLONG_INTERNALS 0
  #ifndef CYTHON_AVOID_BORROWED_REFS
    #define CYTHON_AVOID_BORROWED_REFS 0
  #endif
  #ifndef CYTHON_ASSUME_SAFE_MACROS
    #define CYTHON_ASSUME_SAFE_MACROS 1
  #endif
  #ifndef CYTHON_UNPACK_METHODS
    #define CYTHON_UNPACK_METHODS 1
  #endif
  #undef CYTHON_FAST_THREAD_STATE
  #define CYTHON_FAST_THREAD_STATE 0
  #undef CYTHON_FAST_PYCALL
  #define CYTHON_FAST_PYCALL 0
#else
  #define CYTHON_COMPILING_IN_PYPY 0
  #define CYTHON_COMPILING_IN_PYSTON 0
  #define CYTHON_COMPILING_IN_CPYTHON 1
  #ifndef CYTHON_USE_TYPE_SLOTS
    #define CYTHON_USE_TYPE_SLOTS 1
  #endif
  #if PY_MAJOR_VERSION < 3
    #undef CYTHON_USE_ASYNC_SLOTS
    #define CYTHON_USE_ASYNC_SLOTS 0
  #elif !defined(CYTHON_USE_ASYNC_SLOTS)
    #define CYTHON_USE_ASYNC_SLOTS 1
  #endif
  #if PY_VERSION_HEX < 0x02070000
    #undef CYTHON_USE_PYLONG_INTERNALS
    #define CYTHON_USE_PYLONG_INTERNALS 0
  #elif !defined(CYTHON_USE_PYLONG_INTERNALS)
    #define CYTHON_USE_PYLONG_INTERNALS 1
  #endif
  #ifndef CYTHON_USE_PYLIST_INTERNALS
    #define CYTHON_USE_PYLIST_INTERNALS 1
  #endif
  #ifndef CYTHON_USE_UNICODE_INTERNALS
    #define CYTHON_USE_UNICODE_INTERNALS 1
  #endif
  #if PY_VERSION_HEX < 0x030300F0
    #undef CYTHON_USE_UNICODE_WRITER
    #define CYTHON_USE_UNICODE_WRITER 0
  #elif !defined(CYTHON_USE_UNICODE_WRITER)
    #define CYTHON_USE_UNICODE_WRITER 1
  #endif
  #ifndef CYTHON_AVOID_BORROWED_REFS
    #define CYTHON_AVOID_BORROWED_REFS 0
  #endif
  #ifndef CYTHON_ASSUME_SAFE_MACROS
    #define CYTHON_ASSUME_SAFE_MACROS 1
  #endif
  #ifndef CYTHON_UNPACK_METHODS
    #define CYTHON_UNPACK_METHODS 1
  #endif
  #ifndef CYTHON_FAST_THREAD_STATE
    #define CYTHON_FAST_THREAD_STATE 1
  #endif
  #ifndef CYTHON_FAST_PYCALL
    #define CYTHON_FAST_PYCALL 1
  #endif
#endif
#if !defined(CYTHON_FAST_PYCCALL)
#define CYTHON_FAST_PYCCALL  (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
#endif
#if CYTHON_USE_PYLONG_INTERNALS
  #include "longintrepr.h"
  #undef SHIFT
  #undef BASE
  #undef MASK
#endif
#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
  #define Py_OptimizeFlag 0
#endif
#define __PYX_BUILD_PY_SSIZE_T "n"
#define CYTHON_FORMAT_SSIZE_T "z"
#if PY_MAJOR_VERSION < 3
  #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
          PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
  #define __Pyx_DefaultClassType PyClass_Type
#else
  #define __Pyx_BUILTIN_MODULE_NAME "builtins"
  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
          PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
  #define __Pyx_DefaultClassType PyType_Type
#endif
#ifndef Py_TPFLAGS_CHECKTYPES
  #define Py_TPFLAGS_CHECKTYPES 0
#endif
#ifndef Py_TPFLAGS_HAVE_INDEX
  #define Py_TPFLAGS_HAVE_INDEX 0
#endif
#ifndef Py_TPFLAGS_HAVE_NEWBUFFER
  #define Py_TPFLAGS_HAVE_NEWBUFFER 0
#endif
#ifndef Py_TPFLAGS_HAVE_FINALIZE
  #define Py_TPFLAGS_HAVE_FINALIZE 0
#endif
#ifndef METH_FASTCALL
  #define METH_FASTCALL 0x80
  typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject **args,
                                              Py_ssize_t nargs, PyObject *kwnames);
#else
  #define __Pyx_PyCFunctionFast _PyCFunctionFast
#endif
#if CYTHON_FAST_PYCCALL
#define __Pyx_PyFastCFunction_Check(func)\
    ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST)))))
#else
#define __Pyx_PyFastCFunction_Check(func) 0
#endif
#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
  #define CYTHON_PEP393_ENABLED 1
  #define __Pyx_PyUnicode_READY(op)       (likely(PyUnicode_IS_READY(op)) ?\
                                              0 : _PyUnicode_Ready((PyObject *)(op)))
  #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_LENGTH(u)
  #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
  #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   PyUnicode_MAX_CHAR_VALUE(u)
  #define __Pyx_PyUnicode_KIND(u)         PyUnicode_KIND(u)
  #define __Pyx_PyUnicode_DATA(u)         PyUnicode_DATA(u)
  #define __Pyx_PyUnicode_READ(k, d, i)   PyUnicode_READ(k, d, i)
  #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  PyUnicode_WRITE(k, d, i, ch)
  #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
#else
  #define CYTHON_PEP393_ENABLED 0
  #define PyUnicode_1BYTE_KIND  1
  #define PyUnicode_2BYTE_KIND  2
  #define PyUnicode_4BYTE_KIND  4
  #define __Pyx_PyUnicode_READY(op)       (0)
  #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_SIZE(u)
  #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
  #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
  #define __Pyx_PyUnicode_KIND(u)         (sizeof(Py_UNICODE))
  #define __Pyx_PyUnicode_DATA(u)         ((void*)PyUnicode_AS_UNICODE(u))
  #define __Pyx_PyUnicode_READ(k, d, i)   ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
  #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
  #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != PyUnicode_GET_SIZE(u))
#endif
#if CYTHON_COMPILING_IN_PYPY
  #define __Pyx_PyUnicode_Concat(a, b)      PyNumber_Add(a, b)
  #define __Pyx_PyUnicode_ConcatSafe(a, b)  PyNumber_Add(a, b)
#else
  #define __Pyx_PyUnicode_Concat(a, b)      PyUnicode_Concat(a, b)
  #define __Pyx_PyUnicode_ConcatSafe(a, b)  ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
      PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
  #define PyUnicode_Contains(u, s)  PySequence_Contains(u, s)
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
  #define PyByteArray_Check(obj)  PyObject_TypeCheck(obj, &PyByteArray_Type)
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
  #define PyObject_Format(obj, fmt)  PyObject_CallMethod(obj, "__format__", "O", fmt)
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
  #define PyObject_Malloc(s)   PyMem_Malloc(s)
  #define PyObject_Free(p)     PyMem_Free(p)
  #define PyObject_Realloc(p)  PyMem_Realloc(p)
#endif
#if CYTHON_COMPILING_IN_PYSTON
  #define __Pyx_PyCode_HasFreeVars(co)  PyCode_HasFreeVars(co)
  #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
#else
  #define __Pyx_PyCode_HasFreeVars(co)  (PyCode_GetNumFree(co) > 0)
  #define __Pyx_PyFrame_SetLineNumber(frame, lineno)  (frame)->f_lineno = (lineno)
#endif
#define __Pyx_PyString_FormatSafe(a, b)   ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
#define __Pyx_PyUnicode_FormatSafe(a, b)  ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyString_Format(a, b)  PyUnicode_Format(a, b)
#else
  #define __Pyx_PyString_Format(a, b)  PyString_Format(a, b)
#endif
#if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
  #define PyObject_ASCII(o)            PyObject_Repr(o)
#endif
#if PY_MAJOR_VERSION >= 3
  #define PyBaseString_Type            PyUnicode_Type
  #define PyStringObject               PyUnicodeObject
  #define PyString_Type                PyUnicode_Type
  #define PyString_Check               PyUnicode_Check
  #define PyString_CheckExact          PyUnicode_CheckExact
#endif
#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
  #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
#else
  #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
  #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
#endif
#ifndef PySet_CheckExact
  #define PySet_CheckExact(obj)        (Py_TYPE(obj) == &PySet_Type)
#endif
#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
#if PY_MAJOR_VERSION >= 3
  #define PyIntObject                  PyLongObject
  #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 PyNumber_Int                 PyNumber_Long
#endif
#if PY_MAJOR_VERSION >= 3
  #define PyBoolObject                 PyLongObject
#endif
#if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
  #ifndef PyUnicode_InternFromString
    #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
  #endif
#endif
#if PY_VERSION_HEX < 0x030200A4
  typedef long Py_hash_t;
  #define __Pyx_PyInt_FromHash_t PyInt_FromLong
  #define __Pyx_PyInt_AsHash_t   PyInt_AsLong
#else
  #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
  #define __Pyx_PyInt_AsHash_t   PyInt_AsSsize_t
#endif
#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
#else
  #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
#endif
#if CYTHON_USE_ASYNC_SLOTS
  #if PY_VERSION_HEX >= 0x030500B1
    #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
    #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
  #else
    typedef struct {
        unaryfunc am_await;
        unaryfunc am_aiter;
        unaryfunc am_anext;
    } __Pyx_PyAsyncMethodsStruct;
    #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
  #endif
#else
  #define __Pyx_PyType_AsAsync(obj) NULL
#endif
#ifndef CYTHON_RESTRICT
  #if defined(__GNUC__)
    #define CYTHON_RESTRICT __restrict__
  #elif defined(_MSC_VER) && _MSC_VER >= 1400
    #define CYTHON_RESTRICT __restrict
  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define CYTHON_RESTRICT restrict
  #else
    #define CYTHON_RESTRICT
  #endif
#endif
#ifndef CYTHON_UNUSED
# if defined(__GNUC__)
#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
#     define CYTHON_UNUSED __attribute__ ((__unused__))
#   else
#     define CYTHON_UNUSED
#   endif
# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
#   define CYTHON_UNUSED __attribute__ ((__unused__))
# else
#   define CYTHON_UNUSED
# endif
#endif
#ifndef CYTHON_MAYBE_UNUSED_VAR
#  if defined(__cplusplus)
     template<class T> void CYTHON_MAYBE_UNUSED_VAR( const T& ) { }
#  else
#    define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
#  endif
#endif
#ifndef CYTHON_NCP_UNUSED
# if CYTHON_COMPILING_IN_CPYTHON
#  define CYTHON_NCP_UNUSED
# else
#  define CYTHON_NCP_UNUSED CYTHON_UNUSED
# endif
#endif
#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)

#ifndef CYTHON_INLINE
  #if defined(__clang__)
    #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
  #elif defined(__GNUC__)
    #define CYTHON_INLINE __inline__
  #elif defined(_MSC_VER)
    #define CYTHON_INLINE __inline
  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define CYTHON_INLINE inline
  #else
    #define CYTHON_INLINE
  #endif
#endif

#if defined(WIN32) || defined(MS_WINDOWS)
  #define _USE_MATH_DEFINES
#endif
#include <math.h>
#ifdef NAN
#define __PYX_NAN() ((float) NAN)
#else
static CYTHON_INLINE float __PYX_NAN() {
  float value;
  memset(&value, 0xFF, sizeof(value));
  return value;
}
#endif
#if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
#define __Pyx_truncl trunc
#else
#define __Pyx_truncl truncl
#endif


#define __PYX_ERR(f_index, lineno, Ln_error) \
{ \
  __pyx_filename = __pyx_f[f_index]; __pyx_lineno = lineno; __pyx_clineno = __LINE__; goto Ln_error; \
}

#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
#else
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_Divide(x,y)
  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceDivide(x,y)
#endif

#ifndef __PYX_EXTERN_C
  #ifdef __cplusplus
    #define __PYX_EXTERN_C extern "C"
  #else
    #define __PYX_EXTERN_C extern
  #endif
#endif

#define __PYX_HAVE__asynctnt__iproto__protocol
#define __PYX_HAVE_API__asynctnt__iproto__protocol
#include <stdint.h>
#include "../../third_party/msgpuck/msgpuck.h"
#include <string.h>
#include <stdio.h>
#include "pythread.h"
#include <math.h>
#ifdef _OPENMP
#include <omp.h>
#endif /* _OPENMP */

#ifdef PYREX_WITHOUT_ASSERTIONS
#define CYTHON_WITHOUT_ASSERTIONS
#endif

typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
                const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;

#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0
#define __PYX_DEFAULT_STRING_ENCODING ""
#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
#define __Pyx_uchar_cast(c) ((unsigned char)c)
#define __Pyx_long_cast(x) ((long)x)
#define __Pyx_fits_Py_ssize_t(v, type, is_signed)  (\
    (sizeof(type) < sizeof(Py_ssize_t))  ||\
    (sizeof(type) > sizeof(Py_ssize_t) &&\
          likely(v < (type)PY_SSIZE_T_MAX ||\
                 v == (type)PY_SSIZE_T_MAX)  &&\
          (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
                                v == (type)PY_SSIZE_T_MIN)))  ||\
    (sizeof(type) == sizeof(Py_ssize_t) &&\
          (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
                               v == (type)PY_SSIZE_T_MAX)))  )
#if defined (__cplusplus) && __cplusplus >= 201103L
    #include <cstdlib>
    #define __Pyx_sst_abs(value) std::abs(value)
#elif SIZEOF_INT >= SIZEOF_SIZE_T
    #define __Pyx_sst_abs(value) abs(value)
#elif SIZEOF_LONG >= SIZEOF_SIZE_T
    #define __Pyx_sst_abs(value) labs(value)
#elif defined (_MSC_VER) && defined (_M_X64)
    #define __Pyx_sst_abs(value) _abs64(value)
#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define __Pyx_sst_abs(value) llabs(value)
#elif defined (__GNUC__)
    #define __Pyx_sst_abs(value) __builtin_llabs(value)
#else
    #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
#endif
static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*);
static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
#define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
#define __Pyx_PyBytes_FromString        PyBytes_FromString
#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
#if PY_MAJOR_VERSION < 3
    #define __Pyx_PyStr_FromString        __Pyx_PyBytes_FromString
    #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
#else
    #define __Pyx_PyStr_FromString        __Pyx_PyUnicode_FromString
    #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
#endif
#define __Pyx_PyObject_AsSString(s)    ((signed char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsUString(s)    ((unsigned char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_FromCString(s)  __Pyx_PyObject_FromString((const char*)s)
#define __Pyx_PyBytes_FromCString(s)   __Pyx_PyBytes_FromString((const char*)s)
#define __Pyx_PyByteArray_FromCString(s)   __Pyx_PyByteArray_FromString((const char*)s)
#define __Pyx_PyStr_FromCString(s)     __Pyx_PyStr_FromString((const char*)s)
#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
#if PY_MAJOR_VERSION < 3
static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u)
{
    const Py_UNICODE *u_end = u;
    while (*u_end++) ;
    return (size_t)(u_end - u - 1);
}
#else
#define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen
#endif
#define __Pyx_PyUnicode_FromUnicode(u)       PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
#define __Pyx_PyUnicode_AsUnicode            PyUnicode_AsUnicode
#define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
#define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
#define __Pyx_PyBool_FromLong(b) ((b) ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False))
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
#if CYTHON_ASSUME_SAFE_MACROS
#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
#else
#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
#endif
#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
#if PY_MAJOR_VERSION >= 3
#define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
#else
#define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
#endif
#define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
static int __Pyx_sys_getdefaultencoding_not_ascii;
static int __Pyx_init_sys_getdefaultencoding_params(void) {
    PyObject* sys;
    PyObject* default_encoding = NULL;
    PyObject* ascii_chars_u = NULL;
    PyObject* ascii_chars_b = NULL;
    const char* default_encoding_c;
    sys = PyImport_ImportModule("sys");
    if (!sys) goto bad;
    default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
    Py_DECREF(sys);
    if (!default_encoding) goto bad;
    default_encoding_c = PyBytes_AsString(default_encoding);
    if (!default_encoding_c) goto bad;
    if (strcmp(default_encoding_c, "ascii") == 0) {
        __Pyx_sys_getdefaultencoding_not_ascii = 0;
    } else {
        char ascii_chars[128];
        int c;
        for (c = 0; c < 128; c++) {
            ascii_chars[c] = c;
        }
        __Pyx_sys_getdefaultencoding_not_ascii = 1;
        ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
        if (!ascii_chars_u) goto bad;
        ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
        if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
            PyErr_Format(
                PyExc_ValueError,
                "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
                default_encoding_c);
            goto bad;
        }
        Py_DECREF(ascii_chars_u);
        Py_DECREF(ascii_chars_b);
    }
    Py_DECREF(default_encoding);
    return 0;
bad:
    Py_XDECREF(default_encoding);
    Py_XDECREF(ascii_chars_u);
    Py_XDECREF(ascii_chars_b);
    return -1;
}
#endif
#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
#else
#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
static char* __PYX_DEFAULT_STRING_ENCODING;
static int __Pyx_init_sys_getdefaultencoding_params(void) {
    PyObject* sys;
    PyObject* default_encoding = NULL;
    char* default_encoding_c;
    sys = PyImport_ImportModule("sys");
    if (!sys) goto bad;
    default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
    Py_DECREF(sys);
    if (!default_encoding) goto bad;
    default_encoding_c = PyBytes_AsString(default_encoding);
    if (!default_encoding_c) goto bad;
    __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c));
    if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
    strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
    Py_DECREF(default_encoding);
    return 0;
bad:
    Py_XDECREF(default_encoding);
    return -1;
}
#endif
#endif


/* Test for GCC > 2.95 */
#if defined(__GNUC__)     && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
  #define likely(x)   __builtin_expect(!!(x), 1)
  #define unlikely(x) __builtin_expect(!!(x), 0)
#else /* !__GNUC__ or GCC < 2.95 */
  #define likely(x)   (x)
  #define unlikely(x) (x)
#endif /* __GNUC__ */

static PyObject *__pyx_m;
static PyObject *__pyx_d;
static PyObject *__pyx_b;
static PyObject *__pyx_empty_tuple;
static PyObject *__pyx_empty_bytes;
static PyObject *__pyx_empty_unicode;
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[] = {
  "asynctnt/iproto/buffer.pyx",
  "asynctnt/iproto/schema.pyx",
  "asynctnt/iproto/coreproto.pyx",
  "asynctnt/iproto/protocol.pyx",
  "asynctnt/iproto/unicode.pyx",
  "asynctnt/iproto/rbuffer.pyx",
  "asynctnt/iproto/request.pyx",
  "asynctnt/iproto/response.pyx",
  "asynctnt/iproto/response.pxd",
  "asynctnt/iproto/schema.pxd",
  "asynctnt/iproto/db.pyx",
  "type.pxd",
  "bool.pxd",
  "complex.pxd",
};

/*--- Type declarations ---*/
struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer;
struct __pyx_obj_8asynctnt_6iproto_8protocol_ReadBuffer;
struct __pyx_obj_8asynctnt_6iproto_8protocol_Request;
struct __pyx_obj_8asynctnt_6iproto_8protocol_Response;
struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaIndex;
struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaSpace;
struct __pyx_obj_8asynctnt_6iproto_8protocol_Schema;
struct __pyx_obj_8asynctnt_6iproto_8protocol_Db;
struct __pyx_obj_8asynctnt_6iproto_8protocol_CoreProtocol;
struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol;
struct __pyx_obj_8asynctnt_6iproto_8protocol___pyx_scope_struct__execute;
struct __pyx_obj_8asynctnt_6iproto_8protocol___pyx_scope_struct_1__do_auth;
struct __pyx_obj_8asynctnt_6iproto_8protocol___pyx_scope_struct_2__do_fetch_schema;

/* "tnt.pxd":1
 * cdef enum tnt_header_key:             # <<<<<<<<<<<<<<
 *     TP_CODE = 0x00
 *     TP_SYNC = 0x01
 */
enum __pyx_t_8asynctnt_6iproto_3tnt_tnt_header_key {
  __pyx_e_8asynctnt_6iproto_3tnt_TP_CODE = 0x00,
  __pyx_e_8asynctnt_6iproto_3tnt_TP_SYNC = 0x01,
  __pyx_e_8asynctnt_6iproto_3tnt_TP_SERVER_ID = 0x02,
  __pyx_e_8asynctnt_6iproto_3tnt_TP_LSN = 0x03,
  __pyx_e_8asynctnt_6iproto_3tnt_TP_TIMESTAMP = 0x04,
  __pyx_e_8asynctnt_6iproto_3tnt_TP_SCHEMA_ID = 0x05
};

/* "tnt.pxd":10
 * 
 * 
 * cdef enum tnt_body_key_t:             # <<<<<<<<<<<<<<
 *     TP_SPACE = 0x10
 *     TP_INDEX = 0x11
 */
enum __pyx_t_8asynctnt_6iproto_3tnt_tnt_body_key_t {
  __pyx_e_8asynctnt_6iproto_3tnt_TP_SPACE = 0x10,
  __pyx_e_8asynctnt_6iproto_3tnt_TP_INDEX = 0x11,
  __pyx_e_8asynctnt_6iproto_3tnt_TP_LIMIT = 0x12,
  __pyx_e_8asynctnt_6iproto_3tnt_TP_OFFSET = 0x13,
  __pyx_e_8asynctnt_6iproto_3tnt_TP_ITERATOR = 0x14,
  __pyx_e_8asynctnt_6iproto_3tnt_TP_KEY = 0x20,
  __pyx_e_8asynctnt_6iproto_3tnt_TP_TUPLE = 0x21,
  __pyx_e_8asynctnt_6iproto_3tnt_TP_FUNCTION = 0x22,
  __pyx_e_8asynctnt_6iproto_3tnt_TP_USERNAME = 0x23,
  __pyx_e_8asynctnt_6iproto_3tnt_TP_EXPRESSION = 0x27,
  __pyx_e_8asynctnt_6iproto_3tnt_TP_OPERATIONS = 0x28
};

/* "tnt.pxd":24
 * 
 * 
 * cdef enum tnt_response_key_t:             # <<<<<<<<<<<<<<
 *     TP_DATA = 0x30
 *     TP_ERROR = 0x31
 */
enum __pyx_t_8asynctnt_6iproto_3tnt_tnt_response_key_t {
  __pyx_e_8asynctnt_6iproto_3tnt_TP_DATA = 0x30,
  __pyx_e_8asynctnt_6iproto_3tnt_TP_ERROR = 0x31
};

/* "tnt.pxd":29
 * 
 * 
 * cdef enum tp_request_type:             # <<<<<<<<<<<<<<
 *     TP_SELECT = 0x01
 *     TP_INSERT = 0x02
 */
enum __pyx_t_8asynctnt_6iproto_3tnt_tp_request_type {
  __pyx_e_8asynctnt_6iproto_3tnt_TP_SELECT = 0x01,
  __pyx_e_8asynctnt_6iproto_3tnt_TP_INSERT = 0x02,
  __pyx_e_8asynctnt_6iproto_3tnt_TP_REPLACE = 0x03,
  __pyx_e_8asynctnt_6iproto_3tnt_TP_UPDATE = 0x04,
  __pyx_e_8asynctnt_6iproto_3tnt_TP_DELETE = 0x05,
  __pyx_e_8asynctnt_6iproto_3tnt_TP_CALL_16 = 0x06,
  __pyx_e_8asynctnt_6iproto_3tnt_TP_CALL = 0x0a,
  __pyx_e_8asynctnt_6iproto_3tnt_TP_AUTH = 0x07,
  __pyx_e_8asynctnt_6iproto_3tnt_TP_EVAL = 0x08,
  __pyx_e_8asynctnt_6iproto_3tnt_TP_UPSERT = 0x09,
  __pyx_e_8asynctnt_6iproto_3tnt_TP_PING = 0x40
};

/* "tnt.pxd":43
 * 
 * 
 * cdef enum tnt_update_op_kind:             # <<<<<<<<<<<<<<
 *     OP_UPD_ARITHMETIC
 *     OP_UPD_DELETE
 */
enum __pyx_t_8asynctnt_6iproto_3tnt_tnt_update_op_kind {
  __pyx_e_8asynctnt_6iproto_3tnt_OP_UPD_ARITHMETIC,
  __pyx_e_8asynctnt_6iproto_3tnt_OP_UPD_DELETE,
  __pyx_e_8asynctnt_6iproto_3tnt_OP_UPD_INSERT_ASSIGN,
  __pyx_e_8asynctnt_6iproto_3tnt_OP_UPD_SPLICE,
  __pyx_e_8asynctnt_6iproto_3tnt_OP_UPD_UNKNOWN
};
struct __pyx_opt_args_8asynctnt_6iproto_8protocol_encode_unicode_string;
struct __pyx_opt_args_8asynctnt_6iproto_8protocol_11WriteBuffer_new;
struct __pyx_opt_args_8asynctnt_6iproto_8protocol_11WriteBuffer_write_header;
struct __pyx_opt_args_8asynctnt_6iproto_8protocol_11WriteBuffer_encode_request_update;
struct __pyx_opt_args_8asynctnt_6iproto_8protocol_10ReadBuffer_new;

/* "asynctnt/iproto/coreproto.pxd":1
 * cdef enum ProtocolState:             # <<<<<<<<<<<<<<
 *     PROTOCOL_IDLE = 0
 *     PROTOCOL_GREETING = 1
 */
enum __pyx_t_8asynctnt_6iproto_8protocol_ProtocolState {
  __pyx_e_8asynctnt_6iproto_8protocol_PROTOCOL_IDLE = 0,
  __pyx_e_8asynctnt_6iproto_8protocol_PROTOCOL_GREETING = 1,
  __pyx_e_8asynctnt_6iproto_8protocol_PROTOCOL_NORMAL = 2
};

/* "asynctnt/iproto/coreproto.pxd":7
 * 
 * 
 * cdef enum ConnectionState:             # <<<<<<<<<<<<<<
 *     CONNECTION_BAD = 0
 *     CONNECTION_CONNECTED = 1
 */
enum __pyx_t_8asynctnt_6iproto_8protocol_ConnectionState {
  __pyx_e_8asynctnt_6iproto_8protocol_CONNECTION_BAD = 0,
  __pyx_e_8asynctnt_6iproto_8protocol_CONNECTION_CONNECTED = 1,
  __pyx_e_8asynctnt_6iproto_8protocol_CONNECTION_FULL = 2
};

/* "asynctnt/iproto/unicode.pxd":1
 * cdef bytes encode_unicode_string(str s, bytes encoding=*)             # <<<<<<<<<<<<<<
 */
struct __pyx_opt_args_8asynctnt_6iproto_8protocol_encode_unicode_string {
  int __pyx_n;
  PyObject *encoding;
};

/* "asynctnt/iproto/buffer.pxd":20
 * 
 *     @staticmethod
 *     cdef WriteBuffer new(bytes encoding=*)             # <<<<<<<<<<<<<<
 * 
 *     cdef inline _check_readonly(self)
 */
struct __pyx_opt_args_8asynctnt_6iproto_8protocol_11WriteBuffer_new {
  int __pyx_n;
  PyObject *encoding;
};

/* "asynctnt/iproto/buffer.pxd":29
 *     cdef void _reallocate(self, ssize_t new_size) except *
 *     cdef void write_buffer(self, WriteBuffer buf) except *
 *     cdef void write_header(self, uint64_t sync, tnt.tp_request_type op,             # <<<<<<<<<<<<<<
 *                            int64_t schema_id=*) except *
 *     cdef void write_length(self)
 */
struct __pyx_opt_args_8asynctnt_6iproto_8protocol_11WriteBuffer_write_header {
  int __pyx_n;
  int64_t schema_id;
};

/* "asynctnt/iproto/buffer.pxd":60
 *     cdef void encode_request_delete(self, uint32_t space, uint32_t index,
 *                                     list key) except *
 *     cdef void encode_request_update(self, uint32_t space, uint32_t index,             # <<<<<<<<<<<<<<
 *                                     list key_tuple, list operations,
 *                                     uint32_t key_of_tuple=*,
 */
struct __pyx_opt_args_8asynctnt_6iproto_8protocol_11WriteBuffer_encode_request_update {
  int __pyx_n;
  uint32_t key_of_tuple;
  uint32_t key_of_operations;
};

/* "asynctnt/iproto/rbuffer.pxd":20
 * 
 *     @staticmethod
 *     cdef ReadBuffer new(str encoding, size_t initial_buffer_size=*)             # <<<<<<<<<<<<<<
 * 
 *     cdef void _reallocate(self, size_t new_size) except *
 */
struct __pyx_opt_args_8asynctnt_6iproto_8protocol_10ReadBuffer_new {
  int __pyx_n;
  size_t initial_buffer_size;
};

/* "asynctnt/iproto/buffer.pxd":6
 * 
 * 
 * cdef class WriteBuffer:             # <<<<<<<<<<<<<<
 *     cdef:
 *         # Preallocated small buffer
 */
struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer {
  PyObject_HEAD
  struct __pyx_vtabstruct_8asynctnt_6iproto_8protocol_WriteBuffer *__pyx_vtab;
  int _smallbuf_inuse;
  char _smallbuf[0x400];
  char *_buf;
  Py_ssize_t _size;
  Py_ssize_t _length;
  int _view_count;
  PyObject *_encoding;
};


/* "asynctnt/iproto/rbuffer.pxd":10
 * 
 * 
 * cdef class ReadBuffer:             # <<<<<<<<<<<<<<
 *     cdef:
 *         char *buf
 */
struct __pyx_obj_8asynctnt_6iproto_8protocol_ReadBuffer {
  PyObject_HEAD
  struct __pyx_vtabstruct_8asynctnt_6iproto_8protocol_ReadBuffer *__pyx_vtab;
  char *buf;
  size_t initial_buffer_size;
  size_t len;
  size_t use;
  PyObject *encoding;
};


/* "asynctnt/iproto/request.pxd":5
 * cimport tnt
 * 
 * cdef class Request:             # <<<<<<<<<<<<<<
 *     cdef:
 *         tnt.tp_request_type op
 */
struct __pyx_obj_8asynctnt_6iproto_8protocol_Request {
  PyObject_HEAD
  struct __pyx_vtabstruct_8asynctnt_6iproto_8protocol_Request *__pyx_vtab;
  enum __pyx_t_8asynctnt_6iproto_3tnt_tp_request_type op;
  uint64_t sync;
  int64_t schema_id;
  struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *buf;
  struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *buf_body;
  PyObject *waiter;
  PyObject *timeout_handle;
};


/* "asynctnt/iproto/response.pxd":4
 * 
 * 
 * cdef class Response:             # <<<<<<<<<<<<<<
 *     cdef:
 *         public uint32_t code
 */
struct __pyx_obj_8asynctnt_6iproto_8protocol_Response {
  PyObject_HEAD
  struct __pyx_vtabstruct_8asynctnt_6iproto_8protocol_Response *__pyx_vtab;
  uint32_t code;
  uint64_t sync;
  int64_t schema_id;
  PyObject *errmsg;
  PyObject *body;
  PyObject *encoding;
};


/* "asynctnt/iproto/schema.pxd":4
 * 
 * 
 * cdef class SchemaIndex:             # <<<<<<<<<<<<<<
 *     cdef public int sid
 *     cdef public int iid
 */
struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaIndex {
  PyObject_HEAD
  int sid;
  int iid;
  PyObject *name;
  PyObject *index_type;
  PyObject *unique;
  PyObject *parts;
};


/* "asynctnt/iproto/schema.pxd":13
 * 
 * 
 * cdef class SchemaSpace:             # <<<<<<<<<<<<<<
 *     cdef public int sid
 *     cdef public int arity
 */
struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaSpace {
  PyObject_HEAD
  struct __pyx_vtabstruct_8asynctnt_6iproto_8protocol_SchemaSpace *__pyx_vtab;
  int sid;
  int arity;
  PyObject *name;
  PyObject *indexes;
};


/* "asynctnt/iproto/schema.pxd":22
 * 
 * 
 * cdef class Schema:             # <<<<<<<<<<<<<<
 *     cdef:
 *         dict schema
 */
struct __pyx_obj_8asynctnt_6iproto_8protocol_Schema {
  PyObject_HEAD
  struct __pyx_vtabstruct_8asynctnt_6iproto_8protocol_Schema *__pyx_vtab;
  PyObject *schema;
  int64_t id;
};


/* "asynctnt/iproto/db.pxd":4
 * 
 * 
 * cdef class Db:             # <<<<<<<<<<<<<<
 *     cdef:
 *         BaseProtocol _protocol
 */
struct __pyx_obj_8asynctnt_6iproto_8protocol_Db {
  PyObject_HEAD
  struct __pyx_vtabstruct_8asynctnt_6iproto_8protocol_Db *__pyx_vtab;
  struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *_protocol;
  PyObject *_encoding;
};


/* "asynctnt/iproto/coreproto.pxd":13
 * 
 * 
 * cdef class CoreProtocol:             # <<<<<<<<<<<<<<
 *     cdef:
 *         object host
 */
struct __pyx_obj_8asynctnt_6iproto_8protocol_CoreProtocol {
  PyObject_HEAD
  struct __pyx_vtabstruct_8asynctnt_6iproto_8protocol_CoreProtocol *__pyx_vtab;
  PyObject *host;
  PyObject *port;
  PyObject *encoding;
  enum __pyx_t_8asynctnt_6iproto_8protocol_ProtocolState state;
  enum __pyx_t_8asynctnt_6iproto_8protocol_ConnectionState con_state;
  PyObject *reqs;
  struct __pyx_obj_8asynctnt_6iproto_8protocol_ReadBuffer *rbuf;
  PyObject *version;
  PyObject *salt;
};


/* "asynctnt/iproto/protocol.pxd":17
 * 
 * 
 * cdef class BaseProtocol(CoreProtocol):             # <<<<<<<<<<<<<<
 *     cdef:
 *         object loop
 */
struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol {
  struct __pyx_obj_8asynctnt_6iproto_8protocol_CoreProtocol __pyx_base;
  PyObject *loop;
  PyObject *username;
  PyObject *password;
  int fetch_schema;
  int auto_refetch_schema;
  PyObject *connected_fut;
  PyObject *on_connected_lost_cb;
  PyObject *_on_request_completed_cb;
  PyObject *_on_request_timeout_cb;
  uint64_t _sync;
  struct __pyx_obj_8asynctnt_6iproto_8protocol_Schema *_schema;
  int64_t _schema_id;
  struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *_db;
};


/* "asynctnt/iproto/db.pyx":23
 *         return self._protocol.next_sync()
 * 
 *     async def execute(self, Request req, float timeout):             # <<<<<<<<<<<<<<
 *         cdef object fut
 *         try:
 */
struct __pyx_obj_8asynctnt_6iproto_8protocol___pyx_scope_struct__execute {
  PyObject_HEAD
  PyObject *__pyx_v_e;
  PyObject *__pyx_v_fut;
  struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *__pyx_v_req;
  struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *__pyx_v_self;
  float __pyx_v_timeout;
  PyObject *__pyx_t_0;
  PyObject *__pyx_t_1;
  PyObject *__pyx_t_2;
  PyObject *__pyx_t_3;
  PyObject *__pyx_t_4;
  PyObject *__pyx_t_5;
};


/* "asynctnt/iproto/protocol.pyx":105
 *             self._set_connection_ready()
 * 
 *     cdef void _do_auth(self, str username, str password):             # <<<<<<<<<<<<<<
 *         # No extra error handling from Db.execute
 *         fut = self.execute(
 */
struct __pyx_obj_8asynctnt_6iproto_8protocol___pyx_scope_struct_1__do_auth {
  PyObject_HEAD
  struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *__pyx_v_self;
};


/* "asynctnt/iproto/protocol.pyx":132
 *         fut.add_done_callback(on_authorized)
 * 
 *     cdef object _do_fetch_schema(self):             # <<<<<<<<<<<<<<
 *         fut = self.create_future()
 * 
 */
struct __pyx_obj_8asynctnt_6iproto_8protocol___pyx_scope_struct_2__do_fetch_schema {
  PyObject_HEAD
  PyObject *__pyx_v_fut;
  struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *__pyx_v_self;
};



/* "asynctnt/iproto/buffer.pyx":23
 * @cython.final
 * @cython.freelist(_BUFFER_FREELIST_SIZE)
 * cdef class WriteBuffer:             # <<<<<<<<<<<<<<
 *     def __cinit__(self):
 *         self._smallbuf_inuse = True
 */

struct __pyx_vtabstruct_8asynctnt_6iproto_8protocol_WriteBuffer {
  struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *(*new)(struct __pyx_opt_args_8asynctnt_6iproto_8protocol_11WriteBuffer_new *__pyx_optional_args);
  PyObject *(*_check_readonly)(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *);
  PyObject *(*len)(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *);
  void (*ensure_allocated)(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *, Py_ssize_t);
  char *(*_ensure_allocated)(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *, char *, Py_ssize_t);
  void (*_reallocate)(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *, Py_ssize_t);
  void (*write_buffer)(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *, struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *);
  void (*write_header)(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *, uint64_t, enum __pyx_t_8asynctnt_6iproto_3tnt_tp_request_type, struct __pyx_opt_args_8asynctnt_6iproto_8protocol_11WriteBuffer_write_header *__pyx_optional_args);
  void (*write_length)(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *);
  char *(*_encode_nil)(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *, char *);
  char *(*_encode_bool)(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *, char *, int);
  char *(*_encode_double)(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *, char *, double);
  char *(*_encode_uint)(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *, char *, uint64_t);
  char *(*_encode_int)(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *, char *, int64_t);
  char *(*_encode_str)(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *, char *, char const *, uint32_t);
  char *(*_encode_bin)(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *, char *, char const *, uint32_t);
  char *(*_encode_array)(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *, char *, uint32_t);
  char *(*_encode_map)(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *, char *, uint32_t);
  char *(*_encode_list)(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *, char *, PyObject *);
  char *(*_encode_tuple)(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *, char *, PyObject *);
  char *(*_encode_dict)(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *, char *, PyObject *);
  char *(*_encode_obj)(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *, char *, PyObject *);
  enum __pyx_t_8asynctnt_6iproto_3tnt_tnt_update_op_kind (*_op_type_to_kind)(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *, char *, Py_ssize_t);
  char *(*_encode_update_ops)(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *, char *, PyObject *);
  void (*encode_request_call)(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *, PyObject *, PyObject *);
  void (*encode_request_eval)(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *, PyObject *, PyObject *);
  void (*encode_request_select)(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *, uint32_t, uint32_t, PyObject *, uint64_t, uint64_t, uint32_t);
  void (*encode_request_insert)(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *, uint32_t, PyObject *);
  void (*encode_request_delete)(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *, uint32_t, uint32_t, PyObject *);
  void (*encode_request_update)(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *, uint32_t, uint32_t, PyObject *, PyObject *, struct __pyx_opt_args_8asynctnt_6iproto_8protocol_11WriteBuffer_encode_request_update *__pyx_optional_args);
  void (*encode_request_upsert)(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *, uint32_t, PyObject *, PyObject *);
  void (*encode_request_auth)(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *, PyObject *, PyObject *);
};
static struct __pyx_vtabstruct_8asynctnt_6iproto_8protocol_WriteBuffer *__pyx_vtabptr_8asynctnt_6iproto_8protocol_WriteBuffer;
static struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *__pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer_new(struct __pyx_opt_args_8asynctnt_6iproto_8protocol_11WriteBuffer_new *__pyx_optional_args);
static CYTHON_INLINE PyObject *__pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__check_readonly(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *);
static CYTHON_INLINE PyObject *__pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer_len(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *);
static void __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer_ensure_allocated(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *, Py_ssize_t);
static char *__pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__ensure_allocated(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *, char *, Py_ssize_t);
static void __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__reallocate(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *, Py_ssize_t);
static void __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer_write_buffer(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *, struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *);
static void __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer_write_header(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *, uint64_t, enum __pyx_t_8asynctnt_6iproto_3tnt_tp_request_type, struct __pyx_opt_args_8asynctnt_6iproto_8protocol_11WriteBuffer_write_header *__pyx_optional_args);
static void __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer_write_length(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *);
static char *__pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__encode_nil(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *, char *);
static char *__pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__encode_bool(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *, char *, int);
static char *__pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__encode_double(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *, char *, double);
static char *__pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__encode_uint(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *, char *, uint64_t);
static char *__pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__encode_int(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *, char *, int64_t);
static char *__pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__encode_str(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *, char *, char const *, uint32_t);
static char *__pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__encode_bin(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *, char *, char const *, uint32_t);
static char *__pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__encode_array(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *, char *, uint32_t);
static char *__pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__encode_map(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *, char *, uint32_t);
static char *__pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__encode_list(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *, char *, PyObject *);
static char *__pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__encode_tuple(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *, char *, PyObject *);
static char *__pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__encode_dict(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *, char *, PyObject *);
static char *__pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__encode_obj(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *, char *, PyObject *);
static enum __pyx_t_8asynctnt_6iproto_3tnt_tnt_update_op_kind __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__op_type_to_kind(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *, char *, Py_ssize_t);
static char *__pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__encode_update_ops(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *, char *, PyObject *);
static void __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer_encode_request_call(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *, PyObject *, PyObject *);
static void __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer_encode_request_eval(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *, PyObject *, PyObject *);
static void __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer_encode_request_select(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *, uint32_t, uint32_t, PyObject *, uint64_t, uint64_t, uint32_t);
static void __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer_encode_request_insert(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *, uint32_t, PyObject *);
static void __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer_encode_request_delete(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *, uint32_t, uint32_t, PyObject *);
static void __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer_encode_request_update(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *, uint32_t, uint32_t, PyObject *, PyObject *, struct __pyx_opt_args_8asynctnt_6iproto_8protocol_11WriteBuffer_encode_request_update *__pyx_optional_args);
static void __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer_encode_request_upsert(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *, uint32_t, PyObject *, PyObject *);
static void __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer_encode_request_auth(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *, PyObject *, PyObject *);


/* "asynctnt/iproto/rbuffer.pyx":38
 * @cython.no_gc_clear
 * @cython.final
 * cdef class ReadBuffer:             # <<<<<<<<<<<<<<
 *     def __cinit__(self):
 *         self.buf = NULL
 */

struct __pyx_vtabstruct_8asynctnt_6iproto_8protocol_ReadBuffer {
  struct __pyx_obj_8asynctnt_6iproto_8protocol_ReadBuffer *(*new)(PyObject *, struct __pyx_opt_args_8asynctnt_6iproto_8protocol_10ReadBuffer_new *__pyx_optional_args);
  void (*_reallocate)(struct __pyx_obj_8asynctnt_6iproto_8protocol_ReadBuffer *, size_t);
  int (*extend)(struct __pyx_obj_8asynctnt_6iproto_8protocol_ReadBuffer *, char const *, size_t);
  void (*move)(struct __pyx_obj_8asynctnt_6iproto_8protocol_ReadBuffer *, size_t);
  void (*move_offset)(struct __pyx_obj_8asynctnt_6iproto_8protocol_ReadBuffer *, Py_ssize_t, size_t);
  PyObject *(*get_slice)(struct __pyx_obj_8asynctnt_6iproto_8protocol_ReadBuffer *, size_t, size_t);
  PyObject *(*get_slice_begin)(struct __pyx_obj_8asynctnt_6iproto_8protocol_ReadBuffer *, size_t);
  PyObject *(*get_slice_end)(struct __pyx_obj_8asynctnt_6iproto_8protocol_ReadBuffer *, size_t);
};
static struct __pyx_vtabstruct_8asynctnt_6iproto_8protocol_ReadBuffer *__pyx_vtabptr_8asynctnt_6iproto_8protocol_ReadBuffer;
static struct __pyx_obj_8asynctnt_6iproto_8protocol_ReadBuffer *__pyx_f_8asynctnt_6iproto_8protocol_10ReadBuffer_new(PyObject *, struct __pyx_opt_args_8asynctnt_6iproto_8protocol_10ReadBuffer_new *__pyx_optional_args);
static void __pyx_f_8asynctnt_6iproto_8protocol_10ReadBuffer__reallocate(struct __pyx_obj_8asynctnt_6iproto_8protocol_ReadBuffer *, size_t);
static int __pyx_f_8asynctnt_6iproto_8protocol_10ReadBuffer_extend(struct __pyx_obj_8asynctnt_6iproto_8protocol_ReadBuffer *, char const *, size_t);
static void __pyx_f_8asynctnt_6iproto_8protocol_10ReadBuffer_move(struct __pyx_obj_8asynctnt_6iproto_8protocol_ReadBuffer *, size_t);
static void __pyx_f_8asynctnt_6iproto_8protocol_10ReadBuffer_move_offset(struct __pyx_obj_8asynctnt_6iproto_8protocol_ReadBuffer *, Py_ssize_t, size_t);
static PyObject *__pyx_f_8asynctnt_6iproto_8protocol_10ReadBuffer_get_slice(struct __pyx_obj_8asynctnt_6iproto_8protocol_ReadBuffer *, size_t, size_t);
static PyObject *__pyx_f_8asynctnt_6iproto_8protocol_10ReadBuffer_get_slice_begin(struct __pyx_obj_8asynctnt_6iproto_8protocol_ReadBuffer *, size_t);
static PyObject *__pyx_f_8asynctnt_6iproto_8protocol_10ReadBuffer_get_slice_end(struct __pyx_obj_8asynctnt_6iproto_8protocol_ReadBuffer *, size_t);


/* "asynctnt/iproto/request.pyx":9
 * @cython.final
 * @cython.freelist(_BUFFER_FREELIST_SIZE)
 * cdef class Request:             # <<<<<<<<<<<<<<
 *     @staticmethod
 *     cdef inline Request new(tnt.tp_request_type op,
 */

struct __pyx_vtabstruct_8asynctnt_6iproto_8protocol_Request {
  struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *(*new)(enum __pyx_t_8asynctnt_6iproto_3tnt_tp_request_type, uint64_t, int64_t, struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *);
  struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *(*build)(struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *);
};
static struct __pyx_vtabstruct_8asynctnt_6iproto_8protocol_Request *__pyx_vtabptr_8asynctnt_6iproto_8protocol_Request;
static CYTHON_INLINE struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *__pyx_f_8asynctnt_6iproto_8protocol_7Request_new(enum __pyx_t_8asynctnt_6iproto_3tnt_tp_request_type, uint64_t, int64_t, struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *);
static struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *__pyx_f_8asynctnt_6iproto_8protocol_7Request_build(struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *);


/* "asynctnt/iproto/response.pyx":11
 * 
 * 
 * cdef class Response:             # <<<<<<<<<<<<<<
 *     @staticmethod
 *     cdef inline Response new(bytes encoding):
 */

struct __pyx_vtabstruct_8asynctnt_6iproto_8protocol_Response {
  struct __pyx_obj_8asynctnt_6iproto_8protocol_Response *(*new)(PyObject *);
  PyObject *(*has_schema_id)(struct __pyx_obj_8asynctnt_6iproto_8protocol_Response *);
  PyObject *(*is_error)(struct __pyx_obj_8asynctnt_6iproto_8protocol_Response *);
};
static struct __pyx_vtabstruct_8asynctnt_6iproto_8protocol_Response *__pyx_vtabptr_8asynctnt_6iproto_8protocol_Response;
static CYTHON_INLINE struct __pyx_obj_8asynctnt_6iproto_8protocol_Response *__pyx_f_8asynctnt_6iproto_8protocol_8Response_new(PyObject *);
static CYTHON_INLINE PyObject *__pyx_f_8asynctnt_6iproto_8protocol_8Response_has_schema_id(struct __pyx_obj_8asynctnt_6iproto_8protocol_Response *);
static CYTHON_INLINE PyObject *__pyx_f_8asynctnt_6iproto_8protocol_8Response_is_error(struct __pyx_obj_8asynctnt_6iproto_8protocol_Response *);


/* "asynctnt/iproto/schema.pyx":26
 * 
 * 
 * cdef class SchemaSpace:             # <<<<<<<<<<<<<<
 *     def __init__(self, list space_row):
 *         self.sid = space_row[0]
 */

struct __pyx_vtabstruct_8asynctnt_6iproto_8protocol_SchemaSpace {
  PyObject *(*add_index)(struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaSpace *, struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaIndex *);
};
static struct __pyx_vtabstruct_8asynctnt_6iproto_8protocol_SchemaSpace *__pyx_vtabptr_8asynctnt_6iproto_8protocol_SchemaSpace;


/* "asynctnt/iproto/schema.pyx":44
 * 
 * 
 * cdef class Schema:             # <<<<<<<<<<<<<<
 *     def __init__(self, int64_t schema_id):
 *         self.id = schema_id
 */

struct __pyx_vtabstruct_8asynctnt_6iproto_8protocol_Schema {
  PyObject *(*get_id)(struct __pyx_obj_8asynctnt_6iproto_8protocol_Schema *, int __pyx_skip_dispatch);
  struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaSpace *(*get_space)(struct __pyx_obj_8asynctnt_6iproto_8protocol_Schema *, PyObject *, int __pyx_skip_dispatch);
  struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaIndex *(*get_index)(struct __pyx_obj_8asynctnt_6iproto_8protocol_Schema *, PyObject *, PyObject *, int __pyx_skip_dispatch);
  PyObject *(*clear)(struct __pyx_obj_8asynctnt_6iproto_8protocol_Schema *);
};
static struct __pyx_vtabstruct_8asynctnt_6iproto_8protocol_Schema *__pyx_vtabptr_8asynctnt_6iproto_8protocol_Schema;
static CYTHON_INLINE PyObject *__pyx_f_8asynctnt_6iproto_8protocol_6Schema_clear(struct __pyx_obj_8asynctnt_6iproto_8protocol_Schema *);


/* "asynctnt/iproto/db.pyx":8
 * 
 * 
 * cdef class Db:             # <<<<<<<<<<<<<<
 *     def __cinit__(self):
 *         self._protocol = None
 */

struct __pyx_vtabstruct_8asynctnt_6iproto_8protocol_Db {
  struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *(*new)(struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *);
  uint64_t (*next_sync)(struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *);
  struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *(*_ping)(struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *);
  struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *(*_call16)(struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *, PyObject *, PyObject *);
  struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *(*_call)(struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *, PyObject *, PyObject *);
  struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *(*_eval)(struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *, PyObject *, PyObject *);
  struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *(*_select)(struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *, uint32_t, uint32_t, PyObject *, uint64_t, uint64_t, uint32_t);
  struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *(*_insert)(struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *, uint32_t, PyObject *, int);
  struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *(*_delete)(struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *, uint32_t, uint32_t, PyObject *);
  struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *(*_update)(struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *, uint32_t, uint32_t, PyObject *, PyObject *);
  struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *(*_upsert)(struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *, uint32_t, PyObject *, PyObject *);
  struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *(*_auth)(struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *, PyObject *, PyObject *, PyObject *);
  PyObject *(*_sha1)(PyObject *);
  PyObject *(*_strxor)(PyObject *, PyObject *);
};
static struct __pyx_vtabstruct_8asynctnt_6iproto_8protocol_Db *__pyx_vtabptr_8asynctnt_6iproto_8protocol_Db;
static CYTHON_INLINE struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *__pyx_f_8asynctnt_6iproto_8protocol_2Db_new(struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *);
static CYTHON_INLINE uint64_t __pyx_f_8asynctnt_6iproto_8protocol_2Db_next_sync(struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *);


/* "asynctnt/iproto/coreproto.pyx":19
 * 
 * 
 * cdef class CoreProtocol:             # <<<<<<<<<<<<<<
 *     def __init__(self,
 *                  host, port,
 */

struct __pyx_vtabstruct_8asynctnt_6iproto_8protocol_CoreProtocol {
  int (*_is_connected)(struct __pyx_obj_8asynctnt_6iproto_8protocol_CoreProtocol *);
  int (*_is_fully_connected)(struct __pyx_obj_8asynctnt_6iproto_8protocol_CoreProtocol *);
  void (*_write)(struct __pyx_obj_8asynctnt_6iproto_8protocol_CoreProtocol *, PyObject *);
  void (*_on_data_received)(struct __pyx_obj_8asynctnt_6iproto_8protocol_CoreProtocol *, PyObject *);
  void (*_process__greeting)(struct __pyx_obj_8asynctnt_6iproto_8protocol_CoreProtocol *);
  void (*_on_greeting_received)(struct __pyx_obj_8asynctnt_6iproto_8protocol_CoreProtocol *);
  void (*_on_connection_made)(struct __pyx_obj_8asynctnt_6iproto_8protocol_CoreProtocol *);
  void (*_on_connection_lost)(struct __pyx_obj_8asynctnt_6iproto_8protocol_CoreProtocol *, PyObject *);
};
static struct __pyx_vtabstruct_8asynctnt_6iproto_8protocol_CoreProtocol *__pyx_vtabptr_8asynctnt_6iproto_8protocol_CoreProtocol;


/* "asynctnt/iproto/protocol.pyx":38
 * 
 * 
 * cdef class BaseProtocol(CoreProtocol):             # <<<<<<<<<<<<<<
 *     def __init__(self, host, port,
 *                  username, password,
 */

struct __pyx_vtabstruct_8asynctnt_6iproto_8protocol_BaseProtocol {
  struct __pyx_vtabstruct_8asynctnt_6iproto_8protocol_CoreProtocol __pyx_base;
  void (*_set_connection_ready)(struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *);
  void (*_set_connection_error)(struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *, PyObject *);
  void (*_do_auth)(struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *, PyObject *, PyObject *);
  PyObject *(*_do_fetch_schema)(struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *);
  uint64_t (*next_sync)(struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *);
  uint32_t (*transform_iterator)(struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *, PyObject *);
  uint32_t (*transform_space)(struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *, PyObject *);
  uint32_t (*transform_index)(struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *, PyObject *, PyObject *);
  PyObject *(*_new_waiter_for_request)(struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *, struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *, float);
  struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *(*_create_db)(struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *);
  PyObject *(*execute)(struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *, struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *, float);
};
static struct __pyx_vtabstruct_8asynctnt_6iproto_8protocol_BaseProtocol *__pyx_vtabptr_8asynctnt_6iproto_8protocol_BaseProtocol;

/* --- Runtime support code (head) --- */
/* Refnanny.proto */
#ifndef CYTHON_REFNANNY
  #define CYTHON_REFNANNY 0
#endif
#if CYTHON_REFNANNY
  typedef struct {
    void (*INCREF)(void*, PyObject*, int);
    void (*DECREF)(void*, PyObject*, int);
    void (*GOTREF)(void*, PyObject*, int);
    void (*GIVEREF)(void*, PyObject*, int);
    void* (*SetupContext)(const char*, int, const char*);
    void (*FinishContext)(void**);
  } __Pyx_RefNannyAPIStruct;
  static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
  static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
  #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
#ifdef WITH_THREAD
  #define __Pyx_RefNannySetupContext(name, acquire_gil)\
          if (acquire_gil) {\
              PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
              __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
              PyGILState_Release(__pyx_gilstate_save);\
          } else {\
              __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
          }
#else
  #define __Pyx_RefNannySetupContext(name, acquire_gil)\
          __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
#endif
  #define __Pyx_RefNannyFinishContext()\
          __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
  #define __Pyx_INCREF(r)  __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_DECREF(r)  __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_GOTREF(r)  __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_XINCREF(r)  do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
  #define __Pyx_XDECREF(r)  do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
  #define __Pyx_XGOTREF(r)  do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
  #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
#else
  #define __Pyx_RefNannyDeclarations
  #define __Pyx_RefNannySetupContext(name, acquire_gil)
  #define __Pyx_RefNannyFinishContext()
  #define __Pyx_INCREF(r) Py_INCREF(r)
  #define __Pyx_DECREF(r) Py_DECREF(r)
  #define __Pyx_GOTREF(r)
  #define __Pyx_GIVEREF(r)
  #define __Pyx_XINCREF(r) Py_XINCREF(r)
  #define __Pyx_XDECREF(r) Py_XDECREF(r)
  #define __Pyx_XGOTREF(r)
  #define __Pyx_XGIVEREF(r)
#endif
#define __Pyx_XDECREF_SET(r, v) do {\
        PyObject *tmp = (PyObject *) r;\
        r = v; __Pyx_XDECREF(tmp);\
    } while (0)
#define __Pyx_DECREF_SET(r, v) do {\
        PyObject *tmp = (PyObject *) r;\
        r = v; __Pyx_DECREF(tmp);\
    } while (0)
#define __Pyx_CLEAR(r)    do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
#define __Pyx_XCLEAR(r)   do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)

/* PyObjectGetAttrStr.proto */
#if CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
    PyTypeObject* tp = Py_TYPE(obj);
    if (likely(tp->tp_getattro))
        return tp->tp_getattro(obj, attr_name);
#if PY_MAJOR_VERSION < 3
    if (likely(tp->tp_getattr))
        return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
#endif
    return PyObject_GetAttr(obj, attr_name);
}
#else
#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
#endif

/* GetBuiltinName.proto */
static PyObject *__Pyx_GetBuiltinName(PyObject *name);

/* RaiseArgTupleInvalid.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);

/* KeywordStringCheck.proto */
static CYTHON_INLINE int __Pyx_CheckKeywordStrings(PyObject *kwdict, const char* function_name, int kw_allowed);

/* PyObjectCall.proto */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
#else
#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
#endif

/* PyThreadStateGet.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyThreadState_declare  PyThreadState *__pyx_tstate;
#define __Pyx_PyThreadState_assign  __pyx_tstate = PyThreadState_GET();
#else
#define __Pyx_PyThreadState_declare
#define __Pyx_PyThreadState_assign
#endif

/* PyErrFetchRestore.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_ErrRestoreWithState(type, value, tb)  __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
#define __Pyx_ErrFetchWithState(type, value, tb)    __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
#define __Pyx_ErrRestore(type, value, tb)  __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
#define __Pyx_ErrFetch(type, value, tb)    __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#else
#define __Pyx_ErrRestoreWithState(type, value, tb)  PyErr_Restore(type, value, tb)
#define __Pyx_ErrFetchWithState(type, value, tb)  PyErr_Fetch(type, value, tb)
#define __Pyx_ErrRestore(type, value, tb)  PyErr_Restore(type, value, tb)
#define __Pyx_ErrFetch(type, value, tb)  PyErr_Fetch(type, value, tb)
#endif

/* RaiseException.proto */
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);

/* WriteUnraisableException.proto */
static void __Pyx_WriteUnraisable(const char *name, int clineno,
                                  int lineno, const char *filename,
                                  int full_traceback, int nogil);

/* ExtTypeTest.proto */
static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);

/* PyCFunctionFastCall.proto */
#if CYTHON_FAST_PYCCALL
static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
#else
#define __Pyx_PyCFunction_FastCall(func, args, nargs)  (assert(0), NULL)
#endif

/* PyFunctionFastCall.proto */
#if CYTHON_FAST_PYCALL
#define __Pyx_PyFunction_FastCall(func, args, nargs)\
    __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
#if 1 || PY_VERSION_HEX < 0x030600B1
static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs);
#else
#define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
#endif
#endif

/* PyObjectCallMethO.proto */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
#endif

/* PyObjectCallOneArg.proto */
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);

/* GetItemInt.proto */
#define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
    __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
    (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
               __Pyx_GetItemInt_Generic(o, to_py_func(i))))
#define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
    __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
    (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
                                                              int wraparound, int boundscheck);
#define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
    __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
    (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
                                                              int wraparound, int boundscheck);
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
                                                     int is_list, int wraparound, int boundscheck);

/* GetModuleGlobalName.proto */
static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name);

/* IncludeStringH.proto */
#include <string.h>

/* decode_c_string.proto */
static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
         const char* cstring, Py_ssize_t start, Py_ssize_t stop,
         const char* encoding, const char* errors,
         PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors));

/* ListAppend.proto */
#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
    PyListObject* L = (PyListObject*) list;
    Py_ssize_t len = Py_SIZE(list);
    if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) {
        Py_INCREF(x);
        PyList_SET_ITEM(list, len, x);
        Py_SIZE(list) = len+1;
        return 0;
    }
    return PyList_Append(list, x);
}
#else
#define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
#endif

/* None.proto */
static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname);

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

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

/* ArgTypeTest.proto */
static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
    const char *name, int exact);

/* RaiseTooManyValuesToUnpack.proto */
static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);

/* RaiseNeedMoreValuesToUnpack.proto */
static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);

/* IterFinish.proto */
static CYTHON_INLINE int __Pyx_IterFinish(void);

/* UnpackItemEndCheck.proto */
static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected);

/* PyIntBinop.proto */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_AddCObj(PyObject *op1, PyObject *op2, long intval, int inplace);
#else
#define __Pyx_PyInt_AddCObj(op1, op2, intval, inplace)\
    (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2))
#endif

/* FetchCommonType.proto */
static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type);

/* CythonFunction.proto */
#define __Pyx_CyFunction_USED 1
#include <structmember.h>
#define __Pyx_CYFUNCTION_STATICMETHOD  0x01
#define __Pyx_CYFUNCTION_CLASSMETHOD   0x02
#define __Pyx_CYFUNCTION_CCLASS        0x04
#define __Pyx_CyFunction_GetClosure(f)\
    (((__pyx_CyFunctionObject *) (f))->func_closure)
#define __Pyx_CyFunction_GetClassObj(f)\
    (((__pyx_CyFunctionObject *) (f))->func_classobj)
#define __Pyx_CyFunction_Defaults(type, f)\
    ((type *)(((__pyx_CyFunctionObject *) (f))->defaults))
#define __Pyx_CyFunction_SetDefaultsGetter(f, g)\
    ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g)
typedef struct {
    PyCFunctionObject func;
#if PY_VERSION_HEX < 0x030500A0
    PyObject *func_weakreflist;
#endif
    PyObject *func_dict;
    PyObject *func_name;
    PyObject *func_qualname;
    PyObject *func_doc;
    PyObject *func_globals;
    PyObject *func_code;
    PyObject *func_closure;
    PyObject *func_classobj;
    void *defaults;
    int defaults_pyobjects;
    int flags;
    PyObject *defaults_tuple;
    PyObject *defaults_kwdict;
    PyObject *(*defaults_getter)(PyObject *);
    PyObject *func_annotations;
} __pyx_CyFunctionObject;
static PyTypeObject *__pyx_CyFunctionType = 0;
#define __Pyx_CyFunction_NewEx(ml, flags, qualname, self, module, globals, code)\
    __Pyx_CyFunction_New(__pyx_CyFunctionType, ml, flags, qualname, self, module, globals, code)
static PyObject *__Pyx_CyFunction_New(PyTypeObject *, PyMethodDef *ml,
                                      int flags, PyObject* qualname,
                                      PyObject *self,
                                      PyObject *module, PyObject *globals,
                                      PyObject* code);
static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m,
                                                         size_t size,
                                                         int pyobjects);
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m,
                                                            PyObject *tuple);
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m,
                                                             PyObject *dict);
static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m,
                                                              PyObject *dict);
static int __pyx_CyFunction_init(void);

/* DictGetItem.proto */
#if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
    PyObject *value;
    value = PyDict_GetItemWithError(d, key);
    if (unlikely(!value)) {
        if (!PyErr_Occurred()) {
            PyObject* args = PyTuple_Pack(1, key);
            if (likely(args))
                PyErr_SetObject(PyExc_KeyError, args);
            Py_XDECREF(args);
        }
        return NULL;
    }
    Py_INCREF(value);
    return value;
}
#else
    #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
#endif

/* SaveResetException.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_ExceptionSave(type, value, tb)  __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#define __Pyx_ExceptionReset(type, value, tb)  __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
#else
#define __Pyx_ExceptionSave(type, value, tb)   PyErr_GetExcInfo(type, value, tb)
#define __Pyx_ExceptionReset(type, value, tb)  PyErr_SetExcInfo(type, value, tb)
#endif

/* PyErrExceptionMatches.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
#else
#define __Pyx_PyErr_ExceptionMatches(err)  PyErr_ExceptionMatches(err)
#endif

/* GetException.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_GetException(type, value, tb)  __Pyx__GetException(__pyx_tstate, type, value, tb)
static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#else
static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
#endif

/* PyObjectCallNoArg.proto */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
#else
#define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL)
#endif

/* py_dict_clear.proto */
#define __Pyx_PyDict_Clear(d) (PyDict_Clear(d), 0)

/* SwapException.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_ExceptionSwap(type, value, tb)  __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#else
static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb);
#endif

/* PyObjectCallMethod1.proto */
static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg);

/* CoroutineBase.proto */
typedef PyObject *(*__pyx_coroutine_body_t)(PyObject *, PyObject *);
typedef struct {
    PyObject_HEAD
    __pyx_coroutine_body_t body;
    PyObject *closure;
    PyObject *exc_type;
    PyObject *exc_value;
    PyObject *exc_traceback;
    PyObject *gi_weakreflist;
    PyObject *classobj;
    PyObject *yieldfrom;
    PyObject *gi_name;
    PyObject *gi_qualname;
    PyObject *gi_modulename;
    int resume_label;
    char is_running;
} __pyx_CoroutineObject;
static __pyx_CoroutineObject *__Pyx__Coroutine_New(
    PyTypeObject *type, __pyx_coroutine_body_t body, PyObject *closure,
    PyObject *name, PyObject *qualname, PyObject *module_name);
static int __Pyx_Coroutine_clear(PyObject *self);
#if 1 || PY_VERSION_HEX < 0x030300B0
static int __Pyx_PyGen_FetchStopIterationValue(PyObject **pvalue);
#else
#define __Pyx_PyGen_FetchStopIterationValue(pvalue) PyGen_FetchStopIterationValue(pvalue)
#endif

/* PatchModuleWithCoroutine.proto */
static PyObject* __Pyx_Coroutine_patch_module(PyObject* module, const char* py_code);

/* PatchGeneratorABC.proto */
static int __Pyx_patch_abc(void);

/* Coroutine.proto */
#define __Pyx_Coroutine_USED
static PyTypeObject *__pyx_CoroutineType = 0;
static PyTypeObject *__pyx_CoroutineAwaitType = 0;
#define __Pyx_Coroutine_CheckExact(obj) (Py_TYPE(obj) == __pyx_CoroutineType)
#define __Pyx_Coroutine_New(body, closure, name, qualname, module_name)\
    __Pyx__Coroutine_New(__pyx_CoroutineType, body, closure, name, qualname, module_name)
static int __pyx_Coroutine_init(void);
static PyObject *__Pyx__Coroutine_await(PyObject *coroutine);

/* GetAwaitIter.proto */
static CYTHON_INLINE PyObject *__Pyx_Coroutine_GetAwaitableIter(PyObject *o);
static PyObject *__Pyx__Coroutine_GetAwaitableIter(PyObject *o);

/* CoroutineYieldFrom.proto */
#define __Pyx_Coroutine_Yield_From(gen, source) __Pyx__Coroutine_Yield_From(gen, source, 0)
static CYTHON_INLINE PyObject* __Pyx__Coroutine_Yield_From(__pyx_CoroutineObject *gen, PyObject *source, int warn);

/* ReturnWithStopIteration.proto */
#define __Pyx_ReturnWithStopIteration(value)\
    if (value == Py_None) PyErr_SetNone(PyExc_StopIteration); else __Pyx__ReturnWithStopIteration(value)
static void __Pyx__ReturnWithStopIteration(PyObject* value);

/* PyObjectSetAttrStr.proto */
#if CYTHON_USE_TYPE_SLOTS
#define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o,n,NULL)
static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) {
    PyTypeObject* tp = Py_TYPE(obj);
    if (likely(tp->tp_setattro))
        return tp->tp_setattro(obj, attr_name, value);
#if PY_MAJOR_VERSION < 3
    if (likely(tp->tp_setattr))
        return tp->tp_setattr(obj, PyString_AS_STRING(attr_name), value);
#endif
    return PyObject_SetAttr(obj, attr_name, value);
}
#else
#define __Pyx_PyObject_DelAttrStr(o,n)   PyObject_DelAttr(o,n)
#define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v)
#endif

/* SliceObject.proto */
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(
        PyObject* obj, Py_ssize_t cstart, Py_ssize_t cstop,
        PyObject** py_start, PyObject** py_stop, PyObject** py_slice,
        int has_cstart, int has_cstop, int wraparound);

/* None.proto */
static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname);

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

/* Import.proto */
static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);

/* PatchInspect.proto */
static PyObject* __Pyx_patch_inspect(PyObject* module);

/* PatchAsyncIO.proto */
static PyObject* __Pyx_patch_asyncio(PyObject* module);

/* ImportFrom.proto */
static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);

/* CalculateMetaclass.proto */
static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases);

/* Py3ClassCreate.proto */
static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, PyObject *qualname,
                                           PyObject *mkw, PyObject *modname, PyObject *doc);
static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases, PyObject *dict,
                                      PyObject *mkw, int calculate_metaclass, int allow_py2_metaclass);

/* CodeObjectCache.proto */
typedef struct {
    PyCodeObject* code_object;
    int code_line;
} __Pyx_CodeObjectCacheEntry;
struct __Pyx_CodeObjectCache {
    int count;
    int max_count;
    __Pyx_CodeObjectCacheEntry* entries;
};
static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
static PyCodeObject *__pyx_find_code_object(int code_line);
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);

/* AddTraceback.proto */
static void __Pyx_AddTraceback(const char *funcname, int c_line,
                               int py_line, const char *filename);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint32_t(uint32_t value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum____pyx_t_8asynctnt_6iproto_3tnt_tp_request_type(enum __pyx_t_8asynctnt_6iproto_3tnt_tp_request_type value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint64_t(uint64_t value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int64_t(int64_t value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__mp_type(enum mp_type value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);

/* CIntFromPy.proto */
static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE int64_t __Pyx_PyInt_As_int64_t(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE uint32_t __Pyx_PyInt_As_uint32_t(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE uint64_t __Pyx_PyInt_As_uint64_t(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);

/* CheckBinaryVersion.proto */
static int __Pyx_check_binary_version(void);

/* FunctionExport.proto */
static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig);

/* PyIdentifierFromString.proto */
#if !defined(__Pyx_PyIdentifier_FromString)
#if PY_MAJOR_VERSION < 3
  #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s)
#else
  #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s)
#endif
#endif

/* ModuleImport.proto */
static PyObject *__Pyx_ImportModule(const char *name);

/* TypeImport.proto */
static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict);

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

static struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *__pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer_new(struct __pyx_opt_args_8asynctnt_6iproto_8protocol_11WriteBuffer_new *__pyx_optional_args); /* proto*/
static CYTHON_INLINE PyObject *__pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__check_readonly(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *__pyx_v_self); /* proto*/
static CYTHON_INLINE PyObject *__pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer_len(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *__pyx_v_self); /* proto*/
static void __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer_ensure_allocated(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *__pyx_v_self, Py_ssize_t __pyx_v_extra_length); /* proto*/
static char *__pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__ensure_allocated(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *__pyx_v_self, char *__pyx_v_p, Py_ssize_t __pyx_v_extra_length); /* proto*/
static void __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__reallocate(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *__pyx_v_self, Py_ssize_t __pyx_v_new_size); /* proto*/
static void __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer_write_buffer(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *__pyx_v_self, struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *__pyx_v_buf); /* proto*/
static void __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer_write_header(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *__pyx_v_self, uint64_t __pyx_v_sync, enum __pyx_t_8asynctnt_6iproto_3tnt_tp_request_type __pyx_v_op, struct __pyx_opt_args_8asynctnt_6iproto_8protocol_11WriteBuffer_write_header *__pyx_optional_args); /* proto*/
static void __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer_write_length(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *__pyx_v_self); /* proto*/
static char *__pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__encode_nil(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *__pyx_v_self, char *__pyx_v_p); /* proto*/
static char *__pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__encode_bool(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *__pyx_v_self, char *__pyx_v_p, int __pyx_v_value); /* proto*/
static char *__pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__encode_double(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *__pyx_v_self, char *__pyx_v_p, double __pyx_v_value); /* proto*/
static char *__pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__encode_uint(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *__pyx_v_self, char *__pyx_v_p, uint64_t __pyx_v_value); /* proto*/
static char *__pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__encode_int(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *__pyx_v_self, char *__pyx_v_p, int64_t __pyx_v_value); /* proto*/
static char *__pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__encode_str(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *__pyx_v_self, char *__pyx_v_p, char const *__pyx_v_str, uint32_t __pyx_v_len); /* proto*/
static char *__pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__encode_bin(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *__pyx_v_self, char *__pyx_v_p, char const *__pyx_v_data, uint32_t __pyx_v_len); /* proto*/
static char *__pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__encode_array(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *__pyx_v_self, char *__pyx_v_p, uint32_t __pyx_v_len); /* proto*/
static char *__pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__encode_map(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *__pyx_v_self, char *__pyx_v_p, uint32_t __pyx_v_len); /* proto*/
static char *__pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__encode_list(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *__pyx_v_self, char *__pyx_v_p, PyObject *__pyx_v_arr); /* proto*/
static char *__pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__encode_tuple(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *__pyx_v_self, char *__pyx_v_p, PyObject *__pyx_v_t); /* proto*/
static char *__pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__encode_dict(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *__pyx_v_self, char *__pyx_v_p, PyObject *__pyx_v_d); /* proto*/
static char *__pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__encode_obj(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *__pyx_v_self, char *__pyx_v_p, PyObject *__pyx_v_o); /* proto*/
static enum __pyx_t_8asynctnt_6iproto_3tnt_tnt_update_op_kind __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__op_type_to_kind(CYTHON_UNUSED struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *__pyx_v_self, char *__pyx_v_str, Py_ssize_t __pyx_v_len); /* proto*/
static char *__pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__encode_update_ops(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *__pyx_v_self, char *__pyx_v_p, PyObject *__pyx_v_operations); /* proto*/
static void __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer_encode_request_call(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *__pyx_v_self, PyObject *__pyx_v_func_name, PyObject *__pyx_v_args); /* proto*/
static void __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer_encode_request_eval(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *__pyx_v_self, PyObject *__pyx_v_expression, PyObject *__pyx_v_args); /* proto*/
static void __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer_encode_request_select(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *__pyx_v_self, uint32_t __pyx_v_space, uint32_t __pyx_v_index, PyObject *__pyx_v_key, uint64_t __pyx_v_offset, uint64_t __pyx_v_limit, uint32_t __pyx_v_iterator); /* proto*/
static void __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer_encode_request_insert(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *__pyx_v_self, uint32_t __pyx_v_space, PyObject *__pyx_v_t); /* proto*/
static void __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer_encode_request_delete(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *__pyx_v_self, uint32_t __pyx_v_space, uint32_t __pyx_v_index, PyObject *__pyx_v_key); /* proto*/
static void __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer_encode_request_update(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *__pyx_v_self, uint32_t __pyx_v_space, uint32_t __pyx_v_index, PyObject *__pyx_v_key_tuple, PyObject *__pyx_v_operations, struct __pyx_opt_args_8asynctnt_6iproto_8protocol_11WriteBuffer_encode_request_update *__pyx_optional_args); /* proto*/
static void __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer_encode_request_upsert(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *__pyx_v_self, uint32_t __pyx_v_space, PyObject *__pyx_v_t, PyObject *__pyx_v_operations); /* proto*/
static void __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer_encode_request_auth(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *__pyx_v_self, PyObject *__pyx_v_username, PyObject *__pyx_v_scramble); /* proto*/
static struct __pyx_obj_8asynctnt_6iproto_8protocol_ReadBuffer *__pyx_f_8asynctnt_6iproto_8protocol_10ReadBuffer_new(PyObject *__pyx_v_encoding, struct __pyx_opt_args_8asynctnt_6iproto_8protocol_10ReadBuffer_new *__pyx_optional_args); /* proto*/
static void __pyx_f_8asynctnt_6iproto_8protocol_10ReadBuffer__reallocate(struct __pyx_obj_8asynctnt_6iproto_8protocol_ReadBuffer *__pyx_v_self, size_t __pyx_v_new_size); /* proto*/
static int __pyx_f_8asynctnt_6iproto_8protocol_10ReadBuffer_extend(struct __pyx_obj_8asynctnt_6iproto_8protocol_ReadBuffer *__pyx_v_self, char const *__pyx_v_data, size_t __pyx_v_len); /* proto*/
static void __pyx_f_8asynctnt_6iproto_8protocol_10ReadBuffer_move(struct __pyx_obj_8asynctnt_6iproto_8protocol_ReadBuffer *__pyx_v_self, size_t __pyx_v_pos); /* proto*/
static void __pyx_f_8asynctnt_6iproto_8protocol_10ReadBuffer_move_offset(struct __pyx_obj_8asynctnt_6iproto_8protocol_ReadBuffer *__pyx_v_self, Py_ssize_t __pyx_v_offset, size_t __pyx_v_size); /* proto*/
static PyObject *__pyx_f_8asynctnt_6iproto_8protocol_10ReadBuffer_get_slice(struct __pyx_obj_8asynctnt_6iproto_8protocol_ReadBuffer *__pyx_v_self, size_t __pyx_v_begin, size_t __pyx_v_end); /* proto*/
static PyObject *__pyx_f_8asynctnt_6iproto_8protocol_10ReadBuffer_get_slice_begin(struct __pyx_obj_8asynctnt_6iproto_8protocol_ReadBuffer *__pyx_v_self, size_t __pyx_v_begin); /* proto*/
static PyObject *__pyx_f_8asynctnt_6iproto_8protocol_10ReadBuffer_get_slice_end(struct __pyx_obj_8asynctnt_6iproto_8protocol_ReadBuffer *__pyx_v_self, size_t __pyx_v_end); /* proto*/
static CYTHON_INLINE struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *__pyx_f_8asynctnt_6iproto_8protocol_7Request_new(enum __pyx_t_8asynctnt_6iproto_3tnt_tp_request_type __pyx_v_op, uint64_t __pyx_v_sync, int64_t __pyx_v_schema_id, struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *__pyx_v_buf_body); /* proto*/
static struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *__pyx_f_8asynctnt_6iproto_8protocol_7Request_build(struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *__pyx_v_self); /* proto*/
static CYTHON_INLINE struct __pyx_obj_8asynctnt_6iproto_8protocol_Response *__pyx_f_8asynctnt_6iproto_8protocol_8Response_new(PyObject *__pyx_v_encoding); /* proto*/
static CYTHON_INLINE PyObject *__pyx_f_8asynctnt_6iproto_8protocol_8Response_has_schema_id(struct __pyx_obj_8asynctnt_6iproto_8protocol_Response *__pyx_v_self); /* proto*/
static CYTHON_INLINE PyObject *__pyx_f_8asynctnt_6iproto_8protocol_8Response_is_error(struct __pyx_obj_8asynctnt_6iproto_8protocol_Response *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_8asynctnt_6iproto_8protocol_11SchemaSpace_add_index(struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaSpace *__pyx_v_self, struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaIndex *__pyx_v_idx); /* proto*/
static struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaSpace *__pyx_f_8asynctnt_6iproto_8protocol_6Schema_get_space(struct __pyx_obj_8asynctnt_6iproto_8protocol_Schema *__pyx_v_self, PyObject *__pyx_v_space, int __pyx_skip_dispatch); /* proto*/
static struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaIndex *__pyx_f_8asynctnt_6iproto_8protocol_6Schema_get_index(struct __pyx_obj_8asynctnt_6iproto_8protocol_Schema *__pyx_v_self, PyObject *__pyx_v_space, PyObject *__pyx_v_index, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_8asynctnt_6iproto_8protocol_6Schema_get_id(struct __pyx_obj_8asynctnt_6iproto_8protocol_Schema *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
static CYTHON_INLINE PyObject *__pyx_f_8asynctnt_6iproto_8protocol_6Schema_clear(struct __pyx_obj_8asynctnt_6iproto_8protocol_Schema *__pyx_v_self); /* proto*/
static CYTHON_INLINE struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *__pyx_f_8asynctnt_6iproto_8protocol_2Db_new(struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *__pyx_v_protocol); /* proto*/
static CYTHON_INLINE uint64_t __pyx_f_8asynctnt_6iproto_8protocol_2Db_next_sync(struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *__pyx_v_self); /* proto*/
static struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *__pyx_f_8asynctnt_6iproto_8protocol_2Db__ping(struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *__pyx_v_self); /* proto*/
static struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *__pyx_f_8asynctnt_6iproto_8protocol_2Db__call16(struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *__pyx_v_self, PyObject *__pyx_v_func_name, PyObject *__pyx_v_args); /* proto*/
static struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *__pyx_f_8asynctnt_6iproto_8protocol_2Db__call(struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *__pyx_v_self, PyObject *__pyx_v_func_name, PyObject *__pyx_v_args); /* proto*/
static struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *__pyx_f_8asynctnt_6iproto_8protocol_2Db__eval(struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *__pyx_v_self, PyObject *__pyx_v_expression, PyObject *__pyx_v_args); /* proto*/
static struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *__pyx_f_8asynctnt_6iproto_8protocol_2Db__select(struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *__pyx_v_self, uint32_t __pyx_v_space, uint32_t __pyx_v_index, PyObject *__pyx_v_key, uint64_t __pyx_v_offset, uint64_t __pyx_v_limit, uint32_t __pyx_v_iterator); /* proto*/
static struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *__pyx_f_8asynctnt_6iproto_8protocol_2Db__insert(struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *__pyx_v_self, uint32_t __pyx_v_space, PyObject *__pyx_v_t, int __pyx_v_replace); /* proto*/
static struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *__pyx_f_8asynctnt_6iproto_8protocol_2Db__delete(struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *__pyx_v_self, uint32_t __pyx_v_space, uint32_t __pyx_v_index, PyObject *__pyx_v_key); /* proto*/
static struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *__pyx_f_8asynctnt_6iproto_8protocol_2Db__update(struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *__pyx_v_self, uint32_t __pyx_v_space, uint32_t __pyx_v_index, PyObject *__pyx_v_key, PyObject *__pyx_v_operations); /* proto*/
static struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *__pyx_f_8asynctnt_6iproto_8protocol_2Db__upsert(struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *__pyx_v_self, uint32_t __pyx_v_space, PyObject *__pyx_v_t, PyObject *__pyx_v_operations); /* proto*/
static struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *__pyx_f_8asynctnt_6iproto_8protocol_2Db__auth(struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *__pyx_v_self, PyObject *__pyx_v_salt, PyObject *__pyx_v_username, PyObject *__pyx_v_password); /* proto*/
static PyObject *__pyx_f_8asynctnt_6iproto_8protocol_2Db__sha1(PyObject *__pyx_v_values); /* proto*/
static PyObject *__pyx_f_8asynctnt_6iproto_8protocol_2Db__strxor(PyObject *__pyx_v_hash1, PyObject *__pyx_v_scramble); /* proto*/
static int __pyx_f_8asynctnt_6iproto_8protocol_12CoreProtocol__is_connected(struct __pyx_obj_8asynctnt_6iproto_8protocol_CoreProtocol *__pyx_v_self); /* proto*/
static int __pyx_f_8asynctnt_6iproto_8protocol_12CoreProtocol__is_fully_connected(struct __pyx_obj_8asynctnt_6iproto_8protocol_CoreProtocol *__pyx_v_self); /* proto*/
static void __pyx_f_8asynctnt_6iproto_8protocol_12CoreProtocol__write(struct __pyx_obj_8asynctnt_6iproto_8protocol_CoreProtocol *__pyx_v_self, PyObject *__pyx_v_buf); /* proto*/
static void __pyx_f_8asynctnt_6iproto_8protocol_12CoreProtocol__on_data_received(struct __pyx_obj_8asynctnt_6iproto_8protocol_CoreProtocol *__pyx_v_self, PyObject *__pyx_v_data); /* proto*/
static void __pyx_f_8asynctnt_6iproto_8protocol_12CoreProtocol__process__greeting(struct __pyx_obj_8asynctnt_6iproto_8protocol_CoreProtocol *__pyx_v_self); /* proto*/
static void __pyx_f_8asynctnt_6iproto_8protocol_12CoreProtocol__on_connection_made(CYTHON_UNUSED struct __pyx_obj_8asynctnt_6iproto_8protocol_CoreProtocol *__pyx_v_self); /* proto*/
static void __pyx_f_8asynctnt_6iproto_8protocol_12CoreProtocol__on_connection_lost(struct __pyx_obj_8asynctnt_6iproto_8protocol_CoreProtocol *__pyx_v_self, PyObject *__pyx_v_exc); /* proto*/
static void __pyx_f_8asynctnt_6iproto_8protocol_12CoreProtocol__on_greeting_received(CYTHON_UNUSED struct __pyx_obj_8asynctnt_6iproto_8protocol_CoreProtocol *__pyx_v_self); /* proto*/
static void __pyx_f_8asynctnt_6iproto_8protocol_12BaseProtocol__set_connection_ready(struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *__pyx_v_self); /* proto*/
static void __pyx_f_8asynctnt_6iproto_8protocol_12BaseProtocol__set_connection_error(struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *__pyx_v_self, PyObject *__pyx_v_e); /* proto*/
static void __pyx_f_8asynctnt_6iproto_8protocol_12BaseProtocol__on_greeting_received(struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *__pyx_v_self); /* proto*/
static void __pyx_f_8asynctnt_6iproto_8protocol_12BaseProtocol__do_auth(struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *__pyx_v_self, PyObject *__pyx_v_username, PyObject *__pyx_v_password); /* proto*/
static PyObject *__pyx_f_8asynctnt_6iproto_8protocol_12BaseProtocol__do_fetch_schema(struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *__pyx_v_self); /* proto*/
static void __pyx_f_8asynctnt_6iproto_8protocol_12BaseProtocol__on_connection_made(struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *__pyx_v_self); /* proto*/
static void __pyx_f_8asynctnt_6iproto_8protocol_12BaseProtocol__on_connection_lost(struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *__pyx_v_self, PyObject *__pyx_v_exc); /* proto*/
static uint64_t __pyx_f_8asynctnt_6iproto_8protocol_12BaseProtocol_next_sync(struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_8asynctnt_6iproto_8protocol_12BaseProtocol__new_waiter_for_request(struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *__pyx_v_self, struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *__pyx_v_req, float __pyx_v_timeout); /* proto*/
static struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *__pyx_f_8asynctnt_6iproto_8protocol_12BaseProtocol__create_db(struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_8asynctnt_6iproto_8protocol_12BaseProtocol_execute(struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *__pyx_v_self, struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *__pyx_v_req, float __pyx_v_timeout); /* proto*/
static uint32_t __pyx_f_8asynctnt_6iproto_8protocol_12BaseProtocol_transform_iterator(CYTHON_UNUSED struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *__pyx_v_self, PyObject *__pyx_v_iterator); /* proto*/
static uint32_t __pyx_f_8asynctnt_6iproto_8protocol_12BaseProtocol_transform_space(struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *__pyx_v_self, PyObject *__pyx_v_space); /* proto*/
static uint32_t __pyx_f_8asynctnt_6iproto_8protocol_12BaseProtocol_transform_index(struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *__pyx_v_self, PyObject *__pyx_v_space, PyObject *__pyx_v_index); /* proto*/

/* Module declarations from 'libc.stdint' */

/* Module declarations from 'asynctnt.iproto.tnt' */

/* Module declarations from 'cython' */

/* Module declarations from 'libc.string' */

/* Module declarations from 'libc.stdio' */

/* Module declarations from '__builtin__' */

/* Module declarations from 'cpython.type' */
static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;

/* Module declarations from 'cpython.unicode' */

/* Module declarations from 'cpython.version' */

/* Module declarations from 'cpython.ref' */

/* Module declarations from 'cpython.exc' */

/* Module declarations from 'cpython.module' */

/* Module declarations from 'cpython.mem' */

/* Module declarations from 'cpython.tuple' */

/* Module declarations from 'cpython.list' */

/* Module declarations from 'cpython.sequence' */

/* Module declarations from 'cpython.mapping' */

/* Module declarations from 'cpython.iterator' */

/* Module declarations from 'cpython.number' */

/* Module declarations from 'cpython.int' */

/* Module declarations from '__builtin__' */

/* Module declarations from 'cpython.bool' */
static PyTypeObject *__pyx_ptype_7cpython_4bool_bool = 0;

/* Module declarations from 'cpython.long' */

/* Module declarations from 'cpython.float' */

/* Module declarations from '__builtin__' */

/* Module declarations from 'cpython.complex' */
static PyTypeObject *__pyx_ptype_7cpython_7complex_complex = 0;

/* Module declarations from 'cpython.string' */

/* Module declarations from 'cpython.instance' */

/* Module declarations from 'cpython.function' */

/* Module declarations from 'cpython.method' */

/* Module declarations from 'cpython.weakref' */

/* Module declarations from 'cpython.getargs' */

/* Module declarations from 'cpython.pythread' */

/* Module declarations from 'cpython.pystate' */

/* Module declarations from 'cpython.cobject' */

/* Module declarations from 'cpython.oldbuffer' */

/* Module declarations from 'cpython.set' */

/* Module declarations from 'cpython.buffer' */

/* Module declarations from 'cpython.bytes' */

/* Module declarations from 'cpython.pycapsule' */

/* Module declarations from 'cpython' */

/* Module declarations from 'cpython.object' */

/* Module declarations from 'cpython.dict' */

/* Module declarations from 'libc.math' */

/* Module declarations from 'asynctnt.iproto.protocol' */
static PyTypeObject *__pyx_ptype_8asynctnt_6iproto_8protocol_WriteBuffer = 0;
static PyTypeObject *__pyx_ptype_8asynctnt_6iproto_8protocol_ReadBuffer = 0;
static PyTypeObject *__pyx_ptype_8asynctnt_6iproto_8protocol_Request = 0;
static PyTypeObject *__pyx_ptype_8asynctnt_6iproto_8protocol_Response = 0;
static PyTypeObject *__pyx_ptype_8asynctnt_6iproto_8protocol_SchemaIndex = 0;
static PyTypeObject *__pyx_ptype_8asynctnt_6iproto_8protocol_SchemaSpace = 0;
static PyTypeObject *__pyx_ptype_8asynctnt_6iproto_8protocol_Schema = 0;
static PyTypeObject *__pyx_ptype_8asynctnt_6iproto_8protocol_Db = 0;
static PyTypeObject *__pyx_ptype_8asynctnt_6iproto_8protocol_CoreProtocol = 0;
static PyTypeObject *__pyx_ptype_8asynctnt_6iproto_8protocol_BaseProtocol = 0;
static PyTypeObject *__pyx_ptype_8asynctnt_6iproto_8protocol___pyx_scope_struct__execute = 0;
static PyTypeObject *__pyx_ptype_8asynctnt_6iproto_8protocol___pyx_scope_struct_1__do_auth = 0;
static PyTypeObject *__pyx_ptype_8asynctnt_6iproto_8protocol___pyx_scope_struct_2__do_fetch_schema = 0;
static PyObject *__pyx_f_8asynctnt_6iproto_8protocol_encode_unicode_string(PyObject *, struct __pyx_opt_args_8asynctnt_6iproto_8protocol_encode_unicode_string *__pyx_optional_args); /*proto*/
static CYTHON_INLINE size_t __pyx_f_8asynctnt_6iproto_8protocol_size_t_max(size_t, size_t); /*proto*/
static CYTHON_INLINE uint32_t __pyx_f_8asynctnt_6iproto_8protocol_nearest_power_of_2(uint32_t); /*proto*/
static struct __pyx_obj_8asynctnt_6iproto_8protocol_Response *__pyx_f_8asynctnt_6iproto_8protocol_response_parse(char const *, uint32_t, PyObject *); /*proto*/
static struct __pyx_obj_8asynctnt_6iproto_8protocol_Schema *__pyx_f_8asynctnt_6iproto_8protocol_parse_schema(int64_t, PyObject *, PyObject *); /*proto*/
static PyObject *__pyx_f_8asynctnt_6iproto_8protocol__decode_obj(char const **, PyObject *); /*proto*/
static PyObject *__pyx_f_8asynctnt_6iproto_8protocol__response_parse_body_data(char const *, PyObject *); /*proto*/
#define __Pyx_MODULE_NAME "asynctnt.iproto.protocol"
int __pyx_module_is_main_asynctnt__iproto__protocol = 0;

/* Implementation of 'asynctnt.iproto.protocol' */
static PyObject *__pyx_builtin_RuntimeError;
static PyObject *__pyx_builtin_BufferError;
static PyObject *__pyx_builtin_MemoryError;
static PyObject *__pyx_builtin_range;
static PyObject *__pyx_builtin_TypeError;
static PyObject *__pyx_builtin_IndexError;
static PyObject *__pyx_builtin_KeyError;
static PyObject *__pyx_builtin_memoryview;
static PyObject *__pyx_builtin_map;
static PyObject *__pyx_builtin_AttributeError;
static const char __pyx_k_e[] = "e";
static const char __pyx_k_f[] = "f";
static const char __pyx_k_t[] = "t";
static const char __pyx_k_EQ[] = "EQ";
static const char __pyx_k_GE[] = "GE";
static const char __pyx_k_GT[] = "GT";
static const char __pyx_k_LE[] = "LE";
static const char __pyx_k_LT[] = "LT";
static const char __pyx_k_re[] = "re";
static const char __pyx_k_ALL[] = "ALL";
static const char __pyx_k_REQ[] = "REQ";
static const char __pyx_k__29[] = ".";
static const char __pyx_k_doc[] = "__doc__";
static const char __pyx_k_iid[] = "iid";
static const char __pyx_k_key[] = "key";
static const char __pyx_k_map[] = "map";
static const char __pyx_k_req[] = "req";
static const char __pyx_k_sid[] = "sid";
static const char __pyx_k_args[] = "args";
static const char __pyx_k_body[] = "body";
static const char __pyx_k_code[] = "code";
static const char __pyx_k_done[] = "done";
static const char __pyx_k_dump[] = "dump";
static const char __pyx_k_enum[] = "enum";
static const char __pyx_k_host[] = "host";
static const char __pyx_k_init[] = "__init__";
static const char __pyx_k_loop[] = "loop";
static const char __pyx_k_main[] = "__main__";
static const char __pyx_k_name[] = "name";
static const char __pyx_k_port[] = "port";
static const char __pyx_k_repr[] = "__repr__";
static const char __pyx_k_self[] = "self";
static const char __pyx_k_send[] = "send";
static const char __pyx_k_sha1[] = "sha1";
static const char __pyx_k_test[] = "__test__";
static const char __pyx_k_yaml[] = "yaml";
static const char __pyx_k_ascii[] = "ascii";
static const char __pyx_k_await[] = "__await__";
static const char __pyx_k_class[] = "__class__";
static const char __pyx_k_close[] = "close";
static const char __pyx_k_debug[] = "debug";
static const char __pyx_k_error[] = "error";
static const char __pyx_k_group[] = "group";
static const char __pyx_k_index[] = "index";
static const char __pyx_k_limit[] = "limit";
static const char __pyx_k_match[] = "match";
static const char __pyx_k_range[] = "range";
static const char __pyx_k_req_2[] = "_req";
static const char __pyx_k_space[] = "space";
static const char __pyx_k_split[] = "split";
static const char __pyx_k_throw[] = "throw";
static const char __pyx_k_utf_8[] = "utf-8";
static const char __pyx_k_value[] = "value";
static const char __pyx_k_write[] = "write";
static const char __pyx_k_Future[] = "Future";
static const char __pyx_k_Schema[] = "<Schema>";
static const char __pyx_k_base64[] = "base64";
static const char __pyx_k_cancel[] = "cancel";
static const char __pyx_k_decode[] = "decode";
static const char __pyx_k_digest[] = "digest";
static const char __pyx_k_encode[] = "encode";
static const char __pyx_k_family[] = "family";
static const char __pyx_k_format[] = "format";
static const char __pyx_k_gather[] = "gather";
static const char __pyx_k_get_id[] = "get_id";
static const char __pyx_k_import[] = "__import__";
static const char __pyx_k_insert[] = "insert";
static const char __pyx_k_logger[] = "logger";
static const char __pyx_k_module[] = "__module__";
static const char __pyx_k_name_2[] = "__name__";
static const char __pyx_k_offset[] = "offset";
static const char __pyx_k_result[] = "result";
static const char __pyx_k_select[] = "select";
static const char __pyx_k_socket[] = "socket";
static const char __pyx_k_spaces[] = "spaces";
static const char __pyx_k_unique[] = "unique";
static const char __pyx_k_update[] = "update";
static const char __pyx_k_AF_UNIX[] = "AF_UNIX";
static const char __pyx_k_IntEnum[] = "IntEnum";
static const char __pyx_k_asyncio[] = "asyncio";
static const char __pyx_k_compile[] = "compile";
static const char __pyx_k_execute[] = "execute";
static const char __pyx_k_futures[] = "futures";
static const char __pyx_k_hashlib[] = "hashlib";
static const char __pyx_k_indexes[] = "indexes";
static const char __pyx_k_inspect[] = "inspect";
static const char __pyx_k_prepare[] = "__prepare__";
static const char __pyx_k_replace[] = "replace";
static const char __pyx_k_timeout[] = "timeout";
static const char __pyx_k_warning[] = "warning";
static const char __pyx_k_Iterator[] = "Iterator";
static const char __pyx_k_KeyError[] = "KeyError";
static const char __pyx_k_NEIGHBOR[] = "NEIGHBOR";
static const char __pyx_k_OVERLAPS[] = "OVERLAPS";
static const char __pyx_k_Protocol[] = "Protocol";
static const char __pyx_k_encoding[] = "encoding";
static const char __pyx_k_iterator[] = "iterator";
static const char __pyx_k_on_fetch[] = "on_fetch";
static const char __pyx_k_password[] = "password";
static const char __pyx_k_qualname[] = "__qualname__";
static const char __pyx_k_username[] = "username";
static const char __pyx_k_ErrorCode[] = "ErrorCode";
static const char __pyx_k_TypeError[] = "TypeError";
static const char __pyx_k_b64decode[] = "b64decode";
static const char __pyx_k_cancelled[] = "cancelled";
static const char __pyx_k_exception[] = "exception";
static const char __pyx_k_func_name[] = "func_name";
static const char __pyx_k_get_index[] = "get_index";
static const char __pyx_k_get_space[] = "get_space";
static const char __pyx_k_index_row[] = "index_row";
static const char __pyx_k_metaclass[] = "__metaclass__";
static const char __pyx_k_schema_id[] = "schema_id";
static const char __pyx_k_space_row[] = "space_row";
static const char __pyx_k_transport[] = "transport";
static const char __pyx_k_Db_execute[] = "Db.execute";
static const char __pyx_k_IndexError[] = "IndexError";
static const char __pyx_k_call_later[] = "call_later";
static const char __pyx_k_expression[] = "expression";
static const char __pyx_k_index_type[] = "index_type";
static const char __pyx_k_memoryview[] = "memoryview";
static const char __pyx_k_operations[] = "operations";
static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__";
static const char __pyx_k_set_result[] = "set_result";
static const char __pyx_k_setsockopt[] = "setsockopt";
static const char __pyx_k_BufferError[] = "BufferError";
static const char __pyx_k_IPPROTO_TCP[] = "IPPROTO_TCP";
static const char __pyx_k_MemoryError[] = "MemoryError";
static const char __pyx_k_TCP_NODELAY[] = "TCP_NODELAY";
static const char __pyx_k_BITS_ALL_SET[] = "BITS_ALL_SET";
static const char __pyx_k_BITS_ANY_SET[] = "BITS_ANY_SET";
static const char __pyx_k_RuntimeError[] = "RuntimeError";
static const char __pyx_k_TimeoutError[] = "TimeoutError";
static const char __pyx_k_asynctnt_log[] = "asynctnt.log";
static const char __pyx_k_fetch_schema[] = "fetch_schema";
static const char __pyx_k_allow_unicode[] = "allow_unicode";
static const char __pyx_k_asyncio_tasks[] = "asyncio.tasks";
static const char __pyx_k_connected_fut[] = "connected_fut";
static const char __pyx_k_create_future[] = "create_future";
static const char __pyx_k_on_authorized[] = "on_authorized";
static const char __pyx_k_parse_version[] = "_parse_version";
static const char __pyx_k_set_exception[] = "set_exception";
static const char __pyx_k_AttributeError[] = "AttributeError";
static const char __pyx_k_CancelledError[] = "CancelledError";
static const char __pyx_k_get_extra_info[] = "get_extra_info";
static const char __pyx_k_refetch_schema[] = "refetch_schema";
static const char __pyx_k_Space_not_found[] = "Space {} not found";
static const char __pyx_k_request_timeout[] = "request_timeout";
static const char __pyx_k_BITS_ALL_NOT_SET[] = "BITS_ALL_NOT_SET";
static const char __pyx_k_exceeded_timeout[] = "{} exceeded timeout";
static const char __pyx_k_sync_d_not_found[] = "sync %d not found";
static const char __pyx_k_add_done_callback[] = "add_done_callback";
static const char __pyx_k_return_exceptions[] = "return_exceptions";
static const char __pyx_k_s_Tarantool_s_d_s[] = "\\s*Tarantool\\s+([\\d.]+)\\s+.*";
static const char __pyx_k_Response_code_sync[] = "<Response: code={}, sync={}>";
static const char __pyx_k_Schema_not_fetched[] = "Schema not fetched";
static const char __pyx_k_asyncio_coroutines[] = "asyncio.coroutines";
static const char __pyx_k_on_connection_lost[] = "on_connection_lost";
static const char __pyx_k_on_connection_made[] = "on_connection_made";
static const char __pyx_k_on_request_timeout[] = "_on_request_timeout";
static const char __pyx_k_asynctnt_exceptions[] = "asynctnt.exceptions";
static const char __pyx_k_auto_refetch_schema[] = "auto_refetch_schema";
static const char __pyx_k_Schema_fetch_timeout[] = "Schema fetch timeout";
static const char __pyx_k_TarantoolSchemaError[] = "TarantoolSchemaError";
static const char __pyx_k_VERSION_STRING_REGEX[] = "VERSION_STRING_REGEX";
static const char __pyx_k_init___locals___repr[] = "__init__.<locals>.__repr__";
static const char __pyx_k_on_request_completed[] = "_on_request_completed";
static const char __pyx_k_Unexpected_obj_type_s[] = "Unexpected obj type: %s";
static const char __pyx_k_on_connection_lost_cb[] = "on_connection_lost_cb";
static const char __pyx_k_on_connection_made_cb[] = "on_connection_made_cb";
static const char __pyx_k_TarantoolDatabaseError[] = "TarantoolDatabaseError";
static const char __pyx_k_create_future_fallback[] = "_create_future_fallback";
static const char __pyx_k_ER_WRONG_SCHEMA_VERSION[] = "ER_WRONG_SCHEMA_VERSION";
static const char __pyx_k_asynctnt_iproto_protocol[] = "asynctnt.iproto.protocol";
static const char __pyx_k_initial_read_buffer_size[] = "initial_read_buffer_size";
static const char __pyx_k_Index_for_space_not_found[] = "Index {} for space {} not found";
static const char __pyx_k_SchemaSpace_id_name_arity[] = "<SchemaSpace id={}, name={}, arity={}>";
static const char __pyx_k_Splice_offset_must_be_int[] = "Splice offset must be int";
static const char __pyx_k_TarantoolNotConnectedError[] = "TarantoolNotConnectedError";
static const char __pyx_k_Tarantool_is_not_connected[] = "Tarantool is not connected";
static const char __pyx_k_Splice_position_must_be_int[] = "Splice position must be int";
static const char __pyx_k_code_type_must_be_a_MP_UINT[] = "code type must be a MP_UINT";
static const char __pyx_k_sync_type_must_be_a_MP_UINT[] = "sync type must be a MP_UINT";
static const char __pyx_k_Header_key_must_be_a_MP_UINT[] = "Header key must be a MP_UINT";
static const char __pyx_k_Lost_connection_to_Tarantool[] = "Lost connection to Tarantool";
static const char __pyx_k_Offset_incorrect_Got_use_len[] = "Offset incorrect. Got: {}. use:{}, len:{}";
static const char __pyx_k_Unexpected_key_type_in_map_s[] = "Unexpected key type in map: %s";
static const char __pyx_k_errstr_type_must_be_a_MP_STR[] = "errstr type must be a MP_STR";
static const char __pyx_k_Unknown_update_operation_type[] = "Unknown update operation type `{}`";
static const char __pyx_k_Request_op_sync_schema_id_body[] = "<Request op={}, sync={}, schema_id={}, body_len={}>";
static const char __pyx_k_Response_body_must_be_a_MP_MAP[] = "Response body must be a MP_MAP";
static const char __pyx_k_BaseProtocol__do_auth_locals_on[] = "BaseProtocol._do_auth.<locals>.on_authorized";
static const char __pyx_k_Iterator_is_of_unsupported_type[] = "Iterator is of unsupported type (asynctnt.Iterator, int, str)";
static const char __pyx_k_Operation_type_must_of_a_str_or[] = "Operation type must of a str or bytes type";
static const char __pyx_k_SchemaIndex_sid_id_name_type_un[] = "<SchemaIndex sid={}, id={}, name={}, type={}, unique={}>";
static const char __pyx_k_home_travis_build_igorcoding_as[] = "/home/travis/build/igorcoding/asynctnt/asynctnt/iproto/schema.pyx";
static const char __pyx_k_on_data_received_expected_bytes[] = "_on_data_received: expected bytes object";
static const char __pyx_k_the_buffer_is_in_read_only_mode[] = "the buffer is in read-only mode";
static const char __pyx_k_BaseProtocol__do_fetch_schema_lo[] = "BaseProtocol._do_fetch_schema.<locals>.on_fetch";
static const char __pyx_k_Deallocating_buffer_with_attache[] = "Deallocating buffer with attached memoryviews";
static const char __pyx_k_Operation_field_no_must_be_of_in[] = "Operation field_no must be of int type";
static const char __pyx_k_Operation_length_must_be_at_leas[] = "Operation length must be at least 3";
static const char __pyx_k_Response_header_must_be_a_MP_MAP[] = "Response header must be a MP_MAP";
static const char __pyx_k_Single_operation_must_be_a_tuple[] = "Single operation must be a tuple or list";
static const char __pyx_k_Splice_operation_must_have_lengt[] = "Splice operation must have length of 5, but got: {}";
static const char __pyx_k_Tarantool_s_s_Authorization_fail[] = "Tarantool[%s:%s] Authorization failed: %s";
static const char __pyx_k_Tarantool_s_s_Authorized_success[] = "Tarantool[%s:%s] Authorized successfully";
static const char __pyx_k_Tarantool_s_s_Schema_fetch_faile[] = "Tarantool[%s:%s] Schema fetch failed: %s";
static const char __pyx_k_Tarantool_s_s_Schema_fetch_succe[] = "Tarantool[%s:%s] Schema fetch succeeded. Spaces: %d, Indexes: %d.";
static const char __pyx_k_Type_is_not_supported_for_encodi[] = "Type `{}` is not supported for encoding";
static const char __pyx_k_Unknown_argument_in_header_Skipp[] = "Unknown argument in header. Skipping.";
static const char __pyx_k_body_data_type_must_be_a_MP_ARRA[] = "body data type must be a MP_ARRAY";
static const char __pyx_k_encoding_must_be_either_str_or_b[] = "encoding must be either str or bytes";
static const char __pyx_k_int_argument_required_for_Arithm[] = "int argument required for Arithmetic and Delete operations";
static const char __pyx_k_schema_id_type_must_be_a_MP_UINT[] = "schema_id type must be a MP_UINT";
static const char __pyx_k_home_travis_build_igorcoding_as_2[] = "/home/travis/build/igorcoding/asynctnt/asynctnt/iproto/protocol.pyx";
static PyObject *__pyx_n_s_AF_UNIX;
static PyObject *__pyx_n_s_ALL;
static PyObject *__pyx_n_s_AttributeError;
static PyObject *__pyx_n_s_BITS_ALL_NOT_SET;
static PyObject *__pyx_n_s_BITS_ALL_SET;
static PyObject *__pyx_n_s_BITS_ANY_SET;
static PyObject *__pyx_n_s_BaseProtocol__do_auth_locals_on;
static PyObject *__pyx_n_s_BaseProtocol__do_fetch_schema_lo;
static PyObject *__pyx_n_s_BufferError;
static PyObject *__pyx_n_s_CancelledError;
static PyObject *__pyx_n_s_Db_execute;
static PyObject *__pyx_kp_s_Deallocating_buffer_with_attache;
static PyObject *__pyx_n_s_EQ;
static PyObject *__pyx_n_s_ER_WRONG_SCHEMA_VERSION;
static PyObject *__pyx_n_s_ErrorCode;
static PyObject *__pyx_n_s_Future;
static PyObject *__pyx_n_s_GE;
static PyObject *__pyx_n_s_GT;
static PyObject *__pyx_kp_s_Header_key_must_be_a_MP_UINT;
static PyObject *__pyx_n_s_IPPROTO_TCP;
static PyObject *__pyx_n_s_IndexError;
static PyObject *__pyx_kp_s_Index_for_space_not_found;
static PyObject *__pyx_n_s_IntEnum;
static PyObject *__pyx_n_s_Iterator;
static PyObject *__pyx_kp_s_Iterator_is_of_unsupported_type;
static PyObject *__pyx_n_s_KeyError;
static PyObject *__pyx_n_s_LE;
static PyObject *__pyx_n_s_LT;
static PyObject *__pyx_kp_s_Lost_connection_to_Tarantool;
static PyObject *__pyx_n_s_MemoryError;
static PyObject *__pyx_n_s_NEIGHBOR;
static PyObject *__pyx_n_s_OVERLAPS;
static PyObject *__pyx_kp_s_Offset_incorrect_Got_use_len;
static PyObject *__pyx_kp_s_Operation_field_no_must_be_of_in;
static PyObject *__pyx_kp_s_Operation_length_must_be_at_leas;
static PyObject *__pyx_kp_s_Operation_type_must_of_a_str_or;
static PyObject *__pyx_n_s_Protocol;
static PyObject *__pyx_n_s_REQ;
static PyObject *__pyx_kp_s_Request_op_sync_schema_id_body;
static PyObject *__pyx_kp_s_Response_body_must_be_a_MP_MAP;
static PyObject *__pyx_kp_s_Response_code_sync;
static PyObject *__pyx_kp_s_Response_header_must_be_a_MP_MAP;
static PyObject *__pyx_n_s_RuntimeError;
static PyObject *__pyx_kp_s_Schema;
static PyObject *__pyx_kp_s_SchemaIndex_sid_id_name_type_un;
static PyObject *__pyx_kp_s_SchemaSpace_id_name_arity;
static PyObject *__pyx_kp_s_Schema_fetch_timeout;
static PyObject *__pyx_kp_s_Schema_not_fetched;
static PyObject *__pyx_kp_s_Single_operation_must_be_a_tuple;
static PyObject *__pyx_kp_s_Space_not_found;
static PyObject *__pyx_kp_s_Splice_offset_must_be_int;
static PyObject *__pyx_kp_s_Splice_operation_must_have_lengt;
static PyObject *__pyx_kp_s_Splice_position_must_be_int;
static PyObject *__pyx_n_s_TCP_NODELAY;
static PyObject *__pyx_n_s_TarantoolDatabaseError;
static PyObject *__pyx_n_s_TarantoolNotConnectedError;
static PyObject *__pyx_n_s_TarantoolSchemaError;
static PyObject *__pyx_kp_s_Tarantool_is_not_connected;
static PyObject *__pyx_kp_s_Tarantool_s_s_Authorization_fail;
static PyObject *__pyx_kp_s_Tarantool_s_s_Authorized_success;
static PyObject *__pyx_kp_s_Tarantool_s_s_Schema_fetch_faile;
static PyObject *__pyx_kp_s_Tarantool_s_s_Schema_fetch_succe;
static PyObject *__pyx_n_s_TimeoutError;
static PyObject *__pyx_n_s_TypeError;
static PyObject *__pyx_kp_s_Type_is_not_supported_for_encodi;
static PyObject *__pyx_kp_s_Unexpected_key_type_in_map_s;
static PyObject *__pyx_kp_s_Unexpected_obj_type_s;
static PyObject *__pyx_kp_s_Unknown_argument_in_header_Skipp;
static PyObject *__pyx_kp_s_Unknown_update_operation_type;
static PyObject *__pyx_n_s_VERSION_STRING_REGEX;
static PyObject *__pyx_kp_s__29;
static PyObject *__pyx_n_s_add_done_callback;
static PyObject *__pyx_n_s_allow_unicode;
static PyObject *__pyx_n_s_args;
static PyObject *__pyx_n_s_ascii;
static PyObject *__pyx_n_s_asyncio;
static PyObject *__pyx_n_s_asyncio_coroutines;
static PyObject *__pyx_n_s_asyncio_tasks;
static PyObject *__pyx_n_s_asynctnt_exceptions;
static PyObject *__pyx_n_s_asynctnt_iproto_protocol;
static PyObject *__pyx_n_s_asynctnt_log;
static PyObject *__pyx_n_s_auto_refetch_schema;
static PyObject *__pyx_n_s_await;
static PyObject *__pyx_n_s_b64decode;
static PyObject *__pyx_n_s_base64;
static PyObject *__pyx_n_s_body;
static PyObject *__pyx_kp_s_body_data_type_must_be_a_MP_ARRA;
static PyObject *__pyx_n_s_call_later;
static PyObject *__pyx_n_s_cancel;
static PyObject *__pyx_n_s_cancelled;
static PyObject *__pyx_n_s_class;
static PyObject *__pyx_n_s_close;
static PyObject *__pyx_n_s_code;
static PyObject *__pyx_kp_s_code_type_must_be_a_MP_UINT;
static PyObject *__pyx_n_s_compile;
static PyObject *__pyx_n_s_connected_fut;
static PyObject *__pyx_n_s_create_future;
static PyObject *__pyx_n_s_create_future_fallback;
static PyObject *__pyx_n_s_debug;
static PyObject *__pyx_n_s_decode;
static PyObject *__pyx_n_s_digest;
static PyObject *__pyx_n_s_doc;
static PyObject *__pyx_n_s_done;
static PyObject *__pyx_n_s_dump;
static PyObject *__pyx_n_s_e;
static PyObject *__pyx_n_s_encode;
static PyObject *__pyx_n_s_encoding;
static PyObject *__pyx_kp_s_encoding_must_be_either_str_or_b;
static PyObject *__pyx_n_s_enum;
static PyObject *__pyx_n_s_error;
static PyObject *__pyx_kp_s_errstr_type_must_be_a_MP_STR;
static PyObject *__pyx_kp_s_exceeded_timeout;
static PyObject *__pyx_n_s_exception;
static PyObject *__pyx_n_s_execute;
static PyObject *__pyx_n_s_expression;
static PyObject *__pyx_n_s_f;
static PyObject *__pyx_n_s_family;
static PyObject *__pyx_n_s_fetch_schema;
static PyObject *__pyx_n_s_format;
static PyObject *__pyx_n_s_func_name;
static PyObject *__pyx_n_s_futures;
static PyObject *__pyx_n_s_gather;
static PyObject *__pyx_n_s_get_extra_info;
static PyObject *__pyx_n_s_get_id;
static PyObject *__pyx_n_s_get_index;
static PyObject *__pyx_n_s_get_space;
static PyObject *__pyx_n_s_group;
static PyObject *__pyx_n_s_hashlib;
static PyObject *__pyx_kp_s_home_travis_build_igorcoding_as;
static PyObject *__pyx_kp_s_home_travis_build_igorcoding_as_2;
static PyObject *__pyx_n_s_host;
static PyObject *__pyx_n_s_iid;
static PyObject *__pyx_n_s_import;
static PyObject *__pyx_n_s_index;
static PyObject *__pyx_n_s_index_row;
static PyObject *__pyx_n_s_index_type;
static PyObject *__pyx_n_s_indexes;
static PyObject *__pyx_n_s_init;
static PyObject *__pyx_n_s_init___locals___repr;
static PyObject *__pyx_n_s_initial_read_buffer_size;
static PyObject *__pyx_n_s_insert;
static PyObject *__pyx_n_s_inspect;
static PyObject *__pyx_kp_s_int_argument_required_for_Arithm;
static PyObject *__pyx_n_s_iterator;
static PyObject *__pyx_n_s_key;
static PyObject *__pyx_n_s_limit;
static PyObject *__pyx_n_s_logger;
static PyObject *__pyx_n_s_loop;
static PyObject *__pyx_n_s_main;
static PyObject *__pyx_n_s_map;
static PyObject *__pyx_n_s_match;
static PyObject *__pyx_n_s_memoryview;
static PyObject *__pyx_n_s_metaclass;
static PyObject *__pyx_n_s_module;
static PyObject *__pyx_n_s_name;
static PyObject *__pyx_n_s_name_2;
static PyObject *__pyx_n_s_offset;
static PyObject *__pyx_n_s_on_authorized;
static PyObject *__pyx_n_s_on_connection_lost;
static PyObject *__pyx_n_s_on_connection_lost_cb;
static PyObject *__pyx_n_s_on_connection_made;
static PyObject *__pyx_n_s_on_connection_made_cb;
static PyObject *__pyx_kp_s_on_data_received_expected_bytes;
static PyObject *__pyx_n_s_on_fetch;
static PyObject *__pyx_n_s_on_request_completed;
static PyObject *__pyx_n_s_on_request_timeout;
static PyObject *__pyx_n_s_operations;
static PyObject *__pyx_n_s_parse_version;
static PyObject *__pyx_n_s_password;
static PyObject *__pyx_n_s_port;
static PyObject *__pyx_n_s_prepare;
static PyObject *__pyx_n_s_pyx_vtable;
static PyObject *__pyx_n_s_qualname;
static PyObject *__pyx_n_s_range;
static PyObject *__pyx_n_s_re;
static PyObject *__pyx_n_s_refetch_schema;
static PyObject *__pyx_n_s_replace;
static PyObject *__pyx_n_s_repr;
static PyObject *__pyx_n_s_req;
static PyObject *__pyx_n_s_req_2;
static PyObject *__pyx_n_s_request_timeout;
static PyObject *__pyx_n_s_result;
static PyObject *__pyx_n_s_return_exceptions;
static PyObject *__pyx_kp_s_s_Tarantool_s_d_s;
static PyObject *__pyx_n_s_schema_id;
static PyObject *__pyx_kp_s_schema_id_type_must_be_a_MP_UINT;
static PyObject *__pyx_n_s_select;
static PyObject *__pyx_n_s_self;
static PyObject *__pyx_n_s_send;
static PyObject *__pyx_n_s_set_exception;
static PyObject *__pyx_n_s_set_result;
static PyObject *__pyx_n_s_setsockopt;
static PyObject *__pyx_n_s_sha1;
static PyObject *__pyx_n_s_sid;
static PyObject *__pyx_n_s_socket;
static PyObject *__pyx_n_s_space;
static PyObject *__pyx_n_s_space_row;
static PyObject *__pyx_n_s_spaces;
static PyObject *__pyx_n_s_split;
static PyObject *__pyx_kp_s_sync_d_not_found;
static PyObject *__pyx_kp_s_sync_type_must_be_a_MP_UINT;
static PyObject *__pyx_n_s_t;
static PyObject *__pyx_n_s_test;
static PyObject *__pyx_kp_s_the_buffer_is_in_read_only_mode;
static PyObject *__pyx_n_s_throw;
static PyObject *__pyx_n_s_timeout;
static PyObject *__pyx_n_s_transport;
static PyObject *__pyx_n_s_unique;
static PyObject *__pyx_n_s_update;
static PyObject *__pyx_n_s_username;
static PyObject *__pyx_kp_b_utf_8;
static PyObject *__pyx_n_s_value;
static PyObject *__pyx_n_s_warning;
static PyObject *__pyx_n_s_write;
static PyObject *__pyx_n_s_yaml;
static int __pyx_pf_8asynctnt_6iproto_8protocol_11WriteBuffer___cinit__(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *__pyx_v_self); /* proto */
static void __pyx_pf_8asynctnt_6iproto_8protocol_11WriteBuffer_2__dealloc__(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *__pyx_v_self); /* proto */
static int __pyx_pf_8asynctnt_6iproto_8protocol_11WriteBuffer_4__getbuffer__(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *__pyx_v_self, Py_buffer *__pyx_v_buffer, int __pyx_v_flags); /* proto */
static void __pyx_pf_8asynctnt_6iproto_8protocol_11WriteBuffer_6__releasebuffer__(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *__pyx_v_self, CYTHON_UNUSED Py_buffer *__pyx_v_buffer); /* proto */
static int __pyx_pf_8asynctnt_6iproto_8protocol_10ReadBuffer___cinit__(struct __pyx_obj_8asynctnt_6iproto_8protocol_ReadBuffer *__pyx_v_self); /* proto */
static void __pyx_pf_8asynctnt_6iproto_8protocol_10ReadBuffer_2__dealloc__(struct __pyx_obj_8asynctnt_6iproto_8protocol_ReadBuffer *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_7Request___repr__(struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_8Response___repr__(struct __pyx_obj_8asynctnt_6iproto_8protocol_Response *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_8Response_2body2yaml(struct __pyx_obj_8asynctnt_6iproto_8protocol_Response *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_8Response_4code___get__(struct __pyx_obj_8asynctnt_6iproto_8protocol_Response *__pyx_v_self); /* proto */
static int __pyx_pf_8asynctnt_6iproto_8protocol_8Response_4code_2__set__(struct __pyx_obj_8asynctnt_6iproto_8protocol_Response *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_8Response_4sync___get__(struct __pyx_obj_8asynctnt_6iproto_8protocol_Response *__pyx_v_self); /* proto */
static int __pyx_pf_8asynctnt_6iproto_8protocol_8Response_4sync_2__set__(struct __pyx_obj_8asynctnt_6iproto_8protocol_Response *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_8Response_9schema_id___get__(struct __pyx_obj_8asynctnt_6iproto_8protocol_Response *__pyx_v_self); /* proto */
static int __pyx_pf_8asynctnt_6iproto_8protocol_8Response_9schema_id_2__set__(struct __pyx_obj_8asynctnt_6iproto_8protocol_Response *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_8Response_6errmsg___get__(struct __pyx_obj_8asynctnt_6iproto_8protocol_Response *__pyx_v_self); /* proto */
static int __pyx_pf_8asynctnt_6iproto_8protocol_8Response_6errmsg_2__set__(struct __pyx_obj_8asynctnt_6iproto_8protocol_Response *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_8asynctnt_6iproto_8protocol_8Response_6errmsg_4__del__(struct __pyx_obj_8asynctnt_6iproto_8protocol_Response *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_8Response_4body___get__(struct __pyx_obj_8asynctnt_6iproto_8protocol_Response *__pyx_v_self); /* proto */
static int __pyx_pf_8asynctnt_6iproto_8protocol_8Response_4body_2__set__(struct __pyx_obj_8asynctnt_6iproto_8protocol_Response *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_8asynctnt_6iproto_8protocol_8Response_4body_4__del__(struct __pyx_obj_8asynctnt_6iproto_8protocol_Response *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_8Response_8encoding___get__(struct __pyx_obj_8asynctnt_6iproto_8protocol_Response *__pyx_v_self); /* proto */
static int __pyx_pf_8asynctnt_6iproto_8protocol_8Response_8encoding_2__set__(struct __pyx_obj_8asynctnt_6iproto_8protocol_Response *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_8asynctnt_6iproto_8protocol_8Response_8encoding_4__del__(struct __pyx_obj_8asynctnt_6iproto_8protocol_Response *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_11SchemaIndex_8__init_____repr__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static int __pyx_pf_8asynctnt_6iproto_8protocol_11SchemaIndex___init__(struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaIndex *__pyx_v_self, PyObject *__pyx_v_index_row); /* proto */
static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_11SchemaIndex_3sid___get__(struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaIndex *__pyx_v_self); /* proto */
static int __pyx_pf_8asynctnt_6iproto_8protocol_11SchemaIndex_3sid_2__set__(struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaIndex *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_11SchemaIndex_3iid___get__(struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaIndex *__pyx_v_self); /* proto */
static int __pyx_pf_8asynctnt_6iproto_8protocol_11SchemaIndex_3iid_2__set__(struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaIndex *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_11SchemaIndex_4name___get__(struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaIndex *__pyx_v_self); /* proto */
static int __pyx_pf_8asynctnt_6iproto_8protocol_11SchemaIndex_4name_2__set__(struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaIndex *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_8asynctnt_6iproto_8protocol_11SchemaIndex_4name_4__del__(struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaIndex *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_11SchemaIndex_10index_type___get__(struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaIndex *__pyx_v_self); /* proto */
static int __pyx_pf_8asynctnt_6iproto_8protocol_11SchemaIndex_10index_type_2__set__(struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaIndex *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_8asynctnt_6iproto_8protocol_11SchemaIndex_10index_type_4__del__(struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaIndex *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_11SchemaIndex_6unique___get__(struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaIndex *__pyx_v_self); /* proto */
static int __pyx_pf_8asynctnt_6iproto_8protocol_11SchemaIndex_6unique_2__set__(struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaIndex *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_8asynctnt_6iproto_8protocol_11SchemaIndex_6unique_4__del__(struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaIndex *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_11SchemaIndex_5parts___get__(struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaIndex *__pyx_v_self); /* proto */
static int __pyx_pf_8asynctnt_6iproto_8protocol_11SchemaIndex_5parts_2__set__(struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaIndex *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_8asynctnt_6iproto_8protocol_11SchemaIndex_5parts_4__del__(struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaIndex *__pyx_v_self); /* proto */
static int __pyx_pf_8asynctnt_6iproto_8protocol_11SchemaSpace___init__(struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaSpace *__pyx_v_self, PyObject *__pyx_v_space_row); /* proto */
static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_11SchemaSpace_2__repr__(struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaSpace *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_11SchemaSpace_3sid___get__(struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaSpace *__pyx_v_self); /* proto */
static int __pyx_pf_8asynctnt_6iproto_8protocol_11SchemaSpace_3sid_2__set__(struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaSpace *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_11SchemaSpace_5arity___get__(struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaSpace *__pyx_v_self); /* proto */
static int __pyx_pf_8asynctnt_6iproto_8protocol_11SchemaSpace_5arity_2__set__(struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaSpace *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_11SchemaSpace_4name___get__(struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaSpace *__pyx_v_self); /* proto */
static int __pyx_pf_8asynctnt_6iproto_8protocol_11SchemaSpace_4name_2__set__(struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaSpace *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_8asynctnt_6iproto_8protocol_11SchemaSpace_4name_4__del__(struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaSpace *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_11SchemaSpace_7indexes___get__(struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaSpace *__pyx_v_self); /* proto */
static int __pyx_pf_8asynctnt_6iproto_8protocol_11SchemaSpace_7indexes_2__set__(struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaSpace *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_8asynctnt_6iproto_8protocol_11SchemaSpace_7indexes_4__del__(struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaSpace *__pyx_v_self); /* proto */
static int __pyx_pf_8asynctnt_6iproto_8protocol_6Schema___init__(struct __pyx_obj_8asynctnt_6iproto_8protocol_Schema *__pyx_v_self, int64_t __pyx_v_schema_id); /* proto */
static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_6Schema_2get_space(struct __pyx_obj_8asynctnt_6iproto_8protocol_Schema *__pyx_v_self, PyObject *__pyx_v_space); /* proto */
static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_6Schema_4get_index(struct __pyx_obj_8asynctnt_6iproto_8protocol_Schema *__pyx_v_self, PyObject *__pyx_v_space, PyObject *__pyx_v_index); /* proto */
static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_6Schema_6get_id(struct __pyx_obj_8asynctnt_6iproto_8protocol_Schema *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_6Schema_8__repr__(CYTHON_UNUSED struct __pyx_obj_8asynctnt_6iproto_8protocol_Schema *__pyx_v_self); /* proto */
static int __pyx_pf_8asynctnt_6iproto_8protocol_2Db___cinit__(struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_2Db_2execute(struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *__pyx_v_self, struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *__pyx_v_req, float __pyx_v_timeout); /* proto */
static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_2Db_5ping(struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *__pyx_v_self, PyObject *__pyx_v_timeout); /* proto */
static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_2Db_7call16(struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *__pyx_v_self, PyObject *__pyx_v_func_name, PyObject *__pyx_v_args, PyObject *__pyx_v_timeout); /* proto */
static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_2Db_9call(struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *__pyx_v_self, PyObject *__pyx_v_func_name, PyObject *__pyx_v_args, PyObject *__pyx_v_timeout); /* proto */
static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_2Db_11eval(struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *__pyx_v_self, PyObject *__pyx_v_expression, PyObject *__pyx_v_args, PyObject *__pyx_v_timeout); /* proto */
static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_2Db_13select(struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *__pyx_v_self, PyObject *__pyx_v_space, PyObject *__pyx_v_key, PyObject *__pyx_v_offset, PyObject *__pyx_v_limit, PyObject *__pyx_v_index, PyObject *__pyx_v_iterator, PyObject *__pyx_v_timeout); /* proto */
static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_2Db_15insert(struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *__pyx_v_self, PyObject *__pyx_v_space, PyObject *__pyx_v_t, PyObject *__pyx_v_replace, PyObject *__pyx_v_timeout); /* proto */
static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_2Db_17replace(struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *__pyx_v_self, PyObject *__pyx_v_space, PyObject *__pyx_v_t, PyObject *__pyx_v_timeout); /* proto */
static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_2Db_19delete(struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *__pyx_v_self, PyObject *__pyx_v_space, PyObject *__pyx_v_key, PyObject *__pyx_v_index, PyObject *__pyx_v_timeout); /* proto */
static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_2Db_21update(struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *__pyx_v_self, PyObject *__pyx_v_space, PyObject *__pyx_v_key, PyObject *__pyx_v_operations, PyObject *__pyx_v_index, PyObject *__pyx_v_timeout); /* proto */
static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_2Db_23upsert(struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *__pyx_v_self, PyObject *__pyx_v_space, PyObject *__pyx_v_t, PyObject *__pyx_v_operations, PyObject *__pyx_v_timeout); /* proto */
static int __pyx_pf_8asynctnt_6iproto_8protocol_12CoreProtocol___init__(struct __pyx_obj_8asynctnt_6iproto_8protocol_CoreProtocol *__pyx_v_self, PyObject *__pyx_v_host, PyObject *__pyx_v_port, PyObject *__pyx_v_encoding, PyObject *__pyx_v_initial_read_buffer_size); /* proto */
static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_12CoreProtocol_2is_connected(struct __pyx_obj_8asynctnt_6iproto_8protocol_CoreProtocol *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_12CoreProtocol_4is_fully_connected(struct __pyx_obj_8asynctnt_6iproto_8protocol_CoreProtocol *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_12CoreProtocol_6get_version(struct __pyx_obj_8asynctnt_6iproto_8protocol_CoreProtocol *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_12CoreProtocol_8_parse_version(CYTHON_UNUSED struct __pyx_obj_8asynctnt_6iproto_8protocol_CoreProtocol *__pyx_v_self, PyObject *__pyx_v_version); /* proto */
static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_12CoreProtocol_10data_received(struct __pyx_obj_8asynctnt_6iproto_8protocol_CoreProtocol *__pyx_v_self, PyObject *__pyx_v_data); /* proto */
static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_12CoreProtocol_12connection_made(struct __pyx_obj_8asynctnt_6iproto_8protocol_CoreProtocol *__pyx_v_self, PyObject *__pyx_v_transport); /* proto */
static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_12CoreProtocol_14connection_lost(struct __pyx_obj_8asynctnt_6iproto_8protocol_CoreProtocol *__pyx_v_self, PyObject *__pyx_v_exc); /* proto */
static int __pyx_pf_8asynctnt_6iproto_8protocol_12BaseProtocol___init__(struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *__pyx_v_self, PyObject *__pyx_v_host, PyObject *__pyx_v_port, PyObject *__pyx_v_username, PyObject *__pyx_v_password, PyObject *__pyx_v_fetch_schema, PyObject *__pyx_v_auto_refetch_schema, PyObject *__pyx_v_connected_fut, PyObject *__pyx_v_on_connection_made, PyObject *__pyx_v_on_connection_lost, PyObject *__pyx_v_loop, PyObject *__pyx_v_request_timeout, PyObject *__pyx_v_encoding, PyObject *__pyx_v_initial_read_buffer_size); /* proto */
static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_12BaseProtocol_2_create_future_fallback(struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_12BaseProtocol_6schema___get__(struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_12BaseProtocol_9schema_id___get__(struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_12BaseProtocol_8_do_auth_on_authorized(PyObject *__pyx_self, PyObject *__pyx_v_f); /* proto */
static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_12BaseProtocol_16_do_fetch_schema_on_fetch(PyObject *__pyx_self, PyObject *__pyx_v_f); /* proto */
static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_12BaseProtocol_4_on_request_timeout(CYTHON_UNUSED struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *__pyx_v_self, PyObject *__pyx_v_waiter); /* proto */
static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_12BaseProtocol_6_on_request_completed(CYTHON_UNUSED struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *__pyx_v_self, PyObject *__pyx_v_fut); /* proto */
static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_12BaseProtocol_8create_db(struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_12BaseProtocol_10get_common_db(struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_12BaseProtocol_12refetch_schema(struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *__pyx_v_self); /* proto */
static PyObject *__pyx_tp_new_8asynctnt_6iproto_8protocol_WriteBuffer(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_8asynctnt_6iproto_8protocol_ReadBuffer(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_8asynctnt_6iproto_8protocol_Request(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_8asynctnt_6iproto_8protocol_Response(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_8asynctnt_6iproto_8protocol_SchemaIndex(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_8asynctnt_6iproto_8protocol_SchemaSpace(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_8asynctnt_6iproto_8protocol_Schema(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_8asynctnt_6iproto_8protocol_Db(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_8asynctnt_6iproto_8protocol_CoreProtocol(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_8asynctnt_6iproto_8protocol_BaseProtocol(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_8asynctnt_6iproto_8protocol___pyx_scope_struct__execute(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_8asynctnt_6iproto_8protocol___pyx_scope_struct_1__do_auth(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_8asynctnt_6iproto_8protocol___pyx_scope_struct_2__do_fetch_schema(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_int_0;
static PyObject *__pyx_int_1;
static PyObject *__pyx_int_2;
static PyObject *__pyx_int_3;
static PyObject *__pyx_int_4;
static PyObject *__pyx_int_5;
static PyObject *__pyx_int_6;
static PyObject *__pyx_int_7;
static PyObject *__pyx_int_8;
static PyObject *__pyx_int_9;
static PyObject *__pyx_int_10;
static PyObject *__pyx_int_11;
static PyObject *__pyx_int_20;
static PyObject *__pyx_int_281;
static PyObject *__pyx_int_289;
static PyObject *__pyx_int_4294967295;
static PyObject *__pyx_int_neg_1;
static uint32_t __pyx_k__10;
static uint32_t __pyx_k__11;
static PyObject *__pyx_tuple_;
static PyObject *__pyx_tuple__2;
static PyObject *__pyx_tuple__3;
static PyObject *__pyx_tuple__4;
static PyObject *__pyx_tuple__5;
static PyObject *__pyx_tuple__6;
static PyObject *__pyx_tuple__7;
static PyObject *__pyx_tuple__8;
static PyObject *__pyx_tuple__9;
static PyObject *__pyx_slice__26;
static PyObject *__pyx_tuple__12;
static PyObject *__pyx_tuple__13;
static PyObject *__pyx_tuple__14;
static PyObject *__pyx_tuple__15;
static PyObject *__pyx_tuple__16;
static PyObject *__pyx_tuple__17;
static PyObject *__pyx_tuple__18;
static PyObject *__pyx_tuple__19;
static PyObject *__pyx_tuple__20;
static PyObject *__pyx_tuple__21;
static PyObject *__pyx_tuple__22;
static PyObject *__pyx_tuple__24;
static PyObject *__pyx_tuple__25;
static PyObject *__pyx_tuple__27;
static PyObject *__pyx_tuple__28;
static PyObject *__pyx_tuple__30;
static PyObject *__pyx_tuple__31;
static PyObject *__pyx_tuple__32;
static PyObject *__pyx_tuple__33;
static PyObject *__pyx_tuple__34;
static PyObject *__pyx_tuple__36;
static PyObject *__pyx_tuple__37;
static PyObject *__pyx_tuple__39;
static PyObject *__pyx_tuple__40;
static PyObject *__pyx_tuple__41;
static PyObject *__pyx_tuple__42;
static PyObject *__pyx_tuple__43;
static PyObject *__pyx_tuple__44;
static PyObject *__pyx_tuple__45;
static PyObject *__pyx_codeobj__23;
static PyObject *__pyx_codeobj__35;
static PyObject *__pyx_codeobj__38;

/* "asynctnt/iproto/unicode.pyx":5
 * 
 * 
 * cdef bytes encode_unicode_string(str s, bytes encoding=b'utf-8'):             # <<<<<<<<<<<<<<
 *     cdef:
 *         bytes b
 */

static PyObject *__pyx_f_8asynctnt_6iproto_8protocol_encode_unicode_string(PyObject *__pyx_v_s, struct __pyx_opt_args_8asynctnt_6iproto_8protocol_encode_unicode_string *__pyx_optional_args) {
  PyObject *__pyx_v_encoding = ((PyObject*)__pyx_kp_b_utf_8);
  PyObject *__pyx_v_b = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  char *__pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("encode_unicode_string", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_encoding = __pyx_optional_args->encoding;
    }
  }

  /* "asynctnt/iproto/unicode.pyx":11
 * 
 *     b = <bytes><object>cpython.unicode.PyUnicode_AsEncodedString(
 *         s, encoding, b'strict'             # <<<<<<<<<<<<<<
 *     )
 *     return b
 */
  __pyx_t_1 = __Pyx_PyObject_AsString(__pyx_v_encoding); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) __PYX_ERR(4, 11, __pyx_L1_error)

  /* "asynctnt/iproto/unicode.pyx":10
 *         PyObject *p
 * 
 *     b = <bytes><object>cpython.unicode.PyUnicode_AsEncodedString(             # <<<<<<<<<<<<<<
 *         s, encoding, b'strict'
 *     )
 */
  __pyx_t_2 = PyUnicode_AsEncodedString(__pyx_v_s, __pyx_t_1, ((char *)"strict")); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 10, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __pyx_t_2;
  __Pyx_INCREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_b = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "asynctnt/iproto/unicode.pyx":13
 *         s, encoding, b'strict'
 *     )
 *     return b             # <<<<<<<<<<<<<<
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_b);
  __pyx_r = __pyx_v_b;
  goto __pyx_L0;

  /* "asynctnt/iproto/unicode.pyx":5
 * 
 * 
 * cdef bytes encode_unicode_string(str s, bytes encoding=b'utf-8'):             # <<<<<<<<<<<<<<
 *     cdef:
 *         bytes b
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("asynctnt.iproto.protocol.encode_unicode_string", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_b);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/buffer.pyx":24
 * @cython.freelist(_BUFFER_FREELIST_SIZE)
 * cdef class WriteBuffer:
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._smallbuf_inuse = True
 *         self._buf = self._smallbuf
 */

/* Python wrapper */
static int __pyx_pw_8asynctnt_6iproto_8protocol_11WriteBuffer_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_8asynctnt_6iproto_8protocol_11WriteBuffer_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;
  __pyx_r = __pyx_pf_8asynctnt_6iproto_8protocol_11WriteBuffer___cinit__(((struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_8asynctnt_6iproto_8protocol_11WriteBuffer___cinit__(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  char *__pyx_t_1;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "asynctnt/iproto/buffer.pyx":25
 * cdef class WriteBuffer:
 *     def __cinit__(self):
 *         self._smallbuf_inuse = True             # <<<<<<<<<<<<<<
 *         self._buf = self._smallbuf
 *         self._size = _BUFFER_INITIAL_SIZE
 */
  __pyx_v_self->_smallbuf_inuse = 1;

  /* "asynctnt/iproto/buffer.pyx":26
 *     def __cinit__(self):
 *         self._smallbuf_inuse = True
 *         self._buf = self._smallbuf             # <<<<<<<<<<<<<<
 *         self._size = _BUFFER_INITIAL_SIZE
 *         self._length = 0
 */
  __pyx_t_1 = __pyx_v_self->_smallbuf;
  __pyx_v_self->_buf = __pyx_t_1;

  /* "asynctnt/iproto/buffer.pyx":27
 *         self._smallbuf_inuse = True
 *         self._buf = self._smallbuf
 *         self._size = _BUFFER_INITIAL_SIZE             # <<<<<<<<<<<<<<
 *         self._length = 0
 *         self._encoding = None
 */
  __pyx_v_self->_size = 0x400;

  /* "asynctnt/iproto/buffer.pyx":28
 *         self._buf = self._smallbuf
 *         self._size = _BUFFER_INITIAL_SIZE
 *         self._length = 0             # <<<<<<<<<<<<<<
 *         self._encoding = None
 * 
 */
  __pyx_v_self->_length = 0;

  /* "asynctnt/iproto/buffer.pyx":29
 *         self._size = _BUFFER_INITIAL_SIZE
 *         self._length = 0
 *         self._encoding = None             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->_encoding);
  __Pyx_DECREF(__pyx_v_self->_encoding);
  __pyx_v_self->_encoding = ((PyObject*)Py_None);

  /* "asynctnt/iproto/buffer.pyx":24
 * @cython.freelist(_BUFFER_FREELIST_SIZE)
 * cdef class WriteBuffer:
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._smallbuf_inuse = True
 *         self._buf = self._smallbuf
 */

  /* function exit code */
  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/buffer.pyx":31
 *         self._encoding = None
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self._buf is not NULL and not self._smallbuf_inuse:
 *             PyMem_Free(self._buf)
 */

/* Python wrapper */
static void __pyx_pw_8asynctnt_6iproto_8protocol_11WriteBuffer_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_8asynctnt_6iproto_8protocol_11WriteBuffer_3__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_pf_8asynctnt_6iproto_8protocol_11WriteBuffer_2__dealloc__(((struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

static void __pyx_pf_8asynctnt_6iproto_8protocol_11WriteBuffer_2__dealloc__(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "asynctnt/iproto/buffer.pyx":32
 * 
 *     def __dealloc__(self):
 *         if self._buf is not NULL and not self._smallbuf_inuse:             # <<<<<<<<<<<<<<
 *             PyMem_Free(self._buf)
 *             self._buf = NULL
 */
  __pyx_t_2 = ((__pyx_v_self->_buf != NULL) != 0);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = ((!(__pyx_v_self->_smallbuf_inuse != 0)) != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "asynctnt/iproto/buffer.pyx":33
 *     def __dealloc__(self):
 *         if self._buf is not NULL and not self._smallbuf_inuse:
 *             PyMem_Free(self._buf)             # <<<<<<<<<<<<<<
 *             self._buf = NULL
 *             self._size = 0
 */
    PyMem_Free(__pyx_v_self->_buf);

    /* "asynctnt/iproto/buffer.pyx":34
 *         if self._buf is not NULL and not self._smallbuf_inuse:
 *             PyMem_Free(self._buf)
 *             self._buf = NULL             # <<<<<<<<<<<<<<
 *             self._size = 0
 * 
 */
    __pyx_v_self->_buf = NULL;

    /* "asynctnt/iproto/buffer.pyx":35
 *             PyMem_Free(self._buf)
 *             self._buf = NULL
 *             self._size = 0             # <<<<<<<<<<<<<<
 * 
 *         if self._view_count:
 */
    __pyx_v_self->_size = 0;

    /* "asynctnt/iproto/buffer.pyx":32
 * 
 *     def __dealloc__(self):
 *         if self._buf is not NULL and not self._smallbuf_inuse:             # <<<<<<<<<<<<<<
 *             PyMem_Free(self._buf)
 *             self._buf = NULL
 */
  }

  /* "asynctnt/iproto/buffer.pyx":37
 *             self._size = 0
 * 
 *         if self._view_count:             # <<<<<<<<<<<<<<
 *             raise RuntimeError(
 *                 'Deallocating buffer with attached memoryviews')
 */
  __pyx_t_1 = (__pyx_v_self->_view_count != 0);
  if (__pyx_t_1) {

    /* "asynctnt/iproto/buffer.pyx":38
 * 
 *         if self._view_count:
 *             raise RuntimeError(             # <<<<<<<<<<<<<<
 *                 'Deallocating buffer with attached memoryviews')
 * 
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 38, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(0, 38, __pyx_L1_error)

    /* "asynctnt/iproto/buffer.pyx":37
 *             self._size = 0
 * 
 *         if self._view_count:             # <<<<<<<<<<<<<<
 *             raise RuntimeError(
 *                 'Deallocating buffer with attached memoryviews')
 */
  }

  /* "asynctnt/iproto/buffer.pyx":31
 *         self._encoding = None
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self._buf is not NULL and not self._smallbuf_inuse:
 *             PyMem_Free(self._buf)
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_WriteUnraisable("asynctnt.iproto.protocol.WriteBuffer.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "asynctnt/iproto/buffer.pyx":41
 *                 'Deallocating buffer with attached memoryviews')
 * 
 *     def __getbuffer__(self, Py_buffer *buffer, int flags):             # <<<<<<<<<<<<<<
 *         self._view_count += 1
 * 
 */

/* Python wrapper */
static CYTHON_UNUSED int __pyx_pw_8asynctnt_6iproto_8protocol_11WriteBuffer_5__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_buffer, int __pyx_v_flags); /*proto*/
static CYTHON_UNUSED int __pyx_pw_8asynctnt_6iproto_8protocol_11WriteBuffer_5__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_buffer, int __pyx_v_flags) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8asynctnt_6iproto_8protocol_11WriteBuffer_4__getbuffer__(((struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *)__pyx_v_self), ((Py_buffer *)__pyx_v_buffer), ((int)__pyx_v_flags));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_8asynctnt_6iproto_8protocol_11WriteBuffer_4__getbuffer__(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *__pyx_v_self, Py_buffer *__pyx_v_buffer, int __pyx_v_flags) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__getbuffer__", 0);
  if (__pyx_v_buffer != NULL) {
    __pyx_v_buffer->obj = Py_None; __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(__pyx_v_buffer->obj);
  }

  /* "asynctnt/iproto/buffer.pyx":42
 * 
 *     def __getbuffer__(self, Py_buffer *buffer, int flags):
 *         self._view_count += 1             # <<<<<<<<<<<<<<
 * 
 *         cpython.PyBuffer_FillInfo(
 */
  __pyx_v_self->_view_count = (__pyx_v_self->_view_count + 1);

  /* "asynctnt/iproto/buffer.pyx":44
 *         self._view_count += 1
 * 
 *         cpython.PyBuffer_FillInfo(             # <<<<<<<<<<<<<<
 *             buffer, self, self._buf, self._length,
 *             1,  # read-only
 */
  __pyx_t_1 = PyBuffer_FillInfo(__pyx_v_buffer, ((PyObject *)__pyx_v_self), __pyx_v_self->_buf, __pyx_v_self->_length, 1, __pyx_v_flags); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(0, 44, __pyx_L1_error)

  /* "asynctnt/iproto/buffer.pyx":41
 *                 'Deallocating buffer with attached memoryviews')
 * 
 *     def __getbuffer__(self, Py_buffer *buffer, int flags):             # <<<<<<<<<<<<<<
 *         self._view_count += 1
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("asynctnt.iproto.protocol.WriteBuffer.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  if (__pyx_v_buffer != NULL && __pyx_v_buffer->obj != NULL) {
    __Pyx_GOTREF(__pyx_v_buffer->obj);
    __Pyx_DECREF(__pyx_v_buffer->obj); __pyx_v_buffer->obj = NULL;
  }
  goto __pyx_L2;
  __pyx_L0:;
  if (__pyx_v_buffer != NULL && __pyx_v_buffer->obj == Py_None) {
    __Pyx_GOTREF(Py_None);
    __Pyx_DECREF(Py_None); __pyx_v_buffer->obj = NULL;
  }
  __pyx_L2:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/buffer.pyx":50
 *         )
 * 
 *     def __releasebuffer__(self, Py_buffer *buffer):             # <<<<<<<<<<<<<<
 *         self._view_count -= 1
 * 
 */

/* Python wrapper */
static CYTHON_UNUSED void __pyx_pw_8asynctnt_6iproto_8protocol_11WriteBuffer_7__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_buffer); /*proto*/
static CYTHON_UNUSED void __pyx_pw_8asynctnt_6iproto_8protocol_11WriteBuffer_7__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_buffer) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0);
  __pyx_pf_8asynctnt_6iproto_8protocol_11WriteBuffer_6__releasebuffer__(((struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *)__pyx_v_self), ((Py_buffer *)__pyx_v_buffer));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

static void __pyx_pf_8asynctnt_6iproto_8protocol_11WriteBuffer_6__releasebuffer__(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *__pyx_v_self, CYTHON_UNUSED Py_buffer *__pyx_v_buffer) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__releasebuffer__", 0);

  /* "asynctnt/iproto/buffer.pyx":51
 * 
 *     def __releasebuffer__(self, Py_buffer *buffer):
 *         self._view_count -= 1             # <<<<<<<<<<<<<<
 * 
 *     @staticmethod
 */
  __pyx_v_self->_view_count = (__pyx_v_self->_view_count - 1);

  /* "asynctnt/iproto/buffer.pyx":50
 *         )
 * 
 *     def __releasebuffer__(self, Py_buffer *buffer):             # <<<<<<<<<<<<<<
 *         self._view_count -= 1
 * 
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "asynctnt/iproto/buffer.pyx":54
 * 
 *     @staticmethod
 *     cdef WriteBuffer new(bytes encoding=None):             # <<<<<<<<<<<<<<
 *         cdef WriteBuffer buf
 *         buf = WriteBuffer.__new__(WriteBuffer)
 */

static struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *__pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer_new(struct __pyx_opt_args_8asynctnt_6iproto_8protocol_11WriteBuffer_new *__pyx_optional_args) {
  PyObject *__pyx_v_encoding = ((PyObject*)Py_None);
  struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *__pyx_v_buf = 0;
  struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("new", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_encoding = __pyx_optional_args->encoding;
    }
  }

  /* "asynctnt/iproto/buffer.pyx":56
 *     cdef WriteBuffer new(bytes encoding=None):
 *         cdef WriteBuffer buf
 *         buf = WriteBuffer.__new__(WriteBuffer)             # <<<<<<<<<<<<<<
 *         buf._encoding = encoding
 *         return buf
 */
  __pyx_t_1 = __pyx_tp_new_8asynctnt_6iproto_8protocol_WriteBuffer(((PyTypeObject *)__pyx_ptype_8asynctnt_6iproto_8protocol_WriteBuffer), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 56, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_8asynctnt_6iproto_8protocol_WriteBuffer)))) __PYX_ERR(0, 56, __pyx_L1_error)
  __pyx_v_buf = ((struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "asynctnt/iproto/buffer.pyx":57
 *         cdef WriteBuffer buf
 *         buf = WriteBuffer.__new__(WriteBuffer)
 *         buf._encoding = encoding             # <<<<<<<<<<<<<<
 *         return buf
 * 
 */
  __Pyx_INCREF(__pyx_v_encoding);
  __Pyx_GIVEREF(__pyx_v_encoding);
  __Pyx_GOTREF(__pyx_v_buf->_encoding);
  __Pyx_DECREF(__pyx_v_buf->_encoding);
  __pyx_v_buf->_encoding = __pyx_v_encoding;

  /* "asynctnt/iproto/buffer.pyx":58
 *         buf = WriteBuffer.__new__(WriteBuffer)
 *         buf._encoding = encoding
 *         return buf             # <<<<<<<<<<<<<<
 * 
 *     cdef inline _check_readonly(self):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_buf));
  __pyx_r = __pyx_v_buf;
  goto __pyx_L0;

  /* "asynctnt/iproto/buffer.pyx":54
 * 
 *     @staticmethod
 *     cdef WriteBuffer new(bytes encoding=None):             # <<<<<<<<<<<<<<
 *         cdef WriteBuffer buf
 *         buf = WriteBuffer.__new__(WriteBuffer)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asynctnt.iproto.protocol.WriteBuffer.new", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_buf);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/buffer.pyx":60
 *         return buf
 * 
 *     cdef inline _check_readonly(self):             # <<<<<<<<<<<<<<
 *         if self._view_count:
 *             raise BufferError('the buffer is in read-only mode')
 */

static CYTHON_INLINE PyObject *__pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__check_readonly(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("_check_readonly", 0);

  /* "asynctnt/iproto/buffer.pyx":61
 * 
 *     cdef inline _check_readonly(self):
 *         if self._view_count:             # <<<<<<<<<<<<<<
 *             raise BufferError('the buffer is in read-only mode')
 * 
 */
  __pyx_t_1 = (__pyx_v_self->_view_count != 0);
  if (__pyx_t_1) {

    /* "asynctnt/iproto/buffer.pyx":62
 *     cdef inline _check_readonly(self):
 *         if self._view_count:
 *             raise BufferError('the buffer is in read-only mode')             # <<<<<<<<<<<<<<
 * 
 *     cdef inline len(self):
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_BufferError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 62, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(0, 62, __pyx_L1_error)

    /* "asynctnt/iproto/buffer.pyx":61
 * 
 *     cdef inline _check_readonly(self):
 *         if self._view_count:             # <<<<<<<<<<<<<<
 *             raise BufferError('the buffer is in read-only mode')
 * 
 */
  }

  /* "asynctnt/iproto/buffer.pyx":60
 *         return buf
 * 
 *     cdef inline _check_readonly(self):             # <<<<<<<<<<<<<<
 *         if self._view_count:
 *             raise BufferError('the buffer is in read-only mode')
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("asynctnt.iproto.protocol.WriteBuffer._check_readonly", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/buffer.pyx":64
 *             raise BufferError('the buffer is in read-only mode')
 * 
 *     cdef inline len(self):             # <<<<<<<<<<<<<<
 *         return self._length
 * 
 */

static CYTHON_INLINE PyObject *__pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer_len(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("len", 0);

  /* "asynctnt/iproto/buffer.pyx":65
 * 
 *     cdef inline len(self):
 *         return self._length             # <<<<<<<<<<<<<<
 * 
 *     cdef void ensure_allocated(self, ssize_t extra_length) except *:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->_length); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 65, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "asynctnt/iproto/buffer.pyx":64
 *             raise BufferError('the buffer is in read-only mode')
 * 
 *     cdef inline len(self):             # <<<<<<<<<<<<<<
 *         return self._length
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asynctnt.iproto.protocol.WriteBuffer.len", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/buffer.pyx":67
 *         return self._length
 * 
 *     cdef void ensure_allocated(self, ssize_t extra_length) except *:             # <<<<<<<<<<<<<<
 *         cdef ssize_t new_size = extra_length + self._length
 * 
 */

static void __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer_ensure_allocated(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *__pyx_v_self, Py_ssize_t __pyx_v_extra_length) {
  Py_ssize_t __pyx_v_new_size;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("ensure_allocated", 0);

  /* "asynctnt/iproto/buffer.pyx":68
 * 
 *     cdef void ensure_allocated(self, ssize_t extra_length) except *:
 *         cdef ssize_t new_size = extra_length + self._length             # <<<<<<<<<<<<<<
 * 
 *         if new_size > self._size:
 */
  __pyx_v_new_size = (__pyx_v_extra_length + __pyx_v_self->_length);

  /* "asynctnt/iproto/buffer.pyx":70
 *         cdef ssize_t new_size = extra_length + self._length
 * 
 *         if new_size > self._size:             # <<<<<<<<<<<<<<
 *             self._reallocate(new_size)
 * 
 */
  __pyx_t_1 = ((__pyx_v_new_size > __pyx_v_self->_size) != 0);
  if (__pyx_t_1) {

    /* "asynctnt/iproto/buffer.pyx":71
 * 
 *         if new_size > self._size:
 *             self._reallocate(new_size)             # <<<<<<<<<<<<<<
 * 
 *     cdef char *_ensure_allocated(self, char *p,
 */
    __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__reallocate(__pyx_v_self, __pyx_v_new_size); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 71, __pyx_L1_error)

    /* "asynctnt/iproto/buffer.pyx":70
 *         cdef ssize_t new_size = extra_length + self._length
 * 
 *         if new_size > self._size:             # <<<<<<<<<<<<<<
 *             self._reallocate(new_size)
 * 
 */
  }

  /* "asynctnt/iproto/buffer.pyx":67
 *         return self._length
 * 
 *     cdef void ensure_allocated(self, ssize_t extra_length) except *:             # <<<<<<<<<<<<<<
 *         cdef ssize_t new_size = extra_length + self._length
 * 
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("asynctnt.iproto.protocol.WriteBuffer.ensure_allocated", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "asynctnt/iproto/buffer.pyx":73
 *             self._reallocate(new_size)
 * 
 *     cdef char *_ensure_allocated(self, char *p,             # <<<<<<<<<<<<<<
 *                                  ssize_t extra_length) except NULL:
 *         cdef:
 */

static char *__pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__ensure_allocated(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *__pyx_v_self, char *__pyx_v_p, Py_ssize_t __pyx_v_extra_length) {
  Py_ssize_t __pyx_v_new_size;
  ptrdiff_t __pyx_v_used;
  char *__pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("_ensure_allocated", 0);

  /* "asynctnt/iproto/buffer.pyx":78
 *             ssize_t new_size
 * 
 *         new_size = extra_length + self._length             # <<<<<<<<<<<<<<
 * 
 *         if new_size > self._size:
 */
  __pyx_v_new_size = (__pyx_v_extra_length + __pyx_v_self->_length);

  /* "asynctnt/iproto/buffer.pyx":80
 *         new_size = extra_length + self._length
 * 
 *         if new_size > self._size:             # <<<<<<<<<<<<<<
 *             used = p - self._buf
 *             self._reallocate(new_size)
 */
  __pyx_t_1 = ((__pyx_v_new_size > __pyx_v_self->_size) != 0);
  if (__pyx_t_1) {

    /* "asynctnt/iproto/buffer.pyx":81
 * 
 *         if new_size > self._size:
 *             used = p - self._buf             # <<<<<<<<<<<<<<
 *             self._reallocate(new_size)
 *             p = &self._buf[used]
 */
    __pyx_v_used = (__pyx_v_p - __pyx_v_self->_buf);

    /* "asynctnt/iproto/buffer.pyx":82
 *         if new_size > self._size:
 *             used = p - self._buf
 *             self._reallocate(new_size)             # <<<<<<<<<<<<<<
 *             p = &self._buf[used]
 *         return p
 */
    __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__reallocate(__pyx_v_self, __pyx_v_new_size); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 82, __pyx_L1_error)

    /* "asynctnt/iproto/buffer.pyx":83
 *             used = p - self._buf
 *             self._reallocate(new_size)
 *             p = &self._buf[used]             # <<<<<<<<<<<<<<
 *         return p
 * 
 */
    __pyx_v_p = (&(__pyx_v_self->_buf[__pyx_v_used]));

    /* "asynctnt/iproto/buffer.pyx":80
 *         new_size = extra_length + self._length
 * 
 *         if new_size > self._size:             # <<<<<<<<<<<<<<
 *             used = p - self._buf
 *             self._reallocate(new_size)
 */
  }

  /* "asynctnt/iproto/buffer.pyx":84
 *             self._reallocate(new_size)
 *             p = &self._buf[used]
 *         return p             # <<<<<<<<<<<<<<
 * 
 *     cdef void _reallocate(self, ssize_t new_size) except *:
 */
  __pyx_r = __pyx_v_p;
  goto __pyx_L0;

  /* "asynctnt/iproto/buffer.pyx":73
 *             self._reallocate(new_size)
 * 
 *     cdef char *_ensure_allocated(self, char *p,             # <<<<<<<<<<<<<<
 *                                  ssize_t extra_length) except NULL:
 *         cdef:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("asynctnt.iproto.protocol.WriteBuffer._ensure_allocated", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/buffer.pyx":86
 *         return p
 * 
 *     cdef void _reallocate(self, ssize_t new_size) except *:             # <<<<<<<<<<<<<<
 *         cdef char *new_buf
 * 
 */

static void __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__reallocate(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *__pyx_v_self, Py_ssize_t __pyx_v_new_size) {
  char *__pyx_v_new_buf;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("_reallocate", 0);

  /* "asynctnt/iproto/buffer.pyx":89
 *         cdef char *new_buf
 * 
 *         if new_size < _BUFFER_MAX_GROW:             # <<<<<<<<<<<<<<
 *             new_size = _BUFFER_MAX_GROW
 *         else:
 */
  __pyx_t_1 = ((__pyx_v_new_size < 0x10000) != 0);
  if (__pyx_t_1) {

    /* "asynctnt/iproto/buffer.pyx":90
 * 
 *         if new_size < _BUFFER_MAX_GROW:
 *             new_size = _BUFFER_MAX_GROW             # <<<<<<<<<<<<<<
 *         else:
 *             # Add a little extra
 */
    __pyx_v_new_size = 0x10000;

    /* "asynctnt/iproto/buffer.pyx":89
 *         cdef char *new_buf
 * 
 *         if new_size < _BUFFER_MAX_GROW:             # <<<<<<<<<<<<<<
 *             new_size = _BUFFER_MAX_GROW
 *         else:
 */
    goto __pyx_L3;
  }

  /* "asynctnt/iproto/buffer.pyx":93
 *         else:
 *             # Add a little extra
 *             new_size += _BUFFER_INITIAL_SIZE             # <<<<<<<<<<<<<<
 * 
 *         if self._smallbuf_inuse:
 */
  /*else*/ {
    __pyx_v_new_size = (__pyx_v_new_size + 0x400);
  }
  __pyx_L3:;

  /* "asynctnt/iproto/buffer.pyx":95
 *             new_size += _BUFFER_INITIAL_SIZE
 * 
 *         if self._smallbuf_inuse:             # <<<<<<<<<<<<<<
 *             new_buf = <char*>PyMem_Malloc(sizeof(char) * <size_t>new_size)
 *             if new_buf is NULL:
 */
  __pyx_t_1 = (__pyx_v_self->_smallbuf_inuse != 0);
  if (__pyx_t_1) {

    /* "asynctnt/iproto/buffer.pyx":96
 * 
 *         if self._smallbuf_inuse:
 *             new_buf = <char*>PyMem_Malloc(sizeof(char) * <size_t>new_size)             # <<<<<<<<<<<<<<
 *             if new_buf is NULL:
 *                 self._buf = NULL
 */
    __pyx_v_new_buf = ((char *)PyMem_Malloc(((sizeof(char)) * ((size_t)__pyx_v_new_size))));

    /* "asynctnt/iproto/buffer.pyx":97
 *         if self._smallbuf_inuse:
 *             new_buf = <char*>PyMem_Malloc(sizeof(char) * <size_t>new_size)
 *             if new_buf is NULL:             # <<<<<<<<<<<<<<
 *                 self._buf = NULL
 *                 self._size = 0
 */
    __pyx_t_1 = ((__pyx_v_new_buf == NULL) != 0);
    if (__pyx_t_1) {

      /* "asynctnt/iproto/buffer.pyx":98
 *             new_buf = <char*>PyMem_Malloc(sizeof(char) * <size_t>new_size)
 *             if new_buf is NULL:
 *                 self._buf = NULL             # <<<<<<<<<<<<<<
 *                 self._size = 0
 *                 self._length = 0
 */
      __pyx_v_self->_buf = NULL;

      /* "asynctnt/iproto/buffer.pyx":99
 *             if new_buf is NULL:
 *                 self._buf = NULL
 *                 self._size = 0             # <<<<<<<<<<<<<<
 *                 self._length = 0
 *                 raise MemoryError
 */
      __pyx_v_self->_size = 0;

      /* "asynctnt/iproto/buffer.pyx":100
 *                 self._buf = NULL
 *                 self._size = 0
 *                 self._length = 0             # <<<<<<<<<<<<<<
 *                 raise MemoryError
 *             memcpy(new_buf, self._buf, <size_t>self._size)
 */
      __pyx_v_self->_length = 0;

      /* "asynctnt/iproto/buffer.pyx":101
 *                 self._size = 0
 *                 self._length = 0
 *                 raise MemoryError             # <<<<<<<<<<<<<<
 *             memcpy(new_buf, self._buf, <size_t>self._size)
 *             self._size = new_size
 */
      PyErr_NoMemory(); __PYX_ERR(0, 101, __pyx_L1_error)

      /* "asynctnt/iproto/buffer.pyx":97
 *         if self._smallbuf_inuse:
 *             new_buf = <char*>PyMem_Malloc(sizeof(char) * <size_t>new_size)
 *             if new_buf is NULL:             # <<<<<<<<<<<<<<
 *                 self._buf = NULL
 *                 self._size = 0
 */
    }

    /* "asynctnt/iproto/buffer.pyx":102
 *                 self._length = 0
 *                 raise MemoryError
 *             memcpy(new_buf, self._buf, <size_t>self._size)             # <<<<<<<<<<<<<<
 *             self._size = new_size
 *             self._buf = new_buf
 */
    memcpy(__pyx_v_new_buf, __pyx_v_self->_buf, ((size_t)__pyx_v_self->_size));

    /* "asynctnt/iproto/buffer.pyx":103
 *                 raise MemoryError
 *             memcpy(new_buf, self._buf, <size_t>self._size)
 *             self._size = new_size             # <<<<<<<<<<<<<<
 *             self._buf = new_buf
 *             self._smallbuf_inuse = False
 */
    __pyx_v_self->_size = __pyx_v_new_size;

    /* "asynctnt/iproto/buffer.pyx":104
 *             memcpy(new_buf, self._buf, <size_t>self._size)
 *             self._size = new_size
 *             self._buf = new_buf             # <<<<<<<<<<<<<<
 *             self._smallbuf_inuse = False
 *         else:
 */
    __pyx_v_self->_buf = __pyx_v_new_buf;

    /* "asynctnt/iproto/buffer.pyx":105
 *             self._size = new_size
 *             self._buf = new_buf
 *             self._smallbuf_inuse = False             # <<<<<<<<<<<<<<
 *         else:
 *             new_buf = <char*>PyMem_Realloc(<void*>self._buf, <size_t>new_size)
 */
    __pyx_v_self->_smallbuf_inuse = 0;

    /* "asynctnt/iproto/buffer.pyx":95
 *             new_size += _BUFFER_INITIAL_SIZE
 * 
 *         if self._smallbuf_inuse:             # <<<<<<<<<<<<<<
 *             new_buf = <char*>PyMem_Malloc(sizeof(char) * <size_t>new_size)
 *             if new_buf is NULL:
 */
    goto __pyx_L4;
  }

  /* "asynctnt/iproto/buffer.pyx":107
 *             self._smallbuf_inuse = False
 *         else:
 *             new_buf = <char*>PyMem_Realloc(<void*>self._buf, <size_t>new_size)             # <<<<<<<<<<<<<<
 *             if new_buf is NULL:
 *                 PyMem_Free(self._buf)
 */
  /*else*/ {
    __pyx_v_new_buf = ((char *)PyMem_Realloc(((void *)__pyx_v_self->_buf), ((size_t)__pyx_v_new_size)));

    /* "asynctnt/iproto/buffer.pyx":108
 *         else:
 *             new_buf = <char*>PyMem_Realloc(<void*>self._buf, <size_t>new_size)
 *             if new_buf is NULL:             # <<<<<<<<<<<<<<
 *                 PyMem_Free(self._buf)
 *                 self._buf = NULL
 */
    __pyx_t_1 = ((__pyx_v_new_buf == NULL) != 0);
    if (__pyx_t_1) {

      /* "asynctnt/iproto/buffer.pyx":109
 *             new_buf = <char*>PyMem_Realloc(<void*>self._buf, <size_t>new_size)
 *             if new_buf is NULL:
 *                 PyMem_Free(self._buf)             # <<<<<<<<<<<<<<
 *                 self._buf = NULL
 *                 self._size = 0
 */
      PyMem_Free(__pyx_v_self->_buf);

      /* "asynctnt/iproto/buffer.pyx":110
 *             if new_buf is NULL:
 *                 PyMem_Free(self._buf)
 *                 self._buf = NULL             # <<<<<<<<<<<<<<
 *                 self._size = 0
 *                 self._length = 0
 */
      __pyx_v_self->_buf = NULL;

      /* "asynctnt/iproto/buffer.pyx":111
 *                 PyMem_Free(self._buf)
 *                 self._buf = NULL
 *                 self._size = 0             # <<<<<<<<<<<<<<
 *                 self._length = 0
 *                 raise MemoryError
 */
      __pyx_v_self->_size = 0;

      /* "asynctnt/iproto/buffer.pyx":112
 *                 self._buf = NULL
 *                 self._size = 0
 *                 self._length = 0             # <<<<<<<<<<<<<<
 *                 raise MemoryError
 *             self._buf = new_buf
 */
      __pyx_v_self->_length = 0;

      /* "asynctnt/iproto/buffer.pyx":113
 *                 self._size = 0
 *                 self._length = 0
 *                 raise MemoryError             # <<<<<<<<<<<<<<
 *             self._buf = new_buf
 *             self._size = new_size
 */
      PyErr_NoMemory(); __PYX_ERR(0, 113, __pyx_L1_error)

      /* "asynctnt/iproto/buffer.pyx":108
 *         else:
 *             new_buf = <char*>PyMem_Realloc(<void*>self._buf, <size_t>new_size)
 *             if new_buf is NULL:             # <<<<<<<<<<<<<<
 *                 PyMem_Free(self._buf)
 *                 self._buf = NULL
 */
    }

    /* "asynctnt/iproto/buffer.pyx":114
 *                 self._length = 0
 *                 raise MemoryError
 *             self._buf = new_buf             # <<<<<<<<<<<<<<
 *             self._size = new_size
 * 
 */
    __pyx_v_self->_buf = __pyx_v_new_buf;

    /* "asynctnt/iproto/buffer.pyx":115
 *                 raise MemoryError
 *             self._buf = new_buf
 *             self._size = new_size             # <<<<<<<<<<<<<<
 * 
 *     cdef void write_buffer(self, WriteBuffer buf) except *:
 */
    __pyx_v_self->_size = __pyx_v_new_size;
  }
  __pyx_L4:;

  /* "asynctnt/iproto/buffer.pyx":86
 *         return p
 * 
 *     cdef void _reallocate(self, ssize_t new_size) except *:             # <<<<<<<<<<<<<<
 *         cdef char *new_buf
 * 
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("asynctnt.iproto.protocol.WriteBuffer._reallocate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "asynctnt/iproto/buffer.pyx":117
 *             self._size = new_size
 * 
 *     cdef void write_buffer(self, WriteBuffer buf) except *:             # <<<<<<<<<<<<<<
 *         if not buf._length:
 *             return
 */

static void __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer_write_buffer(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *__pyx_v_self, struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *__pyx_v_buf) {
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("write_buffer", 0);

  /* "asynctnt/iproto/buffer.pyx":118
 * 
 *     cdef void write_buffer(self, WriteBuffer buf) except *:
 *         if not buf._length:             # <<<<<<<<<<<<<<
 *             return
 * 
 */
  __pyx_t_1 = ((!(__pyx_v_buf->_length != 0)) != 0);
  if (__pyx_t_1) {

    /* "asynctnt/iproto/buffer.pyx":119
 *     cdef void write_buffer(self, WriteBuffer buf) except *:
 *         if not buf._length:
 *             return             # <<<<<<<<<<<<<<
 * 
 *         self.ensure_allocated(buf._length)
 */
    goto __pyx_L0;

    /* "asynctnt/iproto/buffer.pyx":118
 * 
 *     cdef void write_buffer(self, WriteBuffer buf) except *:
 *         if not buf._length:             # <<<<<<<<<<<<<<
 *             return
 * 
 */
  }

  /* "asynctnt/iproto/buffer.pyx":121
 *             return
 * 
 *         self.ensure_allocated(buf._length)             # <<<<<<<<<<<<<<
 *         memcpy(self._buf + self._length,
 *                <void*>buf._buf,
 */
  __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer_ensure_allocated(__pyx_v_self, __pyx_v_buf->_length); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 121, __pyx_L1_error)

  /* "asynctnt/iproto/buffer.pyx":122
 * 
 *         self.ensure_allocated(buf._length)
 *         memcpy(self._buf + self._length,             # <<<<<<<<<<<<<<
 *                <void*>buf._buf,
 *                <size_t>buf._length)
 */
  memcpy((__pyx_v_self->_buf + __pyx_v_self->_length), ((void *)__pyx_v_buf->_buf), ((size_t)__pyx_v_buf->_length));

  /* "asynctnt/iproto/buffer.pyx":125
 *                <void*>buf._buf,
 *                <size_t>buf._length)
 *         self._length += buf._length             # <<<<<<<<<<<<<<
 * 
 *     cdef void write_header(self, uint64_t sync, tnt.tp_request_type op,
 */
  __pyx_v_self->_length = (__pyx_v_self->_length + __pyx_v_buf->_length);

  /* "asynctnt/iproto/buffer.pyx":117
 *             self._size = new_size
 * 
 *     cdef void write_buffer(self, WriteBuffer buf) except *:             # <<<<<<<<<<<<<<
 *         if not buf._length:
 *             return
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("asynctnt.iproto.protocol.WriteBuffer.write_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "asynctnt/iproto/buffer.pyx":127
 *         self._length += buf._length
 * 
 *     cdef void write_header(self, uint64_t sync, tnt.tp_request_type op,             # <<<<<<<<<<<<<<
 *                            int64_t schema_id=-1) except *:
 *         cdef:
 */

static void __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer_write_header(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *__pyx_v_self, uint64_t __pyx_v_sync, enum __pyx_t_8asynctnt_6iproto_3tnt_tp_request_type __pyx_v_op, struct __pyx_opt_args_8asynctnt_6iproto_8protocol_11WriteBuffer_write_header *__pyx_optional_args) {
  int64_t __pyx_v_schema_id = ((int64_t)-1L);
  char *__pyx_v_begin;
  char *__pyx_v_p;
  uint32_t __pyx_v_map_size;
  __Pyx_RefNannyDeclarations
  char *__pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("write_header", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_schema_id = __pyx_optional_args->schema_id;
    }
  }

  /* "asynctnt/iproto/buffer.pyx":130
 *                            int64_t schema_id=-1) except *:
 *         cdef:
 *             char *begin = NULL             # <<<<<<<<<<<<<<
 *             char *p = NULL
 *             uint32_t map_size
 */
  __pyx_v_begin = NULL;

  /* "asynctnt/iproto/buffer.pyx":131
 *         cdef:
 *             char *begin = NULL
 *             char *p = NULL             # <<<<<<<<<<<<<<
 *             uint32_t map_size
 *         self.ensure_allocated(HEADER_CONST_LEN)
 */
  __pyx_v_p = NULL;

  /* "asynctnt/iproto/buffer.pyx":133
 *             char *p = NULL
 *             uint32_t map_size
 *         self.ensure_allocated(HEADER_CONST_LEN)             # <<<<<<<<<<<<<<
 * 
 *         map_size = 2 + <uint32_t>(schema_id > 0)
 */
  __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer_ensure_allocated(__pyx_v_self, 24); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 133, __pyx_L1_error)

  /* "asynctnt/iproto/buffer.pyx":135
 *         self.ensure_allocated(HEADER_CONST_LEN)
 * 
 *         map_size = 2 + <uint32_t>(schema_id > 0)             # <<<<<<<<<<<<<<
 * 
 *         p = begin = &self._buf[self._length]
 */
  __pyx_v_map_size = (2 + ((uint32_t)(__pyx_v_schema_id > 0)));

  /* "asynctnt/iproto/buffer.pyx":137
 *         map_size = 2 + <uint32_t>(schema_id > 0)
 * 
 *         p = begin = &self._buf[self._length]             # <<<<<<<<<<<<<<
 *         p = mp_encode_map(&p[5], map_size)
 *         p = mp_encode_uint(p, tnt.TP_CODE)
 */
  __pyx_t_1 = (&(__pyx_v_self->_buf[__pyx_v_self->_length]));
  __pyx_v_p = __pyx_t_1;
  __pyx_v_begin = __pyx_t_1;

  /* "asynctnt/iproto/buffer.pyx":138
 * 
 *         p = begin = &self._buf[self._length]
 *         p = mp_encode_map(&p[5], map_size)             # <<<<<<<<<<<<<<
 *         p = mp_encode_uint(p, tnt.TP_CODE)
 *         p = mp_encode_uint(p, <uint32_t>op)
 */
  __pyx_v_p = mp_encode_map((&(__pyx_v_p[5])), __pyx_v_map_size);

  /* "asynctnt/iproto/buffer.pyx":139
 *         p = begin = &self._buf[self._length]
 *         p = mp_encode_map(&p[5], map_size)
 *         p = mp_encode_uint(p, tnt.TP_CODE)             # <<<<<<<<<<<<<<
 *         p = mp_encode_uint(p, <uint32_t>op)
 *         p = mp_encode_uint(p, tnt.TP_SYNC)
 */
  __pyx_v_p = mp_encode_uint(__pyx_v_p, __pyx_e_8asynctnt_6iproto_3tnt_TP_CODE);

  /* "asynctnt/iproto/buffer.pyx":140
 *         p = mp_encode_map(&p[5], map_size)
 *         p = mp_encode_uint(p, tnt.TP_CODE)
 *         p = mp_encode_uint(p, <uint32_t>op)             # <<<<<<<<<<<<<<
 *         p = mp_encode_uint(p, tnt.TP_SYNC)
 *         p = mp_encode_uint(p, sync)
 */
  __pyx_v_p = mp_encode_uint(__pyx_v_p, ((uint32_t)__pyx_v_op));

  /* "asynctnt/iproto/buffer.pyx":141
 *         p = mp_encode_uint(p, tnt.TP_CODE)
 *         p = mp_encode_uint(p, <uint32_t>op)
 *         p = mp_encode_uint(p, tnt.TP_SYNC)             # <<<<<<<<<<<<<<
 *         p = mp_encode_uint(p, sync)
 * 
 */
  __pyx_v_p = mp_encode_uint(__pyx_v_p, __pyx_e_8asynctnt_6iproto_3tnt_TP_SYNC);

  /* "asynctnt/iproto/buffer.pyx":142
 *         p = mp_encode_uint(p, <uint32_t>op)
 *         p = mp_encode_uint(p, tnt.TP_SYNC)
 *         p = mp_encode_uint(p, sync)             # <<<<<<<<<<<<<<
 * 
 *         if schema_id > 0:
 */
  __pyx_v_p = mp_encode_uint(__pyx_v_p, __pyx_v_sync);

  /* "asynctnt/iproto/buffer.pyx":144
 *         p = mp_encode_uint(p, sync)
 * 
 *         if schema_id > 0:             # <<<<<<<<<<<<<<
 *             p = mp_encode_uint(p, tnt.TP_SCHEMA_ID)
 *             p = mp_encode_uint(p, schema_id)
 */
  __pyx_t_2 = ((__pyx_v_schema_id > 0) != 0);
  if (__pyx_t_2) {

    /* "asynctnt/iproto/buffer.pyx":145
 * 
 *         if schema_id > 0:
 *             p = mp_encode_uint(p, tnt.TP_SCHEMA_ID)             # <<<<<<<<<<<<<<
 *             p = mp_encode_uint(p, schema_id)
 * 
 */
    __pyx_v_p = mp_encode_uint(__pyx_v_p, __pyx_e_8asynctnt_6iproto_3tnt_TP_SCHEMA_ID);

    /* "asynctnt/iproto/buffer.pyx":146
 *         if schema_id > 0:
 *             p = mp_encode_uint(p, tnt.TP_SCHEMA_ID)
 *             p = mp_encode_uint(p, schema_id)             # <<<<<<<<<<<<<<
 * 
 *         self._length += (p - begin)
 */
    __pyx_v_p = mp_encode_uint(__pyx_v_p, __pyx_v_schema_id);

    /* "asynctnt/iproto/buffer.pyx":144
 *         p = mp_encode_uint(p, sync)
 * 
 *         if schema_id > 0:             # <<<<<<<<<<<<<<
 *             p = mp_encode_uint(p, tnt.TP_SCHEMA_ID)
 *             p = mp_encode_uint(p, schema_id)
 */
  }

  /* "asynctnt/iproto/buffer.pyx":148
 *             p = mp_encode_uint(p, schema_id)
 * 
 *         self._length += (p - begin)             # <<<<<<<<<<<<<<
 * 
 *     cdef void write_length(self):
 */
  __pyx_v_self->_length = (__pyx_v_self->_length + (__pyx_v_p - __pyx_v_begin));

  /* "asynctnt/iproto/buffer.pyx":127
 *         self._length += buf._length
 * 
 *     cdef void write_header(self, uint64_t sync, tnt.tp_request_type op,             # <<<<<<<<<<<<<<
 *                            int64_t schema_id=-1) except *:
 *         cdef:
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("asynctnt.iproto.protocol.WriteBuffer.write_header", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "asynctnt/iproto/buffer.pyx":150
 *         self._length += (p - begin)
 * 
 *     cdef void write_length(self):             # <<<<<<<<<<<<<<
 *         cdef:
 *             char *p
 */

static void __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer_write_length(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *__pyx_v_self) {
  char *__pyx_v_p;
  __Pyx_RefNannyDeclarations
  char *__pyx_t_1;
  __Pyx_RefNannySetupContext("write_length", 0);

  /* "asynctnt/iproto/buffer.pyx":153
 *         cdef:
 *             char *p
 *         p = self._buf             # <<<<<<<<<<<<<<
 *         p = mp_store_u8(p, 0xce)
 *         p = mp_store_u32(p, self._length - 5)
 */
  __pyx_t_1 = __pyx_v_self->_buf;
  __pyx_v_p = __pyx_t_1;

  /* "asynctnt/iproto/buffer.pyx":154
 *             char *p
 *         p = self._buf
 *         p = mp_store_u8(p, 0xce)             # <<<<<<<<<<<<<<
 *         p = mp_store_u32(p, self._length - 5)
 * 
 */
  __pyx_v_p = mp_store_u8(__pyx_v_p, 0xce);

  /* "asynctnt/iproto/buffer.pyx":155
 *         p = self._buf
 *         p = mp_store_u8(p, 0xce)
 *         p = mp_store_u32(p, self._length - 5)             # <<<<<<<<<<<<<<
 * 
 *     cdef char *_encode_nil(self, char *p) except NULL:
 */
  __pyx_v_p = mp_store_u32(__pyx_v_p, (__pyx_v_self->_length - 5));

  /* "asynctnt/iproto/buffer.pyx":150
 *         self._length += (p - begin)
 * 
 *     cdef void write_length(self):             # <<<<<<<<<<<<<<
 *         cdef:
 *             char *p
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "asynctnt/iproto/buffer.pyx":157
 *         p = mp_store_u32(p, self._length - 5)
 * 
 *     cdef char *_encode_nil(self, char *p) except NULL:             # <<<<<<<<<<<<<<
 *         cdef char *begin
 *         p = begin = self._ensure_allocated(p, 1)
 */

static char *__pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__encode_nil(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *__pyx_v_self, char *__pyx_v_p) {
  char *__pyx_v_begin;
  char *__pyx_r;
  __Pyx_RefNannyDeclarations
  char *__pyx_t_1;
  __Pyx_RefNannySetupContext("_encode_nil", 0);

  /* "asynctnt/iproto/buffer.pyx":159
 *     cdef char *_encode_nil(self, char *p) except NULL:
 *         cdef char *begin
 *         p = begin = self._ensure_allocated(p, 1)             # <<<<<<<<<<<<<<
 *         p = mp_encode_nil(p)
 *         self._length += (p - begin)
 */
  __pyx_t_1 = __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__ensure_allocated(__pyx_v_self, __pyx_v_p, 1); if (unlikely(__pyx_t_1 == NULL)) __PYX_ERR(0, 159, __pyx_L1_error)
  __pyx_v_p = __pyx_t_1;
  __pyx_v_begin = __pyx_t_1;

  /* "asynctnt/iproto/buffer.pyx":160
 *         cdef char *begin
 *         p = begin = self._ensure_allocated(p, 1)
 *         p = mp_encode_nil(p)             # <<<<<<<<<<<<<<
 *         self._length += (p - begin)
 *         return p
 */
  __pyx_v_p = mp_encode_nil(__pyx_v_p);

  /* "asynctnt/iproto/buffer.pyx":161
 *         p = begin = self._ensure_allocated(p, 1)
 *         p = mp_encode_nil(p)
 *         self._length += (p - begin)             # <<<<<<<<<<<<<<
 *         return p
 * 
 */
  __pyx_v_self->_length = (__pyx_v_self->_length + (__pyx_v_p - __pyx_v_begin));

  /* "asynctnt/iproto/buffer.pyx":162
 *         p = mp_encode_nil(p)
 *         self._length += (p - begin)
 *         return p             # <<<<<<<<<<<<<<
 * 
 *     cdef char *_encode_bool(self, char *p, bint value) except NULL:
 */
  __pyx_r = __pyx_v_p;
  goto __pyx_L0;

  /* "asynctnt/iproto/buffer.pyx":157
 *         p = mp_store_u32(p, self._length - 5)
 * 
 *     cdef char *_encode_nil(self, char *p) except NULL:             # <<<<<<<<<<<<<<
 *         cdef char *begin
 *         p = begin = self._ensure_allocated(p, 1)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("asynctnt.iproto.protocol.WriteBuffer._encode_nil", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/buffer.pyx":164
 *         return p
 * 
 *     cdef char *_encode_bool(self, char *p, bint value) except NULL:             # <<<<<<<<<<<<<<
 *         cdef char *begin
 *         p = begin = self._ensure_allocated(p, 1)
 */

static char *__pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__encode_bool(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *__pyx_v_self, char *__pyx_v_p, int __pyx_v_value) {
  char *__pyx_v_begin;
  char *__pyx_r;
  __Pyx_RefNannyDeclarations
  char *__pyx_t_1;
  __Pyx_RefNannySetupContext("_encode_bool", 0);

  /* "asynctnt/iproto/buffer.pyx":166
 *     cdef char *_encode_bool(self, char *p, bint value) except NULL:
 *         cdef char *begin
 *         p = begin = self._ensure_allocated(p, 1)             # <<<<<<<<<<<<<<
 *         p = mp_encode_bool(p, value)
 *         self._length += (p - begin)
 */
  __pyx_t_1 = __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__ensure_allocated(__pyx_v_self, __pyx_v_p, 1); if (unlikely(__pyx_t_1 == NULL)) __PYX_ERR(0, 166, __pyx_L1_error)
  __pyx_v_p = __pyx_t_1;
  __pyx_v_begin = __pyx_t_1;

  /* "asynctnt/iproto/buffer.pyx":167
 *         cdef char *begin
 *         p = begin = self._ensure_allocated(p, 1)
 *         p = mp_encode_bool(p, value)             # <<<<<<<<<<<<<<
 *         self._length += (p - begin)
 *         return p
 */
  __pyx_v_p = mp_encode_bool(__pyx_v_p, __pyx_v_value);

  /* "asynctnt/iproto/buffer.pyx":168
 *         p = begin = self._ensure_allocated(p, 1)
 *         p = mp_encode_bool(p, value)
 *         self._length += (p - begin)             # <<<<<<<<<<<<<<
 *         return p
 * 
 */
  __pyx_v_self->_length = (__pyx_v_self->_length + (__pyx_v_p - __pyx_v_begin));

  /* "asynctnt/iproto/buffer.pyx":169
 *         p = mp_encode_bool(p, value)
 *         self._length += (p - begin)
 *         return p             # <<<<<<<<<<<<<<
 * 
 *     cdef char *_encode_double(self, char *p, double value) except NULL:
 */
  __pyx_r = __pyx_v_p;
  goto __pyx_L0;

  /* "asynctnt/iproto/buffer.pyx":164
 *         return p
 * 
 *     cdef char *_encode_bool(self, char *p, bint value) except NULL:             # <<<<<<<<<<<<<<
 *         cdef char *begin
 *         p = begin = self._ensure_allocated(p, 1)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("asynctnt.iproto.protocol.WriteBuffer._encode_bool", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/buffer.pyx":171
 *         return p
 * 
 *     cdef char *_encode_double(self, char *p, double value) except NULL:             # <<<<<<<<<<<<<<
 *         cdef char *begin
 *         p = begin = self._ensure_allocated(p, mp_sizeof_double(value))
 */

static char *__pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__encode_double(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *__pyx_v_self, char *__pyx_v_p, double __pyx_v_value) {
  char *__pyx_v_begin;
  char *__pyx_r;
  __Pyx_RefNannyDeclarations
  char *__pyx_t_1;
  __Pyx_RefNannySetupContext("_encode_double", 0);

  /* "asynctnt/iproto/buffer.pyx":173
 *     cdef char *_encode_double(self, char *p, double value) except NULL:
 *         cdef char *begin
 *         p = begin = self._ensure_allocated(p, mp_sizeof_double(value))             # <<<<<<<<<<<<<<
 *         p = mp_encode_double(p, value)
 *         self._length += (p - begin)
 */
  __pyx_t_1 = __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__ensure_allocated(__pyx_v_self, __pyx_v_p, mp_sizeof_double(__pyx_v_value)); if (unlikely(__pyx_t_1 == NULL)) __PYX_ERR(0, 173, __pyx_L1_error)
  __pyx_v_p = __pyx_t_1;
  __pyx_v_begin = __pyx_t_1;

  /* "asynctnt/iproto/buffer.pyx":174
 *         cdef char *begin
 *         p = begin = self._ensure_allocated(p, mp_sizeof_double(value))
 *         p = mp_encode_double(p, value)             # <<<<<<<<<<<<<<
 *         self._length += (p - begin)
 *         return p
 */
  __pyx_v_p = mp_encode_double(__pyx_v_p, __pyx_v_value);

  /* "asynctnt/iproto/buffer.pyx":175
 *         p = begin = self._ensure_allocated(p, mp_sizeof_double(value))
 *         p = mp_encode_double(p, value)
 *         self._length += (p - begin)             # <<<<<<<<<<<<<<
 *         return p
 * 
 */
  __pyx_v_self->_length = (__pyx_v_self->_length + (__pyx_v_p - __pyx_v_begin));

  /* "asynctnt/iproto/buffer.pyx":176
 *         p = mp_encode_double(p, value)
 *         self._length += (p - begin)
 *         return p             # <<<<<<<<<<<<<<
 * 
 *     cdef char *_encode_uint(self, char *p, uint64_t value) except NULL:
 */
  __pyx_r = __pyx_v_p;
  goto __pyx_L0;

  /* "asynctnt/iproto/buffer.pyx":171
 *         return p
 * 
 *     cdef char *_encode_double(self, char *p, double value) except NULL:             # <<<<<<<<<<<<<<
 *         cdef char *begin
 *         p = begin = self._ensure_allocated(p, mp_sizeof_double(value))
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("asynctnt.iproto.protocol.WriteBuffer._encode_double", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/buffer.pyx":178
 *         return p
 * 
 *     cdef char *_encode_uint(self, char *p, uint64_t value) except NULL:             # <<<<<<<<<<<<<<
 *         cdef char *begin
 *         p = begin = self._ensure_allocated(p, mp_sizeof_uint(value))
 */

static char *__pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__encode_uint(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *__pyx_v_self, char *__pyx_v_p, uint64_t __pyx_v_value) {
  char *__pyx_v_begin;
  char *__pyx_r;
  __Pyx_RefNannyDeclarations
  char *__pyx_t_1;
  __Pyx_RefNannySetupContext("_encode_uint", 0);

  /* "asynctnt/iproto/buffer.pyx":180
 *     cdef char *_encode_uint(self, char *p, uint64_t value) except NULL:
 *         cdef char *begin
 *         p = begin = self._ensure_allocated(p, mp_sizeof_uint(value))             # <<<<<<<<<<<<<<
 *         p = mp_encode_uint(p, value)
 *         self._length += (p - begin)
 */
  __pyx_t_1 = __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__ensure_allocated(__pyx_v_self, __pyx_v_p, mp_sizeof_uint(__pyx_v_value)); if (unlikely(__pyx_t_1 == NULL)) __PYX_ERR(0, 180, __pyx_L1_error)
  __pyx_v_p = __pyx_t_1;
  __pyx_v_begin = __pyx_t_1;

  /* "asynctnt/iproto/buffer.pyx":181
 *         cdef char *begin
 *         p = begin = self._ensure_allocated(p, mp_sizeof_uint(value))
 *         p = mp_encode_uint(p, value)             # <<<<<<<<<<<<<<
 *         self._length += (p - begin)
 *         return p
 */
  __pyx_v_p = mp_encode_uint(__pyx_v_p, __pyx_v_value);

  /* "asynctnt/iproto/buffer.pyx":182
 *         p = begin = self._ensure_allocated(p, mp_sizeof_uint(value))
 *         p = mp_encode_uint(p, value)
 *         self._length += (p - begin)             # <<<<<<<<<<<<<<
 *         return p
 * 
 */
  __pyx_v_self->_length = (__pyx_v_self->_length + (__pyx_v_p - __pyx_v_begin));

  /* "asynctnt/iproto/buffer.pyx":183
 *         p = mp_encode_uint(p, value)
 *         self._length += (p - begin)
 *         return p             # <<<<<<<<<<<<<<
 * 
 *     cdef char *_encode_int(self, char *p, int64_t value) except NULL:
 */
  __pyx_r = __pyx_v_p;
  goto __pyx_L0;

  /* "asynctnt/iproto/buffer.pyx":178
 *         return p
 * 
 *     cdef char *_encode_uint(self, char *p, uint64_t value) except NULL:             # <<<<<<<<<<<<<<
 *         cdef char *begin
 *         p = begin = self._ensure_allocated(p, mp_sizeof_uint(value))
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("asynctnt.iproto.protocol.WriteBuffer._encode_uint", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/buffer.pyx":185
 *         return p
 * 
 *     cdef char *_encode_int(self, char *p, int64_t value) except NULL:             # <<<<<<<<<<<<<<
 *         cdef char *begin
 *         p = begin = self._ensure_allocated(p, mp_sizeof_int(value))
 */

static char *__pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__encode_int(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *__pyx_v_self, char *__pyx_v_p, int64_t __pyx_v_value) {
  char *__pyx_v_begin;
  char *__pyx_r;
  __Pyx_RefNannyDeclarations
  char *__pyx_t_1;
  __Pyx_RefNannySetupContext("_encode_int", 0);

  /* "asynctnt/iproto/buffer.pyx":187
 *     cdef char *_encode_int(self, char *p, int64_t value) except NULL:
 *         cdef char *begin
 *         p = begin = self._ensure_allocated(p, mp_sizeof_int(value))             # <<<<<<<<<<<<<<
 *         p = mp_encode_int(p, value)
 *         self._length += (p - begin)
 */
  __pyx_t_1 = __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__ensure_allocated(__pyx_v_self, __pyx_v_p, mp_sizeof_int(__pyx_v_value)); if (unlikely(__pyx_t_1 == NULL)) __PYX_ERR(0, 187, __pyx_L1_error)
  __pyx_v_p = __pyx_t_1;
  __pyx_v_begin = __pyx_t_1;

  /* "asynctnt/iproto/buffer.pyx":188
 *         cdef char *begin
 *         p = begin = self._ensure_allocated(p, mp_sizeof_int(value))
 *         p = mp_encode_int(p, value)             # <<<<<<<<<<<<<<
 *         self._length += (p - begin)
 *         return p
 */
  __pyx_v_p = mp_encode_int(__pyx_v_p, __pyx_v_value);

  /* "asynctnt/iproto/buffer.pyx":189
 *         p = begin = self._ensure_allocated(p, mp_sizeof_int(value))
 *         p = mp_encode_int(p, value)
 *         self._length += (p - begin)             # <<<<<<<<<<<<<<
 *         return p
 * 
 */
  __pyx_v_self->_length = (__pyx_v_self->_length + (__pyx_v_p - __pyx_v_begin));

  /* "asynctnt/iproto/buffer.pyx":190
 *         p = mp_encode_int(p, value)
 *         self._length += (p - begin)
 *         return p             # <<<<<<<<<<<<<<
 * 
 *     cdef char *_encode_str(self, char *p,
 */
  __pyx_r = __pyx_v_p;
  goto __pyx_L0;

  /* "asynctnt/iproto/buffer.pyx":185
 *         return p
 * 
 *     cdef char *_encode_int(self, char *p, int64_t value) except NULL:             # <<<<<<<<<<<<<<
 *         cdef char *begin
 *         p = begin = self._ensure_allocated(p, mp_sizeof_int(value))
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("asynctnt.iproto.protocol.WriteBuffer._encode_int", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/buffer.pyx":192
 *         return p
 * 
 *     cdef char *_encode_str(self, char *p,             # <<<<<<<<<<<<<<
 *                            const char *str, uint32_t len) except NULL:
 *         cdef char *begin
 */

static char *__pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__encode_str(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *__pyx_v_self, char *__pyx_v_p, char const *__pyx_v_str, uint32_t __pyx_v_len) {
  char *__pyx_v_begin;
  char *__pyx_r;
  __Pyx_RefNannyDeclarations
  char *__pyx_t_1;
  __Pyx_RefNannySetupContext("_encode_str", 0);

  /* "asynctnt/iproto/buffer.pyx":195
 *                            const char *str, uint32_t len) except NULL:
 *         cdef char *begin
 *         p = begin = self._ensure_allocated(p, mp_sizeof_str(len))             # <<<<<<<<<<<<<<
 *         p = mp_encode_str(p, str, len)
 *         self._length += (p - begin)
 */
  __pyx_t_1 = __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__ensure_allocated(__pyx_v_self, __pyx_v_p, mp_sizeof_str(__pyx_v_len)); if (unlikely(__pyx_t_1 == NULL)) __PYX_ERR(0, 195, __pyx_L1_error)
  __pyx_v_p = __pyx_t_1;
  __pyx_v_begin = __pyx_t_1;

  /* "asynctnt/iproto/buffer.pyx":196
 *         cdef char *begin
 *         p = begin = self._ensure_allocated(p, mp_sizeof_str(len))
 *         p = mp_encode_str(p, str, len)             # <<<<<<<<<<<<<<
 *         self._length += (p - begin)
 *         return p
 */
  __pyx_v_p = mp_encode_str(__pyx_v_p, __pyx_v_str, __pyx_v_len);

  /* "asynctnt/iproto/buffer.pyx":197
 *         p = begin = self._ensure_allocated(p, mp_sizeof_str(len))
 *         p = mp_encode_str(p, str, len)
 *         self._length += (p - begin)             # <<<<<<<<<<<<<<
 *         return p
 * 
 */
  __pyx_v_self->_length = (__pyx_v_self->_length + (__pyx_v_p - __pyx_v_begin));

  /* "asynctnt/iproto/buffer.pyx":198
 *         p = mp_encode_str(p, str, len)
 *         self._length += (p - begin)
 *         return p             # <<<<<<<<<<<<<<
 * 
 *     cdef char *_encode_bin(self, char *p,
 */
  __pyx_r = __pyx_v_p;
  goto __pyx_L0;

  /* "asynctnt/iproto/buffer.pyx":192
 *         return p
 * 
 *     cdef char *_encode_str(self, char *p,             # <<<<<<<<<<<<<<
 *                            const char *str, uint32_t len) except NULL:
 *         cdef char *begin
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("asynctnt.iproto.protocol.WriteBuffer._encode_str", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/buffer.pyx":200
 *         return p
 * 
 *     cdef char *_encode_bin(self, char *p,             # <<<<<<<<<<<<<<
 *                            const char *data, uint32_t len) except NULL:
 *         cdef char *begin
 */

static char *__pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__encode_bin(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *__pyx_v_self, char *__pyx_v_p, char const *__pyx_v_data, uint32_t __pyx_v_len) {
  char *__pyx_v_begin;
  char *__pyx_r;
  __Pyx_RefNannyDeclarations
  char *__pyx_t_1;
  __Pyx_RefNannySetupContext("_encode_bin", 0);

  /* "asynctnt/iproto/buffer.pyx":203
 *                            const char *data, uint32_t len) except NULL:
 *         cdef char *begin
 *         p = begin = self._ensure_allocated(p, mp_sizeof_bin(len))             # <<<<<<<<<<<<<<
 *         p = mp_encode_bin(p, data, len)
 *         self._length += (p - begin)
 */
  __pyx_t_1 = __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__ensure_allocated(__pyx_v_self, __pyx_v_p, mp_sizeof_bin(__pyx_v_len)); if (unlikely(__pyx_t_1 == NULL)) __PYX_ERR(0, 203, __pyx_L1_error)
  __pyx_v_p = __pyx_t_1;
  __pyx_v_begin = __pyx_t_1;

  /* "asynctnt/iproto/buffer.pyx":204
 *         cdef char *begin
 *         p = begin = self._ensure_allocated(p, mp_sizeof_bin(len))
 *         p = mp_encode_bin(p, data, len)             # <<<<<<<<<<<<<<
 *         self._length += (p - begin)
 *         return p
 */
  __pyx_v_p = mp_encode_bin(__pyx_v_p, __pyx_v_data, __pyx_v_len);

  /* "asynctnt/iproto/buffer.pyx":205
 *         p = begin = self._ensure_allocated(p, mp_sizeof_bin(len))
 *         p = mp_encode_bin(p, data, len)
 *         self._length += (p - begin)             # <<<<<<<<<<<<<<
 *         return p
 * 
 */
  __pyx_v_self->_length = (__pyx_v_self->_length + (__pyx_v_p - __pyx_v_begin));

  /* "asynctnt/iproto/buffer.pyx":206
 *         p = mp_encode_bin(p, data, len)
 *         self._length += (p - begin)
 *         return p             # <<<<<<<<<<<<<<
 * 
 *     cdef char *_encode_array(self, char *p, uint32_t len) except NULL:
 */
  __pyx_r = __pyx_v_p;
  goto __pyx_L0;

  /* "asynctnt/iproto/buffer.pyx":200
 *         return p
 * 
 *     cdef char *_encode_bin(self, char *p,             # <<<<<<<<<<<<<<
 *                            const char *data, uint32_t len) except NULL:
 *         cdef char *begin
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("asynctnt.iproto.protocol.WriteBuffer._encode_bin", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/buffer.pyx":208
 *         return p
 * 
 *     cdef char *_encode_array(self, char *p, uint32_t len) except NULL:             # <<<<<<<<<<<<<<
 *         cdef char *begin
 *         p = begin = self._ensure_allocated(p, mp_sizeof_array(len))
 */

static char *__pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__encode_array(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *__pyx_v_self, char *__pyx_v_p, uint32_t __pyx_v_len) {
  char *__pyx_v_begin;
  char *__pyx_r;
  __Pyx_RefNannyDeclarations
  char *__pyx_t_1;
  __Pyx_RefNannySetupContext("_encode_array", 0);

  /* "asynctnt/iproto/buffer.pyx":210
 *     cdef char *_encode_array(self, char *p, uint32_t len) except NULL:
 *         cdef char *begin
 *         p = begin = self._ensure_allocated(p, mp_sizeof_array(len))             # <<<<<<<<<<<<<<
 *         p = mp_encode_array(p, len)
 *         self._length += (p - begin)
 */
  __pyx_t_1 = __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__ensure_allocated(__pyx_v_self, __pyx_v_p, mp_sizeof_array(__pyx_v_len)); if (unlikely(__pyx_t_1 == NULL)) __PYX_ERR(0, 210, __pyx_L1_error)
  __pyx_v_p = __pyx_t_1;
  __pyx_v_begin = __pyx_t_1;

  /* "asynctnt/iproto/buffer.pyx":211
 *         cdef char *begin
 *         p = begin = self._ensure_allocated(p, mp_sizeof_array(len))
 *         p = mp_encode_array(p, len)             # <<<<<<<<<<<<<<
 *         self._length += (p - begin)
 *         return p
 */
  __pyx_v_p = mp_encode_array(__pyx_v_p, __pyx_v_len);

  /* "asynctnt/iproto/buffer.pyx":212
 *         p = begin = self._ensure_allocated(p, mp_sizeof_array(len))
 *         p = mp_encode_array(p, len)
 *         self._length += (p - begin)             # <<<<<<<<<<<<<<
 *         return p
 * 
 */
  __pyx_v_self->_length = (__pyx_v_self->_length + (__pyx_v_p - __pyx_v_begin));

  /* "asynctnt/iproto/buffer.pyx":213
 *         p = mp_encode_array(p, len)
 *         self._length += (p - begin)
 *         return p             # <<<<<<<<<<<<<<
 * 
 *     cdef char *_encode_map(self, char *p, uint32_t len) except NULL:
 */
  __pyx_r = __pyx_v_p;
  goto __pyx_L0;

  /* "asynctnt/iproto/buffer.pyx":208
 *         return p
 * 
 *     cdef char *_encode_array(self, char *p, uint32_t len) except NULL:             # <<<<<<<<<<<<<<
 *         cdef char *begin
 *         p = begin = self._ensure_allocated(p, mp_sizeof_array(len))
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("asynctnt.iproto.protocol.WriteBuffer._encode_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/buffer.pyx":215
 *         return p
 * 
 *     cdef char *_encode_map(self, char *p, uint32_t len) except NULL:             # <<<<<<<<<<<<<<
 *         cdef char *begin
 *         p = begin = self._ensure_allocated(p, mp_sizeof_map(len))
 */

static char *__pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__encode_map(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *__pyx_v_self, char *__pyx_v_p, uint32_t __pyx_v_len) {
  char *__pyx_v_begin;
  char *__pyx_r;
  __Pyx_RefNannyDeclarations
  char *__pyx_t_1;
  __Pyx_RefNannySetupContext("_encode_map", 0);

  /* "asynctnt/iproto/buffer.pyx":217
 *     cdef char *_encode_map(self, char *p, uint32_t len) except NULL:
 *         cdef char *begin
 *         p = begin = self._ensure_allocated(p, mp_sizeof_map(len))             # <<<<<<<<<<<<<<
 *         p = mp_encode_map(p, len)
 *         self._length += (p - begin)
 */
  __pyx_t_1 = __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__ensure_allocated(__pyx_v_self, __pyx_v_p, mp_sizeof_map(__pyx_v_len)); if (unlikely(__pyx_t_1 == NULL)) __PYX_ERR(0, 217, __pyx_L1_error)
  __pyx_v_p = __pyx_t_1;
  __pyx_v_begin = __pyx_t_1;

  /* "asynctnt/iproto/buffer.pyx":218
 *         cdef char *begin
 *         p = begin = self._ensure_allocated(p, mp_sizeof_map(len))
 *         p = mp_encode_map(p, len)             # <<<<<<<<<<<<<<
 *         self._length += (p - begin)
 *         return p
 */
  __pyx_v_p = mp_encode_map(__pyx_v_p, __pyx_v_len);

  /* "asynctnt/iproto/buffer.pyx":219
 *         p = begin = self._ensure_allocated(p, mp_sizeof_map(len))
 *         p = mp_encode_map(p, len)
 *         self._length += (p - begin)             # <<<<<<<<<<<<<<
 *         return p
 * 
 */
  __pyx_v_self->_length = (__pyx_v_self->_length + (__pyx_v_p - __pyx_v_begin));

  /* "asynctnt/iproto/buffer.pyx":220
 *         p = mp_encode_map(p, len)
 *         self._length += (p - begin)
 *         return p             # <<<<<<<<<<<<<<
 * 
 *     cdef char *_encode_list(self, char *p, list arr) except NULL:
 */
  __pyx_r = __pyx_v_p;
  goto __pyx_L0;

  /* "asynctnt/iproto/buffer.pyx":215
 *         return p
 * 
 *     cdef char *_encode_map(self, char *p, uint32_t len) except NULL:             # <<<<<<<<<<<<<<
 *         cdef char *begin
 *         p = begin = self._ensure_allocated(p, mp_sizeof_map(len))
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("asynctnt.iproto.protocol.WriteBuffer._encode_map", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/buffer.pyx":222
 *         return p
 * 
 *     cdef char *_encode_list(self, char *p, list arr) except NULL:             # <<<<<<<<<<<<<<
 *         cdef:
 *             uint32_t arr_len
 */

static char *__pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__encode_list(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *__pyx_v_self, char *__pyx_v_p, PyObject *__pyx_v_arr) {
  uint32_t __pyx_v_arr_len;
  PyObject *__pyx_v_item_ptr;
  PyObject *__pyx_v_item = 0;
  uint32_t __pyx_v_i;
  char *__pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  char *__pyx_t_3;
  uint32_t __pyx_t_4;
  uint32_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("_encode_list", 0);

  /* "asynctnt/iproto/buffer.pyx":228
 *             object item
 * 
 *         if arr is not None:             # <<<<<<<<<<<<<<
 *             arr_len = <uint32_t>cpython.list.PyList_GET_SIZE(arr)
 *         else:
 */
  __pyx_t_1 = (__pyx_v_arr != ((PyObject*)Py_None));
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "asynctnt/iproto/buffer.pyx":229
 * 
 *         if arr is not None:
 *             arr_len = <uint32_t>cpython.list.PyList_GET_SIZE(arr)             # <<<<<<<<<<<<<<
 *         else:
 *             arr_len = 0
 */
    __pyx_v_arr_len = ((uint32_t)PyList_GET_SIZE(__pyx_v_arr));

    /* "asynctnt/iproto/buffer.pyx":228
 *             object item
 * 
 *         if arr is not None:             # <<<<<<<<<<<<<<
 *             arr_len = <uint32_t>cpython.list.PyList_GET_SIZE(arr)
 *         else:
 */
    goto __pyx_L3;
  }

  /* "asynctnt/iproto/buffer.pyx":231
 *             arr_len = <uint32_t>cpython.list.PyList_GET_SIZE(arr)
 *         else:
 *             arr_len = 0             # <<<<<<<<<<<<<<
 *         p = self._encode_array(p, arr_len)
 * 
 */
  /*else*/ {
    __pyx_v_arr_len = 0;
  }
  __pyx_L3:;

  /* "asynctnt/iproto/buffer.pyx":232
 *         else:
 *             arr_len = 0
 *         p = self._encode_array(p, arr_len)             # <<<<<<<<<<<<<<
 * 
 *         if arr_len > 0:
 */
  __pyx_t_3 = __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__encode_array(__pyx_v_self, __pyx_v_p, __pyx_v_arr_len); if (unlikely(__pyx_t_3 == NULL)) __PYX_ERR(0, 232, __pyx_L1_error)
  __pyx_v_p = __pyx_t_3;

  /* "asynctnt/iproto/buffer.pyx":234
 *         p = self._encode_array(p, arr_len)
 * 
 *         if arr_len > 0:             # <<<<<<<<<<<<<<
 *             for i in range(arr_len):
 *                 item_ptr = cpython.list.PyList_GET_ITEM(arr, i)
 */
  __pyx_t_2 = ((__pyx_v_arr_len > 0) != 0);
  if (__pyx_t_2) {

    /* "asynctnt/iproto/buffer.pyx":235
 * 
 *         if arr_len > 0:
 *             for i in range(arr_len):             # <<<<<<<<<<<<<<
 *                 item_ptr = cpython.list.PyList_GET_ITEM(arr, i)
 *                 item = <object>item_ptr
 */
    __pyx_t_4 = __pyx_v_arr_len;
    for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
      __pyx_v_i = __pyx_t_5;

      /* "asynctnt/iproto/buffer.pyx":236
 *         if arr_len > 0:
 *             for i in range(arr_len):
 *                 item_ptr = cpython.list.PyList_GET_ITEM(arr, i)             # <<<<<<<<<<<<<<
 *                 item = <object>item_ptr
 *                 p = self._encode_obj(p, item)
 */
      __pyx_v_item_ptr = PyList_GET_ITEM(__pyx_v_arr, __pyx_v_i);

      /* "asynctnt/iproto/buffer.pyx":237
 *             for i in range(arr_len):
 *                 item_ptr = cpython.list.PyList_GET_ITEM(arr, i)
 *                 item = <object>item_ptr             # <<<<<<<<<<<<<<
 *                 p = self._encode_obj(p, item)
 *         return p
 */
      __pyx_t_6 = ((PyObject *)__pyx_v_item_ptr);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_6);
      __pyx_t_6 = 0;

      /* "asynctnt/iproto/buffer.pyx":238
 *                 item_ptr = cpython.list.PyList_GET_ITEM(arr, i)
 *                 item = <object>item_ptr
 *                 p = self._encode_obj(p, item)             # <<<<<<<<<<<<<<
 *         return p
 * 
 */
      __pyx_t_3 = __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__encode_obj(__pyx_v_self, __pyx_v_p, __pyx_v_item); if (unlikely(__pyx_t_3 == NULL)) __PYX_ERR(0, 238, __pyx_L1_error)
      __pyx_v_p = __pyx_t_3;
    }

    /* "asynctnt/iproto/buffer.pyx":234
 *         p = self._encode_array(p, arr_len)
 * 
 *         if arr_len > 0:             # <<<<<<<<<<<<<<
 *             for i in range(arr_len):
 *                 item_ptr = cpython.list.PyList_GET_ITEM(arr, i)
 */
  }

  /* "asynctnt/iproto/buffer.pyx":239
 *                 item = <object>item_ptr
 *                 p = self._encode_obj(p, item)
 *         return p             # <<<<<<<<<<<<<<
 * 
 *     cdef char *_encode_tuple(self, char *p, tuple t) except NULL:
 */
  __pyx_r = __pyx_v_p;
  goto __pyx_L0;

  /* "asynctnt/iproto/buffer.pyx":222
 *         return p
 * 
 *     cdef char *_encode_list(self, char *p, list arr) except NULL:             # <<<<<<<<<<<<<<
 *         cdef:
 *             uint32_t arr_len
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("asynctnt.iproto.protocol.WriteBuffer._encode_list", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_item);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/buffer.pyx":241
 *         return p
 * 
 *     cdef char *_encode_tuple(self, char *p, tuple t) except NULL:             # <<<<<<<<<<<<<<
 *         cdef:
 *             uint32_t t_len
 */

static char *__pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__encode_tuple(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *__pyx_v_self, char *__pyx_v_p, PyObject *__pyx_v_t) {
  uint32_t __pyx_v_t_len;
  PyObject *__pyx_v_item_ptr;
  PyObject *__pyx_v_item = 0;
  uint32_t __pyx_v_i;
  char *__pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  char *__pyx_t_3;
  uint32_t __pyx_t_4;
  uint32_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("_encode_tuple", 0);

  /* "asynctnt/iproto/buffer.pyx":247
 *             object item
 * 
 *         if t is not None:             # <<<<<<<<<<<<<<
 *             t_len = <uint32_t>cpython.tuple.PyTuple_GET_SIZE(t)
 *         else:
 */
  __pyx_t_1 = (__pyx_v_t != ((PyObject*)Py_None));
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "asynctnt/iproto/buffer.pyx":248
 * 
 *         if t is not None:
 *             t_len = <uint32_t>cpython.tuple.PyTuple_GET_SIZE(t)             # <<<<<<<<<<<<<<
 *         else:
 *             t_len = 0
 */
    __pyx_v_t_len = ((uint32_t)PyTuple_GET_SIZE(__pyx_v_t));

    /* "asynctnt/iproto/buffer.pyx":247
 *             object item
 * 
 *         if t is not None:             # <<<<<<<<<<<<<<
 *             t_len = <uint32_t>cpython.tuple.PyTuple_GET_SIZE(t)
 *         else:
 */
    goto __pyx_L3;
  }

  /* "asynctnt/iproto/buffer.pyx":250
 *             t_len = <uint32_t>cpython.tuple.PyTuple_GET_SIZE(t)
 *         else:
 *             t_len = 0             # <<<<<<<<<<<<<<
 *         p = self._encode_array(p, t_len)
 * 
 */
  /*else*/ {
    __pyx_v_t_len = 0;
  }
  __pyx_L3:;

  /* "asynctnt/iproto/buffer.pyx":251
 *         else:
 *             t_len = 0
 *         p = self._encode_array(p, t_len)             # <<<<<<<<<<<<<<
 * 
 *         if t_len > 0:
 */
  __pyx_t_3 = __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__encode_array(__pyx_v_self, __pyx_v_p, __pyx_v_t_len); if (unlikely(__pyx_t_3 == NULL)) __PYX_ERR(0, 251, __pyx_L1_error)
  __pyx_v_p = __pyx_t_3;

  /* "asynctnt/iproto/buffer.pyx":253
 *         p = self._encode_array(p, t_len)
 * 
 *         if t_len > 0:             # <<<<<<<<<<<<<<
 *             for i in range(t_len):
 *                 item_ptr = cpython.tuple.PyTuple_GET_ITEM(t, i)
 */
  __pyx_t_2 = ((__pyx_v_t_len > 0) != 0);
  if (__pyx_t_2) {

    /* "asynctnt/iproto/buffer.pyx":254
 * 
 *         if t_len > 0:
 *             for i in range(t_len):             # <<<<<<<<<<<<<<
 *                 item_ptr = cpython.tuple.PyTuple_GET_ITEM(t, i)
 *                 item = <object>item_ptr
 */
    __pyx_t_4 = __pyx_v_t_len;
    for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
      __pyx_v_i = __pyx_t_5;

      /* "asynctnt/iproto/buffer.pyx":255
 *         if t_len > 0:
 *             for i in range(t_len):
 *                 item_ptr = cpython.tuple.PyTuple_GET_ITEM(t, i)             # <<<<<<<<<<<<<<
 *                 item = <object>item_ptr
 *                 p = self._encode_obj(p, item)
 */
      __pyx_v_item_ptr = PyTuple_GET_ITEM(__pyx_v_t, __pyx_v_i);

      /* "asynctnt/iproto/buffer.pyx":256
 *             for i in range(t_len):
 *                 item_ptr = cpython.tuple.PyTuple_GET_ITEM(t, i)
 *                 item = <object>item_ptr             # <<<<<<<<<<<<<<
 *                 p = self._encode_obj(p, item)
 *         return p
 */
      __pyx_t_6 = ((PyObject *)__pyx_v_item_ptr);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_6);
      __pyx_t_6 = 0;

      /* "asynctnt/iproto/buffer.pyx":257
 *                 item_ptr = cpython.tuple.PyTuple_GET_ITEM(t, i)
 *                 item = <object>item_ptr
 *                 p = self._encode_obj(p, item)             # <<<<<<<<<<<<<<
 *         return p
 * 
 */
      __pyx_t_3 = __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__encode_obj(__pyx_v_self, __pyx_v_p, __pyx_v_item); if (unlikely(__pyx_t_3 == NULL)) __PYX_ERR(0, 257, __pyx_L1_error)
      __pyx_v_p = __pyx_t_3;
    }

    /* "asynctnt/iproto/buffer.pyx":253
 *         p = self._encode_array(p, t_len)
 * 
 *         if t_len > 0:             # <<<<<<<<<<<<<<
 *             for i in range(t_len):
 *                 item_ptr = cpython.tuple.PyTuple_GET_ITEM(t, i)
 */
  }

  /* "asynctnt/iproto/buffer.pyx":258
 *                 item = <object>item_ptr
 *                 p = self._encode_obj(p, item)
 *         return p             # <<<<<<<<<<<<<<
 * 
 *     cdef char *_encode_dict(self, char *p, dict d) except NULL:
 */
  __pyx_r = __pyx_v_p;
  goto __pyx_L0;

  /* "asynctnt/iproto/buffer.pyx":241
 *         return p
 * 
 *     cdef char *_encode_tuple(self, char *p, tuple t) except NULL:             # <<<<<<<<<<<<<<
 *         cdef:
 *             uint32_t t_len
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("asynctnt.iproto.protocol.WriteBuffer._encode_tuple", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_item);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/buffer.pyx":260
 *         return p
 * 
 *     cdef char *_encode_dict(self, char *p, dict d) except NULL:             # <<<<<<<<<<<<<<
 *         cdef:
 *             uint32_t d_len
 */

static char *__pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__encode_dict(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *__pyx_v_self, char *__pyx_v_p, PyObject *__pyx_v_d) {
  uint32_t __pyx_v_d_len;
  PyObject *__pyx_v_pkey;
  PyObject *__pyx_v_pvalue;
  PyObject *__pyx_v_key = 0;
  PyObject *__pyx_v_value = 0;
  Py_ssize_t __pyx_v_pos;
  char *__pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  char *__pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("_encode_dict", 0);

  /* "asynctnt/iproto/buffer.pyx":268
 *             Py_ssize_t pos
 * 
 *         if d is not None:             # <<<<<<<<<<<<<<
 *             d_len = <uint32_t>cpython.dict.PyDict_Size(d)
 *         else:
 */
  __pyx_t_1 = (__pyx_v_d != ((PyObject*)Py_None));
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "asynctnt/iproto/buffer.pyx":269
 * 
 *         if d is not None:
 *             d_len = <uint32_t>cpython.dict.PyDict_Size(d)             # <<<<<<<<<<<<<<
 *         else:
 *             d_len = 0
 */
    __pyx_t_3 = PyDict_Size(__pyx_v_d); if (unlikely(__pyx_t_3 == -1L)) __PYX_ERR(0, 269, __pyx_L1_error)
    __pyx_v_d_len = ((uint32_t)__pyx_t_3);

    /* "asynctnt/iproto/buffer.pyx":268
 *             Py_ssize_t pos
 * 
 *         if d is not None:             # <<<<<<<<<<<<<<
 *             d_len = <uint32_t>cpython.dict.PyDict_Size(d)
 *         else:
 */
    goto __pyx_L3;
  }

  /* "asynctnt/iproto/buffer.pyx":271
 *             d_len = <uint32_t>cpython.dict.PyDict_Size(d)
 *         else:
 *             d_len = 0             # <<<<<<<<<<<<<<
 *         p = self._encode_map(p, d_len)
 * 
 */
  /*else*/ {
    __pyx_v_d_len = 0;
  }
  __pyx_L3:;

  /* "asynctnt/iproto/buffer.pyx":272
 *         else:
 *             d_len = 0
 *         p = self._encode_map(p, d_len)             # <<<<<<<<<<<<<<
 * 
 *         pos = 0
 */
  __pyx_t_4 = __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__encode_map(__pyx_v_self, __pyx_v_p, __pyx_v_d_len); if (unlikely(__pyx_t_4 == NULL)) __PYX_ERR(0, 272, __pyx_L1_error)
  __pyx_v_p = __pyx_t_4;

  /* "asynctnt/iproto/buffer.pyx":274
 *         p = self._encode_map(p, d_len)
 * 
 *         pos = 0             # <<<<<<<<<<<<<<
 *         while cpython.dict.PyDict_Next(d, &pos, &pkey, &pvalue):
 *             key = <object>pkey
 */
  __pyx_v_pos = 0;

  /* "asynctnt/iproto/buffer.pyx":275
 * 
 *         pos = 0
 *         while cpython.dict.PyDict_Next(d, &pos, &pkey, &pvalue):             # <<<<<<<<<<<<<<
 *             key = <object>pkey
 *             value = <object>pvalue
 */
  while (1) {
    __pyx_t_2 = (PyDict_Next(__pyx_v_d, (&__pyx_v_pos), (&__pyx_v_pkey), (&__pyx_v_pvalue)) != 0);
    if (!__pyx_t_2) break;

    /* "asynctnt/iproto/buffer.pyx":276
 *         pos = 0
 *         while cpython.dict.PyDict_Next(d, &pos, &pkey, &pvalue):
 *             key = <object>pkey             # <<<<<<<<<<<<<<
 *             value = <object>pvalue
 *             p = self._encode_obj(p, key)
 */
    __pyx_t_5 = ((PyObject *)__pyx_v_pkey);
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_XDECREF_SET(__pyx_v_key, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "asynctnt/iproto/buffer.pyx":277
 *         while cpython.dict.PyDict_Next(d, &pos, &pkey, &pvalue):
 *             key = <object>pkey
 *             value = <object>pvalue             # <<<<<<<<<<<<<<
 *             p = self._encode_obj(p, key)
 *             p = self._encode_obj(p, value)
 */
    __pyx_t_5 = ((PyObject *)__pyx_v_pvalue);
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "asynctnt/iproto/buffer.pyx":278
 *             key = <object>pkey
 *             value = <object>pvalue
 *             p = self._encode_obj(p, key)             # <<<<<<<<<<<<<<
 *             p = self._encode_obj(p, value)
 * 
 */
    __pyx_t_4 = __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__encode_obj(__pyx_v_self, __pyx_v_p, __pyx_v_key); if (unlikely(__pyx_t_4 == NULL)) __PYX_ERR(0, 278, __pyx_L1_error)
    __pyx_v_p = __pyx_t_4;

    /* "asynctnt/iproto/buffer.pyx":279
 *             value = <object>pvalue
 *             p = self._encode_obj(p, key)
 *             p = self._encode_obj(p, value)             # <<<<<<<<<<<<<<
 * 
 *         return p
 */
    __pyx_t_4 = __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__encode_obj(__pyx_v_self, __pyx_v_p, __pyx_v_value); if (unlikely(__pyx_t_4 == NULL)) __PYX_ERR(0, 279, __pyx_L1_error)
    __pyx_v_p = __pyx_t_4;
  }

  /* "asynctnt/iproto/buffer.pyx":281
 *             p = self._encode_obj(p, value)
 * 
 *         return p             # <<<<<<<<<<<<<<
 * 
 *     cdef char *_encode_obj(self, char *p, object o) except NULL:
 */
  __pyx_r = __pyx_v_p;
  goto __pyx_L0;

  /* "asynctnt/iproto/buffer.pyx":260
 *         return p
 * 
 *     cdef char *_encode_dict(self, char *p, dict d) except NULL:             # <<<<<<<<<<<<<<
 *         cdef:
 *             uint32_t d_len
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("asynctnt.iproto.protocol.WriteBuffer._encode_dict", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_key);
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/buffer.pyx":283
 *         return p
 * 
 *     cdef char *_encode_obj(self, char *p, object o) except NULL:             # <<<<<<<<<<<<<<
 *         cdef:
 *             bytes o_string_temp
 */

static char *__pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__encode_obj(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *__pyx_v_self, char *__pyx_v_p, PyObject *__pyx_v_o) {
  PyObject *__pyx_v_o_string_temp = 0;
  char *__pyx_v_o_string_str;
  Py_ssize_t __pyx_v_o_string_len;
  char *__pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  char *__pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  double __pyx_t_5;
  uint64_t __pyx_t_6;
  int64_t __pyx_t_7;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  struct __pyx_opt_args_8asynctnt_6iproto_8protocol_encode_unicode_string __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  __Pyx_RefNannySetupContext("_encode_obj", 0);

  /* "asynctnt/iproto/buffer.pyx":289
 *             ssize_t o_string_len
 * 
 *         if o is None:             # <<<<<<<<<<<<<<
 *             return self._encode_nil(p)
 * 
 */
  __pyx_t_1 = (__pyx_v_o == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "asynctnt/iproto/buffer.pyx":290
 * 
 *         if o is None:
 *             return self._encode_nil(p)             # <<<<<<<<<<<<<<
 * 
 *         elif isinstance(o, bool):
 */
    __pyx_t_3 = __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__encode_nil(__pyx_v_self, __pyx_v_p); if (unlikely(__pyx_t_3 == NULL)) __PYX_ERR(0, 290, __pyx_L1_error)
    __pyx_r = __pyx_t_3;
    goto __pyx_L0;

    /* "asynctnt/iproto/buffer.pyx":289
 *             ssize_t o_string_len
 * 
 *         if o is None:             # <<<<<<<<<<<<<<
 *             return self._encode_nil(p)
 * 
 */
  }

  /* "asynctnt/iproto/buffer.pyx":292
 *             return self._encode_nil(p)
 * 
 *         elif isinstance(o, bool):             # <<<<<<<<<<<<<<
 *             return self._encode_bool(p, <bint>o)
 * 
 */
  __pyx_t_4 = ((PyObject*)&PyBool_Type);
  __Pyx_INCREF(__pyx_t_4);
  __pyx_t_2 = PyObject_IsInstance(__pyx_v_o, __pyx_t_4); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(0, 292, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "asynctnt/iproto/buffer.pyx":293
 * 
 *         elif isinstance(o, bool):
 *             return self._encode_bool(p, <bint>o)             # <<<<<<<<<<<<<<
 * 
 *         elif isinstance(o, float):
 */
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_o); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 293, __pyx_L1_error)
    __pyx_t_3 = __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__encode_bool(__pyx_v_self, __pyx_v_p, __pyx_t_1); if (unlikely(__pyx_t_3 == NULL)) __PYX_ERR(0, 293, __pyx_L1_error)
    __pyx_r = __pyx_t_3;
    goto __pyx_L0;

    /* "asynctnt/iproto/buffer.pyx":292
 *             return self._encode_nil(p)
 * 
 *         elif isinstance(o, bool):             # <<<<<<<<<<<<<<
 *             return self._encode_bool(p, <bint>o)
 * 
 */
  }

  /* "asynctnt/iproto/buffer.pyx":295
 *             return self._encode_bool(p, <bint>o)
 * 
 *         elif isinstance(o, float):             # <<<<<<<<<<<<<<
 *             return self._encode_double(p, <double>o)
 * 
 */
  __pyx_t_1 = PyFloat_Check(__pyx_v_o); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "asynctnt/iproto/buffer.pyx":296
 * 
 *         elif isinstance(o, float):
 *             return self._encode_double(p, <double>o)             # <<<<<<<<<<<<<<
 * 
 *         elif isinstance(o, int):
 */
    __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_v_o); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 296, __pyx_L1_error)
    __pyx_t_3 = __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__encode_double(__pyx_v_self, __pyx_v_p, ((double)__pyx_t_5)); if (unlikely(__pyx_t_3 == NULL)) __PYX_ERR(0, 296, __pyx_L1_error)
    __pyx_r = __pyx_t_3;
    goto __pyx_L0;

    /* "asynctnt/iproto/buffer.pyx":295
 *             return self._encode_bool(p, <bint>o)
 * 
 *         elif isinstance(o, float):             # <<<<<<<<<<<<<<
 *             return self._encode_double(p, <double>o)
 * 
 */
  }

  /* "asynctnt/iproto/buffer.pyx":298
 *             return self._encode_double(p, <double>o)
 * 
 *         elif isinstance(o, int):             # <<<<<<<<<<<<<<
 *             if o >= 0:
 *                 return self._encode_uint(p, <uint64_t>o)
 */
  __pyx_t_2 = PyInt_Check(__pyx_v_o); 
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "asynctnt/iproto/buffer.pyx":299
 * 
 *         elif isinstance(o, int):
 *             if o >= 0:             # <<<<<<<<<<<<<<
 *                 return self._encode_uint(p, <uint64_t>o)
 *             else:
 */
    __pyx_t_4 = PyObject_RichCompare(__pyx_v_o, __pyx_int_0, Py_GE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 299, __pyx_L1_error)
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 299, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_1) {

      /* "asynctnt/iproto/buffer.pyx":300
 *         elif isinstance(o, int):
 *             if o >= 0:
 *                 return self._encode_uint(p, <uint64_t>o)             # <<<<<<<<<<<<<<
 *             else:
 *                 return self._encode_int(p, <int64_t>o)
 */
      __pyx_t_6 = __Pyx_PyInt_As_uint64_t(__pyx_v_o); if (unlikely((__pyx_t_6 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 300, __pyx_L1_error)
      __pyx_t_3 = __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__encode_uint(__pyx_v_self, __pyx_v_p, ((uint64_t)__pyx_t_6)); if (unlikely(__pyx_t_3 == NULL)) __PYX_ERR(0, 300, __pyx_L1_error)
      __pyx_r = __pyx_t_3;
      goto __pyx_L0;

      /* "asynctnt/iproto/buffer.pyx":299
 * 
 *         elif isinstance(o, int):
 *             if o >= 0:             # <<<<<<<<<<<<<<
 *                 return self._encode_uint(p, <uint64_t>o)
 *             else:
 */
    }

    /* "asynctnt/iproto/buffer.pyx":302
 *                 return self._encode_uint(p, <uint64_t>o)
 *             else:
 *                 return self._encode_int(p, <int64_t>o)             # <<<<<<<<<<<<<<
 * 
 *         elif isinstance(o, bytes):
 */
    /*else*/ {
      __pyx_t_7 = __Pyx_PyInt_As_int64_t(__pyx_v_o); if (unlikely((__pyx_t_7 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 302, __pyx_L1_error)
      __pyx_t_3 = __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__encode_int(__pyx_v_self, __pyx_v_p, ((int64_t)__pyx_t_7)); if (unlikely(__pyx_t_3 == NULL)) __PYX_ERR(0, 302, __pyx_L1_error)
      __pyx_r = __pyx_t_3;
      goto __pyx_L0;
    }

    /* "asynctnt/iproto/buffer.pyx":298
 *             return self._encode_double(p, <double>o)
 * 
 *         elif isinstance(o, int):             # <<<<<<<<<<<<<<
 *             if o >= 0:
 *                 return self._encode_uint(p, <uint64_t>o)
 */
  }

  /* "asynctnt/iproto/buffer.pyx":304
 *                 return self._encode_int(p, <int64_t>o)
 * 
 *         elif isinstance(o, bytes):             # <<<<<<<<<<<<<<
 *             o_string_str = NULL
 *             o_string_len = 0
 */
  __pyx_t_1 = PyBytes_Check(__pyx_v_o); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "asynctnt/iproto/buffer.pyx":305
 * 
 *         elif isinstance(o, bytes):
 *             o_string_str = NULL             # <<<<<<<<<<<<<<
 *             o_string_len = 0
 *             cpython.bytes.PyBytes_AsStringAndSize(o,
 */
    __pyx_v_o_string_str = NULL;

    /* "asynctnt/iproto/buffer.pyx":306
 *         elif isinstance(o, bytes):
 *             o_string_str = NULL
 *             o_string_len = 0             # <<<<<<<<<<<<<<
 *             cpython.bytes.PyBytes_AsStringAndSize(o,
 *                                                   &o_string_str,
 */
    __pyx_v_o_string_len = 0;

    /* "asynctnt/iproto/buffer.pyx":307
 *             o_string_str = NULL
 *             o_string_len = 0
 *             cpython.bytes.PyBytes_AsStringAndSize(o,             # <<<<<<<<<<<<<<
 *                                                   &o_string_str,
 *                                                   &o_string_len)
 */
    __pyx_t_8 = PyBytes_AsStringAndSize(__pyx_v_o, (&__pyx_v_o_string_str), ((Py_ssize_t *)(&__pyx_v_o_string_len))); if (unlikely(__pyx_t_8 == -1)) __PYX_ERR(0, 307, __pyx_L1_error)

    /* "asynctnt/iproto/buffer.pyx":310
 *                                                   &o_string_str,
 *                                                   &o_string_len)
 *             return self._encode_bin(p, o_string_str, <uint32_t>o_string_len)             # <<<<<<<<<<<<<<
 * 
 *         elif isinstance(o, str):
 */
    __pyx_t_3 = __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__encode_bin(__pyx_v_self, __pyx_v_p, __pyx_v_o_string_str, ((uint32_t)__pyx_v_o_string_len)); if (unlikely(__pyx_t_3 == NULL)) __PYX_ERR(0, 310, __pyx_L1_error)
    __pyx_r = __pyx_t_3;
    goto __pyx_L0;

    /* "asynctnt/iproto/buffer.pyx":304
 *                 return self._encode_int(p, <int64_t>o)
 * 
 *         elif isinstance(o, bytes):             # <<<<<<<<<<<<<<
 *             o_string_str = NULL
 *             o_string_len = 0
 */
  }

  /* "asynctnt/iproto/buffer.pyx":312
 *             return self._encode_bin(p, o_string_str, <uint32_t>o_string_len)
 * 
 *         elif isinstance(o, str):             # <<<<<<<<<<<<<<
 *             o_string_temp = encode_unicode_string(o, self._encoding)
 *             o_string_str = NULL
 */
  __pyx_t_2 = PyString_Check(__pyx_v_o); 
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "asynctnt/iproto/buffer.pyx":313
 * 
 *         elif isinstance(o, str):
 *             o_string_temp = encode_unicode_string(o, self._encoding)             # <<<<<<<<<<<<<<
 *             o_string_str = NULL
 *             o_string_len = 0
 */
    if (!(likely(PyString_CheckExact(__pyx_v_o))||((__pyx_v_o) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_v_o)->tp_name), 0))) __PYX_ERR(0, 313, __pyx_L1_error)
    __pyx_t_4 = __pyx_v_self->_encoding;
    __Pyx_INCREF(__pyx_t_4);
    __pyx_t_10.__pyx_n = 1;
    __pyx_t_10.encoding = ((PyObject*)__pyx_t_4);
    __pyx_t_9 = __pyx_f_8asynctnt_6iproto_8protocol_encode_unicode_string(((PyObject*)__pyx_v_o), &__pyx_t_10); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 313, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_o_string_temp = ((PyObject*)__pyx_t_9);
    __pyx_t_9 = 0;

    /* "asynctnt/iproto/buffer.pyx":314
 *         elif isinstance(o, str):
 *             o_string_temp = encode_unicode_string(o, self._encoding)
 *             o_string_str = NULL             # <<<<<<<<<<<<<<
 *             o_string_len = 0
 *             cpython.bytes.PyBytes_AsStringAndSize(o_string_temp,
 */
    __pyx_v_o_string_str = NULL;

    /* "asynctnt/iproto/buffer.pyx":315
 *             o_string_temp = encode_unicode_string(o, self._encoding)
 *             o_string_str = NULL
 *             o_string_len = 0             # <<<<<<<<<<<<<<
 *             cpython.bytes.PyBytes_AsStringAndSize(o_string_temp,
 *                                                   &o_string_str,
 */
    __pyx_v_o_string_len = 0;

    /* "asynctnt/iproto/buffer.pyx":316
 *             o_string_str = NULL
 *             o_string_len = 0
 *             cpython.bytes.PyBytes_AsStringAndSize(o_string_temp,             # <<<<<<<<<<<<<<
 *                                                   &o_string_str,
 *                                                   &o_string_len)
 */
    __pyx_t_8 = PyBytes_AsStringAndSize(__pyx_v_o_string_temp, (&__pyx_v_o_string_str), ((Py_ssize_t *)(&__pyx_v_o_string_len))); if (unlikely(__pyx_t_8 == -1)) __PYX_ERR(0, 316, __pyx_L1_error)

    /* "asynctnt/iproto/buffer.pyx":320
 *                                                   &o_string_len)
 * 
 *             p = self._encode_str(p, o_string_str, <uint32_t>o_string_len)             # <<<<<<<<<<<<<<
 *             return p
 * 
 */
    __pyx_t_3 = __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__encode_str(__pyx_v_self, __pyx_v_p, __pyx_v_o_string_str, ((uint32_t)__pyx_v_o_string_len)); if (unlikely(__pyx_t_3 == NULL)) __PYX_ERR(0, 320, __pyx_L1_error)
    __pyx_v_p = __pyx_t_3;

    /* "asynctnt/iproto/buffer.pyx":321
 * 
 *             p = self._encode_str(p, o_string_str, <uint32_t>o_string_len)
 *             return p             # <<<<<<<<<<<<<<
 * 
 *         elif isinstance(o, list):
 */
    __pyx_r = __pyx_v_p;
    goto __pyx_L0;

    /* "asynctnt/iproto/buffer.pyx":312
 *             return self._encode_bin(p, o_string_str, <uint32_t>o_string_len)
 * 
 *         elif isinstance(o, str):             # <<<<<<<<<<<<<<
 *             o_string_temp = encode_unicode_string(o, self._encoding)
 *             o_string_str = NULL
 */
  }

  /* "asynctnt/iproto/buffer.pyx":323
 *             return p
 * 
 *         elif isinstance(o, list):             # <<<<<<<<<<<<<<
 *             return self._encode_list(p, o)
 * 
 */
  __pyx_t_1 = PyList_Check(__pyx_v_o); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "asynctnt/iproto/buffer.pyx":324
 * 
 *         elif isinstance(o, list):
 *             return self._encode_list(p, o)             # <<<<<<<<<<<<<<
 * 
 *         elif isinstance(o, tuple):
 */
    if (!(likely(PyList_CheckExact(__pyx_v_o))||((__pyx_v_o) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_v_o)->tp_name), 0))) __PYX_ERR(0, 324, __pyx_L1_error)
    __pyx_t_3 = __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__encode_list(__pyx_v_self, __pyx_v_p, ((PyObject*)__pyx_v_o)); if (unlikely(__pyx_t_3 == NULL)) __PYX_ERR(0, 324, __pyx_L1_error)
    __pyx_r = __pyx_t_3;
    goto __pyx_L0;

    /* "asynctnt/iproto/buffer.pyx":323
 *             return p
 * 
 *         elif isinstance(o, list):             # <<<<<<<<<<<<<<
 *             return self._encode_list(p, o)
 * 
 */
  }

  /* "asynctnt/iproto/buffer.pyx":326
 *             return self._encode_list(p, o)
 * 
 *         elif isinstance(o, tuple):             # <<<<<<<<<<<<<<
 *             return self._encode_tuple(p, o)
 * 
 */
  __pyx_t_2 = PyTuple_Check(__pyx_v_o); 
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "asynctnt/iproto/buffer.pyx":327
 * 
 *         elif isinstance(o, tuple):
 *             return self._encode_tuple(p, o)             # <<<<<<<<<<<<<<
 * 
 *         elif isinstance(o, dict):
 */
    if (!(likely(PyTuple_CheckExact(__pyx_v_o))||((__pyx_v_o) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v_o)->tp_name), 0))) __PYX_ERR(0, 327, __pyx_L1_error)
    __pyx_t_3 = __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__encode_tuple(__pyx_v_self, __pyx_v_p, ((PyObject*)__pyx_v_o)); if (unlikely(__pyx_t_3 == NULL)) __PYX_ERR(0, 327, __pyx_L1_error)
    __pyx_r = __pyx_t_3;
    goto __pyx_L0;

    /* "asynctnt/iproto/buffer.pyx":326
 *             return self._encode_list(p, o)
 * 
 *         elif isinstance(o, tuple):             # <<<<<<<<<<<<<<
 *             return self._encode_tuple(p, o)
 * 
 */
  }

  /* "asynctnt/iproto/buffer.pyx":329
 *             return self._encode_tuple(p, o)
 * 
 *         elif isinstance(o, dict):             # <<<<<<<<<<<<<<
 *             return self._encode_dict(p, o)
 * 
 */
  __pyx_t_1 = PyDict_Check(__pyx_v_o); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "asynctnt/iproto/buffer.pyx":330
 * 
 *         elif isinstance(o, dict):
 *             return self._encode_dict(p, o)             # <<<<<<<<<<<<<<
 * 
 *         else:
 */
    if (!(likely(PyDict_CheckExact(__pyx_v_o))||((__pyx_v_o) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_v_o)->tp_name), 0))) __PYX_ERR(0, 330, __pyx_L1_error)
    __pyx_t_3 = __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__encode_dict(__pyx_v_self, __pyx_v_p, ((PyObject*)__pyx_v_o)); if (unlikely(__pyx_t_3 == NULL)) __PYX_ERR(0, 330, __pyx_L1_error)
    __pyx_r = __pyx_t_3;
    goto __pyx_L0;

    /* "asynctnt/iproto/buffer.pyx":329
 *             return self._encode_tuple(p, o)
 * 
 *         elif isinstance(o, dict):             # <<<<<<<<<<<<<<
 *             return self._encode_dict(p, o)
 * 
 */
  }

  /* "asynctnt/iproto/buffer.pyx":333
 * 
 *         else:
 *             raise TypeError(             # <<<<<<<<<<<<<<
 *                 'Type `{}` is not supported for encoding'.format(type(o)))
 * 
 */
  /*else*/ {

    /* "asynctnt/iproto/buffer.pyx":334
 *         else:
 *             raise TypeError(
 *                 'Type `{}` is not supported for encoding'.format(type(o)))             # <<<<<<<<<<<<<<
 * 
 *     cdef tnt.tnt_update_op_kind _op_type_to_kind(self, char *str, ssize_t len):
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_Type_is_not_supported_for_encodi, __pyx_n_s_format); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 334, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_11 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_11)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_11);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    if (!__pyx_t_11) {
      __pyx_t_9 = __Pyx_PyObject_CallOneArg(__pyx_t_4, ((PyObject *)Py_TYPE(__pyx_v_o))); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 334, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[2] = {__pyx_t_11, ((PyObject *)Py_TYPE(__pyx_v_o))};
        __pyx_t_9 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 334, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_GOTREF(__pyx_t_9);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[2] = {__pyx_t_11, ((PyObject *)Py_TYPE(__pyx_v_o))};
        __pyx_t_9 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 334, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_GOTREF(__pyx_t_9);
      } else
      #endif
      {
        __pyx_t_12 = PyTuple_New(1+1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 334, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_11); __pyx_t_11 = NULL;
        __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_o)));
        __Pyx_GIVEREF(((PyObject *)Py_TYPE(__pyx_v_o)));
        PyTuple_SET_ITEM(__pyx_t_12, 0+1, ((PyObject *)Py_TYPE(__pyx_v_o)));
        __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_12, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 334, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "asynctnt/iproto/buffer.pyx":333
 * 
 *         else:
 *             raise TypeError(             # <<<<<<<<<<<<<<
 *                 'Type `{}` is not supported for encoding'.format(type(o)))
 * 
 */
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 333, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_9);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_9);
    __pyx_t_9 = 0;
    __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 333, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_Raise(__pyx_t_9, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __PYX_ERR(0, 333, __pyx_L1_error)
  }

  /* "asynctnt/iproto/buffer.pyx":283
 *         return p
 * 
 *     cdef char *_encode_obj(self, char *p, object o) except NULL:             # <<<<<<<<<<<<<<
 *         cdef:
 *             bytes o_string_temp
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("asynctnt.iproto.protocol.WriteBuffer._encode_obj", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_o_string_temp);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/buffer.pyx":336
 *                 'Type `{}` is not supported for encoding'.format(type(o)))
 * 
 *     cdef tnt.tnt_update_op_kind _op_type_to_kind(self, char *str, ssize_t len):             # <<<<<<<<<<<<<<
 *         cdef:
 *             char op
 */

static enum __pyx_t_8asynctnt_6iproto_3tnt_tnt_update_op_kind __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__op_type_to_kind(CYTHON_UNUSED struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *__pyx_v_self, char *__pyx_v_str, Py_ssize_t __pyx_v_len) {
  char __pyx_v_op;
  enum __pyx_t_8asynctnt_6iproto_3tnt_tnt_update_op_kind __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("_op_type_to_kind", 0);

  /* "asynctnt/iproto/buffer.pyx":339
 *         cdef:
 *             char op
 *         if len < 0 or len > 1:             # <<<<<<<<<<<<<<
 *             return tnt.OP_UPD_UNKNOWN
 * 
 */
  __pyx_t_2 = ((__pyx_v_len < 0) != 0);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = ((__pyx_v_len > 1) != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "asynctnt/iproto/buffer.pyx":340
 *             char op
 *         if len < 0 or len > 1:
 *             return tnt.OP_UPD_UNKNOWN             # <<<<<<<<<<<<<<
 * 
 *         op = str[0]
 */
    __pyx_r = __pyx_e_8asynctnt_6iproto_3tnt_OP_UPD_UNKNOWN;
    goto __pyx_L0;

    /* "asynctnt/iproto/buffer.pyx":339
 *         cdef:
 *             char op
 *         if len < 0 or len > 1:             # <<<<<<<<<<<<<<
 *             return tnt.OP_UPD_UNKNOWN
 * 
 */
  }

  /* "asynctnt/iproto/buffer.pyx":342
 *             return tnt.OP_UPD_UNKNOWN
 * 
 *         op = str[0]             # <<<<<<<<<<<<<<
 *         if op == b'+' \
 *               or op == b'-' \
 */
  __pyx_v_op = (__pyx_v_str[0]);

  /* "asynctnt/iproto/buffer.pyx":343
 * 
 *         op = str[0]
 *         if op == b'+' \             # <<<<<<<<<<<<<<
 *               or op == b'-' \
 *               or op == b'&' \
 */
  switch (__pyx_v_op) {
    case '+':

    /* "asynctnt/iproto/buffer.pyx":344
 *         op = str[0]
 *         if op == b'+' \
 *               or op == b'-' \             # <<<<<<<<<<<<<<
 *               or op == b'&' \
 *               or op == b'^' \
 */
    case '-':

    /* "asynctnt/iproto/buffer.pyx":345
 *         if op == b'+' \
 *               or op == b'-' \
 *               or op == b'&' \             # <<<<<<<<<<<<<<
 *               or op == b'^' \
 *               or op == b'|':
 */
    case '&':

    /* "asynctnt/iproto/buffer.pyx":346
 *               or op == b'-' \
 *               or op == b'&' \
 *               or op == b'^' \             # <<<<<<<<<<<<<<
 *               or op == b'|':
 *             return tnt.OP_UPD_ARITHMETIC
 */
    case '^':

    /* "asynctnt/iproto/buffer.pyx":347
 *               or op == b'&' \
 *               or op == b'^' \
 *               or op == b'|':             # <<<<<<<<<<<<<<
 *             return tnt.OP_UPD_ARITHMETIC
 *         elif op == b'#':
 */
    case '|':

    /* "asynctnt/iproto/buffer.pyx":348
 *               or op == b'^' \
 *               or op == b'|':
 *             return tnt.OP_UPD_ARITHMETIC             # <<<<<<<<<<<<<<
 *         elif op == b'#':
 *             return tnt.OP_UPD_DELETE
 */
    __pyx_r = __pyx_e_8asynctnt_6iproto_3tnt_OP_UPD_ARITHMETIC;
    goto __pyx_L0;

    /* "asynctnt/iproto/buffer.pyx":343
 * 
 *         op = str[0]
 *         if op == b'+' \             # <<<<<<<<<<<<<<
 *               or op == b'-' \
 *               or op == b'&' \
 */
    break;

    /* "asynctnt/iproto/buffer.pyx":349
 *               or op == b'|':
 *             return tnt.OP_UPD_ARITHMETIC
 *         elif op == b'#':             # <<<<<<<<<<<<<<
 *             return tnt.OP_UPD_DELETE
 *         elif op == b'!' \
 */
    case '#':

    /* "asynctnt/iproto/buffer.pyx":350
 *             return tnt.OP_UPD_ARITHMETIC
 *         elif op == b'#':
 *             return tnt.OP_UPD_DELETE             # <<<<<<<<<<<<<<
 *         elif op == b'!' \
 *               or op == b'=':
 */
    __pyx_r = __pyx_e_8asynctnt_6iproto_3tnt_OP_UPD_DELETE;
    goto __pyx_L0;

    /* "asynctnt/iproto/buffer.pyx":349
 *               or op == b'|':
 *             return tnt.OP_UPD_ARITHMETIC
 *         elif op == b'#':             # <<<<<<<<<<<<<<
 *             return tnt.OP_UPD_DELETE
 *         elif op == b'!' \
 */
    break;

    /* "asynctnt/iproto/buffer.pyx":351
 *         elif op == b'#':
 *             return tnt.OP_UPD_DELETE
 *         elif op == b'!' \             # <<<<<<<<<<<<<<
 *               or op == b'=':
 *             return tnt.OP_UPD_INSERT_ASSIGN
 */
    case '!':

    /* "asynctnt/iproto/buffer.pyx":352
 *             return tnt.OP_UPD_DELETE
 *         elif op == b'!' \
 *               or op == b'=':             # <<<<<<<<<<<<<<
 *             return tnt.OP_UPD_INSERT_ASSIGN
 *         elif op == b':':
 */
    case '=':

    /* "asynctnt/iproto/buffer.pyx":353
 *         elif op == b'!' \
 *               or op == b'=':
 *             return tnt.OP_UPD_INSERT_ASSIGN             # <<<<<<<<<<<<<<
 *         elif op == b':':
 *             return tnt.OP_UPD_SPLICE
 */
    __pyx_r = __pyx_e_8asynctnt_6iproto_3tnt_OP_UPD_INSERT_ASSIGN;
    goto __pyx_L0;

    /* "asynctnt/iproto/buffer.pyx":351
 *         elif op == b'#':
 *             return tnt.OP_UPD_DELETE
 *         elif op == b'!' \             # <<<<<<<<<<<<<<
 *               or op == b'=':
 *             return tnt.OP_UPD_INSERT_ASSIGN
 */
    break;

    /* "asynctnt/iproto/buffer.pyx":354
 *               or op == b'=':
 *             return tnt.OP_UPD_INSERT_ASSIGN
 *         elif op == b':':             # <<<<<<<<<<<<<<
 *             return tnt.OP_UPD_SPLICE
 *         else:
 */
    case ':':

    /* "asynctnt/iproto/buffer.pyx":355
 *             return tnt.OP_UPD_INSERT_ASSIGN
 *         elif op == b':':
 *             return tnt.OP_UPD_SPLICE             # <<<<<<<<<<<<<<
 *         else:
 *             return tnt.OP_UPD_UNKNOWN
 */
    __pyx_r = __pyx_e_8asynctnt_6iproto_3tnt_OP_UPD_SPLICE;
    goto __pyx_L0;

    /* "asynctnt/iproto/buffer.pyx":354
 *               or op == b'=':
 *             return tnt.OP_UPD_INSERT_ASSIGN
 *         elif op == b':':             # <<<<<<<<<<<<<<
 *             return tnt.OP_UPD_SPLICE
 *         else:
 */
    break;
    default:

    /* "asynctnt/iproto/buffer.pyx":357
 *             return tnt.OP_UPD_SPLICE
 *         else:
 *             return tnt.OP_UPD_UNKNOWN             # <<<<<<<<<<<<<<
 * 
 *     cdef char *_encode_update_ops(self, char *p, list operations) except NULL:
 */
    __pyx_r = __pyx_e_8asynctnt_6iproto_3tnt_OP_UPD_UNKNOWN;
    goto __pyx_L0;
    break;
  }

  /* "asynctnt/iproto/buffer.pyx":336
 *                 'Type `{}` is not supported for encoding'.format(type(o)))
 * 
 *     cdef tnt.tnt_update_op_kind _op_type_to_kind(self, char *str, ssize_t len):             # <<<<<<<<<<<<<<
 *         cdef:
 *             char op
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/buffer.pyx":359
 *             return tnt.OP_UPD_UNKNOWN
 * 
 *     cdef char *_encode_update_ops(self, char *p, list operations) except NULL:             # <<<<<<<<<<<<<<
 *         cdef:
 *             char *begin
 */

static char *__pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__encode_update_ops(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *__pyx_v_self, char *__pyx_v_p, PyObject *__pyx_v_operations) {
  char *__pyx_v_begin;
  uint32_t __pyx_v_ops_len;
  uint32_t __pyx_v_op_len;
  PyObject *__pyx_v_str_temp = 0;
  char *__pyx_v_op_str_c;
  Py_ssize_t __pyx_v_op_str_len;
  uint32_t __pyx_v_extra_length;
  enum __pyx_t_8asynctnt_6iproto_3tnt_tnt_update_op_kind __pyx_v_op_kind;
  uint64_t __pyx_v_field_no;
  uint32_t __pyx_v_splice_position;
  uint32_t __pyx_v_splice_offset;
  PyObject *__pyx_v_operation = NULL;
  PyObject *__pyx_v_op_type_str = NULL;
  PyObject *__pyx_v_op_argument = NULL;
  PyObject *__pyx_v_splice_position_obj = NULL;
  PyObject *__pyx_v_splice_offset_obj = NULL;
  char *__pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  char *__pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  Py_ssize_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  struct __pyx_opt_args_8asynctnt_6iproto_8protocol_encode_unicode_string __pyx_t_9;
  int __pyx_t_10;
  uint64_t __pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  uint32_t __pyx_t_15;
  __Pyx_RefNannySetupContext("_encode_update_ops", 0);

  /* "asynctnt/iproto/buffer.pyx":377
 *             uint32_t splice_position, splice_offset
 * 
 *         begin = NULL             # <<<<<<<<<<<<<<
 * 
 *         if operations is not None:
 */
  __pyx_v_begin = NULL;

  /* "asynctnt/iproto/buffer.pyx":379
 *         begin = NULL
 * 
 *         if operations is not None:             # <<<<<<<<<<<<<<
 *             ops_len = <uint32_t>cpython.list.PyList_GET_SIZE(operations)
 *         else:
 */
  __pyx_t_1 = (__pyx_v_operations != ((PyObject*)Py_None));
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "asynctnt/iproto/buffer.pyx":380
 * 
 *         if operations is not None:
 *             ops_len = <uint32_t>cpython.list.PyList_GET_SIZE(operations)             # <<<<<<<<<<<<<<
 *         else:
 *             ops_len = 0
 */
    __pyx_v_ops_len = ((uint32_t)PyList_GET_SIZE(__pyx_v_operations));

    /* "asynctnt/iproto/buffer.pyx":379
 *         begin = NULL
 * 
 *         if operations is not None:             # <<<<<<<<<<<<<<
 *             ops_len = <uint32_t>cpython.list.PyList_GET_SIZE(operations)
 *         else:
 */
    goto __pyx_L3;
  }

  /* "asynctnt/iproto/buffer.pyx":382
 *             ops_len = <uint32_t>cpython.list.PyList_GET_SIZE(operations)
 *         else:
 *             ops_len = 0             # <<<<<<<<<<<<<<
 * 
 *         p = self._encode_array(p, ops_len)
 */
  /*else*/ {
    __pyx_v_ops_len = 0;
  }
  __pyx_L3:;

  /* "asynctnt/iproto/buffer.pyx":384
 *             ops_len = 0
 * 
 *         p = self._encode_array(p, ops_len)             # <<<<<<<<<<<<<<
 *         if ops_len == 0:
 *             return p
 */
  __pyx_t_3 = __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__encode_array(__pyx_v_self, __pyx_v_p, __pyx_v_ops_len); if (unlikely(__pyx_t_3 == NULL)) __PYX_ERR(0, 384, __pyx_L1_error)
  __pyx_v_p = __pyx_t_3;

  /* "asynctnt/iproto/buffer.pyx":385
 * 
 *         p = self._encode_array(p, ops_len)
 *         if ops_len == 0:             # <<<<<<<<<<<<<<
 *             return p
 * 
 */
  __pyx_t_2 = ((__pyx_v_ops_len == 0) != 0);
  if (__pyx_t_2) {

    /* "asynctnt/iproto/buffer.pyx":386
 *         p = self._encode_array(p, ops_len)
 *         if ops_len == 0:
 *             return p             # <<<<<<<<<<<<<<
 * 
 *         for operation in operations:
 */
    __pyx_r = __pyx_v_p;
    goto __pyx_L0;

    /* "asynctnt/iproto/buffer.pyx":385
 * 
 *         p = self._encode_array(p, ops_len)
 *         if ops_len == 0:             # <<<<<<<<<<<<<<
 *             return p
 * 
 */
  }

  /* "asynctnt/iproto/buffer.pyx":388
 *             return p
 * 
 *         for operation in operations:             # <<<<<<<<<<<<<<
 *             if not isinstance(operation, (list, tuple)):
 *                 raise TypeError(
 */
  if (unlikely(__pyx_v_operations == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(0, 388, __pyx_L1_error)
  }
  __pyx_t_4 = __pyx_v_operations; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0;
  for (;;) {
    if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_6 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_6); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 388, __pyx_L1_error)
    #else
    __pyx_t_6 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 388, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    #endif
    __Pyx_XDECREF_SET(__pyx_v_operation, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "asynctnt/iproto/buffer.pyx":389
 * 
 *         for operation in operations:
 *             if not isinstance(operation, (list, tuple)):             # <<<<<<<<<<<<<<
 *                 raise TypeError(
 *                     'Single operation must be a tuple or list')
 */
    __pyx_t_1 = PyList_Check(__pyx_v_operation); 
    __pyx_t_7 = (__pyx_t_1 != 0);
    if (!__pyx_t_7) {
    } else {
      __pyx_t_2 = __pyx_t_7;
      goto __pyx_L8_bool_binop_done;
    }
    __pyx_t_7 = PyTuple_Check(__pyx_v_operation); 
    __pyx_t_1 = (__pyx_t_7 != 0);
    __pyx_t_2 = __pyx_t_1;
    __pyx_L8_bool_binop_done:;
    __pyx_t_1 = ((!(__pyx_t_2 != 0)) != 0);
    if (__pyx_t_1) {

      /* "asynctnt/iproto/buffer.pyx":390
 *         for operation in operations:
 *             if not isinstance(operation, (list, tuple)):
 *                 raise TypeError(             # <<<<<<<<<<<<<<
 *                     'Single operation must be a tuple or list')
 * 
 */
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 390, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_Raise(__pyx_t_6, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __PYX_ERR(0, 390, __pyx_L1_error)

      /* "asynctnt/iproto/buffer.pyx":389
 * 
 *         for operation in operations:
 *             if not isinstance(operation, (list, tuple)):             # <<<<<<<<<<<<<<
 *                 raise TypeError(
 *                     'Single operation must be a tuple or list')
 */
    }

    /* "asynctnt/iproto/buffer.pyx":393
 *                     'Single operation must be a tuple or list')
 * 
 *             op_len = <uint32_t>cpython.list.PyList_GET_SIZE(operation)             # <<<<<<<<<<<<<<
 *             if op_len < 3:
 *                 raise IndexError(
 */
    __pyx_v_op_len = ((uint32_t)PyList_GET_SIZE(__pyx_v_operation));

    /* "asynctnt/iproto/buffer.pyx":394
 * 
 *             op_len = <uint32_t>cpython.list.PyList_GET_SIZE(operation)
 *             if op_len < 3:             # <<<<<<<<<<<<<<
 *                 raise IndexError(
 *                     'Operation length must be at least 3')
 */
    __pyx_t_1 = ((__pyx_v_op_len < 3) != 0);
    if (__pyx_t_1) {

      /* "asynctnt/iproto/buffer.pyx":395
 *             op_len = <uint32_t>cpython.list.PyList_GET_SIZE(operation)
 *             if op_len < 3:
 *                 raise IndexError(             # <<<<<<<<<<<<<<
 *                     'Operation length must be at least 3')
 * 
 */
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 395, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_Raise(__pyx_t_6, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __PYX_ERR(0, 395, __pyx_L1_error)

      /* "asynctnt/iproto/buffer.pyx":394
 * 
 *             op_len = <uint32_t>cpython.list.PyList_GET_SIZE(operation)
 *             if op_len < 3:             # <<<<<<<<<<<<<<
 *                 raise IndexError(
 *                     'Operation length must be at least 3')
 */
    }

    /* "asynctnt/iproto/buffer.pyx":398
 *                     'Operation length must be at least 3')
 * 
 *             op_type_str = operation[0]             # <<<<<<<<<<<<<<
 *             if isinstance(op_type_str, str):
 *                 str_temp = encode_unicode_string(op_type_str, self._encoding)
 */
    __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_operation, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 398, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_XDECREF_SET(__pyx_v_op_type_str, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "asynctnt/iproto/buffer.pyx":399
 * 
 *             op_type_str = operation[0]
 *             if isinstance(op_type_str, str):             # <<<<<<<<<<<<<<
 *                 str_temp = encode_unicode_string(op_type_str, self._encoding)
 *             elif isinstance(op_type_str, bytes):
 */
    __pyx_t_1 = PyString_Check(__pyx_v_op_type_str); 
    __pyx_t_2 = (__pyx_t_1 != 0);
    if (__pyx_t_2) {

      /* "asynctnt/iproto/buffer.pyx":400
 *             op_type_str = operation[0]
 *             if isinstance(op_type_str, str):
 *                 str_temp = encode_unicode_string(op_type_str, self._encoding)             # <<<<<<<<<<<<<<
 *             elif isinstance(op_type_str, bytes):
 *                 str_temp = op_type_str
 */
      if (!(likely(PyString_CheckExact(__pyx_v_op_type_str))||((__pyx_v_op_type_str) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_v_op_type_str)->tp_name), 0))) __PYX_ERR(0, 400, __pyx_L1_error)
      __pyx_t_6 = __pyx_v_self->_encoding;
      __Pyx_INCREF(__pyx_t_6);
      __pyx_t_9.__pyx_n = 1;
      __pyx_t_9.encoding = ((PyObject*)__pyx_t_6);
      __pyx_t_8 = __pyx_f_8asynctnt_6iproto_8protocol_encode_unicode_string(((PyObject*)__pyx_v_op_type_str), &__pyx_t_9); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 400, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF_SET(__pyx_v_str_temp, ((PyObject*)__pyx_t_8));
      __pyx_t_8 = 0;

      /* "asynctnt/iproto/buffer.pyx":399
 * 
 *             op_type_str = operation[0]
 *             if isinstance(op_type_str, str):             # <<<<<<<<<<<<<<
 *                 str_temp = encode_unicode_string(op_type_str, self._encoding)
 *             elif isinstance(op_type_str, bytes):
 */
      goto __pyx_L11;
    }

    /* "asynctnt/iproto/buffer.pyx":401
 *             if isinstance(op_type_str, str):
 *                 str_temp = encode_unicode_string(op_type_str, self._encoding)
 *             elif isinstance(op_type_str, bytes):             # <<<<<<<<<<<<<<
 *                 str_temp = op_type_str
 *             else:
 */
    __pyx_t_2 = PyBytes_Check(__pyx_v_op_type_str); 
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (__pyx_t_1) {

      /* "asynctnt/iproto/buffer.pyx":402
 *                 str_temp = encode_unicode_string(op_type_str, self._encoding)
 *             elif isinstance(op_type_str, bytes):
 *                 str_temp = op_type_str             # <<<<<<<<<<<<<<
 *             else:
 *                 raise TypeError(
 */
      if (!(likely(PyBytes_CheckExact(__pyx_v_op_type_str))||((__pyx_v_op_type_str) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_v_op_type_str)->tp_name), 0))) __PYX_ERR(0, 402, __pyx_L1_error)
      __pyx_t_8 = __pyx_v_op_type_str;
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_XDECREF_SET(__pyx_v_str_temp, ((PyObject*)__pyx_t_8));
      __pyx_t_8 = 0;

      /* "asynctnt/iproto/buffer.pyx":401
 *             if isinstance(op_type_str, str):
 *                 str_temp = encode_unicode_string(op_type_str, self._encoding)
 *             elif isinstance(op_type_str, bytes):             # <<<<<<<<<<<<<<
 *                 str_temp = op_type_str
 *             else:
 */
      goto __pyx_L11;
    }

    /* "asynctnt/iproto/buffer.pyx":404
 *                 str_temp = op_type_str
 *             else:
 *                 raise TypeError(             # <<<<<<<<<<<<<<
 *                     'Operation type must of a str or bytes type')
 * 
 */
    /*else*/ {
      __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 404, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_Raise(__pyx_t_8, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __PYX_ERR(0, 404, __pyx_L1_error)
    }
    __pyx_L11:;

    /* "asynctnt/iproto/buffer.pyx":407
 *                     'Operation type must of a str or bytes type')
 * 
 *             cpython.bytes.PyBytes_AsStringAndSize(str_temp,             # <<<<<<<<<<<<<<
 *                                                   &op_str_c, &op_str_len)
 * 
 */
    __pyx_t_10 = PyBytes_AsStringAndSize(__pyx_v_str_temp, (&__pyx_v_op_str_c), ((Py_ssize_t *)(&__pyx_v_op_str_len))); if (unlikely(__pyx_t_10 == -1)) __PYX_ERR(0, 407, __pyx_L1_error)

    /* "asynctnt/iproto/buffer.pyx":410
 *                                                   &op_str_c, &op_str_len)
 * 
 *             op_kind = self._op_type_to_kind(op_str_c, op_str_len)             # <<<<<<<<<<<<<<
 *             if not isinstance(operation[1], int):
 *                 raise TypeError(
 */
    __pyx_v_op_kind = __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__op_type_to_kind(__pyx_v_self, __pyx_v_op_str_c, __pyx_v_op_str_len);

    /* "asynctnt/iproto/buffer.pyx":411
 * 
 *             op_kind = self._op_type_to_kind(op_str_c, op_str_len)
 *             if not isinstance(operation[1], int):             # <<<<<<<<<<<<<<
 *                 raise TypeError(
 *                     'Operation field_no must be of int type')
 */
    __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_operation, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 411, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_1 = PyInt_Check(__pyx_t_8); 
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
    if (__pyx_t_2) {

      /* "asynctnt/iproto/buffer.pyx":412
 *             op_kind = self._op_type_to_kind(op_str_c, op_str_len)
 *             if not isinstance(operation[1], int):
 *                 raise TypeError(             # <<<<<<<<<<<<<<
 *                     'Operation field_no must be of int type')
 *             field_no = <uint64_t>int(operation[1])
 */
      __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 412, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_Raise(__pyx_t_8, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __PYX_ERR(0, 412, __pyx_L1_error)

      /* "asynctnt/iproto/buffer.pyx":411
 * 
 *             op_kind = self._op_type_to_kind(op_str_c, op_str_len)
 *             if not isinstance(operation[1], int):             # <<<<<<<<<<<<<<
 *                 raise TypeError(
 *                     'Operation field_no must be of int type')
 */
    }

    /* "asynctnt/iproto/buffer.pyx":414
 *                 raise TypeError(
 *                     'Operation field_no must be of int type')
 *             field_no = <uint64_t>int(operation[1])             # <<<<<<<<<<<<<<
 * 
 *             if op_kind == tnt.OP_UPD_ARITHMETIC \
 */
    __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_operation, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 414, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_6 = __Pyx_PyNumber_Int(__pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 414, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_11 = __Pyx_PyInt_As_uint64_t(__pyx_t_6); if (unlikely((__pyx_t_11 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 414, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_v_field_no = ((uint64_t)__pyx_t_11);

    /* "asynctnt/iproto/buffer.pyx":416
 *             field_no = <uint64_t>int(operation[1])
 * 
 *             if op_kind == tnt.OP_UPD_ARITHMETIC \             # <<<<<<<<<<<<<<
 *                     or op_kind == tnt.OP_UPD_DELETE:
 *                 op_argument = operation[2]
 */
    switch (__pyx_v_op_kind) {
      case __pyx_e_8asynctnt_6iproto_3tnt_OP_UPD_ARITHMETIC:

      /* "asynctnt/iproto/buffer.pyx":417
 * 
 *             if op_kind == tnt.OP_UPD_ARITHMETIC \
 *                     or op_kind == tnt.OP_UPD_DELETE:             # <<<<<<<<<<<<<<
 *                 op_argument = operation[2]
 *                 if not isinstance(op_argument, int):
 */
      case __pyx_e_8asynctnt_6iproto_3tnt_OP_UPD_DELETE:

      /* "asynctnt/iproto/buffer.pyx":418
 *             if op_kind == tnt.OP_UPD_ARITHMETIC \
 *                     or op_kind == tnt.OP_UPD_DELETE:
 *                 op_argument = operation[2]             # <<<<<<<<<<<<<<
 *                 if not isinstance(op_argument, int):
 *                     raise TypeError(
 */
      __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_operation, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 418, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_XDECREF_SET(__pyx_v_op_argument, __pyx_t_6);
      __pyx_t_6 = 0;

      /* "asynctnt/iproto/buffer.pyx":419
 *                     or op_kind == tnt.OP_UPD_DELETE:
 *                 op_argument = operation[2]
 *                 if not isinstance(op_argument, int):             # <<<<<<<<<<<<<<
 *                     raise TypeError(
 *                         'int argument required for '
 */
      __pyx_t_2 = PyInt_Check(__pyx_v_op_argument); 
      __pyx_t_1 = ((!(__pyx_t_2 != 0)) != 0);
      if (__pyx_t_1) {

        /* "asynctnt/iproto/buffer.pyx":420
 *                 op_argument = operation[2]
 *                 if not isinstance(op_argument, int):
 *                     raise TypeError(             # <<<<<<<<<<<<<<
 *                         'int argument required for '
 *                         'Arithmetic and Delete operations'
 */
        __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 420, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_Raise(__pyx_t_6, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __PYX_ERR(0, 420, __pyx_L1_error)

        /* "asynctnt/iproto/buffer.pyx":419
 *                     or op_kind == tnt.OP_UPD_DELETE:
 *                 op_argument = operation[2]
 *                 if not isinstance(op_argument, int):             # <<<<<<<<<<<<<<
 *                     raise TypeError(
 *                         'int argument required for '
 */
      }

      /* "asynctnt/iproto/buffer.pyx":427
 *                 # + mp_sizeof_str(1)
 *                 # + mp_sizeof_uint(field_no)
 *                 extra_length = 1 + 2 + mp_sizeof_uint(field_no)             # <<<<<<<<<<<<<<
 *                 p = begin = self._ensure_allocated(p, extra_length)
 * 
 */
      __pyx_v_extra_length = (3 + mp_sizeof_uint(__pyx_v_field_no));

      /* "asynctnt/iproto/buffer.pyx":428
 *                 # + mp_sizeof_uint(field_no)
 *                 extra_length = 1 + 2 + mp_sizeof_uint(field_no)
 *                 p = begin = self._ensure_allocated(p, extra_length)             # <<<<<<<<<<<<<<
 * 
 *                 p = mp_encode_array(p, 3)
 */
      __pyx_t_3 = __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__ensure_allocated(__pyx_v_self, __pyx_v_p, __pyx_v_extra_length); if (unlikely(__pyx_t_3 == NULL)) __PYX_ERR(0, 428, __pyx_L1_error)
      __pyx_v_p = __pyx_t_3;
      __pyx_v_begin = __pyx_t_3;

      /* "asynctnt/iproto/buffer.pyx":430
 *                 p = begin = self._ensure_allocated(p, extra_length)
 * 
 *                 p = mp_encode_array(p, 3)             # <<<<<<<<<<<<<<
 *                 p = mp_encode_str(p, op_str_c, 1)
 *                 p = mp_encode_uint(p, field_no)
 */
      __pyx_v_p = mp_encode_array(__pyx_v_p, 3);

      /* "asynctnt/iproto/buffer.pyx":431
 * 
 *                 p = mp_encode_array(p, 3)
 *                 p = mp_encode_str(p, op_str_c, 1)             # <<<<<<<<<<<<<<
 *                 p = mp_encode_uint(p, field_no)
 *                 self._length += (p - begin)
 */
      __pyx_v_p = mp_encode_str(__pyx_v_p, __pyx_v_op_str_c, 1);

      /* "asynctnt/iproto/buffer.pyx":432
 *                 p = mp_encode_array(p, 3)
 *                 p = mp_encode_str(p, op_str_c, 1)
 *                 p = mp_encode_uint(p, field_no)             # <<<<<<<<<<<<<<
 *                 self._length += (p - begin)
 *                 p = self._encode_obj(p, op_argument)
 */
      __pyx_v_p = mp_encode_uint(__pyx_v_p, __pyx_v_field_no);

      /* "asynctnt/iproto/buffer.pyx":433
 *                 p = mp_encode_str(p, op_str_c, 1)
 *                 p = mp_encode_uint(p, field_no)
 *                 self._length += (p - begin)             # <<<<<<<<<<<<<<
 *                 p = self._encode_obj(p, op_argument)
 *             elif op_kind == tnt.OP_UPD_INSERT_ASSIGN:
 */
      __pyx_v_self->_length = (__pyx_v_self->_length + (__pyx_v_p - __pyx_v_begin));

      /* "asynctnt/iproto/buffer.pyx":434
 *                 p = mp_encode_uint(p, field_no)
 *                 self._length += (p - begin)
 *                 p = self._encode_obj(p, op_argument)             # <<<<<<<<<<<<<<
 *             elif op_kind == tnt.OP_UPD_INSERT_ASSIGN:
 *                 op_argument = operation[2]
 */
      __pyx_t_3 = __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__encode_obj(__pyx_v_self, __pyx_v_p, __pyx_v_op_argument); if (unlikely(__pyx_t_3 == NULL)) __PYX_ERR(0, 434, __pyx_L1_error)
      __pyx_v_p = __pyx_t_3;

      /* "asynctnt/iproto/buffer.pyx":416
 *             field_no = <uint64_t>int(operation[1])
 * 
 *             if op_kind == tnt.OP_UPD_ARITHMETIC \             # <<<<<<<<<<<<<<
 *                     or op_kind == tnt.OP_UPD_DELETE:
 *                 op_argument = operation[2]
 */
      break;

      /* "asynctnt/iproto/buffer.pyx":435
 *                 self._length += (p - begin)
 *                 p = self._encode_obj(p, op_argument)
 *             elif op_kind == tnt.OP_UPD_INSERT_ASSIGN:             # <<<<<<<<<<<<<<
 *                 op_argument = operation[2]
 * 
 */
      case __pyx_e_8asynctnt_6iproto_3tnt_OP_UPD_INSERT_ASSIGN:

      /* "asynctnt/iproto/buffer.pyx":436
 *                 p = self._encode_obj(p, op_argument)
 *             elif op_kind == tnt.OP_UPD_INSERT_ASSIGN:
 *                 op_argument = operation[2]             # <<<<<<<<<<<<<<
 * 
 *                 # mp_sizeof_array(3)
 */
      __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_operation, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 436, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_XDECREF_SET(__pyx_v_op_argument, __pyx_t_6);
      __pyx_t_6 = 0;

      /* "asynctnt/iproto/buffer.pyx":441
 *                 # + mp_sizeof_str(1)
 *                 # + mp_sizeof_uint(field_no)
 *                 extra_length = 1 + 2 + mp_sizeof_uint(field_no)             # <<<<<<<<<<<<<<
 *                 p = begin = self._ensure_allocated(p, extra_length)
 * 
 */
      __pyx_v_extra_length = (3 + mp_sizeof_uint(__pyx_v_field_no));

      /* "asynctnt/iproto/buffer.pyx":442
 *                 # + mp_sizeof_uint(field_no)
 *                 extra_length = 1 + 2 + mp_sizeof_uint(field_no)
 *                 p = begin = self._ensure_allocated(p, extra_length)             # <<<<<<<<<<<<<<
 * 
 *                 p = mp_encode_array(p, 3)
 */
      __pyx_t_3 = __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__ensure_allocated(__pyx_v_self, __pyx_v_p, __pyx_v_extra_length); if (unlikely(__pyx_t_3 == NULL)) __PYX_ERR(0, 442, __pyx_L1_error)
      __pyx_v_p = __pyx_t_3;
      __pyx_v_begin = __pyx_t_3;

      /* "asynctnt/iproto/buffer.pyx":444
 *                 p = begin = self._ensure_allocated(p, extra_length)
 * 
 *                 p = mp_encode_array(p, 3)             # <<<<<<<<<<<<<<
 *                 p = mp_encode_str(p, op_str_c, 1)
 *                 p = mp_encode_uint(p, field_no)
 */
      __pyx_v_p = mp_encode_array(__pyx_v_p, 3);

      /* "asynctnt/iproto/buffer.pyx":445
 * 
 *                 p = mp_encode_array(p, 3)
 *                 p = mp_encode_str(p, op_str_c, 1)             # <<<<<<<<<<<<<<
 *                 p = mp_encode_uint(p, field_no)
 *                 self._length += (p - begin)
 */
      __pyx_v_p = mp_encode_str(__pyx_v_p, __pyx_v_op_str_c, 1);

      /* "asynctnt/iproto/buffer.pyx":446
 *                 p = mp_encode_array(p, 3)
 *                 p = mp_encode_str(p, op_str_c, 1)
 *                 p = mp_encode_uint(p, field_no)             # <<<<<<<<<<<<<<
 *                 self._length += (p - begin)
 *                 p = self._encode_obj(p, op_argument)
 */
      __pyx_v_p = mp_encode_uint(__pyx_v_p, __pyx_v_field_no);

      /* "asynctnt/iproto/buffer.pyx":447
 *                 p = mp_encode_str(p, op_str_c, 1)
 *                 p = mp_encode_uint(p, field_no)
 *                 self._length += (p - begin)             # <<<<<<<<<<<<<<
 *                 p = self._encode_obj(p, op_argument)
 * 
 */
      __pyx_v_self->_length = (__pyx_v_self->_length + (__pyx_v_p - __pyx_v_begin));

      /* "asynctnt/iproto/buffer.pyx":448
 *                 p = mp_encode_uint(p, field_no)
 *                 self._length += (p - begin)
 *                 p = self._encode_obj(p, op_argument)             # <<<<<<<<<<<<<<
 * 
 *             elif op_kind == tnt.OP_UPD_SPLICE:
 */
      __pyx_t_3 = __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__encode_obj(__pyx_v_self, __pyx_v_p, __pyx_v_op_argument); if (unlikely(__pyx_t_3 == NULL)) __PYX_ERR(0, 448, __pyx_L1_error)
      __pyx_v_p = __pyx_t_3;

      /* "asynctnt/iproto/buffer.pyx":435
 *                 self._length += (p - begin)
 *                 p = self._encode_obj(p, op_argument)
 *             elif op_kind == tnt.OP_UPD_INSERT_ASSIGN:             # <<<<<<<<<<<<<<
 *                 op_argument = operation[2]
 * 
 */
      break;

      /* "asynctnt/iproto/buffer.pyx":450
 *                 p = self._encode_obj(p, op_argument)
 * 
 *             elif op_kind == tnt.OP_UPD_SPLICE:             # <<<<<<<<<<<<<<
 *                 if op_len < 5:
 *                     raise IndexError(
 */
      case __pyx_e_8asynctnt_6iproto_3tnt_OP_UPD_SPLICE:

      /* "asynctnt/iproto/buffer.pyx":451
 * 
 *             elif op_kind == tnt.OP_UPD_SPLICE:
 *                 if op_len < 5:             # <<<<<<<<<<<<<<
 *                     raise IndexError(
 *                         'Splice operation must have length of 5, '
 */
      __pyx_t_1 = ((__pyx_v_op_len < 5) != 0);
      if (__pyx_t_1) {

        /* "asynctnt/iproto/buffer.pyx":454
 *                     raise IndexError(
 *                         'Splice operation must have length of 5, '
 *                         'but got: {}'.format(op_len)             # <<<<<<<<<<<<<<
 *                     )
 * 
 */
        __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_Splice_operation_must_have_lengt, __pyx_n_s_format); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 454, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_12 = __Pyx_PyInt_From_uint32_t(__pyx_v_op_len); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 454, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        __pyx_t_13 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
          __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_8);
          if (likely(__pyx_t_13)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
            __Pyx_INCREF(__pyx_t_13);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_8, function);
          }
        }
        if (!__pyx_t_13) {
          __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_12); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 454, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          __Pyx_GOTREF(__pyx_t_6);
        } else {
          #if CYTHON_FAST_PYCALL
          if (PyFunction_Check(__pyx_t_8)) {
            PyObject *__pyx_temp[2] = {__pyx_t_13, __pyx_t_12};
            __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 454, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
            __Pyx_GOTREF(__pyx_t_6);
            __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          } else
          #endif
          #if CYTHON_FAST_PYCCALL
          if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) {
            PyObject *__pyx_temp[2] = {__pyx_t_13, __pyx_t_12};
            __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 454, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
            __Pyx_GOTREF(__pyx_t_6);
            __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          } else
          #endif
          {
            __pyx_t_14 = PyTuple_New(1+1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 454, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_14);
            __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_13); __pyx_t_13 = NULL;
            __Pyx_GIVEREF(__pyx_t_12);
            PyTuple_SET_ITEM(__pyx_t_14, 0+1, __pyx_t_12);
            __pyx_t_12 = 0;
            __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_14, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 454, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_6);
            __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
          }
        }
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

        /* "asynctnt/iproto/buffer.pyx":452
 *             elif op_kind == tnt.OP_UPD_SPLICE:
 *                 if op_len < 5:
 *                     raise IndexError(             # <<<<<<<<<<<<<<
 *                         'Splice operation must have length of 5, '
 *                         'but got: {}'.format(op_len)
 */
        __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 452, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_GIVEREF(__pyx_t_6);
        PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6);
        __pyx_t_6 = 0;
        __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_t_8, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 452, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_Raise(__pyx_t_6, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __PYX_ERR(0, 452, __pyx_L1_error)

        /* "asynctnt/iproto/buffer.pyx":451
 * 
 *             elif op_kind == tnt.OP_UPD_SPLICE:
 *                 if op_len < 5:             # <<<<<<<<<<<<<<
 *                     raise IndexError(
 *                         'Splice operation must have length of 5, '
 */
      }

      /* "asynctnt/iproto/buffer.pyx":457
 *                     )
 * 
 *                 splice_position_obj = operation[2]             # <<<<<<<<<<<<<<
 *                 splice_offset_obj = operation[3]
 *                 op_argument = operation[4]
 */
      __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_operation, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 457, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_XDECREF_SET(__pyx_v_splice_position_obj, __pyx_t_6);
      __pyx_t_6 = 0;

      /* "asynctnt/iproto/buffer.pyx":458
 * 
 *                 splice_position_obj = operation[2]
 *                 splice_offset_obj = operation[3]             # <<<<<<<<<<<<<<
 *                 op_argument = operation[4]
 *                 if not isinstance(splice_position_obj, int):
 */
      __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_operation, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 458, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_XDECREF_SET(__pyx_v_splice_offset_obj, __pyx_t_6);
      __pyx_t_6 = 0;

      /* "asynctnt/iproto/buffer.pyx":459
 *                 splice_position_obj = operation[2]
 *                 splice_offset_obj = operation[3]
 *                 op_argument = operation[4]             # <<<<<<<<<<<<<<
 *                 if not isinstance(splice_position_obj, int):
 *                     raise TypeError('Splice position must be int')
 */
      __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_operation, 4, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 459, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_XDECREF_SET(__pyx_v_op_argument, __pyx_t_6);
      __pyx_t_6 = 0;

      /* "asynctnt/iproto/buffer.pyx":460
 *                 splice_offset_obj = operation[3]
 *                 op_argument = operation[4]
 *                 if not isinstance(splice_position_obj, int):             # <<<<<<<<<<<<<<
 *                     raise TypeError('Splice position must be int')
 *                 if not isinstance(splice_offset_obj, int):
 */
      __pyx_t_1 = PyInt_Check(__pyx_v_splice_position_obj); 
      __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
      if (__pyx_t_2) {

        /* "asynctnt/iproto/buffer.pyx":461
 *                 op_argument = operation[4]
 *                 if not isinstance(splice_position_obj, int):
 *                     raise TypeError('Splice position must be int')             # <<<<<<<<<<<<<<
 *                 if not isinstance(splice_offset_obj, int):
 *                     raise TypeError('Splice offset must be int')
 */
        __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 461, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_Raise(__pyx_t_6, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __PYX_ERR(0, 461, __pyx_L1_error)

        /* "asynctnt/iproto/buffer.pyx":460
 *                 splice_offset_obj = operation[3]
 *                 op_argument = operation[4]
 *                 if not isinstance(splice_position_obj, int):             # <<<<<<<<<<<<<<
 *                     raise TypeError('Splice position must be int')
 *                 if not isinstance(splice_offset_obj, int):
 */
      }

      /* "asynctnt/iproto/buffer.pyx":462
 *                 if not isinstance(splice_position_obj, int):
 *                     raise TypeError('Splice position must be int')
 *                 if not isinstance(splice_offset_obj, int):             # <<<<<<<<<<<<<<
 *                     raise TypeError('Splice offset must be int')
 * 
 */
      __pyx_t_2 = PyInt_Check(__pyx_v_splice_offset_obj); 
      __pyx_t_1 = ((!(__pyx_t_2 != 0)) != 0);
      if (__pyx_t_1) {

        /* "asynctnt/iproto/buffer.pyx":463
 *                     raise TypeError('Splice position must be int')
 *                 if not isinstance(splice_offset_obj, int):
 *                     raise TypeError('Splice offset must be int')             # <<<<<<<<<<<<<<
 * 
 *                 splice_position = <uint32_t>splice_position_obj
 */
        __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 463, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_Raise(__pyx_t_6, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __PYX_ERR(0, 463, __pyx_L1_error)

        /* "asynctnt/iproto/buffer.pyx":462
 *                 if not isinstance(splice_position_obj, int):
 *                     raise TypeError('Splice position must be int')
 *                 if not isinstance(splice_offset_obj, int):             # <<<<<<<<<<<<<<
 *                     raise TypeError('Splice offset must be int')
 * 
 */
      }

      /* "asynctnt/iproto/buffer.pyx":465
 *                     raise TypeError('Splice offset must be int')
 * 
 *                 splice_position = <uint32_t>splice_position_obj             # <<<<<<<<<<<<<<
 *                 splice_offset = <uint32_t>splice_offset_obj
 * 
 */
      __pyx_t_15 = __Pyx_PyInt_As_uint32_t(__pyx_v_splice_position_obj); if (unlikely((__pyx_t_15 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 465, __pyx_L1_error)
      __pyx_v_splice_position = ((uint32_t)__pyx_t_15);

      /* "asynctnt/iproto/buffer.pyx":466
 * 
 *                 splice_position = <uint32_t>splice_position_obj
 *                 splice_offset = <uint32_t>splice_offset_obj             # <<<<<<<<<<<<<<
 * 
 *                 # mp_sizeof_array(5) + mp_sizeof_str(1) + ...
 */
      __pyx_t_15 = __Pyx_PyInt_As_uint32_t(__pyx_v_splice_offset_obj); if (unlikely((__pyx_t_15 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 466, __pyx_L1_error)
      __pyx_v_splice_offset = ((uint32_t)__pyx_t_15);

      /* "asynctnt/iproto/buffer.pyx":472
 *                                 + mp_sizeof_uint(field_no) \
 *                                 + mp_sizeof_uint(splice_position) \
 *                                 + mp_sizeof_uint(splice_offset)             # <<<<<<<<<<<<<<
 *                 p = begin = self._ensure_allocated(p, extra_length)
 * 
 */
      __pyx_v_extra_length = (((3 + mp_sizeof_uint(__pyx_v_field_no)) + mp_sizeof_uint(__pyx_v_splice_position)) + mp_sizeof_uint(__pyx_v_splice_offset));

      /* "asynctnt/iproto/buffer.pyx":473
 *                                 + mp_sizeof_uint(splice_position) \
 *                                 + mp_sizeof_uint(splice_offset)
 *                 p = begin = self._ensure_allocated(p, extra_length)             # <<<<<<<<<<<<<<
 * 
 *                 p = mp_encode_array(p, 5)
 */
      __pyx_t_3 = __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__ensure_allocated(__pyx_v_self, __pyx_v_p, __pyx_v_extra_length); if (unlikely(__pyx_t_3 == NULL)) __PYX_ERR(0, 473, __pyx_L1_error)
      __pyx_v_p = __pyx_t_3;
      __pyx_v_begin = __pyx_t_3;

      /* "asynctnt/iproto/buffer.pyx":475
 *                 p = begin = self._ensure_allocated(p, extra_length)
 * 
 *                 p = mp_encode_array(p, 5)             # <<<<<<<<<<<<<<
 *                 p = mp_encode_str(p, op_str_c, 1)
 *                 p = mp_encode_uint(p, field_no)
 */
      __pyx_v_p = mp_encode_array(__pyx_v_p, 5);

      /* "asynctnt/iproto/buffer.pyx":476
 * 
 *                 p = mp_encode_array(p, 5)
 *                 p = mp_encode_str(p, op_str_c, 1)             # <<<<<<<<<<<<<<
 *                 p = mp_encode_uint(p, field_no)
 *                 p = mp_encode_uint(p, splice_position)
 */
      __pyx_v_p = mp_encode_str(__pyx_v_p, __pyx_v_op_str_c, 1);

      /* "asynctnt/iproto/buffer.pyx":477
 *                 p = mp_encode_array(p, 5)
 *                 p = mp_encode_str(p, op_str_c, 1)
 *                 p = mp_encode_uint(p, field_no)             # <<<<<<<<<<<<<<
 *                 p = mp_encode_uint(p, splice_position)
 *                 p = mp_encode_uint(p, splice_offset)
 */
      __pyx_v_p = mp_encode_uint(__pyx_v_p, __pyx_v_field_no);

      /* "asynctnt/iproto/buffer.pyx":478
 *                 p = mp_encode_str(p, op_str_c, 1)
 *                 p = mp_encode_uint(p, field_no)
 *                 p = mp_encode_uint(p, splice_position)             # <<<<<<<<<<<<<<
 *                 p = mp_encode_uint(p, splice_offset)
 *                 self._length += (p - begin)
 */
      __pyx_v_p = mp_encode_uint(__pyx_v_p, __pyx_v_splice_position);

      /* "asynctnt/iproto/buffer.pyx":479
 *                 p = mp_encode_uint(p, field_no)
 *                 p = mp_encode_uint(p, splice_position)
 *                 p = mp_encode_uint(p, splice_offset)             # <<<<<<<<<<<<<<
 *                 self._length += (p - begin)
 *                 p = self._encode_obj(p, op_argument)
 */
      __pyx_v_p = mp_encode_uint(__pyx_v_p, __pyx_v_splice_offset);

      /* "asynctnt/iproto/buffer.pyx":480
 *                 p = mp_encode_uint(p, splice_position)
 *                 p = mp_encode_uint(p, splice_offset)
 *                 self._length += (p - begin)             # <<<<<<<<<<<<<<
 *                 p = self._encode_obj(p, op_argument)
 *             else:
 */
      __pyx_v_self->_length = (__pyx_v_self->_length + (__pyx_v_p - __pyx_v_begin));

      /* "asynctnt/iproto/buffer.pyx":481
 *                 p = mp_encode_uint(p, splice_offset)
 *                 self._length += (p - begin)
 *                 p = self._encode_obj(p, op_argument)             # <<<<<<<<<<<<<<
 *             else:
 *                 raise TypeError(
 */
      __pyx_t_3 = __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__encode_obj(__pyx_v_self, __pyx_v_p, __pyx_v_op_argument); if (unlikely(__pyx_t_3 == NULL)) __PYX_ERR(0, 481, __pyx_L1_error)
      __pyx_v_p = __pyx_t_3;

      /* "asynctnt/iproto/buffer.pyx":450
 *                 p = self._encode_obj(p, op_argument)
 * 
 *             elif op_kind == tnt.OP_UPD_SPLICE:             # <<<<<<<<<<<<<<
 *                 if op_len < 5:
 *                     raise IndexError(
 */
      break;
      default:

      /* "asynctnt/iproto/buffer.pyx":484
 *             else:
 *                 raise TypeError(
 *                     'Unknown update operation type `{}`'.format(op_type_str))             # <<<<<<<<<<<<<<
 *         return p
 * 
 */
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_Unknown_update_operation_type, __pyx_n_s_format); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 484, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_14 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
        __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_8);
        if (likely(__pyx_t_14)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
          __Pyx_INCREF(__pyx_t_14);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_8, function);
        }
      }
      if (!__pyx_t_14) {
        __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_v_op_type_str); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 484, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_8)) {
          PyObject *__pyx_temp[2] = {__pyx_t_14, __pyx_v_op_type_str};
          __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 484, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
          __Pyx_GOTREF(__pyx_t_6);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) {
          PyObject *__pyx_temp[2] = {__pyx_t_14, __pyx_v_op_type_str};
          __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 484, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
          __Pyx_GOTREF(__pyx_t_6);
        } else
        #endif
        {
          __pyx_t_12 = PyTuple_New(1+1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 484, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_12);
          __Pyx_GIVEREF(__pyx_t_14); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_14); __pyx_t_14 = NULL;
          __Pyx_INCREF(__pyx_v_op_type_str);
          __Pyx_GIVEREF(__pyx_v_op_type_str);
          PyTuple_SET_ITEM(__pyx_t_12, 0+1, __pyx_v_op_type_str);
          __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_12, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 484, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

      /* "asynctnt/iproto/buffer.pyx":483
 *                 p = self._encode_obj(p, op_argument)
 *             else:
 *                 raise TypeError(             # <<<<<<<<<<<<<<
 *                     'Unknown update operation type `{}`'.format(op_type_str))
 *         return p
 */
      __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 483, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6);
      __pyx_t_6 = 0;
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_t_8, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 483, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_Raise(__pyx_t_6, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __PYX_ERR(0, 483, __pyx_L1_error)
      break;
    }

    /* "asynctnt/iproto/buffer.pyx":388
 *             return p
 * 
 *         for operation in operations:             # <<<<<<<<<<<<<<
 *             if not isinstance(operation, (list, tuple)):
 *                 raise TypeError(
 */
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "asynctnt/iproto/buffer.pyx":485
 *                 raise TypeError(
 *                     'Unknown update operation type `{}`'.format(op_type_str))
 *         return p             # <<<<<<<<<<<<<<
 * 
 *     cdef void encode_request_call(self, str func_name, list args) except *:
 */
  __pyx_r = __pyx_v_p;
  goto __pyx_L0;

  /* "asynctnt/iproto/buffer.pyx":359
 *             return tnt.OP_UPD_UNKNOWN
 * 
 *     cdef char *_encode_update_ops(self, char *p, list operations) except NULL:             # <<<<<<<<<<<<<<
 *         cdef:
 *             char *begin
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_AddTraceback("asynctnt.iproto.protocol.WriteBuffer._encode_update_ops", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_str_temp);
  __Pyx_XDECREF(__pyx_v_operation);
  __Pyx_XDECREF(__pyx_v_op_type_str);
  __Pyx_XDECREF(__pyx_v_op_argument);
  __Pyx_XDECREF(__pyx_v_splice_position_obj);
  __Pyx_XDECREF(__pyx_v_splice_offset_obj);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/buffer.pyx":487
 *         return p
 * 
 *     cdef void encode_request_call(self, str func_name, list args) except *:             # <<<<<<<<<<<<<<
 *         cdef:
 *             char *begin
 */

static void __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer_encode_request_call(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *__pyx_v_self, PyObject *__pyx_v_func_name, PyObject *__pyx_v_args) {
  char *__pyx_v_begin;
  char *__pyx_v_p;
  uint32_t __pyx_v_body_map_sz;
  uint32_t __pyx_v_max_body_len;
  PyObject *__pyx_v_func_name_temp = 0;
  char *__pyx_v_func_name_str;
  Py_ssize_t __pyx_v_func_name_len;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  struct __pyx_opt_args_8asynctnt_6iproto_8protocol_encode_unicode_string __pyx_t_3;
  int __pyx_t_4;
  char *__pyx_t_5;
  __Pyx_RefNannySetupContext("encode_request_call", 0);

  /* "asynctnt/iproto/buffer.pyx":498
 *             ssize_t func_name_len
 * 
 *         func_name_str = NULL             # <<<<<<<<<<<<<<
 *         func_name_len = 0
 * 
 */
  __pyx_v_func_name_str = NULL;

  /* "asynctnt/iproto/buffer.pyx":499
 * 
 *         func_name_str = NULL
 *         func_name_len = 0             # <<<<<<<<<<<<<<
 * 
 *         func_name_temp = encode_unicode_string(func_name, self._encoding)
 */
  __pyx_v_func_name_len = 0;

  /* "asynctnt/iproto/buffer.pyx":501
 *         func_name_len = 0
 * 
 *         func_name_temp = encode_unicode_string(func_name, self._encoding)             # <<<<<<<<<<<<<<
 *         cpython.bytes.PyBytes_AsStringAndSize(func_name_temp,
 *                                               &func_name_str,
 */
  __pyx_t_1 = __pyx_v_self->_encoding;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_3.__pyx_n = 1;
  __pyx_t_3.encoding = ((PyObject*)__pyx_t_1);
  __pyx_t_2 = __pyx_f_8asynctnt_6iproto_8protocol_encode_unicode_string(__pyx_v_func_name, &__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 501, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_func_name_temp = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "asynctnt/iproto/buffer.pyx":502
 * 
 *         func_name_temp = encode_unicode_string(func_name, self._encoding)
 *         cpython.bytes.PyBytes_AsStringAndSize(func_name_temp,             # <<<<<<<<<<<<<<
 *                                               &func_name_str,
 *                                               &func_name_len)
 */
  __pyx_t_4 = PyBytes_AsStringAndSize(__pyx_v_func_name_temp, (&__pyx_v_func_name_str), ((Py_ssize_t *)(&__pyx_v_func_name_len))); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(0, 502, __pyx_L1_error)

  /* "asynctnt/iproto/buffer.pyx":505
 *                                               &func_name_str,
 *                                               &func_name_len)
 *         body_map_sz = 2             # <<<<<<<<<<<<<<
 *         # Size description:
 *         # mp_sizeof_map()
 */
  __pyx_v_body_map_sz = 2;

  /* "asynctnt/iproto/buffer.pyx":514
 *                        + 1 \
 *                        + mp_sizeof_str(<uint32_t>func_name_len) \
 *                        + 1             # <<<<<<<<<<<<<<
 * 
 *         self.ensure_allocated(max_body_len)
 */
  __pyx_v_max_body_len = ((2 + mp_sizeof_str(((uint32_t)__pyx_v_func_name_len))) + 1);

  /* "asynctnt/iproto/buffer.pyx":516
 *                        + 1
 * 
 *         self.ensure_allocated(max_body_len)             # <<<<<<<<<<<<<<
 * 
 *         p = begin = &self._buf[self._length]
 */
  __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer_ensure_allocated(__pyx_v_self, __pyx_v_max_body_len); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 516, __pyx_L1_error)

  /* "asynctnt/iproto/buffer.pyx":518
 *         self.ensure_allocated(max_body_len)
 * 
 *         p = begin = &self._buf[self._length]             # <<<<<<<<<<<<<<
 *         p = mp_encode_map(p, body_map_sz)
 *         p = mp_encode_uint(p, tnt.TP_FUNCTION)
 */
  __pyx_t_5 = (&(__pyx_v_self->_buf[__pyx_v_self->_length]));
  __pyx_v_p = __pyx_t_5;
  __pyx_v_begin = __pyx_t_5;

  /* "asynctnt/iproto/buffer.pyx":519
 * 
 *         p = begin = &self._buf[self._length]
 *         p = mp_encode_map(p, body_map_sz)             # <<<<<<<<<<<<<<
 *         p = mp_encode_uint(p, tnt.TP_FUNCTION)
 *         p = mp_encode_str(p, func_name_str, <uint32_t>func_name_len)
 */
  __pyx_v_p = mp_encode_map(__pyx_v_p, __pyx_v_body_map_sz);

  /* "asynctnt/iproto/buffer.pyx":520
 *         p = begin = &self._buf[self._length]
 *         p = mp_encode_map(p, body_map_sz)
 *         p = mp_encode_uint(p, tnt.TP_FUNCTION)             # <<<<<<<<<<<<<<
 *         p = mp_encode_str(p, func_name_str, <uint32_t>func_name_len)
 * 
 */
  __pyx_v_p = mp_encode_uint(__pyx_v_p, __pyx_e_8asynctnt_6iproto_3tnt_TP_FUNCTION);

  /* "asynctnt/iproto/buffer.pyx":521
 *         p = mp_encode_map(p, body_map_sz)
 *         p = mp_encode_uint(p, tnt.TP_FUNCTION)
 *         p = mp_encode_str(p, func_name_str, <uint32_t>func_name_len)             # <<<<<<<<<<<<<<
 * 
 *         p = mp_encode_uint(p, tnt.TP_TUPLE)
 */
  __pyx_v_p = mp_encode_str(__pyx_v_p, __pyx_v_func_name_str, ((uint32_t)__pyx_v_func_name_len));

  /* "asynctnt/iproto/buffer.pyx":523
 *         p = mp_encode_str(p, func_name_str, <uint32_t>func_name_len)
 * 
 *         p = mp_encode_uint(p, tnt.TP_TUPLE)             # <<<<<<<<<<<<<<
 *         self._length += (p - begin)
 *         p = self._encode_list(p, args)
 */
  __pyx_v_p = mp_encode_uint(__pyx_v_p, __pyx_e_8asynctnt_6iproto_3tnt_TP_TUPLE);

  /* "asynctnt/iproto/buffer.pyx":524
 * 
 *         p = mp_encode_uint(p, tnt.TP_TUPLE)
 *         self._length += (p - begin)             # <<<<<<<<<<<<<<
 *         p = self._encode_list(p, args)
 * 
 */
  __pyx_v_self->_length = (__pyx_v_self->_length + (__pyx_v_p - __pyx_v_begin));

  /* "asynctnt/iproto/buffer.pyx":525
 *         p = mp_encode_uint(p, tnt.TP_TUPLE)
 *         self._length += (p - begin)
 *         p = self._encode_list(p, args)             # <<<<<<<<<<<<<<
 * 
 *     cdef void encode_request_eval(self, str expression, list args) except *:
 */
  __pyx_t_5 = __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__encode_list(__pyx_v_self, __pyx_v_p, __pyx_v_args); if (unlikely(__pyx_t_5 == NULL)) __PYX_ERR(0, 525, __pyx_L1_error)
  __pyx_v_p = __pyx_t_5;

  /* "asynctnt/iproto/buffer.pyx":487
 *         return p
 * 
 *     cdef void encode_request_call(self, str func_name, list args) except *:             # <<<<<<<<<<<<<<
 *         cdef:
 *             char *begin
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("asynctnt.iproto.protocol.WriteBuffer.encode_request_call", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_func_name_temp);
  __Pyx_RefNannyFinishContext();
}

/* "asynctnt/iproto/buffer.pyx":527
 *         p = self._encode_list(p, args)
 * 
 *     cdef void encode_request_eval(self, str expression, list args) except *:             # <<<<<<<<<<<<<<
 *         cdef:
 *             char *begin
 */

static void __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer_encode_request_eval(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *__pyx_v_self, PyObject *__pyx_v_expression, PyObject *__pyx_v_args) {
  char *__pyx_v_begin;
  char *__pyx_v_p;
  uint32_t __pyx_v_body_map_sz;
  uint32_t __pyx_v_max_body_len;
  PyObject *__pyx_v_expression_temp = 0;
  char *__pyx_v_expression_str;
  Py_ssize_t __pyx_v_expression_len;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  struct __pyx_opt_args_8asynctnt_6iproto_8protocol_encode_unicode_string __pyx_t_3;
  int __pyx_t_4;
  char *__pyx_t_5;
  __Pyx_RefNannySetupContext("encode_request_eval", 0);

  /* "asynctnt/iproto/buffer.pyx":538
 *             ssize_t expression_len
 * 
 *         expression_str = NULL             # <<<<<<<<<<<<<<
 *         expression_len = 0
 * 
 */
  __pyx_v_expression_str = NULL;

  /* "asynctnt/iproto/buffer.pyx":539
 * 
 *         expression_str = NULL
 *         expression_len = 0             # <<<<<<<<<<<<<<
 * 
 *         expression_temp = encode_unicode_string(expression, self._encoding)
 */
  __pyx_v_expression_len = 0;

  /* "asynctnt/iproto/buffer.pyx":541
 *         expression_len = 0
 * 
 *         expression_temp = encode_unicode_string(expression, self._encoding)             # <<<<<<<<<<<<<<
 *         cpython.bytes.PyBytes_AsStringAndSize(expression_temp,
 *                                               &expression_str,
 */
  __pyx_t_1 = __pyx_v_self->_encoding;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_3.__pyx_n = 1;
  __pyx_t_3.encoding = ((PyObject*)__pyx_t_1);
  __pyx_t_2 = __pyx_f_8asynctnt_6iproto_8protocol_encode_unicode_string(__pyx_v_expression, &__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 541, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_expression_temp = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "asynctnt/iproto/buffer.pyx":542
 * 
 *         expression_temp = encode_unicode_string(expression, self._encoding)
 *         cpython.bytes.PyBytes_AsStringAndSize(expression_temp,             # <<<<<<<<<<<<<<
 *                                               &expression_str,
 *                                               &expression_len)
 */
  __pyx_t_4 = PyBytes_AsStringAndSize(__pyx_v_expression_temp, (&__pyx_v_expression_str), ((Py_ssize_t *)(&__pyx_v_expression_len))); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(0, 542, __pyx_L1_error)

  /* "asynctnt/iproto/buffer.pyx":545
 *                                               &expression_str,
 *                                               &expression_len)
 *         body_map_sz = 2             # <<<<<<<<<<<<<<
 *         # Size description:
 *         # mp_sizeof_map()
 */
  __pyx_v_body_map_sz = 2;

  /* "asynctnt/iproto/buffer.pyx":554
 *                        + 1 \
 *                        + mp_sizeof_str(<uint32_t>expression_len) \
 *                        + 1             # <<<<<<<<<<<<<<
 * 
 *         self.ensure_allocated(max_body_len)
 */
  __pyx_v_max_body_len = ((2 + mp_sizeof_str(((uint32_t)__pyx_v_expression_len))) + 1);

  /* "asynctnt/iproto/buffer.pyx":556
 *                        + 1
 * 
 *         self.ensure_allocated(max_body_len)             # <<<<<<<<<<<<<<
 * 
 *         p = begin = &self._buf[self._length]
 */
  __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer_ensure_allocated(__pyx_v_self, __pyx_v_max_body_len); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 556, __pyx_L1_error)

  /* "asynctnt/iproto/buffer.pyx":558
 *         self.ensure_allocated(max_body_len)
 * 
 *         p = begin = &self._buf[self._length]             # <<<<<<<<<<<<<<
 *         p = mp_encode_map(p, body_map_sz)
 *         p = mp_encode_uint(p, tnt.TP_EXPRESSION)
 */
  __pyx_t_5 = (&(__pyx_v_self->_buf[__pyx_v_self->_length]));
  __pyx_v_p = __pyx_t_5;
  __pyx_v_begin = __pyx_t_5;

  /* "asynctnt/iproto/buffer.pyx":559
 * 
 *         p = begin = &self._buf[self._length]
 *         p = mp_encode_map(p, body_map_sz)             # <<<<<<<<<<<<<<
 *         p = mp_encode_uint(p, tnt.TP_EXPRESSION)
 *         p = mp_encode_str(p, expression_str, <uint32_t>expression_len)
 */
  __pyx_v_p = mp_encode_map(__pyx_v_p, __pyx_v_body_map_sz);

  /* "asynctnt/iproto/buffer.pyx":560
 *         p = begin = &self._buf[self._length]
 *         p = mp_encode_map(p, body_map_sz)
 *         p = mp_encode_uint(p, tnt.TP_EXPRESSION)             # <<<<<<<<<<<<<<
 *         p = mp_encode_str(p, expression_str, <uint32_t>expression_len)
 * 
 */
  __pyx_v_p = mp_encode_uint(__pyx_v_p, __pyx_e_8asynctnt_6iproto_3tnt_TP_EXPRESSION);

  /* "asynctnt/iproto/buffer.pyx":561
 *         p = mp_encode_map(p, body_map_sz)
 *         p = mp_encode_uint(p, tnt.TP_EXPRESSION)
 *         p = mp_encode_str(p, expression_str, <uint32_t>expression_len)             # <<<<<<<<<<<<<<
 * 
 *         p = mp_encode_uint(p, tnt.TP_TUPLE)
 */
  __pyx_v_p = mp_encode_str(__pyx_v_p, __pyx_v_expression_str, ((uint32_t)__pyx_v_expression_len));

  /* "asynctnt/iproto/buffer.pyx":563
 *         p = mp_encode_str(p, expression_str, <uint32_t>expression_len)
 * 
 *         p = mp_encode_uint(p, tnt.TP_TUPLE)             # <<<<<<<<<<<<<<
 *         self._length += (p - begin)
 *         p = self._encode_list(p, args)
 */
  __pyx_v_p = mp_encode_uint(__pyx_v_p, __pyx_e_8asynctnt_6iproto_3tnt_TP_TUPLE);

  /* "asynctnt/iproto/buffer.pyx":564
 * 
 *         p = mp_encode_uint(p, tnt.TP_TUPLE)
 *         self._length += (p - begin)             # <<<<<<<<<<<<<<
 *         p = self._encode_list(p, args)
 * 
 */
  __pyx_v_self->_length = (__pyx_v_self->_length + (__pyx_v_p - __pyx_v_begin));

  /* "asynctnt/iproto/buffer.pyx":565
 *         p = mp_encode_uint(p, tnt.TP_TUPLE)
 *         self._length += (p - begin)
 *         p = self._encode_list(p, args)             # <<<<<<<<<<<<<<
 * 
 *     cdef void encode_request_select(self, uint32_t space, uint32_t index,
 */
  __pyx_t_5 = __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__encode_list(__pyx_v_self, __pyx_v_p, __pyx_v_args); if (unlikely(__pyx_t_5 == NULL)) __PYX_ERR(0, 565, __pyx_L1_error)
  __pyx_v_p = __pyx_t_5;

  /* "asynctnt/iproto/buffer.pyx":527
 *         p = self._encode_list(p, args)
 * 
 *     cdef void encode_request_eval(self, str expression, list args) except *:             # <<<<<<<<<<<<<<
 *         cdef:
 *             char *begin
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("asynctnt.iproto.protocol.WriteBuffer.encode_request_eval", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_expression_temp);
  __Pyx_RefNannyFinishContext();
}

/* "asynctnt/iproto/buffer.pyx":567
 *         p = self._encode_list(p, args)
 * 
 *     cdef void encode_request_select(self, uint32_t space, uint32_t index,             # <<<<<<<<<<<<<<
 *                                     list key, uint64_t offset, uint64_t limit,
 *                                     uint32_t iterator) except *:
 */

static void __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer_encode_request_select(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *__pyx_v_self, uint32_t __pyx_v_space, uint32_t __pyx_v_index, PyObject *__pyx_v_key, uint64_t __pyx_v_offset, uint64_t __pyx_v_limit, uint32_t __pyx_v_iterator) {
  char *__pyx_v_begin;
  char *__pyx_v_p;
  uint32_t __pyx_v_body_map_sz;
  uint32_t __pyx_v_max_body_len;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  char *__pyx_t_2;
  __Pyx_RefNannySetupContext("encode_request_select", 0);

  /* "asynctnt/iproto/buffer.pyx":579
 *                       + <uint32_t>(index > 0) \
 *                       + <uint32_t>(offset > 0) \
 *                       + <uint32_t>(iterator > 0)             # <<<<<<<<<<<<<<
 *         # Size description:
 *         # mp_sizeof_map(body_map_sz)
 */
  __pyx_v_body_map_sz = (((3 + ((uint32_t)(__pyx_v_index > 0))) + ((uint32_t)(__pyx_v_offset > 0))) + ((uint32_t)(__pyx_v_iterator > 0)));

  /* "asynctnt/iproto/buffer.pyx":590
 *                        + 9 \
 *                        + 1 \
 *                        + 9             # <<<<<<<<<<<<<<
 * 
 *         if index > 0:
 */
  __pyx_v_max_body_len = 21;

  /* "asynctnt/iproto/buffer.pyx":592
 *                        + 9
 * 
 *         if index > 0:             # <<<<<<<<<<<<<<
 *             # mp_sizeof_uint(TP_INDEX) + mp_sizeof_uint(index)
 *             max_body_len += 1 + 9
 */
  __pyx_t_1 = ((__pyx_v_index > 0) != 0);
  if (__pyx_t_1) {

    /* "asynctnt/iproto/buffer.pyx":594
 *         if index > 0:
 *             # mp_sizeof_uint(TP_INDEX) + mp_sizeof_uint(index)
 *             max_body_len += 1 + 9             # <<<<<<<<<<<<<<
 *         if offset > 0:
 *             # mp_sizeof_uint(TP_OFFSET) + mp_sizeof_uint(offset)
 */
    __pyx_v_max_body_len = (__pyx_v_max_body_len + 10);

    /* "asynctnt/iproto/buffer.pyx":592
 *                        + 9
 * 
 *         if index > 0:             # <<<<<<<<<<<<<<
 *             # mp_sizeof_uint(TP_INDEX) + mp_sizeof_uint(index)
 *             max_body_len += 1 + 9
 */
  }

  /* "asynctnt/iproto/buffer.pyx":595
 *             # mp_sizeof_uint(TP_INDEX) + mp_sizeof_uint(index)
 *             max_body_len += 1 + 9
 *         if offset > 0:             # <<<<<<<<<<<<<<
 *             # mp_sizeof_uint(TP_OFFSET) + mp_sizeof_uint(offset)
 *             max_body_len += 1 + 9
 */
  __pyx_t_1 = ((__pyx_v_offset > 0) != 0);
  if (__pyx_t_1) {

    /* "asynctnt/iproto/buffer.pyx":597
 *         if offset > 0:
 *             # mp_sizeof_uint(TP_OFFSET) + mp_sizeof_uint(offset)
 *             max_body_len += 1 + 9             # <<<<<<<<<<<<<<
 *         if iterator > 0:
 *             # mp_sizeof_uint(TP_ITERATOR) + mp_sizeof_uint(iterator)
 */
    __pyx_v_max_body_len = (__pyx_v_max_body_len + 10);

    /* "asynctnt/iproto/buffer.pyx":595
 *             # mp_sizeof_uint(TP_INDEX) + mp_sizeof_uint(index)
 *             max_body_len += 1 + 9
 *         if offset > 0:             # <<<<<<<<<<<<<<
 *             # mp_sizeof_uint(TP_OFFSET) + mp_sizeof_uint(offset)
 *             max_body_len += 1 + 9
 */
  }

  /* "asynctnt/iproto/buffer.pyx":598
 *             # mp_sizeof_uint(TP_OFFSET) + mp_sizeof_uint(offset)
 *             max_body_len += 1 + 9
 *         if iterator > 0:             # <<<<<<<<<<<<<<
 *             # mp_sizeof_uint(TP_ITERATOR) + mp_sizeof_uint(iterator)
 *             max_body_len += 1 + 1
 */
  __pyx_t_1 = ((__pyx_v_iterator > 0) != 0);
  if (__pyx_t_1) {

    /* "asynctnt/iproto/buffer.pyx":600
 *         if iterator > 0:
 *             # mp_sizeof_uint(TP_ITERATOR) + mp_sizeof_uint(iterator)
 *             max_body_len += 1 + 1             # <<<<<<<<<<<<<<
 * 
 *         max_body_len += 1  # mp_sizeof_uint(TP_KEY);
 */
    __pyx_v_max_body_len = (__pyx_v_max_body_len + 2);

    /* "asynctnt/iproto/buffer.pyx":598
 *             # mp_sizeof_uint(TP_OFFSET) + mp_sizeof_uint(offset)
 *             max_body_len += 1 + 9
 *         if iterator > 0:             # <<<<<<<<<<<<<<
 *             # mp_sizeof_uint(TP_ITERATOR) + mp_sizeof_uint(iterator)
 *             max_body_len += 1 + 1
 */
  }

  /* "asynctnt/iproto/buffer.pyx":602
 *             max_body_len += 1 + 1
 * 
 *         max_body_len += 1  # mp_sizeof_uint(TP_KEY);             # <<<<<<<<<<<<<<
 * 
 *         self.ensure_allocated(max_body_len)
 */
  __pyx_v_max_body_len = (__pyx_v_max_body_len + 1);

  /* "asynctnt/iproto/buffer.pyx":604
 *         max_body_len += 1  # mp_sizeof_uint(TP_KEY);
 * 
 *         self.ensure_allocated(max_body_len)             # <<<<<<<<<<<<<<
 * 
 *         p = begin = &self._buf[self._length]
 */
  __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer_ensure_allocated(__pyx_v_self, __pyx_v_max_body_len); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 604, __pyx_L1_error)

  /* "asynctnt/iproto/buffer.pyx":606
 *         self.ensure_allocated(max_body_len)
 * 
 *         p = begin = &self._buf[self._length]             # <<<<<<<<<<<<<<
 *         p = mp_encode_map(p, body_map_sz)
 *         p = mp_encode_uint(p, tnt.TP_SPACE)
 */
  __pyx_t_2 = (&(__pyx_v_self->_buf[__pyx_v_self->_length]));
  __pyx_v_p = __pyx_t_2;
  __pyx_v_begin = __pyx_t_2;

  /* "asynctnt/iproto/buffer.pyx":607
 * 
 *         p = begin = &self._buf[self._length]
 *         p = mp_encode_map(p, body_map_sz)             # <<<<<<<<<<<<<<
 *         p = mp_encode_uint(p, tnt.TP_SPACE)
 *         p = mp_encode_uint(p, space)
 */
  __pyx_v_p = mp_encode_map(__pyx_v_p, __pyx_v_body_map_sz);

  /* "asynctnt/iproto/buffer.pyx":608
 *         p = begin = &self._buf[self._length]
 *         p = mp_encode_map(p, body_map_sz)
 *         p = mp_encode_uint(p, tnt.TP_SPACE)             # <<<<<<<<<<<<<<
 *         p = mp_encode_uint(p, space)
 *         p = mp_encode_uint(p, tnt.TP_LIMIT)
 */
  __pyx_v_p = mp_encode_uint(__pyx_v_p, __pyx_e_8asynctnt_6iproto_3tnt_TP_SPACE);

  /* "asynctnt/iproto/buffer.pyx":609
 *         p = mp_encode_map(p, body_map_sz)
 *         p = mp_encode_uint(p, tnt.TP_SPACE)
 *         p = mp_encode_uint(p, space)             # <<<<<<<<<<<<<<
 *         p = mp_encode_uint(p, tnt.TP_LIMIT)
 *         p = mp_encode_uint(p, limit)
 */
  __pyx_v_p = mp_encode_uint(__pyx_v_p, __pyx_v_space);

  /* "asynctnt/iproto/buffer.pyx":610
 *         p = mp_encode_uint(p, tnt.TP_SPACE)
 *         p = mp_encode_uint(p, space)
 *         p = mp_encode_uint(p, tnt.TP_LIMIT)             # <<<<<<<<<<<<<<
 *         p = mp_encode_uint(p, limit)
 * 
 */
  __pyx_v_p = mp_encode_uint(__pyx_v_p, __pyx_e_8asynctnt_6iproto_3tnt_TP_LIMIT);

  /* "asynctnt/iproto/buffer.pyx":611
 *         p = mp_encode_uint(p, space)
 *         p = mp_encode_uint(p, tnt.TP_LIMIT)
 *         p = mp_encode_uint(p, limit)             # <<<<<<<<<<<<<<
 * 
 *         if index > 0:
 */
  __pyx_v_p = mp_encode_uint(__pyx_v_p, __pyx_v_limit);

  /* "asynctnt/iproto/buffer.pyx":613
 *         p = mp_encode_uint(p, limit)
 * 
 *         if index > 0:             # <<<<<<<<<<<<<<
 *             p = mp_encode_uint(p, tnt.TP_INDEX)
 *             p = mp_encode_uint(p, index)
 */
  __pyx_t_1 = ((__pyx_v_index > 0) != 0);
  if (__pyx_t_1) {

    /* "asynctnt/iproto/buffer.pyx":614
 * 
 *         if index > 0:
 *             p = mp_encode_uint(p, tnt.TP_INDEX)             # <<<<<<<<<<<<<<
 *             p = mp_encode_uint(p, index)
 *         if offset > 0:
 */
    __pyx_v_p = mp_encode_uint(__pyx_v_p, __pyx_e_8asynctnt_6iproto_3tnt_TP_INDEX);

    /* "asynctnt/iproto/buffer.pyx":615
 *         if index > 0:
 *             p = mp_encode_uint(p, tnt.TP_INDEX)
 *             p = mp_encode_uint(p, index)             # <<<<<<<<<<<<<<
 *         if offset > 0:
 *             p = mp_encode_uint(p, tnt.TP_OFFSET)
 */
    __pyx_v_p = mp_encode_uint(__pyx_v_p, __pyx_v_index);

    /* "asynctnt/iproto/buffer.pyx":613
 *         p = mp_encode_uint(p, limit)
 * 
 *         if index > 0:             # <<<<<<<<<<<<<<
 *             p = mp_encode_uint(p, tnt.TP_INDEX)
 *             p = mp_encode_uint(p, index)
 */
  }

  /* "asynctnt/iproto/buffer.pyx":616
 *             p = mp_encode_uint(p, tnt.TP_INDEX)
 *             p = mp_encode_uint(p, index)
 *         if offset > 0:             # <<<<<<<<<<<<<<
 *             p = mp_encode_uint(p, tnt.TP_OFFSET)
 *             p = mp_encode_uint(p, offset)
 */
  __pyx_t_1 = ((__pyx_v_offset > 0) != 0);
  if (__pyx_t_1) {

    /* "asynctnt/iproto/buffer.pyx":617
 *             p = mp_encode_uint(p, index)
 *         if offset > 0:
 *             p = mp_encode_uint(p, tnt.TP_OFFSET)             # <<<<<<<<<<<<<<
 *             p = mp_encode_uint(p, offset)
 *         if iterator > 0:
 */
    __pyx_v_p = mp_encode_uint(__pyx_v_p, __pyx_e_8asynctnt_6iproto_3tnt_TP_OFFSET);

    /* "asynctnt/iproto/buffer.pyx":618
 *         if offset > 0:
 *             p = mp_encode_uint(p, tnt.TP_OFFSET)
 *             p = mp_encode_uint(p, offset)             # <<<<<<<<<<<<<<
 *         if iterator > 0:
 *             p = mp_encode_uint(p, tnt.TP_ITERATOR)
 */
    __pyx_v_p = mp_encode_uint(__pyx_v_p, __pyx_v_offset);

    /* "asynctnt/iproto/buffer.pyx":616
 *             p = mp_encode_uint(p, tnt.TP_INDEX)
 *             p = mp_encode_uint(p, index)
 *         if offset > 0:             # <<<<<<<<<<<<<<
 *             p = mp_encode_uint(p, tnt.TP_OFFSET)
 *             p = mp_encode_uint(p, offset)
 */
  }

  /* "asynctnt/iproto/buffer.pyx":619
 *             p = mp_encode_uint(p, tnt.TP_OFFSET)
 *             p = mp_encode_uint(p, offset)
 *         if iterator > 0:             # <<<<<<<<<<<<<<
 *             p = mp_encode_uint(p, tnt.TP_ITERATOR)
 *             p = mp_encode_uint(p, iterator)
 */
  __pyx_t_1 = ((__pyx_v_iterator > 0) != 0);
  if (__pyx_t_1) {

    /* "asynctnt/iproto/buffer.pyx":620
 *             p = mp_encode_uint(p, offset)
 *         if iterator > 0:
 *             p = mp_encode_uint(p, tnt.TP_ITERATOR)             # <<<<<<<<<<<<<<
 *             p = mp_encode_uint(p, iterator)
 * 
 */
    __pyx_v_p = mp_encode_uint(__pyx_v_p, __pyx_e_8asynctnt_6iproto_3tnt_TP_ITERATOR);

    /* "asynctnt/iproto/buffer.pyx":621
 *         if iterator > 0:
 *             p = mp_encode_uint(p, tnt.TP_ITERATOR)
 *             p = mp_encode_uint(p, iterator)             # <<<<<<<<<<<<<<
 * 
 *         p = mp_encode_uint(p, tnt.TP_KEY)
 */
    __pyx_v_p = mp_encode_uint(__pyx_v_p, __pyx_v_iterator);

    /* "asynctnt/iproto/buffer.pyx":619
 *             p = mp_encode_uint(p, tnt.TP_OFFSET)
 *             p = mp_encode_uint(p, offset)
 *         if iterator > 0:             # <<<<<<<<<<<<<<
 *             p = mp_encode_uint(p, tnt.TP_ITERATOR)
 *             p = mp_encode_uint(p, iterator)
 */
  }

  /* "asynctnt/iproto/buffer.pyx":623
 *             p = mp_encode_uint(p, iterator)
 * 
 *         p = mp_encode_uint(p, tnt.TP_KEY)             # <<<<<<<<<<<<<<
 *         self._length += (p - begin)
 *         p = self._encode_list(p, key)
 */
  __pyx_v_p = mp_encode_uint(__pyx_v_p, __pyx_e_8asynctnt_6iproto_3tnt_TP_KEY);

  /* "asynctnt/iproto/buffer.pyx":624
 * 
 *         p = mp_encode_uint(p, tnt.TP_KEY)
 *         self._length += (p - begin)             # <<<<<<<<<<<<<<
 *         p = self._encode_list(p, key)
 * 
 */
  __pyx_v_self->_length = (__pyx_v_self->_length + (__pyx_v_p - __pyx_v_begin));

  /* "asynctnt/iproto/buffer.pyx":625
 *         p = mp_encode_uint(p, tnt.TP_KEY)
 *         self._length += (p - begin)
 *         p = self._encode_list(p, key)             # <<<<<<<<<<<<<<
 * 
 *     cdef void encode_request_insert(self, uint32_t space, list t) except *:
 */
  __pyx_t_2 = __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__encode_list(__pyx_v_self, __pyx_v_p, __pyx_v_key); if (unlikely(__pyx_t_2 == NULL)) __PYX_ERR(0, 625, __pyx_L1_error)
  __pyx_v_p = __pyx_t_2;

  /* "asynctnt/iproto/buffer.pyx":567
 *         p = self._encode_list(p, args)
 * 
 *     cdef void encode_request_select(self, uint32_t space, uint32_t index,             # <<<<<<<<<<<<<<
 *                                     list key, uint64_t offset, uint64_t limit,
 *                                     uint32_t iterator) except *:
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("asynctnt.iproto.protocol.WriteBuffer.encode_request_select", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "asynctnt/iproto/buffer.pyx":627
 *         p = self._encode_list(p, key)
 * 
 *     cdef void encode_request_insert(self, uint32_t space, list t) except *:             # <<<<<<<<<<<<<<
 *         cdef:
 *             char *begin
 */

static void __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer_encode_request_insert(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *__pyx_v_self, uint32_t __pyx_v_space, PyObject *__pyx_v_t) {
  char *__pyx_v_begin;
  char *__pyx_v_p;
  uint32_t __pyx_v_body_map_sz;
  uint32_t __pyx_v_max_body_len;
  __Pyx_RefNannyDeclarations
  char *__pyx_t_1;
  __Pyx_RefNannySetupContext("encode_request_insert", 0);

  /* "asynctnt/iproto/buffer.pyx":634
 *             uint32_t max_body_len
 * 
 *         body_map_sz = 2             # <<<<<<<<<<<<<<
 *         # Size description:
 *         # mp_sizeof_map(body_map_sz)
 */
  __pyx_v_body_map_sz = 2;

  /* "asynctnt/iproto/buffer.pyx":643
 *                        + 1 \
 *                        + 9 \
 *                        + 1             # <<<<<<<<<<<<<<
 * 
 *         self.ensure_allocated(max_body_len)
 */
  __pyx_v_max_body_len = 12;

  /* "asynctnt/iproto/buffer.pyx":645
 *                        + 1
 * 
 *         self.ensure_allocated(max_body_len)             # <<<<<<<<<<<<<<
 * 
 *         p = begin = &self._buf[self._length]
 */
  __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer_ensure_allocated(__pyx_v_self, __pyx_v_max_body_len); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 645, __pyx_L1_error)

  /* "asynctnt/iproto/buffer.pyx":647
 *         self.ensure_allocated(max_body_len)
 * 
 *         p = begin = &self._buf[self._length]             # <<<<<<<<<<<<<<
 *         p = mp_encode_map(p, body_map_sz)
 *         p = mp_encode_uint(p, tnt.TP_SPACE)
 */
  __pyx_t_1 = (&(__pyx_v_self->_buf[__pyx_v_self->_length]));
  __pyx_v_p = __pyx_t_1;
  __pyx_v_begin = __pyx_t_1;

  /* "asynctnt/iproto/buffer.pyx":648
 * 
 *         p = begin = &self._buf[self._length]
 *         p = mp_encode_map(p, body_map_sz)             # <<<<<<<<<<<<<<
 *         p = mp_encode_uint(p, tnt.TP_SPACE)
 *         p = mp_encode_uint(p, space)
 */
  __pyx_v_p = mp_encode_map(__pyx_v_p, __pyx_v_body_map_sz);

  /* "asynctnt/iproto/buffer.pyx":649
 *         p = begin = &self._buf[self._length]
 *         p = mp_encode_map(p, body_map_sz)
 *         p = mp_encode_uint(p, tnt.TP_SPACE)             # <<<<<<<<<<<<<<
 *         p = mp_encode_uint(p, space)
 * 
 */
  __pyx_v_p = mp_encode_uint(__pyx_v_p, __pyx_e_8asynctnt_6iproto_3tnt_TP_SPACE);

  /* "asynctnt/iproto/buffer.pyx":650
 *         p = mp_encode_map(p, body_map_sz)
 *         p = mp_encode_uint(p, tnt.TP_SPACE)
 *         p = mp_encode_uint(p, space)             # <<<<<<<<<<<<<<
 * 
 *         p = mp_encode_uint(p, tnt.TP_TUPLE)
 */
  __pyx_v_p = mp_encode_uint(__pyx_v_p, __pyx_v_space);

  /* "asynctnt/iproto/buffer.pyx":652
 *         p = mp_encode_uint(p, space)
 * 
 *         p = mp_encode_uint(p, tnt.TP_TUPLE)             # <<<<<<<<<<<<<<
 *         self._length += (p - begin)
 *         p = self._encode_list(p, t)
 */
  __pyx_v_p = mp_encode_uint(__pyx_v_p, __pyx_e_8asynctnt_6iproto_3tnt_TP_TUPLE);

  /* "asynctnt/iproto/buffer.pyx":653
 * 
 *         p = mp_encode_uint(p, tnt.TP_TUPLE)
 *         self._length += (p - begin)             # <<<<<<<<<<<<<<
 *         p = self._encode_list(p, t)
 * 
 */
  __pyx_v_self->_length = (__pyx_v_self->_length + (__pyx_v_p - __pyx_v_begin));

  /* "asynctnt/iproto/buffer.pyx":654
 *         p = mp_encode_uint(p, tnt.TP_TUPLE)
 *         self._length += (p - begin)
 *         p = self._encode_list(p, t)             # <<<<<<<<<<<<<<
 * 
 *     cdef void encode_request_delete(self, uint32_t space, uint32_t index,
 */
  __pyx_t_1 = __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__encode_list(__pyx_v_self, __pyx_v_p, __pyx_v_t); if (unlikely(__pyx_t_1 == NULL)) __PYX_ERR(0, 654, __pyx_L1_error)
  __pyx_v_p = __pyx_t_1;

  /* "asynctnt/iproto/buffer.pyx":627
 *         p = self._encode_list(p, key)
 * 
 *     cdef void encode_request_insert(self, uint32_t space, list t) except *:             # <<<<<<<<<<<<<<
 *         cdef:
 *             char *begin
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("asynctnt.iproto.protocol.WriteBuffer.encode_request_insert", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "asynctnt/iproto/buffer.pyx":656
 *         p = self._encode_list(p, t)
 * 
 *     cdef void encode_request_delete(self, uint32_t space, uint32_t index,             # <<<<<<<<<<<<<<
 *                                     list key) except *:
 *         cdef:
 */

static void __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer_encode_request_delete(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *__pyx_v_self, uint32_t __pyx_v_space, uint32_t __pyx_v_index, PyObject *__pyx_v_key) {
  char *__pyx_v_p;
  uint32_t __pyx_v_body_map_sz;
  uint32_t __pyx_v_max_body_len;
  char *__pyx_v_begin;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  char *__pyx_t_2;
  __Pyx_RefNannySetupContext("encode_request_delete", 0);

  /* "asynctnt/iproto/buffer.pyx":664
 * 
 *         body_map_sz = 2 \
 *                       + <uint32_t>(index > 0)             # <<<<<<<<<<<<<<
 *         # Size description:
 *         # mp_sizeof_map(body_map_sz)
 */
  __pyx_v_body_map_sz = (2 + ((uint32_t)(__pyx_v_index > 0)));

  /* "asynctnt/iproto/buffer.pyx":671
 *         max_body_len = 1 \
 *                        + 1 \
 *                        + 9             # <<<<<<<<<<<<<<
 * 
 *         if index > 0:
 */
  __pyx_v_max_body_len = 11;

  /* "asynctnt/iproto/buffer.pyx":673
 *                        + 9
 * 
 *         if index > 0:             # <<<<<<<<<<<<<<
 *             # mp_sizeof_uint(TP_INDEX) + mp_sizeof_uint(index)
 *             max_body_len += 1 + 9
 */
  __pyx_t_1 = ((__pyx_v_index > 0) != 0);
  if (__pyx_t_1) {

    /* "asynctnt/iproto/buffer.pyx":675
 *         if index > 0:
 *             # mp_sizeof_uint(TP_INDEX) + mp_sizeof_uint(index)
 *             max_body_len += 1 + 9             # <<<<<<<<<<<<<<
 * 
 *         max_body_len += 1  # mp_sizeof_uint(TP_KEY);
 */
    __pyx_v_max_body_len = (__pyx_v_max_body_len + 10);

    /* "asynctnt/iproto/buffer.pyx":673
 *                        + 9
 * 
 *         if index > 0:             # <<<<<<<<<<<<<<
 *             # mp_sizeof_uint(TP_INDEX) + mp_sizeof_uint(index)
 *             max_body_len += 1 + 9
 */
  }

  /* "asynctnt/iproto/buffer.pyx":677
 *             max_body_len += 1 + 9
 * 
 *         max_body_len += 1  # mp_sizeof_uint(TP_KEY);             # <<<<<<<<<<<<<<
 * 
 *         self.ensure_allocated(max_body_len)
 */
  __pyx_v_max_body_len = (__pyx_v_max_body_len + 1);

  /* "asynctnt/iproto/buffer.pyx":679
 *         max_body_len += 1  # mp_sizeof_uint(TP_KEY);
 * 
 *         self.ensure_allocated(max_body_len)             # <<<<<<<<<<<<<<
 * 
 *         p = begin = &self._buf[self._length]
 */
  __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer_ensure_allocated(__pyx_v_self, __pyx_v_max_body_len); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 679, __pyx_L1_error)

  /* "asynctnt/iproto/buffer.pyx":681
 *         self.ensure_allocated(max_body_len)
 * 
 *         p = begin = &self._buf[self._length]             # <<<<<<<<<<<<<<
 *         p = mp_encode_map(p, body_map_sz)
 *         p = mp_encode_uint(p, tnt.TP_SPACE)
 */
  __pyx_t_2 = (&(__pyx_v_self->_buf[__pyx_v_self->_length]));
  __pyx_v_p = __pyx_t_2;
  __pyx_v_begin = __pyx_t_2;

  /* "asynctnt/iproto/buffer.pyx":682
 * 
 *         p = begin = &self._buf[self._length]
 *         p = mp_encode_map(p, body_map_sz)             # <<<<<<<<<<<<<<
 *         p = mp_encode_uint(p, tnt.TP_SPACE)
 *         p = mp_encode_uint(p, space)
 */
  __pyx_v_p = mp_encode_map(__pyx_v_p, __pyx_v_body_map_sz);

  /* "asynctnt/iproto/buffer.pyx":683
 *         p = begin = &self._buf[self._length]
 *         p = mp_encode_map(p, body_map_sz)
 *         p = mp_encode_uint(p, tnt.TP_SPACE)             # <<<<<<<<<<<<<<
 *         p = mp_encode_uint(p, space)
 * 
 */
  __pyx_v_p = mp_encode_uint(__pyx_v_p, __pyx_e_8asynctnt_6iproto_3tnt_TP_SPACE);

  /* "asynctnt/iproto/buffer.pyx":684
 *         p = mp_encode_map(p, body_map_sz)
 *         p = mp_encode_uint(p, tnt.TP_SPACE)
 *         p = mp_encode_uint(p, space)             # <<<<<<<<<<<<<<
 * 
 *         if index > 0:
 */
  __pyx_v_p = mp_encode_uint(__pyx_v_p, __pyx_v_space);

  /* "asynctnt/iproto/buffer.pyx":686
 *         p = mp_encode_uint(p, space)
 * 
 *         if index > 0:             # <<<<<<<<<<<<<<
 *             p = mp_encode_uint(p, tnt.TP_INDEX)
 *             p = mp_encode_uint(p, index)
 */
  __pyx_t_1 = ((__pyx_v_index > 0) != 0);
  if (__pyx_t_1) {

    /* "asynctnt/iproto/buffer.pyx":687
 * 
 *         if index > 0:
 *             p = mp_encode_uint(p, tnt.TP_INDEX)             # <<<<<<<<<<<<<<
 *             p = mp_encode_uint(p, index)
 * 
 */
    __pyx_v_p = mp_encode_uint(__pyx_v_p, __pyx_e_8asynctnt_6iproto_3tnt_TP_INDEX);

    /* "asynctnt/iproto/buffer.pyx":688
 *         if index > 0:
 *             p = mp_encode_uint(p, tnt.TP_INDEX)
 *             p = mp_encode_uint(p, index)             # <<<<<<<<<<<<<<
 * 
 *         p = mp_encode_uint(p, tnt.TP_KEY)
 */
    __pyx_v_p = mp_encode_uint(__pyx_v_p, __pyx_v_index);

    /* "asynctnt/iproto/buffer.pyx":686
 *         p = mp_encode_uint(p, space)
 * 
 *         if index > 0:             # <<<<<<<<<<<<<<
 *             p = mp_encode_uint(p, tnt.TP_INDEX)
 *             p = mp_encode_uint(p, index)
 */
  }

  /* "asynctnt/iproto/buffer.pyx":690
 *             p = mp_encode_uint(p, index)
 * 
 *         p = mp_encode_uint(p, tnt.TP_KEY)             # <<<<<<<<<<<<<<
 *         self._length += (p - begin)
 *         p = self._encode_list(p, key)
 */
  __pyx_v_p = mp_encode_uint(__pyx_v_p, __pyx_e_8asynctnt_6iproto_3tnt_TP_KEY);

  /* "asynctnt/iproto/buffer.pyx":691
 * 
 *         p = mp_encode_uint(p, tnt.TP_KEY)
 *         self._length += (p - begin)             # <<<<<<<<<<<<<<
 *         p = self._encode_list(p, key)
 * 
 */
  __pyx_v_self->_length = (__pyx_v_self->_length + (__pyx_v_p - __pyx_v_begin));

  /* "asynctnt/iproto/buffer.pyx":692
 *         p = mp_encode_uint(p, tnt.TP_KEY)
 *         self._length += (p - begin)
 *         p = self._encode_list(p, key)             # <<<<<<<<<<<<<<
 * 
 *     cdef void encode_request_update(self, uint32_t space, uint32_t index,
 */
  __pyx_t_2 = __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__encode_list(__pyx_v_self, __pyx_v_p, __pyx_v_key); if (unlikely(__pyx_t_2 == NULL)) __PYX_ERR(0, 692, __pyx_L1_error)
  __pyx_v_p = __pyx_t_2;

  /* "asynctnt/iproto/buffer.pyx":656
 *         p = self._encode_list(p, t)
 * 
 *     cdef void encode_request_delete(self, uint32_t space, uint32_t index,             # <<<<<<<<<<<<<<
 *                                     list key) except *:
 *         cdef:
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("asynctnt.iproto.protocol.WriteBuffer.encode_request_delete", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "asynctnt/iproto/buffer.pyx":694
 *         p = self._encode_list(p, key)
 * 
 *     cdef void encode_request_update(self, uint32_t space, uint32_t index,             # <<<<<<<<<<<<<<
 *                                     list key_tuple, list operations,
 *                                     uint32_t key_of_tuple=tnt.TP_KEY,
 */

static void __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer_encode_request_update(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *__pyx_v_self, uint32_t __pyx_v_space, uint32_t __pyx_v_index, PyObject *__pyx_v_key_tuple, PyObject *__pyx_v_operations, struct __pyx_opt_args_8asynctnt_6iproto_8protocol_11WriteBuffer_encode_request_update *__pyx_optional_args) {
  uint32_t __pyx_v_key_of_tuple = __pyx_k__10;
  uint32_t __pyx_v_key_of_operations = __pyx_k__11;
  char *__pyx_v_begin;
  char *__pyx_v_p;
  uint32_t __pyx_v_body_map_sz;
  uint32_t __pyx_v_max_body_len;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  char *__pyx_t_2;
  __Pyx_RefNannySetupContext("encode_request_update", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_key_of_tuple = __pyx_optional_args->key_of_tuple;
      if (__pyx_optional_args->__pyx_n > 1) {
        __pyx_v_key_of_operations = __pyx_optional_args->key_of_operations;
      }
    }
  }

  /* "asynctnt/iproto/buffer.pyx":705
 *             uint32_t max_body_len
 * 
 *         body_map_sz = 3 + <uint32_t>(index > 0)             # <<<<<<<<<<<<<<
 *         # Size description:
 *         # mp_sizeof_map(body_map_sz)
 */
  __pyx_v_body_map_sz = (3 + ((uint32_t)(__pyx_v_index > 0)));

  /* "asynctnt/iproto/buffer.pyx":712
 *         max_body_len = 1 \
 *                        + 1 \
 *                        + 9             # <<<<<<<<<<<<<<
 * 
 *         if index > 0:
 */
  __pyx_v_max_body_len = 11;

  /* "asynctnt/iproto/buffer.pyx":714
 *                        + 9
 * 
 *         if index > 0:             # <<<<<<<<<<<<<<
 *             # + mp_sizeof_uint(TP_INDEX)
 *             # + mp_sizeof_uint(index)
 */
  __pyx_t_1 = ((__pyx_v_index > 0) != 0);
  if (__pyx_t_1) {

    /* "asynctnt/iproto/buffer.pyx":717
 *             # + mp_sizeof_uint(TP_INDEX)
 *             # + mp_sizeof_uint(index)
 *             max_body_len += 1 + 9             # <<<<<<<<<<<<<<
 * 
 *         max_body_len += 1  # + mp_sizeof_uint(TP_KEY)
 */
    __pyx_v_max_body_len = (__pyx_v_max_body_len + 10);

    /* "asynctnt/iproto/buffer.pyx":714
 *                        + 9
 * 
 *         if index > 0:             # <<<<<<<<<<<<<<
 *             # + mp_sizeof_uint(TP_INDEX)
 *             # + mp_sizeof_uint(index)
 */
  }

  /* "asynctnt/iproto/buffer.pyx":719
 *             max_body_len += 1 + 9
 * 
 *         max_body_len += 1  # + mp_sizeof_uint(TP_KEY)             # <<<<<<<<<<<<<<
 *         max_body_len += 1  # + mp_sizeof_uint(TP_TUPLE)
 * 
 */
  __pyx_v_max_body_len = (__pyx_v_max_body_len + 1);

  /* "asynctnt/iproto/buffer.pyx":720
 * 
 *         max_body_len += 1  # + mp_sizeof_uint(TP_KEY)
 *         max_body_len += 1  # + mp_sizeof_uint(TP_TUPLE)             # <<<<<<<<<<<<<<
 * 
 *         self.ensure_allocated(max_body_len)
 */
  __pyx_v_max_body_len = (__pyx_v_max_body_len + 1);

  /* "asynctnt/iproto/buffer.pyx":722
 *         max_body_len += 1  # + mp_sizeof_uint(TP_TUPLE)
 * 
 *         self.ensure_allocated(max_body_len)             # <<<<<<<<<<<<<<
 * 
 *         p = begin = &self._buf[self._length]
 */
  __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer_ensure_allocated(__pyx_v_self, __pyx_v_max_body_len); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 722, __pyx_L1_error)

  /* "asynctnt/iproto/buffer.pyx":724
 *         self.ensure_allocated(max_body_len)
 * 
 *         p = begin = &self._buf[self._length]             # <<<<<<<<<<<<<<
 *         p = mp_encode_map(p, body_map_sz)
 *         p = mp_encode_uint(p, tnt.TP_SPACE)
 */
  __pyx_t_2 = (&(__pyx_v_self->_buf[__pyx_v_self->_length]));
  __pyx_v_p = __pyx_t_2;
  __pyx_v_begin = __pyx_t_2;

  /* "asynctnt/iproto/buffer.pyx":725
 * 
 *         p = begin = &self._buf[self._length]
 *         p = mp_encode_map(p, body_map_sz)             # <<<<<<<<<<<<<<
 *         p = mp_encode_uint(p, tnt.TP_SPACE)
 *         p = mp_encode_uint(p, space)
 */
  __pyx_v_p = mp_encode_map(__pyx_v_p, __pyx_v_body_map_sz);

  /* "asynctnt/iproto/buffer.pyx":726
 *         p = begin = &self._buf[self._length]
 *         p = mp_encode_map(p, body_map_sz)
 *         p = mp_encode_uint(p, tnt.TP_SPACE)             # <<<<<<<<<<<<<<
 *         p = mp_encode_uint(p, space)
 * 
 */
  __pyx_v_p = mp_encode_uint(__pyx_v_p, __pyx_e_8asynctnt_6iproto_3tnt_TP_SPACE);

  /* "asynctnt/iproto/buffer.pyx":727
 *         p = mp_encode_map(p, body_map_sz)
 *         p = mp_encode_uint(p, tnt.TP_SPACE)
 *         p = mp_encode_uint(p, space)             # <<<<<<<<<<<<<<
 * 
 *         if index > 0:
 */
  __pyx_v_p = mp_encode_uint(__pyx_v_p, __pyx_v_space);

  /* "asynctnt/iproto/buffer.pyx":729
 *         p = mp_encode_uint(p, space)
 * 
 *         if index > 0:             # <<<<<<<<<<<<<<
 *             p = mp_encode_uint(p, tnt.TP_INDEX)
 *             p = mp_encode_uint(p, index)
 */
  __pyx_t_1 = ((__pyx_v_index > 0) != 0);
  if (__pyx_t_1) {

    /* "asynctnt/iproto/buffer.pyx":730
 * 
 *         if index > 0:
 *             p = mp_encode_uint(p, tnt.TP_INDEX)             # <<<<<<<<<<<<<<
 *             p = mp_encode_uint(p, index)
 *         self._length += (p - begin)
 */
    __pyx_v_p = mp_encode_uint(__pyx_v_p, __pyx_e_8asynctnt_6iproto_3tnt_TP_INDEX);

    /* "asynctnt/iproto/buffer.pyx":731
 *         if index > 0:
 *             p = mp_encode_uint(p, tnt.TP_INDEX)
 *             p = mp_encode_uint(p, index)             # <<<<<<<<<<<<<<
 *         self._length += (p - begin)
 * 
 */
    __pyx_v_p = mp_encode_uint(__pyx_v_p, __pyx_v_index);

    /* "asynctnt/iproto/buffer.pyx":729
 *         p = mp_encode_uint(p, space)
 * 
 *         if index > 0:             # <<<<<<<<<<<<<<
 *             p = mp_encode_uint(p, tnt.TP_INDEX)
 *             p = mp_encode_uint(p, index)
 */
  }

  /* "asynctnt/iproto/buffer.pyx":732
 *             p = mp_encode_uint(p, tnt.TP_INDEX)
 *             p = mp_encode_uint(p, index)
 *         self._length += (p - begin)             # <<<<<<<<<<<<<<
 * 
 *         p = self._encode_uint(p, key_of_tuple)
 */
  __pyx_v_self->_length = (__pyx_v_self->_length + (__pyx_v_p - __pyx_v_begin));

  /* "asynctnt/iproto/buffer.pyx":734
 *         self._length += (p - begin)
 * 
 *         p = self._encode_uint(p, key_of_tuple)             # <<<<<<<<<<<<<<
 *         p = self._encode_list(p, key_tuple)
 * 
 */
  __pyx_t_2 = __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__encode_uint(__pyx_v_self, __pyx_v_p, __pyx_v_key_of_tuple); if (unlikely(__pyx_t_2 == NULL)) __PYX_ERR(0, 734, __pyx_L1_error)
  __pyx_v_p = __pyx_t_2;

  /* "asynctnt/iproto/buffer.pyx":735
 * 
 *         p = self._encode_uint(p, key_of_tuple)
 *         p = self._encode_list(p, key_tuple)             # <<<<<<<<<<<<<<
 * 
 *         p = self._encode_uint(p, key_of_operations)
 */
  __pyx_t_2 = __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__encode_list(__pyx_v_self, __pyx_v_p, __pyx_v_key_tuple); if (unlikely(__pyx_t_2 == NULL)) __PYX_ERR(0, 735, __pyx_L1_error)
  __pyx_v_p = __pyx_t_2;

  /* "asynctnt/iproto/buffer.pyx":737
 *         p = self._encode_list(p, key_tuple)
 * 
 *         p = self._encode_uint(p, key_of_operations)             # <<<<<<<<<<<<<<
 *         p = self._encode_update_ops(p, operations)
 * 
 */
  __pyx_t_2 = __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__encode_uint(__pyx_v_self, __pyx_v_p, __pyx_v_key_of_operations); if (unlikely(__pyx_t_2 == NULL)) __PYX_ERR(0, 737, __pyx_L1_error)
  __pyx_v_p = __pyx_t_2;

  /* "asynctnt/iproto/buffer.pyx":738
 * 
 *         p = self._encode_uint(p, key_of_operations)
 *         p = self._encode_update_ops(p, operations)             # <<<<<<<<<<<<<<
 * 
 *     cdef void encode_request_upsert(self, uint32_t space,
 */
  __pyx_t_2 = __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__encode_update_ops(__pyx_v_self, __pyx_v_p, __pyx_v_operations); if (unlikely(__pyx_t_2 == NULL)) __PYX_ERR(0, 738, __pyx_L1_error)
  __pyx_v_p = __pyx_t_2;

  /* "asynctnt/iproto/buffer.pyx":694
 *         p = self._encode_list(p, key)
 * 
 *     cdef void encode_request_update(self, uint32_t space, uint32_t index,             # <<<<<<<<<<<<<<
 *                                     list key_tuple, list operations,
 *                                     uint32_t key_of_tuple=tnt.TP_KEY,
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("asynctnt.iproto.protocol.WriteBuffer.encode_request_update", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "asynctnt/iproto/buffer.pyx":740
 *         p = self._encode_update_ops(p, operations)
 * 
 *     cdef void encode_request_upsert(self, uint32_t space,             # <<<<<<<<<<<<<<
 *                                     list t, list operations) except *:
 *         self.encode_request_update(space, 0, t, operations,
 */

static void __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer_encode_request_upsert(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *__pyx_v_self, uint32_t __pyx_v_space, PyObject *__pyx_v_t, PyObject *__pyx_v_operations) {
  __Pyx_RefNannyDeclarations
  struct __pyx_opt_args_8asynctnt_6iproto_8protocol_11WriteBuffer_encode_request_update __pyx_t_1;
  __Pyx_RefNannySetupContext("encode_request_upsert", 0);

  /* "asynctnt/iproto/buffer.pyx":742
 *     cdef void encode_request_upsert(self, uint32_t space,
 *                                     list t, list operations) except *:
 *         self.encode_request_update(space, 0, t, operations,             # <<<<<<<<<<<<<<
 *                                    tnt.TP_TUPLE, tnt.TP_OPERATIONS)
 * 
 */
  __pyx_t_1.__pyx_n = 2;
  __pyx_t_1.key_of_tuple = __pyx_e_8asynctnt_6iproto_3tnt_TP_TUPLE;
  __pyx_t_1.key_of_operations = __pyx_e_8asynctnt_6iproto_3tnt_TP_OPERATIONS;
  __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer_encode_request_update(__pyx_v_self, __pyx_v_space, 0, __pyx_v_t, __pyx_v_operations, &__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 742, __pyx_L1_error)

  /* "asynctnt/iproto/buffer.pyx":740
 *         p = self._encode_update_ops(p, operations)
 * 
 *     cdef void encode_request_upsert(self, uint32_t space,             # <<<<<<<<<<<<<<
 *                                     list t, list operations) except *:
 *         self.encode_request_update(space, 0, t, operations,
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("asynctnt.iproto.protocol.WriteBuffer.encode_request_upsert", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "asynctnt/iproto/buffer.pyx":745
 *                                    tnt.TP_TUPLE, tnt.TP_OPERATIONS)
 * 
 *     cdef void encode_request_auth(self,             # <<<<<<<<<<<<<<
 *                                   bytes username,
 *                                   bytes scramble) except *:
 */

static void __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer_encode_request_auth(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *__pyx_v_self, PyObject *__pyx_v_username, PyObject *__pyx_v_scramble) {
  char *__pyx_v_begin;
  char *__pyx_v_p;
  uint32_t __pyx_v_body_map_sz;
  uint32_t __pyx_v_max_body_len;
  char *__pyx_v_username_str;
  Py_ssize_t __pyx_v_username_len;
  char *__pyx_v_scramble_str;
  Py_ssize_t __pyx_v_scramble_len;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  char *__pyx_t_2;
  __Pyx_RefNannySetupContext("encode_request_auth", 0);

  /* "asynctnt/iproto/buffer.pyx":760
 *             ssize_t scramble_len
 * 
 *         cpython.bytes.PyBytes_AsStringAndSize(username,             # <<<<<<<<<<<<<<
 *                                               &username_str, &username_len)
 *         cpython.bytes.PyBytes_AsStringAndSize(scramble,
 */
  __pyx_t_1 = PyBytes_AsStringAndSize(__pyx_v_username, (&__pyx_v_username_str), ((Py_ssize_t *)(&__pyx_v_username_len))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(0, 760, __pyx_L1_error)

  /* "asynctnt/iproto/buffer.pyx":762
 *         cpython.bytes.PyBytes_AsStringAndSize(username,
 *                                               &username_str, &username_len)
 *         cpython.bytes.PyBytes_AsStringAndSize(scramble,             # <<<<<<<<<<<<<<
 *                                               &scramble_str, &scramble_len)
 *         body_map_sz = 2
 */
  __pyx_t_1 = PyBytes_AsStringAndSize(__pyx_v_scramble, (&__pyx_v_scramble_str), ((Py_ssize_t *)(&__pyx_v_scramble_len))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(0, 762, __pyx_L1_error)

  /* "asynctnt/iproto/buffer.pyx":764
 *         cpython.bytes.PyBytes_AsStringAndSize(scramble,
 *                                               &scramble_str, &scramble_len)
 *         body_map_sz = 2             # <<<<<<<<<<<<<<
 *         # Size description:
 *         # mp_sizeof_map()
 */
  __pyx_v_body_map_sz = 2;

  /* "asynctnt/iproto/buffer.pyx":779
 *                        + 1 \
 *                        + 1 + 9 \
 *                        + mp_sizeof_str(<uint32_t>scramble_len)             # <<<<<<<<<<<<<<
 * 
 *         self.ensure_allocated(max_body_len)
 */
  __pyx_v_max_body_len = ((((((2 + mp_sizeof_str(((uint32_t)__pyx_v_username_len))) + 1) + 1) + 1) + 9) + mp_sizeof_str(((uint32_t)__pyx_v_scramble_len)));

  /* "asynctnt/iproto/buffer.pyx":781
 *                        + mp_sizeof_str(<uint32_t>scramble_len)
 * 
 *         self.ensure_allocated(max_body_len)             # <<<<<<<<<<<<<<
 * 
 *         p = begin = &self._buf[self._length]
 */
  __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer_ensure_allocated(__pyx_v_self, __pyx_v_max_body_len); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 781, __pyx_L1_error)

  /* "asynctnt/iproto/buffer.pyx":783
 *         self.ensure_allocated(max_body_len)
 * 
 *         p = begin = &self._buf[self._length]             # <<<<<<<<<<<<<<
 *         p = mp_encode_map(p, body_map_sz)
 *         p = mp_encode_uint(p, tnt.TP_USERNAME)
 */
  __pyx_t_2 = (&(__pyx_v_self->_buf[__pyx_v_self->_length]));
  __pyx_v_p = __pyx_t_2;
  __pyx_v_begin = __pyx_t_2;

  /* "asynctnt/iproto/buffer.pyx":784
 * 
 *         p = begin = &self._buf[self._length]
 *         p = mp_encode_map(p, body_map_sz)             # <<<<<<<<<<<<<<
 *         p = mp_encode_uint(p, tnt.TP_USERNAME)
 *         p = mp_encode_str(p, username_str, <uint32_t>username_len)
 */
  __pyx_v_p = mp_encode_map(__pyx_v_p, __pyx_v_body_map_sz);

  /* "asynctnt/iproto/buffer.pyx":785
 *         p = begin = &self._buf[self._length]
 *         p = mp_encode_map(p, body_map_sz)
 *         p = mp_encode_uint(p, tnt.TP_USERNAME)             # <<<<<<<<<<<<<<
 *         p = mp_encode_str(p, username_str, <uint32_t>username_len)
 * 
 */
  __pyx_v_p = mp_encode_uint(__pyx_v_p, __pyx_e_8asynctnt_6iproto_3tnt_TP_USERNAME);

  /* "asynctnt/iproto/buffer.pyx":786
 *         p = mp_encode_map(p, body_map_sz)
 *         p = mp_encode_uint(p, tnt.TP_USERNAME)
 *         p = mp_encode_str(p, username_str, <uint32_t>username_len)             # <<<<<<<<<<<<<<
 * 
 *         p = mp_encode_uint(p, tnt.TP_TUPLE)
 */
  __pyx_v_p = mp_encode_str(__pyx_v_p, __pyx_v_username_str, ((uint32_t)__pyx_v_username_len));

  /* "asynctnt/iproto/buffer.pyx":788
 *         p = mp_encode_str(p, username_str, <uint32_t>username_len)
 * 
 *         p = mp_encode_uint(p, tnt.TP_TUPLE)             # <<<<<<<<<<<<<<
 *         p = mp_encode_array(p, 2)
 *         p = mp_encode_str(p, "chap-sha1", 9)
 */
  __pyx_v_p = mp_encode_uint(__pyx_v_p, __pyx_e_8asynctnt_6iproto_3tnt_TP_TUPLE);

  /* "asynctnt/iproto/buffer.pyx":789
 * 
 *         p = mp_encode_uint(p, tnt.TP_TUPLE)
 *         p = mp_encode_array(p, 2)             # <<<<<<<<<<<<<<
 *         p = mp_encode_str(p, "chap-sha1", 9)
 *         p = mp_encode_str(p, scramble_str, <uint32_t>scramble_len)
 */
  __pyx_v_p = mp_encode_array(__pyx_v_p, 2);

  /* "asynctnt/iproto/buffer.pyx":790
 *         p = mp_encode_uint(p, tnt.TP_TUPLE)
 *         p = mp_encode_array(p, 2)
 *         p = mp_encode_str(p, "chap-sha1", 9)             # <<<<<<<<<<<<<<
 *         p = mp_encode_str(p, scramble_str, <uint32_t>scramble_len)
 *         self._length += (p - begin)
 */
  __pyx_v_p = mp_encode_str(__pyx_v_p, ((char const *)"chap-sha1"), 9);

  /* "asynctnt/iproto/buffer.pyx":791
 *         p = mp_encode_array(p, 2)
 *         p = mp_encode_str(p, "chap-sha1", 9)
 *         p = mp_encode_str(p, scramble_str, <uint32_t>scramble_len)             # <<<<<<<<<<<<<<
 *         self._length += (p - begin)
 */
  __pyx_v_p = mp_encode_str(__pyx_v_p, __pyx_v_scramble_str, ((uint32_t)__pyx_v_scramble_len));

  /* "asynctnt/iproto/buffer.pyx":792
 *         p = mp_encode_str(p, "chap-sha1", 9)
 *         p = mp_encode_str(p, scramble_str, <uint32_t>scramble_len)
 *         self._length += (p - begin)             # <<<<<<<<<<<<<<
 */
  __pyx_v_self->_length = (__pyx_v_self->_length + (__pyx_v_p - __pyx_v_begin));

  /* "asynctnt/iproto/buffer.pyx":745
 *                                    tnt.TP_TUPLE, tnt.TP_OPERATIONS)
 * 
 *     cdef void encode_request_auth(self,             # <<<<<<<<<<<<<<
 *                                   bytes username,
 *                                   bytes scramble) except *:
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("asynctnt.iproto.protocol.WriteBuffer.encode_request_auth", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "asynctnt/iproto/rbuffer.pyx":19
 * 
 * 
 * cdef inline size_t size_t_max(size_t a, size_t b):             # <<<<<<<<<<<<<<
 *     if a > b:
 *         return a
 */

static CYTHON_INLINE size_t __pyx_f_8asynctnt_6iproto_8protocol_size_t_max(size_t __pyx_v_a, size_t __pyx_v_b) {
  size_t __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("size_t_max", 0);

  /* "asynctnt/iproto/rbuffer.pyx":20
 * 
 * cdef inline size_t size_t_max(size_t a, size_t b):
 *     if a > b:             # <<<<<<<<<<<<<<
 *         return a
 *     return b
 */
  __pyx_t_1 = ((__pyx_v_a > __pyx_v_b) != 0);
  if (__pyx_t_1) {

    /* "asynctnt/iproto/rbuffer.pyx":21
 * cdef inline size_t size_t_max(size_t a, size_t b):
 *     if a > b:
 *         return a             # <<<<<<<<<<<<<<
 *     return b
 * 
 */
    __pyx_r = __pyx_v_a;
    goto __pyx_L0;

    /* "asynctnt/iproto/rbuffer.pyx":20
 * 
 * cdef inline size_t size_t_max(size_t a, size_t b):
 *     if a > b:             # <<<<<<<<<<<<<<
 *         return a
 *     return b
 */
  }

  /* "asynctnt/iproto/rbuffer.pyx":22
 *     if a > b:
 *         return a
 *     return b             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_b;
  goto __pyx_L0;

  /* "asynctnt/iproto/rbuffer.pyx":19
 * 
 * 
 * cdef inline size_t size_t_max(size_t a, size_t b):             # <<<<<<<<<<<<<<
 *     if a > b:
 *         return a
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/rbuffer.pyx":25
 * 
 * 
 * cdef inline uint32_t nearest_power_of_2(uint32_t v):             # <<<<<<<<<<<<<<
 *     v -= 1
 *     v |= v >> 1
 */

static CYTHON_INLINE uint32_t __pyx_f_8asynctnt_6iproto_8protocol_nearest_power_of_2(uint32_t __pyx_v_v) {
  uint32_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nearest_power_of_2", 0);

  /* "asynctnt/iproto/rbuffer.pyx":26
 * 
 * cdef inline uint32_t nearest_power_of_2(uint32_t v):
 *     v -= 1             # <<<<<<<<<<<<<<
 *     v |= v >> 1
 *     v |= v >> 2
 */
  __pyx_v_v = (__pyx_v_v - 1);

  /* "asynctnt/iproto/rbuffer.pyx":27
 * cdef inline uint32_t nearest_power_of_2(uint32_t v):
 *     v -= 1
 *     v |= v >> 1             # <<<<<<<<<<<<<<
 *     v |= v >> 2
 *     v |= v >> 4
 */
  __pyx_v_v = (__pyx_v_v | (__pyx_v_v >> 1));

  /* "asynctnt/iproto/rbuffer.pyx":28
 *     v -= 1
 *     v |= v >> 1
 *     v |= v >> 2             # <<<<<<<<<<<<<<
 *     v |= v >> 4
 *     v |= v >> 8
 */
  __pyx_v_v = (__pyx_v_v | (__pyx_v_v >> 2));

  /* "asynctnt/iproto/rbuffer.pyx":29
 *     v |= v >> 1
 *     v |= v >> 2
 *     v |= v >> 4             # <<<<<<<<<<<<<<
 *     v |= v >> 8
 *     v |= v >> 16
 */
  __pyx_v_v = (__pyx_v_v | (__pyx_v_v >> 4));

  /* "asynctnt/iproto/rbuffer.pyx":30
 *     v |= v >> 2
 *     v |= v >> 4
 *     v |= v >> 8             # <<<<<<<<<<<<<<
 *     v |= v >> 16
 *     v += 1
 */
  __pyx_v_v = (__pyx_v_v | (__pyx_v_v >> 8));

  /* "asynctnt/iproto/rbuffer.pyx":31
 *     v |= v >> 4
 *     v |= v >> 8
 *     v |= v >> 16             # <<<<<<<<<<<<<<
 *     v += 1
 *     return v
 */
  __pyx_v_v = (__pyx_v_v | (__pyx_v_v >> 16));

  /* "asynctnt/iproto/rbuffer.pyx":32
 *     v |= v >> 8
 *     v |= v >> 16
 *     v += 1             # <<<<<<<<<<<<<<
 *     return v
 * 
 */
  __pyx_v_v = (__pyx_v_v + 1);

  /* "asynctnt/iproto/rbuffer.pyx":33
 *     v |= v >> 16
 *     v += 1
 *     return v             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_v;
  goto __pyx_L0;

  /* "asynctnt/iproto/rbuffer.pyx":25
 * 
 * 
 * cdef inline uint32_t nearest_power_of_2(uint32_t v):             # <<<<<<<<<<<<<<
 *     v -= 1
 *     v |= v >> 1
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/rbuffer.pyx":39
 * @cython.final
 * cdef class ReadBuffer:
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self.buf = NULL
 *         self.initial_buffer_size = 0
 */

/* Python wrapper */
static int __pyx_pw_8asynctnt_6iproto_8protocol_10ReadBuffer_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_8asynctnt_6iproto_8protocol_10ReadBuffer_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;
  __pyx_r = __pyx_pf_8asynctnt_6iproto_8protocol_10ReadBuffer___cinit__(((struct __pyx_obj_8asynctnt_6iproto_8protocol_ReadBuffer *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_8asynctnt_6iproto_8protocol_10ReadBuffer___cinit__(struct __pyx_obj_8asynctnt_6iproto_8protocol_ReadBuffer *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "asynctnt/iproto/rbuffer.pyx":40
 * cdef class ReadBuffer:
 *     def __cinit__(self):
 *         self.buf = NULL             # <<<<<<<<<<<<<<
 *         self.initial_buffer_size = 0
 *         self.len = 0
 */
  __pyx_v_self->buf = NULL;

  /* "asynctnt/iproto/rbuffer.pyx":41
 *     def __cinit__(self):
 *         self.buf = NULL
 *         self.initial_buffer_size = 0             # <<<<<<<<<<<<<<
 *         self.len = 0
 *         self.use = 0
 */
  __pyx_v_self->initial_buffer_size = 0;

  /* "asynctnt/iproto/rbuffer.pyx":42
 *         self.buf = NULL
 *         self.initial_buffer_size = 0
 *         self.len = 0             # <<<<<<<<<<<<<<
 *         self.use = 0
 *         self.encoding = None
 */
  __pyx_v_self->len = 0;

  /* "asynctnt/iproto/rbuffer.pyx":43
 *         self.initial_buffer_size = 0
 *         self.len = 0
 *         self.use = 0             # <<<<<<<<<<<<<<
 *         self.encoding = None
 * 
 */
  __pyx_v_self->use = 0;

  /* "asynctnt/iproto/rbuffer.pyx":44
 *         self.len = 0
 *         self.use = 0
 *         self.encoding = None             # <<<<<<<<<<<<<<
 * 
 *     @staticmethod
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->encoding);
  __Pyx_DECREF(__pyx_v_self->encoding);
  __pyx_v_self->encoding = ((PyObject*)Py_None);

  /* "asynctnt/iproto/rbuffer.pyx":39
 * @cython.final
 * cdef class ReadBuffer:
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self.buf = NULL
 *         self.initial_buffer_size = 0
 */

  /* function exit code */
  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/rbuffer.pyx":47
 * 
 *     @staticmethod
 *     cdef ReadBuffer new(str encoding, size_t initial_buffer_size=0x80000):             # <<<<<<<<<<<<<<
 *         cdef ReadBuffer b
 *         b = ReadBuffer.__new__(ReadBuffer)
 */

static struct __pyx_obj_8asynctnt_6iproto_8protocol_ReadBuffer *__pyx_f_8asynctnt_6iproto_8protocol_10ReadBuffer_new(PyObject *__pyx_v_encoding, struct __pyx_opt_args_8asynctnt_6iproto_8protocol_10ReadBuffer_new *__pyx_optional_args) {
  size_t __pyx_v_initial_buffer_size = ((size_t)0x80000);
  struct __pyx_obj_8asynctnt_6iproto_8protocol_ReadBuffer *__pyx_v_b = 0;
  struct __pyx_obj_8asynctnt_6iproto_8protocol_ReadBuffer *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("new", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_initial_buffer_size = __pyx_optional_args->initial_buffer_size;
    }
  }

  /* "asynctnt/iproto/rbuffer.pyx":49
 *     cdef ReadBuffer new(str encoding, size_t initial_buffer_size=0x80000):
 *         cdef ReadBuffer b
 *         b = ReadBuffer.__new__(ReadBuffer)             # <<<<<<<<<<<<<<
 * 
 *         b.buf = <char*>PyMem_Malloc(sizeof(char) * <size_t>initial_buffer_size)
 */
  __pyx_t_1 = __pyx_tp_new_8asynctnt_6iproto_8protocol_ReadBuffer(((PyTypeObject *)__pyx_ptype_8asynctnt_6iproto_8protocol_ReadBuffer), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 49, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_8asynctnt_6iproto_8protocol_ReadBuffer)))) __PYX_ERR(5, 49, __pyx_L1_error)
  __pyx_v_b = ((struct __pyx_obj_8asynctnt_6iproto_8protocol_ReadBuffer *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "asynctnt/iproto/rbuffer.pyx":51
 *         b = ReadBuffer.__new__(ReadBuffer)
 * 
 *         b.buf = <char*>PyMem_Malloc(sizeof(char) * <size_t>initial_buffer_size)             # <<<<<<<<<<<<<<
 *         if b.buf is NULL:
 *             raise MemoryError
 */
  __pyx_v_b->buf = ((char *)PyMem_Malloc(((sizeof(char)) * ((size_t)__pyx_v_initial_buffer_size))));

  /* "asynctnt/iproto/rbuffer.pyx":52
 * 
 *         b.buf = <char*>PyMem_Malloc(sizeof(char) * <size_t>initial_buffer_size)
 *         if b.buf is NULL:             # <<<<<<<<<<<<<<
 *             raise MemoryError
 * 
 */
  __pyx_t_2 = ((__pyx_v_b->buf == NULL) != 0);
  if (__pyx_t_2) {

    /* "asynctnt/iproto/rbuffer.pyx":53
 *         b.buf = <char*>PyMem_Malloc(sizeof(char) * <size_t>initial_buffer_size)
 *         if b.buf is NULL:
 *             raise MemoryError             # <<<<<<<<<<<<<<
 * 
 *         b.initial_buffer_size = initial_buffer_size
 */
    PyErr_NoMemory(); __PYX_ERR(5, 53, __pyx_L1_error)

    /* "asynctnt/iproto/rbuffer.pyx":52
 * 
 *         b.buf = <char*>PyMem_Malloc(sizeof(char) * <size_t>initial_buffer_size)
 *         if b.buf is NULL:             # <<<<<<<<<<<<<<
 *             raise MemoryError
 * 
 */
  }

  /* "asynctnt/iproto/rbuffer.pyx":55
 *             raise MemoryError
 * 
 *         b.initial_buffer_size = initial_buffer_size             # <<<<<<<<<<<<<<
 *         b.len = initial_buffer_size
 *         b.use = 0
 */
  __pyx_v_b->initial_buffer_size = __pyx_v_initial_buffer_size;

  /* "asynctnt/iproto/rbuffer.pyx":56
 * 
 *         b.initial_buffer_size = initial_buffer_size
 *         b.len = initial_buffer_size             # <<<<<<<<<<<<<<
 *         b.use = 0
 *         b.encoding = encoding
 */
  __pyx_v_b->len = __pyx_v_initial_buffer_size;

  /* "asynctnt/iproto/rbuffer.pyx":57
 *         b.initial_buffer_size = initial_buffer_size
 *         b.len = initial_buffer_size
 *         b.use = 0             # <<<<<<<<<<<<<<
 *         b.encoding = encoding
 *         return b
 */
  __pyx_v_b->use = 0;

  /* "asynctnt/iproto/rbuffer.pyx":58
 *         b.len = initial_buffer_size
 *         b.use = 0
 *         b.encoding = encoding             # <<<<<<<<<<<<<<
 *         return b
 * 
 */
  __Pyx_INCREF(__pyx_v_encoding);
  __Pyx_GIVEREF(__pyx_v_encoding);
  __Pyx_GOTREF(__pyx_v_b->encoding);
  __Pyx_DECREF(__pyx_v_b->encoding);
  __pyx_v_b->encoding = __pyx_v_encoding;

  /* "asynctnt/iproto/rbuffer.pyx":59
 *         b.use = 0
 *         b.encoding = encoding
 *         return b             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_b));
  __pyx_r = __pyx_v_b;
  goto __pyx_L0;

  /* "asynctnt/iproto/rbuffer.pyx":47
 * 
 *     @staticmethod
 *     cdef ReadBuffer new(str encoding, size_t initial_buffer_size=0x80000):             # <<<<<<<<<<<<<<
 *         cdef ReadBuffer b
 *         b = ReadBuffer.__new__(ReadBuffer)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asynctnt.iproto.protocol.ReadBuffer.new", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_b);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/rbuffer.pyx":61
 *         return b
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self.buf is not NULL:
 *             PyMem_Free(self.buf)
 */

/* Python wrapper */
static void __pyx_pw_8asynctnt_6iproto_8protocol_10ReadBuffer_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_8asynctnt_6iproto_8protocol_10ReadBuffer_3__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_pf_8asynctnt_6iproto_8protocol_10ReadBuffer_2__dealloc__(((struct __pyx_obj_8asynctnt_6iproto_8protocol_ReadBuffer *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

static void __pyx_pf_8asynctnt_6iproto_8protocol_10ReadBuffer_2__dealloc__(struct __pyx_obj_8asynctnt_6iproto_8protocol_ReadBuffer *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "asynctnt/iproto/rbuffer.pyx":62
 * 
 *     def __dealloc__(self):
 *         if self.buf is not NULL:             # <<<<<<<<<<<<<<
 *             PyMem_Free(self.buf)
 *             self.buf = NULL
 */
  __pyx_t_1 = ((__pyx_v_self->buf != NULL) != 0);
  if (__pyx_t_1) {

    /* "asynctnt/iproto/rbuffer.pyx":63
 *     def __dealloc__(self):
 *         if self.buf is not NULL:
 *             PyMem_Free(self.buf)             # <<<<<<<<<<<<<<
 *             self.buf = NULL
 *         self.initial_buffer_size = 0
 */
    PyMem_Free(__pyx_v_self->buf);

    /* "asynctnt/iproto/rbuffer.pyx":64
 *         if self.buf is not NULL:
 *             PyMem_Free(self.buf)
 *             self.buf = NULL             # <<<<<<<<<<<<<<
 *         self.initial_buffer_size = 0
 *         self.len = 0
 */
    __pyx_v_self->buf = NULL;

    /* "asynctnt/iproto/rbuffer.pyx":62
 * 
 *     def __dealloc__(self):
 *         if self.buf is not NULL:             # <<<<<<<<<<<<<<
 *             PyMem_Free(self.buf)
 *             self.buf = NULL
 */
  }

  /* "asynctnt/iproto/rbuffer.pyx":65
 *             PyMem_Free(self.buf)
 *             self.buf = NULL
 *         self.initial_buffer_size = 0             # <<<<<<<<<<<<<<
 *         self.len = 0
 *         self.use = 0
 */
  __pyx_v_self->initial_buffer_size = 0;

  /* "asynctnt/iproto/rbuffer.pyx":66
 *             self.buf = NULL
 *         self.initial_buffer_size = 0
 *         self.len = 0             # <<<<<<<<<<<<<<
 *         self.use = 0
 * 
 */
  __pyx_v_self->len = 0;

  /* "asynctnt/iproto/rbuffer.pyx":67
 *         self.initial_buffer_size = 0
 *         self.len = 0
 *         self.use = 0             # <<<<<<<<<<<<<<
 * 
 *     cdef void _reallocate(self, size_t new_size) except *:
 */
  __pyx_v_self->use = 0;

  /* "asynctnt/iproto/rbuffer.pyx":61
 *         return b
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self.buf is not NULL:
 *             PyMem_Free(self.buf)
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "asynctnt/iproto/rbuffer.pyx":69
 *         self.use = 0
 * 
 *     cdef void _reallocate(self, size_t new_size) except *:             # <<<<<<<<<<<<<<
 *         cdef char *new_buf
 * 
 */

static void __pyx_f_8asynctnt_6iproto_8protocol_10ReadBuffer__reallocate(struct __pyx_obj_8asynctnt_6iproto_8protocol_ReadBuffer *__pyx_v_self, size_t __pyx_v_new_size) {
  char *__pyx_v_new_buf;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("_reallocate", 0);

  /* "asynctnt/iproto/rbuffer.pyx":73
 * 
 *         # print('ReadBuffer reallocate: {}'.format(new_size))
 *         new_buf = <char*>PyMem_Realloc(<void*>self.buf, <size_t>new_size)             # <<<<<<<<<<<<<<
 *         if new_buf is NULL:
 *             PyMem_Free(self.buf)
 */
  __pyx_v_new_buf = ((char *)PyMem_Realloc(((void *)__pyx_v_self->buf), ((size_t)__pyx_v_new_size)));

  /* "asynctnt/iproto/rbuffer.pyx":74
 *         # print('ReadBuffer reallocate: {}'.format(new_size))
 *         new_buf = <char*>PyMem_Realloc(<void*>self.buf, <size_t>new_size)
 *         if new_buf is NULL:             # <<<<<<<<<<<<<<
 *             PyMem_Free(self.buf)
 *             self.buf = NULL
 */
  __pyx_t_1 = ((__pyx_v_new_buf == NULL) != 0);
  if (__pyx_t_1) {

    /* "asynctnt/iproto/rbuffer.pyx":75
 *         new_buf = <char*>PyMem_Realloc(<void*>self.buf, <size_t>new_size)
 *         if new_buf is NULL:
 *             PyMem_Free(self.buf)             # <<<<<<<<<<<<<<
 *             self.buf = NULL
 *             self.initial_buffer_size = 0
 */
    PyMem_Free(__pyx_v_self->buf);

    /* "asynctnt/iproto/rbuffer.pyx":76
 *         if new_buf is NULL:
 *             PyMem_Free(self.buf)
 *             self.buf = NULL             # <<<<<<<<<<<<<<
 *             self.initial_buffer_size = 0
 *             self.len = 0
 */
    __pyx_v_self->buf = NULL;

    /* "asynctnt/iproto/rbuffer.pyx":77
 *             PyMem_Free(self.buf)
 *             self.buf = NULL
 *             self.initial_buffer_size = 0             # <<<<<<<<<<<<<<
 *             self.len = 0
 *             self.use = 0
 */
    __pyx_v_self->initial_buffer_size = 0;

    /* "asynctnt/iproto/rbuffer.pyx":78
 *             self.buf = NULL
 *             self.initial_buffer_size = 0
 *             self.len = 0             # <<<<<<<<<<<<<<
 *             self.use = 0
 *             raise MemoryError
 */
    __pyx_v_self->len = 0;

    /* "asynctnt/iproto/rbuffer.pyx":79
 *             self.initial_buffer_size = 0
 *             self.len = 0
 *             self.use = 0             # <<<<<<<<<<<<<<
 *             raise MemoryError
 *         self.buf = new_buf
 */
    __pyx_v_self->use = 0;

    /* "asynctnt/iproto/rbuffer.pyx":80
 *             self.len = 0
 *             self.use = 0
 *             raise MemoryError             # <<<<<<<<<<<<<<
 *         self.buf = new_buf
 *         self.len = new_size
 */
    PyErr_NoMemory(); __PYX_ERR(5, 80, __pyx_L1_error)

    /* "asynctnt/iproto/rbuffer.pyx":74
 *         # print('ReadBuffer reallocate: {}'.format(new_size))
 *         new_buf = <char*>PyMem_Realloc(<void*>self.buf, <size_t>new_size)
 *         if new_buf is NULL:             # <<<<<<<<<<<<<<
 *             PyMem_Free(self.buf)
 *             self.buf = NULL
 */
  }

  /* "asynctnt/iproto/rbuffer.pyx":81
 *             self.use = 0
 *             raise MemoryError
 *         self.buf = new_buf             # <<<<<<<<<<<<<<
 *         self.len = new_size
 * 
 */
  __pyx_v_self->buf = __pyx_v_new_buf;

  /* "asynctnt/iproto/rbuffer.pyx":82
 *             raise MemoryError
 *         self.buf = new_buf
 *         self.len = new_size             # <<<<<<<<<<<<<<
 * 
 *     cdef int extend(self, const char *data, size_t len) except -1:
 */
  __pyx_v_self->len = __pyx_v_new_size;

  /* "asynctnt/iproto/rbuffer.pyx":69
 *         self.use = 0
 * 
 *     cdef void _reallocate(self, size_t new_size) except *:             # <<<<<<<<<<<<<<
 *         cdef char *new_buf
 * 
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("asynctnt.iproto.protocol.ReadBuffer._reallocate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "asynctnt/iproto/rbuffer.pyx":84
 *         self.len = new_size
 * 
 *     cdef int extend(self, const char *data, size_t len) except -1:             # <<<<<<<<<<<<<<
 *         cdef:
 *             size_t new_size
 */

static int __pyx_f_8asynctnt_6iproto_8protocol_10ReadBuffer_extend(struct __pyx_obj_8asynctnt_6iproto_8protocol_ReadBuffer *__pyx_v_self, char const *__pyx_v_data, size_t __pyx_v_len) {
  size_t __pyx_v_new_size;
  size_t __pyx_v_dealloc_threshold;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("extend", 0);

  /* "asynctnt/iproto/rbuffer.pyx":88
 *             size_t new_size
 *             size_t dealloc_threshold
 *         new_size = self.use + len             # <<<<<<<<<<<<<<
 *         dealloc_threshold = self.len // _DEALLOCATE_RATIO
 *         if new_size > self.len:
 */
  __pyx_v_new_size = (__pyx_v_self->use + __pyx_v_len);

  /* "asynctnt/iproto/rbuffer.pyx":89
 *             size_t dealloc_threshold
 *         new_size = self.use + len
 *         dealloc_threshold = self.len // _DEALLOCATE_RATIO             # <<<<<<<<<<<<<<
 *         if new_size > self.len:
 *             self._reallocate(
 */
  __pyx_v_dealloc_threshold = (__pyx_v_self->len / 4);

  /* "asynctnt/iproto/rbuffer.pyx":90
 *         new_size = self.use + len
 *         dealloc_threshold = self.len // _DEALLOCATE_RATIO
 *         if new_size > self.len:             # <<<<<<<<<<<<<<
 *             self._reallocate(
 *                 size_t_max(nearest_power_of_2(new_size), self.len << 1)
 */
  __pyx_t_1 = ((__pyx_v_new_size > __pyx_v_self->len) != 0);
  if (__pyx_t_1) {

    /* "asynctnt/iproto/rbuffer.pyx":91
 *         dealloc_threshold = self.len // _DEALLOCATE_RATIO
 *         if new_size > self.len:
 *             self._reallocate(             # <<<<<<<<<<<<<<
 *                 size_t_max(nearest_power_of_2(new_size), self.len << 1)
 *             )
 */
    __pyx_f_8asynctnt_6iproto_8protocol_10ReadBuffer__reallocate(__pyx_v_self, __pyx_f_8asynctnt_6iproto_8protocol_size_t_max(__pyx_f_8asynctnt_6iproto_8protocol_nearest_power_of_2(__pyx_v_new_size), (__pyx_v_self->len << 1))); if (unlikely(PyErr_Occurred())) __PYX_ERR(5, 91, __pyx_L1_error)

    /* "asynctnt/iproto/rbuffer.pyx":90
 *         new_size = self.use + len
 *         dealloc_threshold = self.len // _DEALLOCATE_RATIO
 *         if new_size > self.len:             # <<<<<<<<<<<<<<
 *             self._reallocate(
 *                 size_t_max(nearest_power_of_2(new_size), self.len << 1)
 */
    goto __pyx_L3;
  }

  /* "asynctnt/iproto/rbuffer.pyx":94
 *                 size_t_max(nearest_power_of_2(new_size), self.len << 1)
 *             )
 *         elif dealloc_threshold >= self.initial_buffer_size \             # <<<<<<<<<<<<<<
 *                 and new_size < dealloc_threshold:
 *             self._reallocate(dealloc_threshold)
 */
  __pyx_t_2 = ((__pyx_v_dealloc_threshold >= __pyx_v_self->initial_buffer_size) != 0);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }

  /* "asynctnt/iproto/rbuffer.pyx":95
 *             )
 *         elif dealloc_threshold >= self.initial_buffer_size \
 *                 and new_size < dealloc_threshold:             # <<<<<<<<<<<<<<
 *             self._reallocate(dealloc_threshold)
 * 
 */
  __pyx_t_2 = ((__pyx_v_new_size < __pyx_v_dealloc_threshold) != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;

  /* "asynctnt/iproto/rbuffer.pyx":94
 *                 size_t_max(nearest_power_of_2(new_size), self.len << 1)
 *             )
 *         elif dealloc_threshold >= self.initial_buffer_size \             # <<<<<<<<<<<<<<
 *                 and new_size < dealloc_threshold:
 *             self._reallocate(dealloc_threshold)
 */
  if (__pyx_t_1) {

    /* "asynctnt/iproto/rbuffer.pyx":96
 *         elif dealloc_threshold >= self.initial_buffer_size \
 *                 and new_size < dealloc_threshold:
 *             self._reallocate(dealloc_threshold)             # <<<<<<<<<<<<<<
 * 
 *         memcpy(&self.buf[self.use], data, len)
 */
    __pyx_f_8asynctnt_6iproto_8protocol_10ReadBuffer__reallocate(__pyx_v_self, __pyx_v_dealloc_threshold); if (unlikely(PyErr_Occurred())) __PYX_ERR(5, 96, __pyx_L1_error)

    /* "asynctnt/iproto/rbuffer.pyx":94
 *                 size_t_max(nearest_power_of_2(new_size), self.len << 1)
 *             )
 *         elif dealloc_threshold >= self.initial_buffer_size \             # <<<<<<<<<<<<<<
 *                 and new_size < dealloc_threshold:
 *             self._reallocate(dealloc_threshold)
 */
  }
  __pyx_L3:;

  /* "asynctnt/iproto/rbuffer.pyx":98
 *             self._reallocate(dealloc_threshold)
 * 
 *         memcpy(&self.buf[self.use], data, len)             # <<<<<<<<<<<<<<
 *         self.use += len
 *         return 0
 */
  memcpy((&(__pyx_v_self->buf[__pyx_v_self->use])), __pyx_v_data, __pyx_v_len);

  /* "asynctnt/iproto/rbuffer.pyx":99
 * 
 *         memcpy(&self.buf[self.use], data, len)
 *         self.use += len             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */
  __pyx_v_self->use = (__pyx_v_self->use + __pyx_v_len);

  /* "asynctnt/iproto/rbuffer.pyx":100
 *         memcpy(&self.buf[self.use], data, len)
 *         self.use += len
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     cdef void move(self, size_t pos):
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "asynctnt/iproto/rbuffer.pyx":84
 *         self.len = new_size
 * 
 *     cdef int extend(self, const char *data, size_t len) except -1:             # <<<<<<<<<<<<<<
 *         cdef:
 *             size_t new_size
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("asynctnt.iproto.protocol.ReadBuffer.extend", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/rbuffer.pyx":102
 *         return 0
 * 
 *     cdef void move(self, size_t pos):             # <<<<<<<<<<<<<<
 *         cdef size_t delta = self.use - pos
 *         memmove(self.buf, &self.buf[pos], delta)
 */

static void __pyx_f_8asynctnt_6iproto_8protocol_10ReadBuffer_move(struct __pyx_obj_8asynctnt_6iproto_8protocol_ReadBuffer *__pyx_v_self, size_t __pyx_v_pos) {
  size_t __pyx_v_delta;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("move", 0);

  /* "asynctnt/iproto/rbuffer.pyx":103
 * 
 *     cdef void move(self, size_t pos):
 *         cdef size_t delta = self.use - pos             # <<<<<<<<<<<<<<
 *         memmove(self.buf, &self.buf[pos], delta)
 *         self.use = delta
 */
  __pyx_v_delta = (__pyx_v_self->use - __pyx_v_pos);

  /* "asynctnt/iproto/rbuffer.pyx":104
 *     cdef void move(self, size_t pos):
 *         cdef size_t delta = self.use - pos
 *         memmove(self.buf, &self.buf[pos], delta)             # <<<<<<<<<<<<<<
 *         self.use = delta
 * 
 */
  memmove(__pyx_v_self->buf, (&(__pyx_v_self->buf[__pyx_v_pos])), __pyx_v_delta);

  /* "asynctnt/iproto/rbuffer.pyx":105
 *         cdef size_t delta = self.use - pos
 *         memmove(self.buf, &self.buf[pos], delta)
 *         self.use = delta             # <<<<<<<<<<<<<<
 * 
 *     cdef void move_offset(self, ssize_t offset, size_t size) except *:
 */
  __pyx_v_self->use = __pyx_v_delta;

  /* "asynctnt/iproto/rbuffer.pyx":102
 *         return 0
 * 
 *     cdef void move(self, size_t pos):             # <<<<<<<<<<<<<<
 *         cdef size_t delta = self.use - pos
 *         memmove(self.buf, &self.buf[pos], delta)
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "asynctnt/iproto/rbuffer.pyx":107
 *         self.use = delta
 * 
 *     cdef void move_offset(self, ssize_t offset, size_t size) except *:             # <<<<<<<<<<<<<<
 *         cdef size_t dealloc_threshold = self.len // _DEALLOCATE_RATIO
 *         if offset == 0:
 */

static void __pyx_f_8asynctnt_6iproto_8protocol_10ReadBuffer_move_offset(struct __pyx_obj_8asynctnt_6iproto_8protocol_ReadBuffer *__pyx_v_self, Py_ssize_t __pyx_v_offset, size_t __pyx_v_size) {
  size_t __pyx_v_dealloc_threshold;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  __Pyx_RefNannySetupContext("move_offset", 0);

  /* "asynctnt/iproto/rbuffer.pyx":108
 * 
 *     cdef void move_offset(self, ssize_t offset, size_t size) except *:
 *         cdef size_t dealloc_threshold = self.len // _DEALLOCATE_RATIO             # <<<<<<<<<<<<<<
 *         if offset == 0:
 *             return
 */
  __pyx_v_dealloc_threshold = (__pyx_v_self->len / 4);

  /* "asynctnt/iproto/rbuffer.pyx":109
 *     cdef void move_offset(self, ssize_t offset, size_t size) except *:
 *         cdef size_t dealloc_threshold = self.len // _DEALLOCATE_RATIO
 *         if offset == 0:             # <<<<<<<<<<<<<<
 *             return
 *         assert offset > 0, \
 */
  __pyx_t_1 = ((__pyx_v_offset == 0) != 0);
  if (__pyx_t_1) {

    /* "asynctnt/iproto/rbuffer.pyx":110
 *         cdef size_t dealloc_threshold = self.len // _DEALLOCATE_RATIO
 *         if offset == 0:
 *             return             # <<<<<<<<<<<<<<
 *         assert offset > 0, \
 *             'Offset incorrect. Got: {}. use:{}, len:{}'.format(
 */
    goto __pyx_L0;

    /* "asynctnt/iproto/rbuffer.pyx":109
 *     cdef void move_offset(self, ssize_t offset, size_t size) except *:
 *         cdef size_t dealloc_threshold = self.len // _DEALLOCATE_RATIO
 *         if offset == 0:             # <<<<<<<<<<<<<<
 *             return
 *         assert offset > 0, \
 */
  }

  /* "asynctnt/iproto/rbuffer.pyx":111
 *         if offset == 0:
 *             return
 *         assert offset > 0, \             # <<<<<<<<<<<<<<
 *             'Offset incorrect. Got: {}. use:{}, len:{}'.format(
 *                 offset, self.use, self.len
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    if (unlikely(!((__pyx_v_offset > 0) != 0))) {

      /* "asynctnt/iproto/rbuffer.pyx":112
 *             return
 *         assert offset > 0, \
 *             'Offset incorrect. Got: {}. use:{}, len:{}'.format(             # <<<<<<<<<<<<<<
 *                 offset, self.use, self.len
 *             )
 */
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_Offset_incorrect_Got_use_len, __pyx_n_s_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 112, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);

      /* "asynctnt/iproto/rbuffer.pyx":113
 *         assert offset > 0, \
 *             'Offset incorrect. Got: {}. use:{}, len:{}'.format(
 *                 offset, self.use, self.len             # <<<<<<<<<<<<<<
 *             )
 *         if dealloc_threshold >= self.initial_buffer_size \
 */
      __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_offset); if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 113, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PyInt_FromSize_t(__pyx_v_self->use); if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 113, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = __Pyx_PyInt_FromSize_t(__pyx_v_self->len); if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 113, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = NULL;
      __pyx_t_8 = 0;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_7)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_7);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
          __pyx_t_8 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_t_4, __pyx_t_5, __pyx_t_6};
        __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 112, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_t_4, __pyx_t_5, __pyx_t_6};
        __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 112, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      } else
      #endif
      {
        __pyx_t_9 = PyTuple_New(3+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(5, 112, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        if (__pyx_t_7) {
          __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
        }
        __Pyx_GIVEREF(__pyx_t_4);
        PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_4);
        __Pyx_GIVEREF(__pyx_t_5);
        PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_t_5);
        __Pyx_GIVEREF(__pyx_t_6);
        PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_8, __pyx_t_6);
        __pyx_t_4 = 0;
        __pyx_t_5 = 0;
        __pyx_t_6 = 0;
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_9, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 112, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "asynctnt/iproto/rbuffer.pyx":112
 *             return
 *         assert offset > 0, \
 *             'Offset incorrect. Got: {}. use:{}, len:{}'.format(             # <<<<<<<<<<<<<<
 *                 offset, self.use, self.len
 *             )
 */
      __pyx_t_3 = PyTuple_Pack(1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 112, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_3);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __PYX_ERR(5, 111, __pyx_L1_error)
    }
  }
  #endif

  /* "asynctnt/iproto/rbuffer.pyx":115
 *                 offset, self.use, self.len
 *             )
 *         if dealloc_threshold >= self.initial_buffer_size \             # <<<<<<<<<<<<<<
 *                 and size < dealloc_threshold:
 *             self._reallocate(dealloc_threshold)
 */
  __pyx_t_10 = ((__pyx_v_dealloc_threshold >= __pyx_v_self->initial_buffer_size) != 0);
  if (__pyx_t_10) {
  } else {
    __pyx_t_1 = __pyx_t_10;
    goto __pyx_L5_bool_binop_done;
  }

  /* "asynctnt/iproto/rbuffer.pyx":116
 *             )
 *         if dealloc_threshold >= self.initial_buffer_size \
 *                 and size < dealloc_threshold:             # <<<<<<<<<<<<<<
 *             self._reallocate(dealloc_threshold)
 *         else:
 */
  __pyx_t_10 = ((__pyx_v_size < __pyx_v_dealloc_threshold) != 0);
  __pyx_t_1 = __pyx_t_10;
  __pyx_L5_bool_binop_done:;

  /* "asynctnt/iproto/rbuffer.pyx":115
 *                 offset, self.use, self.len
 *             )
 *         if dealloc_threshold >= self.initial_buffer_size \             # <<<<<<<<<<<<<<
 *                 and size < dealloc_threshold:
 *             self._reallocate(dealloc_threshold)
 */
  if (__pyx_t_1) {

    /* "asynctnt/iproto/rbuffer.pyx":117
 *         if dealloc_threshold >= self.initial_buffer_size \
 *                 and size < dealloc_threshold:
 *             self._reallocate(dealloc_threshold)             # <<<<<<<<<<<<<<
 *         else:
 *             memmove(self.buf, &self.buf[offset], size)
 */
    __pyx_f_8asynctnt_6iproto_8protocol_10ReadBuffer__reallocate(__pyx_v_self, __pyx_v_dealloc_threshold); if (unlikely(PyErr_Occurred())) __PYX_ERR(5, 117, __pyx_L1_error)

    /* "asynctnt/iproto/rbuffer.pyx":115
 *                 offset, self.use, self.len
 *             )
 *         if dealloc_threshold >= self.initial_buffer_size \             # <<<<<<<<<<<<<<
 *                 and size < dealloc_threshold:
 *             self._reallocate(dealloc_threshold)
 */
    goto __pyx_L4;
  }

  /* "asynctnt/iproto/rbuffer.pyx":119
 *             self._reallocate(dealloc_threshold)
 *         else:
 *             memmove(self.buf, &self.buf[offset], size)             # <<<<<<<<<<<<<<
 * 
 *     cdef bytes get_slice(self, size_t begin, size_t end):
 */
  /*else*/ {
    memmove(__pyx_v_self->buf, (&(__pyx_v_self->buf[__pyx_v_offset])), __pyx_v_size);
  }
  __pyx_L4:;

  /* "asynctnt/iproto/rbuffer.pyx":107
 *         self.use = delta
 * 
 *     cdef void move_offset(self, ssize_t offset, size_t size) except *:             # <<<<<<<<<<<<<<
 *         cdef size_t dealloc_threshold = self.len // _DEALLOCATE_RATIO
 *         if offset == 0:
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("asynctnt.iproto.protocol.ReadBuffer.move_offset", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "asynctnt/iproto/rbuffer.pyx":121
 *             memmove(self.buf, &self.buf[offset], size)
 * 
 *     cdef bytes get_slice(self, size_t begin, size_t end):             # <<<<<<<<<<<<<<
 *         cdef:
 *             ssize_t diff
 */

static PyObject *__pyx_f_8asynctnt_6iproto_8protocol_10ReadBuffer_get_slice(struct __pyx_obj_8asynctnt_6iproto_8protocol_ReadBuffer *__pyx_v_self, size_t __pyx_v_begin, size_t __pyx_v_end) {
  Py_ssize_t __pyx_v_diff;
  char *__pyx_v_p;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("get_slice", 0);

  /* "asynctnt/iproto/rbuffer.pyx":125
 *             ssize_t diff
 *             char *p
 *         p = &self.buf[begin]             # <<<<<<<<<<<<<<
 *         diff = end - begin
 *         return <bytes>p[:diff]
 */
  __pyx_v_p = (&(__pyx_v_self->buf[__pyx_v_begin]));

  /* "asynctnt/iproto/rbuffer.pyx":126
 *             char *p
 *         p = &self.buf[begin]
 *         diff = end - begin             # <<<<<<<<<<<<<<
 *         return <bytes>p[:diff]
 * 
 */
  __pyx_v_diff = (__pyx_v_end - __pyx_v_begin);

  /* "asynctnt/iproto/rbuffer.pyx":127
 *         p = &self.buf[begin]
 *         diff = end - begin
 *         return <bytes>p[:diff]             # <<<<<<<<<<<<<<
 * 
 *     cdef bytes get_slice_begin(self, size_t begin):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_p + 0, __pyx_v_diff - 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 127, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject*)__pyx_t_1));
  __pyx_r = ((PyObject*)__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "asynctnt/iproto/rbuffer.pyx":121
 *             memmove(self.buf, &self.buf[offset], size)
 * 
 *     cdef bytes get_slice(self, size_t begin, size_t end):             # <<<<<<<<<<<<<<
 *         cdef:
 *             ssize_t diff
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asynctnt.iproto.protocol.ReadBuffer.get_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/rbuffer.pyx":129
 *         return <bytes>p[:diff]
 * 
 *     cdef bytes get_slice_begin(self, size_t begin):             # <<<<<<<<<<<<<<
 *         cdef:
 *             ssize_t diff
 */

static PyObject *__pyx_f_8asynctnt_6iproto_8protocol_10ReadBuffer_get_slice_begin(struct __pyx_obj_8asynctnt_6iproto_8protocol_ReadBuffer *__pyx_v_self, size_t __pyx_v_begin) {
  Py_ssize_t __pyx_v_diff;
  char *__pyx_v_p;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("get_slice_begin", 0);

  /* "asynctnt/iproto/rbuffer.pyx":133
 *             ssize_t diff
 *             char *p
 *         p = &self.buf[begin]             # <<<<<<<<<<<<<<
 *         diff = self.use - begin
 *         return <bytes>p[:diff]
 */
  __pyx_v_p = (&(__pyx_v_self->buf[__pyx_v_begin]));

  /* "asynctnt/iproto/rbuffer.pyx":134
 *             char *p
 *         p = &self.buf[begin]
 *         diff = self.use - begin             # <<<<<<<<<<<<<<
 *         return <bytes>p[:diff]
 * 
 */
  __pyx_v_diff = (__pyx_v_self->use - __pyx_v_begin);

  /* "asynctnt/iproto/rbuffer.pyx":135
 *         p = &self.buf[begin]
 *         diff = self.use - begin
 *         return <bytes>p[:diff]             # <<<<<<<<<<<<<<
 * 
 *     cdef bytes get_slice_end(self, size_t end):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_p + 0, __pyx_v_diff - 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 135, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject*)__pyx_t_1));
  __pyx_r = ((PyObject*)__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "asynctnt/iproto/rbuffer.pyx":129
 *         return <bytes>p[:diff]
 * 
 *     cdef bytes get_slice_begin(self, size_t begin):             # <<<<<<<<<<<<<<
 *         cdef:
 *             ssize_t diff
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asynctnt.iproto.protocol.ReadBuffer.get_slice_begin", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/rbuffer.pyx":137
 *         return <bytes>p[:diff]
 * 
 *     cdef bytes get_slice_end(self, size_t end):             # <<<<<<<<<<<<<<
 *         cdef:
 *             ssize_t diff
 */

static PyObject *__pyx_f_8asynctnt_6iproto_8protocol_10ReadBuffer_get_slice_end(struct __pyx_obj_8asynctnt_6iproto_8protocol_ReadBuffer *__pyx_v_self, size_t __pyx_v_end) {
  Py_ssize_t __pyx_v_diff;
  char *__pyx_v_p;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("get_slice_end", 0);

  /* "asynctnt/iproto/rbuffer.pyx":141
 *             ssize_t diff
 *             char *p
 *         p = &self.buf[0]             # <<<<<<<<<<<<<<
 *         diff = end - 0
 *         return <bytes>p[:diff]
 */
  __pyx_v_p = (&(__pyx_v_self->buf[0]));

  /* "asynctnt/iproto/rbuffer.pyx":142
 *             char *p
 *         p = &self.buf[0]
 *         diff = end - 0             # <<<<<<<<<<<<<<
 *         return <bytes>p[:diff]
 */
  __pyx_v_diff = (__pyx_v_end - 0);

  /* "asynctnt/iproto/rbuffer.pyx":143
 *         p = &self.buf[0]
 *         diff = end - 0
 *         return <bytes>p[:diff]             # <<<<<<<<<<<<<<
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_p + 0, __pyx_v_diff - 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 143, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject*)__pyx_t_1));
  __pyx_r = ((PyObject*)__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "asynctnt/iproto/rbuffer.pyx":137
 *         return <bytes>p[:diff]
 * 
 *     cdef bytes get_slice_end(self, size_t end):             # <<<<<<<<<<<<<<
 *         cdef:
 *             ssize_t diff
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asynctnt.iproto.protocol.ReadBuffer.get_slice_end", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/request.pyx":11
 * cdef class Request:
 *     @staticmethod
 *     cdef inline Request new(tnt.tp_request_type op,             # <<<<<<<<<<<<<<
 *                             uint64_t sync, int64_t schema_id,
 *                             WriteBuffer buf_body):
 */

static CYTHON_INLINE struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *__pyx_f_8asynctnt_6iproto_8protocol_7Request_new(enum __pyx_t_8asynctnt_6iproto_3tnt_tp_request_type __pyx_v_op, uint64_t __pyx_v_sync, int64_t __pyx_v_schema_id, struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *__pyx_v_buf_body) {
  struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *__pyx_v_req = 0;
  struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("new", 0);

  /* "asynctnt/iproto/request.pyx":15
 *                             WriteBuffer buf_body):
 *         cdef Request req
 *         req = Request.__new__(Request)             # <<<<<<<<<<<<<<
 *         req.op = op
 *         req.sync = sync
 */
  __pyx_t_1 = __pyx_tp_new_8asynctnt_6iproto_8protocol_Request(((PyTypeObject *)__pyx_ptype_8asynctnt_6iproto_8protocol_Request), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 15, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_8asynctnt_6iproto_8protocol_Request)))) __PYX_ERR(6, 15, __pyx_L1_error)
  __pyx_v_req = ((struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "asynctnt/iproto/request.pyx":16
 *         cdef Request req
 *         req = Request.__new__(Request)
 *         req.op = op             # <<<<<<<<<<<<<<
 *         req.sync = sync
 *         req.schema_id = schema_id
 */
  __pyx_v_req->op = __pyx_v_op;

  /* "asynctnt/iproto/request.pyx":17
 *         req = Request.__new__(Request)
 *         req.op = op
 *         req.sync = sync             # <<<<<<<<<<<<<<
 *         req.schema_id = schema_id
 *         req.buf_body = buf_body
 */
  __pyx_v_req->sync = __pyx_v_sync;

  /* "asynctnt/iproto/request.pyx":18
 *         req.op = op
 *         req.sync = sync
 *         req.schema_id = schema_id             # <<<<<<<<<<<<<<
 *         req.buf_body = buf_body
 *         req.waiter = None
 */
  __pyx_v_req->schema_id = __pyx_v_schema_id;

  /* "asynctnt/iproto/request.pyx":19
 *         req.sync = sync
 *         req.schema_id = schema_id
 *         req.buf_body = buf_body             # <<<<<<<<<<<<<<
 *         req.waiter = None
 *         req.timeout_handle = None
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_buf_body));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_buf_body));
  __Pyx_GOTREF(__pyx_v_req->buf_body);
  __Pyx_DECREF(((PyObject *)__pyx_v_req->buf_body));
  __pyx_v_req->buf_body = __pyx_v_buf_body;

  /* "asynctnt/iproto/request.pyx":20
 *         req.schema_id = schema_id
 *         req.buf_body = buf_body
 *         req.waiter = None             # <<<<<<<<<<<<<<
 *         req.timeout_handle = None
 *         return req
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_req->waiter);
  __Pyx_DECREF(__pyx_v_req->waiter);
  __pyx_v_req->waiter = Py_None;

  /* "asynctnt/iproto/request.pyx":21
 *         req.buf_body = buf_body
 *         req.waiter = None
 *         req.timeout_handle = None             # <<<<<<<<<<<<<<
 *         return req
 * 
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_req->timeout_handle);
  __Pyx_DECREF(__pyx_v_req->timeout_handle);
  __pyx_v_req->timeout_handle = Py_None;

  /* "asynctnt/iproto/request.pyx":22
 *         req.waiter = None
 *         req.timeout_handle = None
 *         return req             # <<<<<<<<<<<<<<
 * 
 *     cdef WriteBuffer build(self):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_req));
  __pyx_r = __pyx_v_req;
  goto __pyx_L0;

  /* "asynctnt/iproto/request.pyx":11
 * cdef class Request:
 *     @staticmethod
 *     cdef inline Request new(tnt.tp_request_type op,             # <<<<<<<<<<<<<<
 *                             uint64_t sync, int64_t schema_id,
 *                             WriteBuffer buf_body):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asynctnt.iproto.protocol.Request.new", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_req);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/request.pyx":24
 *         return req
 * 
 *     cdef WriteBuffer build(self):             # <<<<<<<<<<<<<<
 *         cdef WriteBuffer buf
 *         buf = WriteBuffer.new()
 */

static struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *__pyx_f_8asynctnt_6iproto_8protocol_7Request_build(struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *__pyx_v_self) {
  struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *__pyx_v_buf = 0;
  struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_8asynctnt_6iproto_8protocol_11WriteBuffer_write_header __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("build", 0);

  /* "asynctnt/iproto/request.pyx":26
 *     cdef WriteBuffer build(self):
 *         cdef WriteBuffer buf
 *         buf = WriteBuffer.new()             # <<<<<<<<<<<<<<
 *         buf.write_header(self.sync, self.op, self.schema_id)
 *         if self.buf_body is not None:
 */
  __pyx_t_1 = ((PyObject *)__pyx_vtabptr_8asynctnt_6iproto_8protocol_WriteBuffer->new(NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 26, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_buf = ((struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "asynctnt/iproto/request.pyx":27
 *         cdef WriteBuffer buf
 *         buf = WriteBuffer.new()
 *         buf.write_header(self.sync, self.op, self.schema_id)             # <<<<<<<<<<<<<<
 *         if self.buf_body is not None:
 *             buf.write_buffer(self.buf_body)
 */
  __pyx_t_2.__pyx_n = 1;
  __pyx_t_2.schema_id = __pyx_v_self->schema_id;
  __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer_write_header(__pyx_v_buf, __pyx_v_self->sync, __pyx_v_self->op, &__pyx_t_2); if (unlikely(PyErr_Occurred())) __PYX_ERR(6, 27, __pyx_L1_error)

  /* "asynctnt/iproto/request.pyx":28
 *         buf = WriteBuffer.new()
 *         buf.write_header(self.sync, self.op, self.schema_id)
 *         if self.buf_body is not None:             # <<<<<<<<<<<<<<
 *             buf.write_buffer(self.buf_body)
 *         buf.write_length()
 */
  __pyx_t_3 = (((PyObject *)__pyx_v_self->buf_body) != Py_None);
  __pyx_t_4 = (__pyx_t_3 != 0);
  if (__pyx_t_4) {

    /* "asynctnt/iproto/request.pyx":29
 *         buf.write_header(self.sync, self.op, self.schema_id)
 *         if self.buf_body is not None:
 *             buf.write_buffer(self.buf_body)             # <<<<<<<<<<<<<<
 *         buf.write_length()
 *         return buf
 */
    __pyx_t_1 = ((PyObject *)__pyx_v_self->buf_body);
    __Pyx_INCREF(__pyx_t_1);
    __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer_write_buffer(__pyx_v_buf, ((struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *)__pyx_t_1)); if (unlikely(PyErr_Occurred())) __PYX_ERR(6, 29, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "asynctnt/iproto/request.pyx":28
 *         buf = WriteBuffer.new()
 *         buf.write_header(self.sync, self.op, self.schema_id)
 *         if self.buf_body is not None:             # <<<<<<<<<<<<<<
 *             buf.write_buffer(self.buf_body)
 *         buf.write_length()
 */
  }

  /* "asynctnt/iproto/request.pyx":30
 *         if self.buf_body is not None:
 *             buf.write_buffer(self.buf_body)
 *         buf.write_length()             # <<<<<<<<<<<<<<
 *         return buf
 * 
 */
  __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer_write_length(__pyx_v_buf);

  /* "asynctnt/iproto/request.pyx":31
 *             buf.write_buffer(self.buf_body)
 *         buf.write_length()
 *         return buf             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_buf));
  __pyx_r = __pyx_v_buf;
  goto __pyx_L0;

  /* "asynctnt/iproto/request.pyx":24
 *         return req
 * 
 *     cdef WriteBuffer build(self):             # <<<<<<<<<<<<<<
 *         cdef WriteBuffer buf
 *         buf = WriteBuffer.new()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asynctnt.iproto.protocol.Request.build", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_buf);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/request.pyx":33
 *         return buf
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return '<Request op={}, sync={}, schema_id={}, body_len={}>'.format(
 *             self.op,
 */

/* Python wrapper */
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_7Request_1__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_7Request_1__repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8asynctnt_6iproto_8protocol_7Request___repr__(((struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_7Request___repr__(struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "asynctnt/iproto/request.pyx":34
 * 
 *     def __repr__(self):
 *         return '<Request op={}, sync={}, schema_id={}, body_len={}>'.format(             # <<<<<<<<<<<<<<
 *             self.op,
 *             self.sync,
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_Request_op_sync_schema_id_body, __pyx_n_s_format); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 34, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "asynctnt/iproto/request.pyx":35
 *     def __repr__(self):
 *         return '<Request op={}, sync={}, schema_id={}, body_len={}>'.format(
 *             self.op,             # <<<<<<<<<<<<<<
 *             self.sync,
 *             self.schema_id,
 */
  __pyx_t_3 = __Pyx_PyInt_From_enum____pyx_t_8asynctnt_6iproto_3tnt_tp_request_type(__pyx_v_self->op); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 35, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "asynctnt/iproto/request.pyx":36
 *         return '<Request op={}, sync={}, schema_id={}, body_len={}>'.format(
 *             self.op,
 *             self.sync,             # <<<<<<<<<<<<<<
 *             self.schema_id,
 *             self.buf_body.len()
 */
  __pyx_t_4 = __Pyx_PyInt_From_uint64_t(__pyx_v_self->sync); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 36, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);

  /* "asynctnt/iproto/request.pyx":37
 *             self.op,
 *             self.sync,
 *             self.schema_id,             # <<<<<<<<<<<<<<
 *             self.buf_body.len()
 *         )
 */
  __pyx_t_5 = __Pyx_PyInt_From_int64_t(__pyx_v_self->schema_id); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 37, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);

  /* "asynctnt/iproto/request.pyx":38
 *             self.sync,
 *             self.schema_id,
 *             self.buf_body.len()             # <<<<<<<<<<<<<<
 *         )
 */
  __pyx_t_6 = __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer_len(__pyx_v_self->buf_body); if (unlikely(!__pyx_t_6)) __PYX_ERR(6, 38, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = NULL;
  __pyx_t_8 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_8 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[5] = {__pyx_t_7, __pyx_t_3, __pyx_t_4, __pyx_t_5, __pyx_t_6};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 4+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 34, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[5] = {__pyx_t_7, __pyx_t_3, __pyx_t_4, __pyx_t_5, __pyx_t_6};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 4+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 34, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else
  #endif
  {
    __pyx_t_9 = PyTuple_New(4+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(6, 34, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    if (__pyx_t_7) {
      __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_8, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_9, 3+__pyx_t_8, __pyx_t_6);
    __pyx_t_3 = 0;
    __pyx_t_4 = 0;
    __pyx_t_5 = 0;
    __pyx_t_6 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 34, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "asynctnt/iproto/request.pyx":33
 *         return buf
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return '<Request op={}, sync={}, schema_id={}, body_len={}>'.format(
 *             self.op,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("asynctnt.iproto.protocol.Request.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/response.pyx":13
 * cdef class Response:
 *     @staticmethod
 *     cdef inline Response new(bytes encoding):             # <<<<<<<<<<<<<<
 *         cdef Response resp
 *         resp = Response.__new__(Response)
 */

static CYTHON_INLINE struct __pyx_obj_8asynctnt_6iproto_8protocol_Response *__pyx_f_8asynctnt_6iproto_8protocol_8Response_new(PyObject *__pyx_v_encoding) {
  struct __pyx_obj_8asynctnt_6iproto_8protocol_Response *__pyx_v_resp = 0;
  struct __pyx_obj_8asynctnt_6iproto_8protocol_Response *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("new", 0);

  /* "asynctnt/iproto/response.pyx":15
 *     cdef inline Response new(bytes encoding):
 *         cdef Response resp
 *         resp = Response.__new__(Response)             # <<<<<<<<<<<<<<
 *         resp.sync = 0
 *         resp.code = 0
 */
  __pyx_t_1 = __pyx_tp_new_8asynctnt_6iproto_8protocol_Response(((PyTypeObject *)__pyx_ptype_8asynctnt_6iproto_8protocol_Response), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 15, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_8asynctnt_6iproto_8protocol_Response)))) __PYX_ERR(7, 15, __pyx_L1_error)
  __pyx_v_resp = ((struct __pyx_obj_8asynctnt_6iproto_8protocol_Response *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "asynctnt/iproto/response.pyx":16
 *         cdef Response resp
 *         resp = Response.__new__(Response)
 *         resp.sync = 0             # <<<<<<<<<<<<<<
 *         resp.code = 0
 *         resp.schema_id = -1
 */
  __pyx_v_resp->sync = 0;

  /* "asynctnt/iproto/response.pyx":17
 *         resp = Response.__new__(Response)
 *         resp.sync = 0
 *         resp.code = 0             # <<<<<<<<<<<<<<
 *         resp.schema_id = -1
 *         resp.errmsg = None
 */
  __pyx_v_resp->code = 0;

  /* "asynctnt/iproto/response.pyx":18
 *         resp.sync = 0
 *         resp.code = 0
 *         resp.schema_id = -1             # <<<<<<<<<<<<<<
 *         resp.errmsg = None
 *         resp.body = None
 */
  __pyx_v_resp->schema_id = -1L;

  /* "asynctnt/iproto/response.pyx":19
 *         resp.code = 0
 *         resp.schema_id = -1
 *         resp.errmsg = None             # <<<<<<<<<<<<<<
 *         resp.body = None
 *         resp.encoding = encoding
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_resp->errmsg);
  __Pyx_DECREF(__pyx_v_resp->errmsg);
  __pyx_v_resp->errmsg = ((PyObject*)Py_None);

  /* "asynctnt/iproto/response.pyx":20
 *         resp.schema_id = -1
 *         resp.errmsg = None
 *         resp.body = None             # <<<<<<<<<<<<<<
 *         resp.encoding = encoding
 *         return resp
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_resp->body);
  __Pyx_DECREF(__pyx_v_resp->body);
  __pyx_v_resp->body = ((PyObject*)Py_None);

  /* "asynctnt/iproto/response.pyx":21
 *         resp.errmsg = None
 *         resp.body = None
 *         resp.encoding = encoding             # <<<<<<<<<<<<<<
 *         return resp
 * 
 */
  __Pyx_INCREF(__pyx_v_encoding);
  __Pyx_GIVEREF(__pyx_v_encoding);
  __Pyx_GOTREF(__pyx_v_resp->encoding);
  __Pyx_DECREF(__pyx_v_resp->encoding);
  __pyx_v_resp->encoding = __pyx_v_encoding;

  /* "asynctnt/iproto/response.pyx":22
 *         resp.body = None
 *         resp.encoding = encoding
 *         return resp             # <<<<<<<<<<<<<<
 * 
 *     cdef inline has_schema_id(self):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_resp));
  __pyx_r = __pyx_v_resp;
  goto __pyx_L0;

  /* "asynctnt/iproto/response.pyx":13
 * cdef class Response:
 *     @staticmethod
 *     cdef inline Response new(bytes encoding):             # <<<<<<<<<<<<<<
 *         cdef Response resp
 *         resp = Response.__new__(Response)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asynctnt.iproto.protocol.Response.new", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_resp);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/response.pyx":24
 *         return resp
 * 
 *     cdef inline has_schema_id(self):             # <<<<<<<<<<<<<<
 *         return self.schema_id != -1
 * 
 */

static CYTHON_INLINE PyObject *__pyx_f_8asynctnt_6iproto_8protocol_8Response_has_schema_id(struct __pyx_obj_8asynctnt_6iproto_8protocol_Response *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("has_schema_id", 0);

  /* "asynctnt/iproto/response.pyx":25
 * 
 *     cdef inline has_schema_id(self):
 *         return self.schema_id != -1             # <<<<<<<<<<<<<<
 * 
 *     cdef inline is_error(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong((__pyx_v_self->schema_id != -1L)); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 25, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "asynctnt/iproto/response.pyx":24
 *         return resp
 * 
 *     cdef inline has_schema_id(self):             # <<<<<<<<<<<<<<
 *         return self.schema_id != -1
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asynctnt.iproto.protocol.Response.has_schema_id", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/response.pyx":27
 *         return self.schema_id != -1
 * 
 *     cdef inline is_error(self):             # <<<<<<<<<<<<<<
 *         return self.code != 0
 * 
 */

static CYTHON_INLINE PyObject *__pyx_f_8asynctnt_6iproto_8protocol_8Response_is_error(struct __pyx_obj_8asynctnt_6iproto_8protocol_Response *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("is_error", 0);

  /* "asynctnt/iproto/response.pyx":28
 * 
 *     cdef inline is_error(self):
 *         return self.code != 0             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong((__pyx_v_self->code != 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 28, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "asynctnt/iproto/response.pyx":27
 *         return self.schema_id != -1
 * 
 *     cdef inline is_error(self):             # <<<<<<<<<<<<<<
 *         return self.code != 0
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asynctnt.iproto.protocol.Response.is_error", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/response.pyx":30
 *         return self.code != 0
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return '<Response: code={}, sync={}>'.format(self.code, self.sync)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_8Response_1__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_8Response_1__repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8asynctnt_6iproto_8protocol_8Response___repr__(((struct __pyx_obj_8asynctnt_6iproto_8protocol_Response *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_8Response___repr__(struct __pyx_obj_8asynctnt_6iproto_8protocol_Response *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "asynctnt/iproto/response.pyx":31
 * 
 *     def __repr__(self):
 *         return '<Response: code={}, sync={}>'.format(self.code, self.sync)             # <<<<<<<<<<<<<<
 * 
 *     def body2yaml(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_Response_code_sync, __pyx_n_s_format); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 31, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyInt_From_uint32_t(__pyx_v_self->code); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 31, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyInt_From_uint64_t(__pyx_v_self->sync); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 31, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_6 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_3, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 31, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_3, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 31, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  {
    __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(7, 31, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (__pyx_t_5) {
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_4);
    __pyx_t_3 = 0;
    __pyx_t_4 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 31, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "asynctnt/iproto/response.pyx":30
 *         return self.code != 0
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return '<Response: code={}, sync={}>'.format(self.code, self.sync)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("asynctnt.iproto.protocol.Response.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/response.pyx":33
 *         return '<Response: code={}, sync={}>'.format(self.code, self.sync)
 * 
 *     def body2yaml(self):             # <<<<<<<<<<<<<<
 *         return yaml.dump(self.body, allow_unicode=True)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_8Response_3body2yaml(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_8Response_3body2yaml(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("body2yaml (wrapper)", 0);
  __pyx_r = __pyx_pf_8asynctnt_6iproto_8protocol_8Response_2body2yaml(((struct __pyx_obj_8asynctnt_6iproto_8protocol_Response *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_8Response_2body2yaml(struct __pyx_obj_8asynctnt_6iproto_8protocol_Response *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("body2yaml", 0);

  /* "asynctnt/iproto/response.pyx":34
 * 
 *     def body2yaml(self):
 *         return yaml.dump(self.body, allow_unicode=True)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_yaml); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 34, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_dump); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 34, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 34, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_self->body);
  __Pyx_GIVEREF(__pyx_v_self->body);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->body);
  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 34, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_allow_unicode, Py_True) < 0) __PYX_ERR(7, 34, __pyx_L1_error)
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 34, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "asynctnt/iproto/response.pyx":33
 *         return '<Response: code={}, sync={}>'.format(self.code, self.sync)
 * 
 *     def body2yaml(self):             # <<<<<<<<<<<<<<
 *         return yaml.dump(self.body, allow_unicode=True)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("asynctnt.iproto.protocol.Response.body2yaml", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/response.pxd":6
 * cdef class Response:
 *     cdef:
 *         public uint32_t code             # <<<<<<<<<<<<<<
 *         public uint64_t sync
 *         public int64_t schema_id
 */

/* Python wrapper */
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_8Response_4code_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_8Response_4code_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8asynctnt_6iproto_8protocol_8Response_4code___get__(((struct __pyx_obj_8asynctnt_6iproto_8protocol_Response *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_8Response_4code___get__(struct __pyx_obj_8asynctnt_6iproto_8protocol_Response *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_uint32_t(__pyx_v_self->code); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asynctnt.iproto.protocol.Response.code.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_8asynctnt_6iproto_8protocol_8Response_4code_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8asynctnt_6iproto_8protocol_8Response_4code_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8asynctnt_6iproto_8protocol_8Response_4code_2__set__(((struct __pyx_obj_8asynctnt_6iproto_8protocol_Response *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_8asynctnt_6iproto_8protocol_8Response_4code_2__set__(struct __pyx_obj_8asynctnt_6iproto_8protocol_Response *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  uint32_t __pyx_t_1;
  __Pyx_RefNannySetupContext("__set__", 0);
  __pyx_t_1 = __Pyx_PyInt_As_uint32_t(__pyx_v_value); if (unlikely((__pyx_t_1 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(8, 6, __pyx_L1_error)
  __pyx_v_self->code = __pyx_t_1;

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("asynctnt.iproto.protocol.Response.code.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/response.pxd":7
 *     cdef:
 *         public uint32_t code
 *         public uint64_t sync             # <<<<<<<<<<<<<<
 *         public int64_t schema_id
 *         public str errmsg
 */

/* Python wrapper */
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_8Response_4sync_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_8Response_4sync_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8asynctnt_6iproto_8protocol_8Response_4sync___get__(((struct __pyx_obj_8asynctnt_6iproto_8protocol_Response *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_8Response_4sync___get__(struct __pyx_obj_8asynctnt_6iproto_8protocol_Response *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_uint64_t(__pyx_v_self->sync); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asynctnt.iproto.protocol.Response.sync.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_8asynctnt_6iproto_8protocol_8Response_4sync_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8asynctnt_6iproto_8protocol_8Response_4sync_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8asynctnt_6iproto_8protocol_8Response_4sync_2__set__(((struct __pyx_obj_8asynctnt_6iproto_8protocol_Response *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_8asynctnt_6iproto_8protocol_8Response_4sync_2__set__(struct __pyx_obj_8asynctnt_6iproto_8protocol_Response *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  uint64_t __pyx_t_1;
  __Pyx_RefNannySetupContext("__set__", 0);
  __pyx_t_1 = __Pyx_PyInt_As_uint64_t(__pyx_v_value); if (unlikely((__pyx_t_1 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(8, 7, __pyx_L1_error)
  __pyx_v_self->sync = __pyx_t_1;

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("asynctnt.iproto.protocol.Response.sync.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/response.pxd":8
 *         public uint32_t code
 *         public uint64_t sync
 *         public int64_t schema_id             # <<<<<<<<<<<<<<
 *         public str errmsg
 *         public list body
 */

/* Python wrapper */
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_8Response_9schema_id_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_8Response_9schema_id_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8asynctnt_6iproto_8protocol_8Response_9schema_id___get__(((struct __pyx_obj_8asynctnt_6iproto_8protocol_Response *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_8Response_9schema_id___get__(struct __pyx_obj_8asynctnt_6iproto_8protocol_Response *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int64_t(__pyx_v_self->schema_id); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 8, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asynctnt.iproto.protocol.Response.schema_id.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_8asynctnt_6iproto_8protocol_8Response_9schema_id_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8asynctnt_6iproto_8protocol_8Response_9schema_id_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8asynctnt_6iproto_8protocol_8Response_9schema_id_2__set__(((struct __pyx_obj_8asynctnt_6iproto_8protocol_Response *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_8asynctnt_6iproto_8protocol_8Response_9schema_id_2__set__(struct __pyx_obj_8asynctnt_6iproto_8protocol_Response *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int64_t __pyx_t_1;
  __Pyx_RefNannySetupContext("__set__", 0);
  __pyx_t_1 = __Pyx_PyInt_As_int64_t(__pyx_v_value); if (unlikely((__pyx_t_1 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(8, 8, __pyx_L1_error)
  __pyx_v_self->schema_id = __pyx_t_1;

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("asynctnt.iproto.protocol.Response.schema_id.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/response.pxd":9
 *         public uint64_t sync
 *         public int64_t schema_id
 *         public str errmsg             # <<<<<<<<<<<<<<
 *         public list body
 *         public bytes encoding
 */

/* Python wrapper */
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_8Response_6errmsg_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_8Response_6errmsg_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8asynctnt_6iproto_8protocol_8Response_6errmsg___get__(((struct __pyx_obj_8asynctnt_6iproto_8protocol_Response *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_8Response_6errmsg___get__(struct __pyx_obj_8asynctnt_6iproto_8protocol_Response *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->errmsg);
  __pyx_r = __pyx_v_self->errmsg;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_8asynctnt_6iproto_8protocol_8Response_6errmsg_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8asynctnt_6iproto_8protocol_8Response_6errmsg_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8asynctnt_6iproto_8protocol_8Response_6errmsg_2__set__(((struct __pyx_obj_8asynctnt_6iproto_8protocol_Response *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_8asynctnt_6iproto_8protocol_8Response_6errmsg_2__set__(struct __pyx_obj_8asynctnt_6iproto_8protocol_Response *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__set__", 0);
  if (!(likely(PyString_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_v_value)->tp_name), 0))) __PYX_ERR(8, 9, __pyx_L1_error)
  __pyx_t_1 = __pyx_v_value;
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->errmsg);
  __Pyx_DECREF(__pyx_v_self->errmsg);
  __pyx_v_self->errmsg = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asynctnt.iproto.protocol.Response.errmsg.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_8asynctnt_6iproto_8protocol_8Response_6errmsg_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_8asynctnt_6iproto_8protocol_8Response_6errmsg_5__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8asynctnt_6iproto_8protocol_8Response_6errmsg_4__del__(((struct __pyx_obj_8asynctnt_6iproto_8protocol_Response *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_8asynctnt_6iproto_8protocol_8Response_6errmsg_4__del__(struct __pyx_obj_8asynctnt_6iproto_8protocol_Response *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__", 0);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->errmsg);
  __Pyx_DECREF(__pyx_v_self->errmsg);
  __pyx_v_self->errmsg = ((PyObject*)Py_None);

  /* function exit code */
  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/response.pxd":10
 *         public int64_t schema_id
 *         public str errmsg
 *         public list body             # <<<<<<<<<<<<<<
 *         public bytes encoding
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_8Response_4body_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_8Response_4body_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8asynctnt_6iproto_8protocol_8Response_4body___get__(((struct __pyx_obj_8asynctnt_6iproto_8protocol_Response *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_8Response_4body___get__(struct __pyx_obj_8asynctnt_6iproto_8protocol_Response *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->body);
  __pyx_r = __pyx_v_self->body;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_8asynctnt_6iproto_8protocol_8Response_4body_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8asynctnt_6iproto_8protocol_8Response_4body_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8asynctnt_6iproto_8protocol_8Response_4body_2__set__(((struct __pyx_obj_8asynctnt_6iproto_8protocol_Response *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_8asynctnt_6iproto_8protocol_8Response_4body_2__set__(struct __pyx_obj_8asynctnt_6iproto_8protocol_Response *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__set__", 0);
  if (!(likely(PyList_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_v_value)->tp_name), 0))) __PYX_ERR(8, 10, __pyx_L1_error)
  __pyx_t_1 = __pyx_v_value;
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->body);
  __Pyx_DECREF(__pyx_v_self->body);
  __pyx_v_self->body = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asynctnt.iproto.protocol.Response.body.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_8asynctnt_6iproto_8protocol_8Response_4body_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_8asynctnt_6iproto_8protocol_8Response_4body_5__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8asynctnt_6iproto_8protocol_8Response_4body_4__del__(((struct __pyx_obj_8asynctnt_6iproto_8protocol_Response *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_8asynctnt_6iproto_8protocol_8Response_4body_4__del__(struct __pyx_obj_8asynctnt_6iproto_8protocol_Response *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__", 0);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->body);
  __Pyx_DECREF(__pyx_v_self->body);
  __pyx_v_self->body = ((PyObject*)Py_None);

  /* function exit code */
  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/response.pxd":11
 *         public str errmsg
 *         public list body
 *         public bytes encoding             # <<<<<<<<<<<<<<
 * 
 *     @staticmethod
 */

/* Python wrapper */
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_8Response_8encoding_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_8Response_8encoding_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8asynctnt_6iproto_8protocol_8Response_8encoding___get__(((struct __pyx_obj_8asynctnt_6iproto_8protocol_Response *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_8Response_8encoding___get__(struct __pyx_obj_8asynctnt_6iproto_8protocol_Response *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->encoding);
  __pyx_r = __pyx_v_self->encoding;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_8asynctnt_6iproto_8protocol_8Response_8encoding_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8asynctnt_6iproto_8protocol_8Response_8encoding_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8asynctnt_6iproto_8protocol_8Response_8encoding_2__set__(((struct __pyx_obj_8asynctnt_6iproto_8protocol_Response *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_8asynctnt_6iproto_8protocol_8Response_8encoding_2__set__(struct __pyx_obj_8asynctnt_6iproto_8protocol_Response *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__set__", 0);
  if (!(likely(PyBytes_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_v_value)->tp_name), 0))) __PYX_ERR(8, 11, __pyx_L1_error)
  __pyx_t_1 = __pyx_v_value;
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->encoding);
  __Pyx_DECREF(__pyx_v_self->encoding);
  __pyx_v_self->encoding = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asynctnt.iproto.protocol.Response.encoding.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_8asynctnt_6iproto_8protocol_8Response_8encoding_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_8asynctnt_6iproto_8protocol_8Response_8encoding_5__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8asynctnt_6iproto_8protocol_8Response_8encoding_4__del__(((struct __pyx_obj_8asynctnt_6iproto_8protocol_Response *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_8asynctnt_6iproto_8protocol_8Response_8encoding_4__del__(struct __pyx_obj_8asynctnt_6iproto_8protocol_Response *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__", 0);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->encoding);
  __Pyx_DECREF(__pyx_v_self->encoding);
  __pyx_v_self->encoding = ((PyObject*)Py_None);

  /* function exit code */
  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/response.pyx":37
 * 
 * 
 * cdef object _decode_obj(const char** p, bytes encoding):             # <<<<<<<<<<<<<<
 *     cdef:
 *         uint32_t i
 */

static PyObject *__pyx_f_8asynctnt_6iproto_8protocol__decode_obj(char const **__pyx_v_p, PyObject *__pyx_v_encoding) {
  CYTHON_UNUSED uint32_t __pyx_v_i;
  enum mp_type __pyx_v_obj_type;
  char const *__pyx_v_s;
  uint32_t __pyx_v_s_len;
  uint32_t __pyx_v_arr_size;
  uint32_t __pyx_v_map_size;
  PyObject *__pyx_v_map = 0;
  enum mp_type __pyx_v_map_key_type;
  char const *__pyx_v_map_key_str;
  uint32_t __pyx_v_map_key_len;
  PyObject *__pyx_v_map_key = 0;
  PyObject *__pyx_v_value = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  char const *__pyx_t_2;
  uint32_t __pyx_t_3;
  uint32_t __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  __Pyx_RefNannySetupContext("_decode_obj", 0);

  /* "asynctnt/iproto/response.pyx":55
 *         object map_key
 * 
 *     obj_type = mp_typeof(p[0][0])             # <<<<<<<<<<<<<<
 *     if obj_type == MP_UINT:
 *         return mp_decode_uint(p)
 */
  __pyx_v_obj_type = mp_typeof(((__pyx_v_p[0])[0]));

  /* "asynctnt/iproto/response.pyx":56
 * 
 *     obj_type = mp_typeof(p[0][0])
 *     if obj_type == MP_UINT:             # <<<<<<<<<<<<<<
 *         return mp_decode_uint(p)
 *     elif obj_type == MP_INT:
 */
  switch (__pyx_v_obj_type) {
    case MP_UINT:

    /* "asynctnt/iproto/response.pyx":57
 *     obj_type = mp_typeof(p[0][0])
 *     if obj_type == MP_UINT:
 *         return mp_decode_uint(p)             # <<<<<<<<<<<<<<
 *     elif obj_type == MP_INT:
 *         return mp_decode_int(p)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyInt_From_uint64_t(mp_decode_uint(__pyx_v_p)); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 57, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "asynctnt/iproto/response.pyx":56
 * 
 *     obj_type = mp_typeof(p[0][0])
 *     if obj_type == MP_UINT:             # <<<<<<<<<<<<<<
 *         return mp_decode_uint(p)
 *     elif obj_type == MP_INT:
 */
    break;

    /* "asynctnt/iproto/response.pyx":58
 *     if obj_type == MP_UINT:
 *         return mp_decode_uint(p)
 *     elif obj_type == MP_INT:             # <<<<<<<<<<<<<<
 *         return mp_decode_int(p)
 *     elif obj_type == MP_STR:
 */
    case MP_INT:

    /* "asynctnt/iproto/response.pyx":59
 *         return mp_decode_uint(p)
 *     elif obj_type == MP_INT:
 *         return mp_decode_int(p)             # <<<<<<<<<<<<<<
 *     elif obj_type == MP_STR:
 *         s = NULL
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyInt_From_int64_t(mp_decode_int(__pyx_v_p)); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 59, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "asynctnt/iproto/response.pyx":58
 *     if obj_type == MP_UINT:
 *         return mp_decode_uint(p)
 *     elif obj_type == MP_INT:             # <<<<<<<<<<<<<<
 *         return mp_decode_int(p)
 *     elif obj_type == MP_STR:
 */
    break;

    /* "asynctnt/iproto/response.pyx":60
 *     elif obj_type == MP_INT:
 *         return mp_decode_int(p)
 *     elif obj_type == MP_STR:             # <<<<<<<<<<<<<<
 *         s = NULL
 *         s_len = 0
 */
    case MP_STR:

    /* "asynctnt/iproto/response.pyx":61
 *         return mp_decode_int(p)
 *     elif obj_type == MP_STR:
 *         s = NULL             # <<<<<<<<<<<<<<
 *         s_len = 0
 *         s = mp_decode_str(p, &s_len)
 */
    __pyx_v_s = NULL;

    /* "asynctnt/iproto/response.pyx":62
 *     elif obj_type == MP_STR:
 *         s = NULL
 *         s_len = 0             # <<<<<<<<<<<<<<
 *         s = mp_decode_str(p, &s_len)
 *         return s[:s_len].decode(encoding)
 */
    __pyx_v_s_len = 0;

    /* "asynctnt/iproto/response.pyx":63
 *         s = NULL
 *         s_len = 0
 *         s = mp_decode_str(p, &s_len)             # <<<<<<<<<<<<<<
 *         return s[:s_len].decode(encoding)
 *     elif obj_type == MP_BIN:
 */
    __pyx_v_s = mp_decode_str(__pyx_v_p, (&__pyx_v_s_len));

    /* "asynctnt/iproto/response.pyx":64
 *         s_len = 0
 *         s = mp_decode_str(p, &s_len)
 *         return s[:s_len].decode(encoding)             # <<<<<<<<<<<<<<
 *     elif obj_type == MP_BIN:
 *         s = NULL
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_PyObject_AsString(__pyx_v_encoding); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(7, 64, __pyx_L1_error)
    __pyx_t_1 = __Pyx_decode_c_string(__pyx_v_s, 0, __pyx_v_s_len, __pyx_t_2, NULL, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 64, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "asynctnt/iproto/response.pyx":60
 *     elif obj_type == MP_INT:
 *         return mp_decode_int(p)
 *     elif obj_type == MP_STR:             # <<<<<<<<<<<<<<
 *         s = NULL
 *         s_len = 0
 */
    break;

    /* "asynctnt/iproto/response.pyx":65
 *         s = mp_decode_str(p, &s_len)
 *         return s[:s_len].decode(encoding)
 *     elif obj_type == MP_BIN:             # <<<<<<<<<<<<<<
 *         s = NULL
 *         s_len = 0
 */
    case MP_BIN:

    /* "asynctnt/iproto/response.pyx":66
 *         return s[:s_len].decode(encoding)
 *     elif obj_type == MP_BIN:
 *         s = NULL             # <<<<<<<<<<<<<<
 *         s_len = 0
 *         s = mp_decode_bin(p, &s_len)
 */
    __pyx_v_s = NULL;

    /* "asynctnt/iproto/response.pyx":67
 *     elif obj_type == MP_BIN:
 *         s = NULL
 *         s_len = 0             # <<<<<<<<<<<<<<
 *         s = mp_decode_bin(p, &s_len)
 *         return <bytes>s[:s_len]
 */
    __pyx_v_s_len = 0;

    /* "asynctnt/iproto/response.pyx":68
 *         s = NULL
 *         s_len = 0
 *         s = mp_decode_bin(p, &s_len)             # <<<<<<<<<<<<<<
 *         return <bytes>s[:s_len]
 *     elif obj_type == MP_BOOL:
 */
    __pyx_v_s = mp_decode_bin(__pyx_v_p, (&__pyx_v_s_len));

    /* "asynctnt/iproto/response.pyx":69
 *         s_len = 0
 *         s = mp_decode_bin(p, &s_len)
 *         return <bytes>s[:s_len]             # <<<<<<<<<<<<<<
 *     elif obj_type == MP_BOOL:
 *         return mp_decode_bool(p)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_s + 0, __pyx_v_s_len - 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 69, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(((PyObject*)__pyx_t_1));
    __pyx_r = __pyx_t_1;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "asynctnt/iproto/response.pyx":65
 *         s = mp_decode_str(p, &s_len)
 *         return s[:s_len].decode(encoding)
 *     elif obj_type == MP_BIN:             # <<<<<<<<<<<<<<
 *         s = NULL
 *         s_len = 0
 */
    break;

    /* "asynctnt/iproto/response.pyx":70
 *         s = mp_decode_bin(p, &s_len)
 *         return <bytes>s[:s_len]
 *     elif obj_type == MP_BOOL:             # <<<<<<<<<<<<<<
 *         return mp_decode_bool(p)
 *     elif obj_type == MP_FLOAT:
 */
    case MP_BOOL:

    /* "asynctnt/iproto/response.pyx":71
 *         return <bytes>s[:s_len]
 *     elif obj_type == MP_BOOL:
 *         return mp_decode_bool(p)             # <<<<<<<<<<<<<<
 *     elif obj_type == MP_FLOAT:
 *         return mp_decode_float(p)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyBool_FromLong(mp_decode_bool(__pyx_v_p)); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 71, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "asynctnt/iproto/response.pyx":70
 *         s = mp_decode_bin(p, &s_len)
 *         return <bytes>s[:s_len]
 *     elif obj_type == MP_BOOL:             # <<<<<<<<<<<<<<
 *         return mp_decode_bool(p)
 *     elif obj_type == MP_FLOAT:
 */
    break;

    /* "asynctnt/iproto/response.pyx":72
 *     elif obj_type == MP_BOOL:
 *         return mp_decode_bool(p)
 *     elif obj_type == MP_FLOAT:             # <<<<<<<<<<<<<<
 *         return mp_decode_float(p)
 *     elif obj_type == MP_DOUBLE:
 */
    case MP_FLOAT:

    /* "asynctnt/iproto/response.pyx":73
 *         return mp_decode_bool(p)
 *     elif obj_type == MP_FLOAT:
 *         return mp_decode_float(p)             # <<<<<<<<<<<<<<
 *     elif obj_type == MP_DOUBLE:
 *         return mp_decode_double(p)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = PyFloat_FromDouble(mp_decode_float(__pyx_v_p)); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 73, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "asynctnt/iproto/response.pyx":72
 *     elif obj_type == MP_BOOL:
 *         return mp_decode_bool(p)
 *     elif obj_type == MP_FLOAT:             # <<<<<<<<<<<<<<
 *         return mp_decode_float(p)
 *     elif obj_type == MP_DOUBLE:
 */
    break;

    /* "asynctnt/iproto/response.pyx":74
 *     elif obj_type == MP_FLOAT:
 *         return mp_decode_float(p)
 *     elif obj_type == MP_DOUBLE:             # <<<<<<<<<<<<<<
 *         return mp_decode_double(p)
 *     elif obj_type == MP_ARRAY:
 */
    case MP_DOUBLE:

    /* "asynctnt/iproto/response.pyx":75
 *         return mp_decode_float(p)
 *     elif obj_type == MP_DOUBLE:
 *         return mp_decode_double(p)             # <<<<<<<<<<<<<<
 *     elif obj_type == MP_ARRAY:
 *         arr_size = mp_decode_array(p)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = PyFloat_FromDouble(mp_decode_double(__pyx_v_p)); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 75, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "asynctnt/iproto/response.pyx":74
 *     elif obj_type == MP_FLOAT:
 *         return mp_decode_float(p)
 *     elif obj_type == MP_DOUBLE:             # <<<<<<<<<<<<<<
 *         return mp_decode_double(p)
 *     elif obj_type == MP_ARRAY:
 */
    break;

    /* "asynctnt/iproto/response.pyx":76
 *     elif obj_type == MP_DOUBLE:
 *         return mp_decode_double(p)
 *     elif obj_type == MP_ARRAY:             # <<<<<<<<<<<<<<
 *         arr_size = mp_decode_array(p)
 *         value = []
 */
    case MP_ARRAY:

    /* "asynctnt/iproto/response.pyx":77
 *         return mp_decode_double(p)
 *     elif obj_type == MP_ARRAY:
 *         arr_size = mp_decode_array(p)             # <<<<<<<<<<<<<<
 *         value = []
 *         for i in range(arr_size):
 */
    __pyx_v_arr_size = mp_decode_array(__pyx_v_p);

    /* "asynctnt/iproto/response.pyx":78
 *     elif obj_type == MP_ARRAY:
 *         arr_size = mp_decode_array(p)
 *         value = []             # <<<<<<<<<<<<<<
 *         for i in range(arr_size):
 *             value.append(_decode_obj(p, encoding))
 */
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 78, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_value = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "asynctnt/iproto/response.pyx":79
 *         arr_size = mp_decode_array(p)
 *         value = []
 *         for i in range(arr_size):             # <<<<<<<<<<<<<<
 *             value.append(_decode_obj(p, encoding))
 *         return value
 */
    __pyx_t_3 = __pyx_v_arr_size;
    for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
      __pyx_v_i = __pyx_t_4;

      /* "asynctnt/iproto/response.pyx":80
 *         value = []
 *         for i in range(arr_size):
 *             value.append(_decode_obj(p, encoding))             # <<<<<<<<<<<<<<
 *         return value
 *     elif obj_type == MP_MAP:
 */
      __pyx_t_1 = __pyx_f_8asynctnt_6iproto_8protocol__decode_obj(__pyx_v_p, __pyx_v_encoding); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 80, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_value, __pyx_t_1); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(7, 80, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }

    /* "asynctnt/iproto/response.pyx":81
 *         for i in range(arr_size):
 *             value.append(_decode_obj(p, encoding))
 *         return value             # <<<<<<<<<<<<<<
 *     elif obj_type == MP_MAP:
 *         map = {}
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_value);
    __pyx_r = __pyx_v_value;
    goto __pyx_L0;

    /* "asynctnt/iproto/response.pyx":76
 *     elif obj_type == MP_DOUBLE:
 *         return mp_decode_double(p)
 *     elif obj_type == MP_ARRAY:             # <<<<<<<<<<<<<<
 *         arr_size = mp_decode_array(p)
 *         value = []
 */
    break;

    /* "asynctnt/iproto/response.pyx":82
 *             value.append(_decode_obj(p, encoding))
 *         return value
 *     elif obj_type == MP_MAP:             # <<<<<<<<<<<<<<
 *         map = {}
 *         map_size = mp_decode_map(p)
 */
    case MP_MAP:

    /* "asynctnt/iproto/response.pyx":83
 *         return value
 *     elif obj_type == MP_MAP:
 *         map = {}             # <<<<<<<<<<<<<<
 *         map_size = mp_decode_map(p)
 *         for i in range(map_size):
 */
    __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 83, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_map = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "asynctnt/iproto/response.pyx":84
 *     elif obj_type == MP_MAP:
 *         map = {}
 *         map_size = mp_decode_map(p)             # <<<<<<<<<<<<<<
 *         for i in range(map_size):
 *             map_key_type = mp_typeof(p[0][0])
 */
    __pyx_v_map_size = mp_decode_map(__pyx_v_p);

    /* "asynctnt/iproto/response.pyx":85
 *         map = {}
 *         map_size = mp_decode_map(p)
 *         for i in range(map_size):             # <<<<<<<<<<<<<<
 *             map_key_type = mp_typeof(p[0][0])
 *             if map_key_type == MP_STR:
 */
    __pyx_t_3 = __pyx_v_map_size;
    for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
      __pyx_v_i = __pyx_t_4;

      /* "asynctnt/iproto/response.pyx":86
 *         map_size = mp_decode_map(p)
 *         for i in range(map_size):
 *             map_key_type = mp_typeof(p[0][0])             # <<<<<<<<<<<<<<
 *             if map_key_type == MP_STR:
 *                 map_key_len = 0
 */
      __pyx_v_map_key_type = mp_typeof(((__pyx_v_p[0])[0]));

      /* "asynctnt/iproto/response.pyx":87
 *         for i in range(map_size):
 *             map_key_type = mp_typeof(p[0][0])
 *             if map_key_type == MP_STR:             # <<<<<<<<<<<<<<
 *                 map_key_len = 0
 *                 map_key_str = mp_decode_str(p, &map_key_len)
 */
      __pyx_t_6 = ((__pyx_v_map_key_type == MP_STR) != 0);
      if (__pyx_t_6) {

        /* "asynctnt/iproto/response.pyx":88
 *             map_key_type = mp_typeof(p[0][0])
 *             if map_key_type == MP_STR:
 *                 map_key_len = 0             # <<<<<<<<<<<<<<
 *                 map_key_str = mp_decode_str(p, &map_key_len)
 *                 map_key = <object>(map_key_str[:map_key_len].decode(encoding))
 */
        __pyx_v_map_key_len = 0;

        /* "asynctnt/iproto/response.pyx":89
 *             if map_key_type == MP_STR:
 *                 map_key_len = 0
 *                 map_key_str = mp_decode_str(p, &map_key_len)             # <<<<<<<<<<<<<<
 *                 map_key = <object>(map_key_str[:map_key_len].decode(encoding))
 *             elif map_key_type == MP_UINT:
 */
        __pyx_v_map_key_str = mp_decode_str(__pyx_v_p, (&__pyx_v_map_key_len));

        /* "asynctnt/iproto/response.pyx":90
 *                 map_key_len = 0
 *                 map_key_str = mp_decode_str(p, &map_key_len)
 *                 map_key = <object>(map_key_str[:map_key_len].decode(encoding))             # <<<<<<<<<<<<<<
 *             elif map_key_type == MP_UINT:
 *                 map_key = <object>mp_decode_uint(p)
 */
        __pyx_t_2 = __Pyx_PyObject_AsString(__pyx_v_encoding); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(7, 90, __pyx_L1_error)
        __pyx_t_1 = __Pyx_decode_c_string(__pyx_v_map_key_str, 0, __pyx_v_map_key_len, __pyx_t_2, NULL, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 90, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_7 = __pyx_t_1;
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_XDECREF_SET(__pyx_v_map_key, __pyx_t_7);
        __pyx_t_7 = 0;

        /* "asynctnt/iproto/response.pyx":87
 *         for i in range(map_size):
 *             map_key_type = mp_typeof(p[0][0])
 *             if map_key_type == MP_STR:             # <<<<<<<<<<<<<<
 *                 map_key_len = 0
 *                 map_key_str = mp_decode_str(p, &map_key_len)
 */
        goto __pyx_L7;
      }

      /* "asynctnt/iproto/response.pyx":91
 *                 map_key_str = mp_decode_str(p, &map_key_len)
 *                 map_key = <object>(map_key_str[:map_key_len].decode(encoding))
 *             elif map_key_type == MP_UINT:             # <<<<<<<<<<<<<<
 *                 map_key = <object>mp_decode_uint(p)
 *             elif map_key_type == MP_INT:
 */
      __pyx_t_6 = ((__pyx_v_map_key_type == MP_UINT) != 0);
      if (__pyx_t_6) {

        /* "asynctnt/iproto/response.pyx":92
 *                 map_key = <object>(map_key_str[:map_key_len].decode(encoding))
 *             elif map_key_type == MP_UINT:
 *                 map_key = <object>mp_decode_uint(p)             # <<<<<<<<<<<<<<
 *             elif map_key_type == MP_INT:
 *                 map_key = <object>mp_decode_int(p)
 */
        __pyx_t_7 = __Pyx_PyInt_From_uint64_t(mp_decode_uint(__pyx_v_p)); if (unlikely(!__pyx_t_7)) __PYX_ERR(7, 92, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_1 = __pyx_t_7;
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_XDECREF_SET(__pyx_v_map_key, __pyx_t_1);
        __pyx_t_1 = 0;

        /* "asynctnt/iproto/response.pyx":91
 *                 map_key_str = mp_decode_str(p, &map_key_len)
 *                 map_key = <object>(map_key_str[:map_key_len].decode(encoding))
 *             elif map_key_type == MP_UINT:             # <<<<<<<<<<<<<<
 *                 map_key = <object>mp_decode_uint(p)
 *             elif map_key_type == MP_INT:
 */
        goto __pyx_L7;
      }

      /* "asynctnt/iproto/response.pyx":93
 *             elif map_key_type == MP_UINT:
 *                 map_key = <object>mp_decode_uint(p)
 *             elif map_key_type == MP_INT:             # <<<<<<<<<<<<<<
 *                 map_key = <object>mp_decode_int(p)
 *             else:
 */
      __pyx_t_6 = ((__pyx_v_map_key_type == MP_INT) != 0);
      if (__pyx_t_6) {

        /* "asynctnt/iproto/response.pyx":94
 *                 map_key = <object>mp_decode_uint(p)
 *             elif map_key_type == MP_INT:
 *                 map_key = <object>mp_decode_int(p)             # <<<<<<<<<<<<<<
 *             else:
 *                 mp_next(p)  # skip current key
 */
        __pyx_t_1 = __Pyx_PyInt_From_int64_t(mp_decode_int(__pyx_v_p)); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 94, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_7 = __pyx_t_1;
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_XDECREF_SET(__pyx_v_map_key, __pyx_t_7);
        __pyx_t_7 = 0;

        /* "asynctnt/iproto/response.pyx":93
 *             elif map_key_type == MP_UINT:
 *                 map_key = <object>mp_decode_uint(p)
 *             elif map_key_type == MP_INT:             # <<<<<<<<<<<<<<
 *                 map_key = <object>mp_decode_int(p)
 *             else:
 */
        goto __pyx_L7;
      }

      /* "asynctnt/iproto/response.pyx":96
 *                 map_key = <object>mp_decode_int(p)
 *             else:
 *                 mp_next(p)  # skip current key             # <<<<<<<<<<<<<<
 *                 mp_next(p)  # skip value
 *                 logger.warning('Unexpected key type in map: %s',
 */
      /*else*/ {
        mp_next(__pyx_v_p);

        /* "asynctnt/iproto/response.pyx":97
 *             else:
 *                 mp_next(p)  # skip current key
 *                 mp_next(p)  # skip value             # <<<<<<<<<<<<<<
 *                 logger.warning('Unexpected key type in map: %s',
 *                                map_key_type)
 */
        mp_next(__pyx_v_p);

        /* "asynctnt/iproto/response.pyx":98
 *                 mp_next(p)  # skip current key
 *                 mp_next(p)  # skip value
 *                 logger.warning('Unexpected key type in map: %s',             # <<<<<<<<<<<<<<
 *                                map_key_type)
 * 
 */
        __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 98, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_warning); if (unlikely(!__pyx_t_8)) __PYX_ERR(7, 98, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

        /* "asynctnt/iproto/response.pyx":99
 *                 mp_next(p)  # skip value
 *                 logger.warning('Unexpected key type in map: %s',
 *                                map_key_type)             # <<<<<<<<<<<<<<
 * 
 *             map[map_key] = _decode_obj(p, encoding)
 */
        __pyx_t_1 = __Pyx_PyInt_From_enum__mp_type(__pyx_v_map_key_type); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 99, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_9 = NULL;
        __pyx_t_10 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
          __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8);
          if (likely(__pyx_t_9)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
            __Pyx_INCREF(__pyx_t_9);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_8, function);
            __pyx_t_10 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_8)) {
          PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_kp_s_Unexpected_key_type_in_map_s, __pyx_t_1};
          __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_7)) __PYX_ERR(7, 98, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) {
          PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_kp_s_Unexpected_key_type_in_map_s, __pyx_t_1};
          __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_7)) __PYX_ERR(7, 98, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        } else
        #endif
        {
          __pyx_t_11 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(7, 98, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_11);
          if (__pyx_t_9) {
            __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_9); __pyx_t_9 = NULL;
          }
          __Pyx_INCREF(__pyx_kp_s_Unexpected_key_type_in_map_s);
          __Pyx_GIVEREF(__pyx_kp_s_Unexpected_key_type_in_map_s);
          PyTuple_SET_ITEM(__pyx_t_11, 0+__pyx_t_10, __pyx_kp_s_Unexpected_key_type_in_map_s);
          __Pyx_GIVEREF(__pyx_t_1);
          PyTuple_SET_ITEM(__pyx_t_11, 1+__pyx_t_10, __pyx_t_1);
          __pyx_t_1 = 0;
          __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_11, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(7, 98, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        }
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      }
      __pyx_L7:;

      /* "asynctnt/iproto/response.pyx":101
 *                                map_key_type)
 * 
 *             map[map_key] = _decode_obj(p, encoding)             # <<<<<<<<<<<<<<
 * 
 *         return map
 */
      __pyx_t_7 = __pyx_f_8asynctnt_6iproto_8protocol__decode_obj(__pyx_v_p, __pyx_v_encoding); if (unlikely(!__pyx_t_7)) __PYX_ERR(7, 101, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      if (unlikely(!__pyx_v_map_key)) { __Pyx_RaiseUnboundLocalError("map_key"); __PYX_ERR(7, 101, __pyx_L1_error) }
      if (unlikely(PyDict_SetItem(__pyx_v_map, __pyx_v_map_key, __pyx_t_7) < 0)) __PYX_ERR(7, 101, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }

    /* "asynctnt/iproto/response.pyx":103
 *             map[map_key] = _decode_obj(p, encoding)
 * 
 *         return map             # <<<<<<<<<<<<<<
 *     elif obj_type == MP_NIL:
 *         mp_next(p)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_map);
    __pyx_r = __pyx_v_map;
    goto __pyx_L0;

    /* "asynctnt/iproto/response.pyx":82
 *             value.append(_decode_obj(p, encoding))
 *         return value
 *     elif obj_type == MP_MAP:             # <<<<<<<<<<<<<<
 *         map = {}
 *         map_size = mp_decode_map(p)
 */
    break;

    /* "asynctnt/iproto/response.pyx":104
 * 
 *         return map
 *     elif obj_type == MP_NIL:             # <<<<<<<<<<<<<<
 *         mp_next(p)
 *         return None
 */
    case MP_NIL:

    /* "asynctnt/iproto/response.pyx":105
 *         return map
 *     elif obj_type == MP_NIL:
 *         mp_next(p)             # <<<<<<<<<<<<<<
 *         return None
 *     else:
 */
    mp_next(__pyx_v_p);

    /* "asynctnt/iproto/response.pyx":106
 *     elif obj_type == MP_NIL:
 *         mp_next(p)
 *         return None             # <<<<<<<<<<<<<<
 *     else:
 *         mp_next(p)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;

    /* "asynctnt/iproto/response.pyx":104
 * 
 *         return map
 *     elif obj_type == MP_NIL:             # <<<<<<<<<<<<<<
 *         mp_next(p)
 *         return None
 */
    break;
    default:

    /* "asynctnt/iproto/response.pyx":108
 *         return None
 *     else:
 *         mp_next(p)             # <<<<<<<<<<<<<<
 *         logger.warning('Unexpected obj type: %s', obj_type)
 *         return None
 */
    mp_next(__pyx_v_p);

    /* "asynctnt/iproto/response.pyx":109
 *     else:
 *         mp_next(p)
 *         logger.warning('Unexpected obj type: %s', obj_type)             # <<<<<<<<<<<<<<
 *         return None
 * 
 */
    __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_8)) __PYX_ERR(7, 109, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_warning); if (unlikely(!__pyx_t_11)) __PYX_ERR(7, 109, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = __Pyx_PyInt_From_enum__mp_type(__pyx_v_obj_type); if (unlikely(!__pyx_t_8)) __PYX_ERR(7, 109, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_1 = NULL;
    __pyx_t_10 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_11))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_11);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_11, function);
        __pyx_t_10 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_11)) {
      PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_kp_s_Unexpected_obj_type_s, __pyx_t_8};
      __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_11, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_7)) __PYX_ERR(7, 109, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_11)) {
      PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_kp_s_Unexpected_obj_type_s, __pyx_t_8};
      __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_11, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_7)) __PYX_ERR(7, 109, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    } else
    #endif
    {
      __pyx_t_9 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_9)) __PYX_ERR(7, 109, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      if (__pyx_t_1) {
        __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_1); __pyx_t_1 = NULL;
      }
      __Pyx_INCREF(__pyx_kp_s_Unexpected_obj_type_s);
      __Pyx_GIVEREF(__pyx_kp_s_Unexpected_obj_type_s);
      PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_10, __pyx_kp_s_Unexpected_obj_type_s);
      __Pyx_GIVEREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_10, __pyx_t_8);
      __pyx_t_8 = 0;
      __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_9, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(7, 109, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    }
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "asynctnt/iproto/response.pyx":110
 *         mp_next(p)
 *         logger.warning('Unexpected obj type: %s', obj_type)
 *         return None             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
    break;
  }

  /* "asynctnt/iproto/response.pyx":37
 * 
 * 
 * cdef object _decode_obj(const char** p, bytes encoding):             # <<<<<<<<<<<<<<
 *     cdef:
 *         uint32_t i
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("asynctnt.iproto.protocol._decode_obj", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_map);
  __Pyx_XDECREF(__pyx_v_map_key);
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/response.pyx":113
 * 
 * 
 * cdef list _response_parse_body_data(const char *b, bytes encoding):             # <<<<<<<<<<<<<<
 *     cdef:
 *         uint32_t size
 */

static PyObject *__pyx_f_8asynctnt_6iproto_8protocol__response_parse_body_data(char const *__pyx_v_b, PyObject *__pyx_v_encoding) {
  uint32_t __pyx_v_size;
  PyObject *__pyx_v_tuples = 0;
  CYTHON_UNUSED uint32_t __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  uint32_t __pyx_t_2;
  uint32_t __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("_response_parse_body_data", 0);

  /* "asynctnt/iproto/response.pyx":120
 *         uint32_t i, k
 * 
 *     size = mp_decode_array(&b)             # <<<<<<<<<<<<<<
 *     tuples = []
 *     for i in range(size):
 */
  __pyx_v_size = mp_decode_array((&__pyx_v_b));

  /* "asynctnt/iproto/response.pyx":121
 * 
 *     size = mp_decode_array(&b)
 *     tuples = []             # <<<<<<<<<<<<<<
 *     for i in range(size):
 *         tuples.append(_decode_obj(&b, encoding))
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 121, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_tuples = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "asynctnt/iproto/response.pyx":122
 *     size = mp_decode_array(&b)
 *     tuples = []
 *     for i in range(size):             # <<<<<<<<<<<<<<
 *         tuples.append(_decode_obj(&b, encoding))
 * 
 */
  __pyx_t_2 = __pyx_v_size;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_i = __pyx_t_3;

    /* "asynctnt/iproto/response.pyx":123
 *     tuples = []
 *     for i in range(size):
 *         tuples.append(_decode_obj(&b, encoding))             # <<<<<<<<<<<<<<
 * 
 *     return tuples
 */
    __pyx_t_1 = __pyx_f_8asynctnt_6iproto_8protocol__decode_obj((&__pyx_v_b), __pyx_v_encoding); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 123, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __Pyx_PyList_Append(__pyx_v_tuples, __pyx_t_1); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(7, 123, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "asynctnt/iproto/response.pyx":125
 *         tuples.append(_decode_obj(&b, encoding))
 * 
 *     return tuples             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_tuples);
  __pyx_r = __pyx_v_tuples;
  goto __pyx_L0;

  /* "asynctnt/iproto/response.pyx":113
 * 
 * 
 * cdef list _response_parse_body_data(const char *b, bytes encoding):             # <<<<<<<<<<<<<<
 *     cdef:
 *         uint32_t size
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asynctnt.iproto.protocol._response_parse_body_data", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_tuples);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/response.pyx":128
 * 
 * 
 * cdef Response response_parse(const char *buf, uint32_t buf_len,             # <<<<<<<<<<<<<<
 *                              bytes encoding):
 *     cdef:
 */

static struct __pyx_obj_8asynctnt_6iproto_8protocol_Response *__pyx_f_8asynctnt_6iproto_8protocol_response_parse(char const *__pyx_v_buf, uint32_t __pyx_v_buf_len, PyObject *__pyx_v_encoding) {
  char const *__pyx_v_b;
  uint32_t __pyx_v_size;
  uint32_t __pyx_v_key;
  uint32_t __pyx_v_s_len;
  char const *__pyx_v_s;
  struct __pyx_obj_8asynctnt_6iproto_8protocol_Response *__pyx_v_resp = 0;
  CYTHON_UNUSED uint32_t __pyx_v__;
  struct __pyx_obj_8asynctnt_6iproto_8protocol_Response *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  uint32_t __pyx_t_3;
  uint32_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  char const *__pyx_t_6;
  __Pyx_RefNannySetupContext("response_parse", 0);

  /* "asynctnt/iproto/response.pyx":138
 *         Response resp
 * 
 *     b = <const char*>buf             # <<<<<<<<<<<<<<
 *     if mp_typeof(b[0]) != MP_MAP:
 *         raise TypeError('Response header must be a MP_MAP')
 */
  __pyx_v_b = ((char const *)__pyx_v_buf);

  /* "asynctnt/iproto/response.pyx":139
 * 
 *     b = <const char*>buf
 *     if mp_typeof(b[0]) != MP_MAP:             # <<<<<<<<<<<<<<
 *         raise TypeError('Response header must be a MP_MAP')
 * 
 */
  __pyx_t_1 = ((mp_typeof((__pyx_v_b[0])) != MP_MAP) != 0);
  if (__pyx_t_1) {

    /* "asynctnt/iproto/response.pyx":140
 *     b = <const char*>buf
 *     if mp_typeof(b[0]) != MP_MAP:
 *         raise TypeError('Response header must be a MP_MAP')             # <<<<<<<<<<<<<<
 * 
 *     resp = Response.new(encoding)
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 140, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(7, 140, __pyx_L1_error)

    /* "asynctnt/iproto/response.pyx":139
 * 
 *     b = <const char*>buf
 *     if mp_typeof(b[0]) != MP_MAP:             # <<<<<<<<<<<<<<
 *         raise TypeError('Response header must be a MP_MAP')
 * 
 */
  }

  /* "asynctnt/iproto/response.pyx":142
 *         raise TypeError('Response header must be a MP_MAP')
 * 
 *     resp = Response.new(encoding)             # <<<<<<<<<<<<<<
 * 
 *     # parsing header
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_8asynctnt_6iproto_8protocol_8Response_new(__pyx_v_encoding)); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 142, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_resp = ((struct __pyx_obj_8asynctnt_6iproto_8protocol_Response *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "asynctnt/iproto/response.pyx":145
 * 
 *     # parsing header
 *     size = mp_decode_map(&b)             # <<<<<<<<<<<<<<
 *     for _ in range(size):
 *         if mp_typeof(b[0]) != MP_UINT:
 */
  __pyx_v_size = mp_decode_map((&__pyx_v_b));

  /* "asynctnt/iproto/response.pyx":146
 *     # parsing header
 *     size = mp_decode_map(&b)
 *     for _ in range(size):             # <<<<<<<<<<<<<<
 *         if mp_typeof(b[0]) != MP_UINT:
 *             raise TypeError('Header key must be a MP_UINT')
 */
  __pyx_t_3 = __pyx_v_size;
  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
    __pyx_v__ = __pyx_t_4;

    /* "asynctnt/iproto/response.pyx":147
 *     size = mp_decode_map(&b)
 *     for _ in range(size):
 *         if mp_typeof(b[0]) != MP_UINT:             # <<<<<<<<<<<<<<
 *             raise TypeError('Header key must be a MP_UINT')
 * 
 */
    __pyx_t_1 = ((mp_typeof((__pyx_v_b[0])) != MP_UINT) != 0);
    if (__pyx_t_1) {

      /* "asynctnt/iproto/response.pyx":148
 *     for _ in range(size):
 *         if mp_typeof(b[0]) != MP_UINT:
 *             raise TypeError('Header key must be a MP_UINT')             # <<<<<<<<<<<<<<
 * 
 *         key = mp_decode_uint(&b)
 */
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 148, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_Raise(__pyx_t_2, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(7, 148, __pyx_L1_error)

      /* "asynctnt/iproto/response.pyx":147
 *     size = mp_decode_map(&b)
 *     for _ in range(size):
 *         if mp_typeof(b[0]) != MP_UINT:             # <<<<<<<<<<<<<<
 *             raise TypeError('Header key must be a MP_UINT')
 * 
 */
    }

    /* "asynctnt/iproto/response.pyx":150
 *             raise TypeError('Header key must be a MP_UINT')
 * 
 *         key = mp_decode_uint(&b)             # <<<<<<<<<<<<<<
 *         if key == tnt.TP_CODE:
 *             if mp_typeof(b[0]) != MP_UINT:
 */
    __pyx_v_key = mp_decode_uint((&__pyx_v_b));

    /* "asynctnt/iproto/response.pyx":151
 * 
 *         key = mp_decode_uint(&b)
 *         if key == tnt.TP_CODE:             # <<<<<<<<<<<<<<
 *             if mp_typeof(b[0]) != MP_UINT:
 *                 raise TypeError('code type must be a MP_UINT')
 */
    switch (__pyx_v_key) {
      case __pyx_e_8asynctnt_6iproto_3tnt_TP_CODE:

      /* "asynctnt/iproto/response.pyx":152
 *         key = mp_decode_uint(&b)
 *         if key == tnt.TP_CODE:
 *             if mp_typeof(b[0]) != MP_UINT:             # <<<<<<<<<<<<<<
 *                 raise TypeError('code type must be a MP_UINT')
 * 
 */
      __pyx_t_1 = ((mp_typeof((__pyx_v_b[0])) != MP_UINT) != 0);
      if (__pyx_t_1) {

        /* "asynctnt/iproto/response.pyx":153
 *         if key == tnt.TP_CODE:
 *             if mp_typeof(b[0]) != MP_UINT:
 *                 raise TypeError('code type must be a MP_UINT')             # <<<<<<<<<<<<<<
 * 
 *             resp.code = <uint32_t>mp_decode_uint(&b)
 */
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 153, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_Raise(__pyx_t_2, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __PYX_ERR(7, 153, __pyx_L1_error)

        /* "asynctnt/iproto/response.pyx":152
 *         key = mp_decode_uint(&b)
 *         if key == tnt.TP_CODE:
 *             if mp_typeof(b[0]) != MP_UINT:             # <<<<<<<<<<<<<<
 *                 raise TypeError('code type must be a MP_UINT')
 * 
 */
      }

      /* "asynctnt/iproto/response.pyx":155
 *                 raise TypeError('code type must be a MP_UINT')
 * 
 *             resp.code = <uint32_t>mp_decode_uint(&b)             # <<<<<<<<<<<<<<
 *             resp.code &= 0x7FFF
 *         elif key == tnt.TP_SYNC:
 */
      __pyx_v_resp->code = ((uint32_t)mp_decode_uint((&__pyx_v_b)));

      /* "asynctnt/iproto/response.pyx":156
 * 
 *             resp.code = <uint32_t>mp_decode_uint(&b)
 *             resp.code &= 0x7FFF             # <<<<<<<<<<<<<<
 *         elif key == tnt.TP_SYNC:
 *             if mp_typeof(b[0]) != MP_UINT:
 */
      __pyx_v_resp->code = (__pyx_v_resp->code & 0x7FFF);

      /* "asynctnt/iproto/response.pyx":151
 * 
 *         key = mp_decode_uint(&b)
 *         if key == tnt.TP_CODE:             # <<<<<<<<<<<<<<
 *             if mp_typeof(b[0]) != MP_UINT:
 *                 raise TypeError('code type must be a MP_UINT')
 */
      break;

      /* "asynctnt/iproto/response.pyx":157
 *             resp.code = <uint32_t>mp_decode_uint(&b)
 *             resp.code &= 0x7FFF
 *         elif key == tnt.TP_SYNC:             # <<<<<<<<<<<<<<
 *             if mp_typeof(b[0]) != MP_UINT:
 *                 raise TypeError('sync type must be a MP_UINT')
 */
      case __pyx_e_8asynctnt_6iproto_3tnt_TP_SYNC:

      /* "asynctnt/iproto/response.pyx":158
 *             resp.code &= 0x7FFF
 *         elif key == tnt.TP_SYNC:
 *             if mp_typeof(b[0]) != MP_UINT:             # <<<<<<<<<<<<<<
 *                 raise TypeError('sync type must be a MP_UINT')
 * 
 */
      __pyx_t_1 = ((mp_typeof((__pyx_v_b[0])) != MP_UINT) != 0);
      if (__pyx_t_1) {

        /* "asynctnt/iproto/response.pyx":159
 *         elif key == tnt.TP_SYNC:
 *             if mp_typeof(b[0]) != MP_UINT:
 *                 raise TypeError('sync type must be a MP_UINT')             # <<<<<<<<<<<<<<
 * 
 *             resp.sync = mp_decode_uint(&b)
 */
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__15, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 159, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_Raise(__pyx_t_2, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __PYX_ERR(7, 159, __pyx_L1_error)

        /* "asynctnt/iproto/response.pyx":158
 *             resp.code &= 0x7FFF
 *         elif key == tnt.TP_SYNC:
 *             if mp_typeof(b[0]) != MP_UINT:             # <<<<<<<<<<<<<<
 *                 raise TypeError('sync type must be a MP_UINT')
 * 
 */
      }

      /* "asynctnt/iproto/response.pyx":161
 *                 raise TypeError('sync type must be a MP_UINT')
 * 
 *             resp.sync = mp_decode_uint(&b)             # <<<<<<<<<<<<<<
 *         elif key == tnt.TP_SCHEMA_ID:
 *             if mp_typeof(b[0]) != MP_UINT:
 */
      __pyx_v_resp->sync = mp_decode_uint((&__pyx_v_b));

      /* "asynctnt/iproto/response.pyx":157
 *             resp.code = <uint32_t>mp_decode_uint(&b)
 *             resp.code &= 0x7FFF
 *         elif key == tnt.TP_SYNC:             # <<<<<<<<<<<<<<
 *             if mp_typeof(b[0]) != MP_UINT:
 *                 raise TypeError('sync type must be a MP_UINT')
 */
      break;

      /* "asynctnt/iproto/response.pyx":162
 * 
 *             resp.sync = mp_decode_uint(&b)
 *         elif key == tnt.TP_SCHEMA_ID:             # <<<<<<<<<<<<<<
 *             if mp_typeof(b[0]) != MP_UINT:
 *                 raise TypeError('schema_id type must be a MP_UINT')
 */
      case __pyx_e_8asynctnt_6iproto_3tnt_TP_SCHEMA_ID:

      /* "asynctnt/iproto/response.pyx":163
 *             resp.sync = mp_decode_uint(&b)
 *         elif key == tnt.TP_SCHEMA_ID:
 *             if mp_typeof(b[0]) != MP_UINT:             # <<<<<<<<<<<<<<
 *                 raise TypeError('schema_id type must be a MP_UINT')
 * 
 */
      __pyx_t_1 = ((mp_typeof((__pyx_v_b[0])) != MP_UINT) != 0);
      if (__pyx_t_1) {

        /* "asynctnt/iproto/response.pyx":164
 *         elif key == tnt.TP_SCHEMA_ID:
 *             if mp_typeof(b[0]) != MP_UINT:
 *                 raise TypeError('schema_id type must be a MP_UINT')             # <<<<<<<<<<<<<<
 * 
 *             resp.schema_id = mp_decode_uint(&b)
 */
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 164, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_Raise(__pyx_t_2, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __PYX_ERR(7, 164, __pyx_L1_error)

        /* "asynctnt/iproto/response.pyx":163
 *             resp.sync = mp_decode_uint(&b)
 *         elif key == tnt.TP_SCHEMA_ID:
 *             if mp_typeof(b[0]) != MP_UINT:             # <<<<<<<<<<<<<<
 *                 raise TypeError('schema_id type must be a MP_UINT')
 * 
 */
      }

      /* "asynctnt/iproto/response.pyx":166
 *                 raise TypeError('schema_id type must be a MP_UINT')
 * 
 *             resp.schema_id = mp_decode_uint(&b)             # <<<<<<<<<<<<<<
 *         else:
 *             logger.warning('Unknown argument in header. Skipping.')
 */
      __pyx_v_resp->schema_id = mp_decode_uint((&__pyx_v_b));

      /* "asynctnt/iproto/response.pyx":162
 * 
 *             resp.sync = mp_decode_uint(&b)
 *         elif key == tnt.TP_SCHEMA_ID:             # <<<<<<<<<<<<<<
 *             if mp_typeof(b[0]) != MP_UINT:
 *                 raise TypeError('schema_id type must be a MP_UINT')
 */
      break;
      default:

      /* "asynctnt/iproto/response.pyx":168
 *             resp.schema_id = mp_decode_uint(&b)
 *         else:
 *             logger.warning('Unknown argument in header. Skipping.')             # <<<<<<<<<<<<<<
 *             mp_next(&b)
 * 
 */
      __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 168, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_warning); if (unlikely(!__pyx_t_5)) __PYX_ERR(7, 168, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 168, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "asynctnt/iproto/response.pyx":169
 *         else:
 *             logger.warning('Unknown argument in header. Skipping.')
 *             mp_next(&b)             # <<<<<<<<<<<<<<
 * 
 *     # parsing body
 */
      mp_next((&__pyx_v_b));
      break;
    }
  }

  /* "asynctnt/iproto/response.pyx":172
 * 
 *     # parsing body
 *     if b == &buf[buf_len]:             # <<<<<<<<<<<<<<
 *         # buffer exceeded
 *         return resp
 */
  __pyx_t_1 = ((__pyx_v_b == (&(__pyx_v_buf[__pyx_v_buf_len]))) != 0);
  if (__pyx_t_1) {

    /* "asynctnt/iproto/response.pyx":174
 *     if b == &buf[buf_len]:
 *         # buffer exceeded
 *         return resp             # <<<<<<<<<<<<<<
 * 
 *     if mp_typeof(b[0]) != MP_MAP:
 */
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    __Pyx_INCREF(((PyObject *)__pyx_v_resp));
    __pyx_r = __pyx_v_resp;
    goto __pyx_L0;

    /* "asynctnt/iproto/response.pyx":172
 * 
 *     # parsing body
 *     if b == &buf[buf_len]:             # <<<<<<<<<<<<<<
 *         # buffer exceeded
 *         return resp
 */
  }

  /* "asynctnt/iproto/response.pyx":176
 *         return resp
 * 
 *     if mp_typeof(b[0]) != MP_MAP:             # <<<<<<<<<<<<<<
 *         raise TypeError('Response body must be a MP_MAP')
 * 
 */
  __pyx_t_1 = ((mp_typeof((__pyx_v_b[0])) != MP_MAP) != 0);
  if (__pyx_t_1) {

    /* "asynctnt/iproto/response.pyx":177
 * 
 *     if mp_typeof(b[0]) != MP_MAP:
 *         raise TypeError('Response body must be a MP_MAP')             # <<<<<<<<<<<<<<
 * 
 *     size = mp_decode_map(&b)
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 177, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(7, 177, __pyx_L1_error)

    /* "asynctnt/iproto/response.pyx":176
 *         return resp
 * 
 *     if mp_typeof(b[0]) != MP_MAP:             # <<<<<<<<<<<<<<
 *         raise TypeError('Response body must be a MP_MAP')
 * 
 */
  }

  /* "asynctnt/iproto/response.pyx":179
 *         raise TypeError('Response body must be a MP_MAP')
 * 
 *     size = mp_decode_map(&b)             # <<<<<<<<<<<<<<
 *     for _ in range(size):
 *         if mp_typeof(b[0]) != MP_UINT:
 */
  __pyx_v_size = mp_decode_map((&__pyx_v_b));

  /* "asynctnt/iproto/response.pyx":180
 * 
 *     size = mp_decode_map(&b)
 *     for _ in range(size):             # <<<<<<<<<<<<<<
 *         if mp_typeof(b[0]) != MP_UINT:
 *             raise TypeError('Header key must be a MP_UINT')
 */
  __pyx_t_3 = __pyx_v_size;
  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
    __pyx_v__ = __pyx_t_4;

    /* "asynctnt/iproto/response.pyx":181
 *     size = mp_decode_map(&b)
 *     for _ in range(size):
 *         if mp_typeof(b[0]) != MP_UINT:             # <<<<<<<<<<<<<<
 *             raise TypeError('Header key must be a MP_UINT')
 * 
 */
    __pyx_t_1 = ((mp_typeof((__pyx_v_b[0])) != MP_UINT) != 0);
    if (__pyx_t_1) {

      /* "asynctnt/iproto/response.pyx":182
 *     for _ in range(size):
 *         if mp_typeof(b[0]) != MP_UINT:
 *             raise TypeError('Header key must be a MP_UINT')             # <<<<<<<<<<<<<<
 * 
 *         key = mp_decode_uint(&b)
 */
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 182, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_Raise(__pyx_t_2, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(7, 182, __pyx_L1_error)

      /* "asynctnt/iproto/response.pyx":181
 *     size = mp_decode_map(&b)
 *     for _ in range(size):
 *         if mp_typeof(b[0]) != MP_UINT:             # <<<<<<<<<<<<<<
 *             raise TypeError('Header key must be a MP_UINT')
 * 
 */
    }

    /* "asynctnt/iproto/response.pyx":184
 *             raise TypeError('Header key must be a MP_UINT')
 * 
 *         key = mp_decode_uint(&b)             # <<<<<<<<<<<<<<
 *         if key == tnt.TP_ERROR:
 *             if mp_typeof(b[0]) != MP_STR:
 */
    __pyx_v_key = mp_decode_uint((&__pyx_v_b));

    /* "asynctnt/iproto/response.pyx":185
 * 
 *         key = mp_decode_uint(&b)
 *         if key == tnt.TP_ERROR:             # <<<<<<<<<<<<<<
 *             if mp_typeof(b[0]) != MP_STR:
 *                 raise TypeError('errstr type must be a MP_STR')
 */
    switch (__pyx_v_key) {
      case __pyx_e_8asynctnt_6iproto_3tnt_TP_ERROR:

      /* "asynctnt/iproto/response.pyx":186
 *         key = mp_decode_uint(&b)
 *         if key == tnt.TP_ERROR:
 *             if mp_typeof(b[0]) != MP_STR:             # <<<<<<<<<<<<<<
 *                 raise TypeError('errstr type must be a MP_STR')
 * 
 */
      __pyx_t_1 = ((mp_typeof((__pyx_v_b[0])) != MP_STR) != 0);
      if (__pyx_t_1) {

        /* "asynctnt/iproto/response.pyx":187
 *         if key == tnt.TP_ERROR:
 *             if mp_typeof(b[0]) != MP_STR:
 *                 raise TypeError('errstr type must be a MP_STR')             # <<<<<<<<<<<<<<
 * 
 *             s = NULL
 */
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__20, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 187, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_Raise(__pyx_t_2, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __PYX_ERR(7, 187, __pyx_L1_error)

        /* "asynctnt/iproto/response.pyx":186
 *         key = mp_decode_uint(&b)
 *         if key == tnt.TP_ERROR:
 *             if mp_typeof(b[0]) != MP_STR:             # <<<<<<<<<<<<<<
 *                 raise TypeError('errstr type must be a MP_STR')
 * 
 */
      }

      /* "asynctnt/iproto/response.pyx":189
 *                 raise TypeError('errstr type must be a MP_STR')
 * 
 *             s = NULL             # <<<<<<<<<<<<<<
 *             s_len = 0
 *             s = mp_decode_str(&b, &s_len)
 */
      __pyx_v_s = NULL;

      /* "asynctnt/iproto/response.pyx":190
 * 
 *             s = NULL
 *             s_len = 0             # <<<<<<<<<<<<<<
 *             s = mp_decode_str(&b, &s_len)
 *             resp.errmsg = s[:s_len].decode(encoding)
 */
      __pyx_v_s_len = 0;

      /* "asynctnt/iproto/response.pyx":191
 *             s = NULL
 *             s_len = 0
 *             s = mp_decode_str(&b, &s_len)             # <<<<<<<<<<<<<<
 *             resp.errmsg = s[:s_len].decode(encoding)
 *         elif key == tnt.TP_DATA:
 */
      __pyx_v_s = mp_decode_str((&__pyx_v_b), (&__pyx_v_s_len));

      /* "asynctnt/iproto/response.pyx":192
 *             s_len = 0
 *             s = mp_decode_str(&b, &s_len)
 *             resp.errmsg = s[:s_len].decode(encoding)             # <<<<<<<<<<<<<<
 *         elif key == tnt.TP_DATA:
 *             if mp_typeof(b[0]) != MP_ARRAY:
 */
      __pyx_t_6 = __Pyx_PyObject_AsString(__pyx_v_encoding); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) __PYX_ERR(7, 192, __pyx_L1_error)
      __pyx_t_2 = __Pyx_decode_c_string(__pyx_v_s, 0, __pyx_v_s_len, __pyx_t_6, NULL, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 192, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (!(likely(PyString_CheckExact(__pyx_t_2))||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(7, 192, __pyx_L1_error)
      __Pyx_GIVEREF(__pyx_t_2);
      __Pyx_GOTREF(__pyx_v_resp->errmsg);
      __Pyx_DECREF(__pyx_v_resp->errmsg);
      __pyx_v_resp->errmsg = ((PyObject*)__pyx_t_2);
      __pyx_t_2 = 0;

      /* "asynctnt/iproto/response.pyx":185
 * 
 *         key = mp_decode_uint(&b)
 *         if key == tnt.TP_ERROR:             # <<<<<<<<<<<<<<
 *             if mp_typeof(b[0]) != MP_STR:
 *                 raise TypeError('errstr type must be a MP_STR')
 */
      break;

      /* "asynctnt/iproto/response.pyx":193
 *             s = mp_decode_str(&b, &s_len)
 *             resp.errmsg = s[:s_len].decode(encoding)
 *         elif key == tnt.TP_DATA:             # <<<<<<<<<<<<<<
 *             if mp_typeof(b[0]) != MP_ARRAY:
 *                 raise TypeError('body data type must be a MP_ARRAY')
 */
      case __pyx_e_8asynctnt_6iproto_3tnt_TP_DATA:

      /* "asynctnt/iproto/response.pyx":194
 *             resp.errmsg = s[:s_len].decode(encoding)
 *         elif key == tnt.TP_DATA:
 *             if mp_typeof(b[0]) != MP_ARRAY:             # <<<<<<<<<<<<<<
 *                 raise TypeError('body data type must be a MP_ARRAY')
 *             resp.body = _response_parse_body_data(b, encoding)
 */
      __pyx_t_1 = ((mp_typeof((__pyx_v_b[0])) != MP_ARRAY) != 0);
      if (__pyx_t_1) {

        /* "asynctnt/iproto/response.pyx":195
 *         elif key == tnt.TP_DATA:
 *             if mp_typeof(b[0]) != MP_ARRAY:
 *                 raise TypeError('body data type must be a MP_ARRAY')             # <<<<<<<<<<<<<<
 *             resp.body = _response_parse_body_data(b, encoding)
 * 
 */
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__21, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 195, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_Raise(__pyx_t_2, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __PYX_ERR(7, 195, __pyx_L1_error)

        /* "asynctnt/iproto/response.pyx":194
 *             resp.errmsg = s[:s_len].decode(encoding)
 *         elif key == tnt.TP_DATA:
 *             if mp_typeof(b[0]) != MP_ARRAY:             # <<<<<<<<<<<<<<
 *                 raise TypeError('body data type must be a MP_ARRAY')
 *             resp.body = _response_parse_body_data(b, encoding)
 */
      }

      /* "asynctnt/iproto/response.pyx":196
 *             if mp_typeof(b[0]) != MP_ARRAY:
 *                 raise TypeError('body data type must be a MP_ARRAY')
 *             resp.body = _response_parse_body_data(b, encoding)             # <<<<<<<<<<<<<<
 * 
 *     return resp
 */
      __pyx_t_2 = __pyx_f_8asynctnt_6iproto_8protocol__response_parse_body_data(__pyx_v_b, __pyx_v_encoding); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 196, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      __Pyx_GOTREF(__pyx_v_resp->body);
      __Pyx_DECREF(__pyx_v_resp->body);
      __pyx_v_resp->body = ((PyObject*)__pyx_t_2);
      __pyx_t_2 = 0;

      /* "asynctnt/iproto/response.pyx":193
 *             s = mp_decode_str(&b, &s_len)
 *             resp.errmsg = s[:s_len].decode(encoding)
 *         elif key == tnt.TP_DATA:             # <<<<<<<<<<<<<<
 *             if mp_typeof(b[0]) != MP_ARRAY:
 *                 raise TypeError('body data type must be a MP_ARRAY')
 */
      break;
      default: break;
    }
  }

  /* "asynctnt/iproto/response.pyx":198
 *             resp.body = _response_parse_body_data(b, encoding)
 * 
 *     return resp             # <<<<<<<<<<<<<<
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_resp));
  __pyx_r = __pyx_v_resp;
  goto __pyx_L0;

  /* "asynctnt/iproto/response.pyx":128
 * 
 * 
 * cdef Response response_parse(const char *buf, uint32_t buf_len,             # <<<<<<<<<<<<<<
 *                              bytes encoding):
 *     cdef:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("asynctnt.iproto.protocol.response_parse", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_resp);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/schema.pyx":3
 * cdef class SchemaIndex:
 * 
 *     def __init__(self, list index_row):             # <<<<<<<<<<<<<<
 *         self.sid = index_row[0]
 *         self.iid = index_row[1]
 */

/* Python wrapper */
static int __pyx_pw_8asynctnt_6iproto_8protocol_11SchemaIndex_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_8asynctnt_6iproto_8protocol_11SchemaIndex_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_index_row = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_index_row,0};
    PyObject* values[1] = {0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_index_row)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(1, 3, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    }
    __pyx_v_index_row = ((PyObject*)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 3, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("asynctnt.iproto.protocol.SchemaIndex.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_index_row), (&PyList_Type), 1, "index_row", 1))) __PYX_ERR(1, 3, __pyx_L1_error)
  __pyx_r = __pyx_pf_8asynctnt_6iproto_8protocol_11SchemaIndex___init__(((struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaIndex *)__pyx_v_self), __pyx_v_index_row);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/schema.pyx":18
 *                     (index_row[5 + 1 + i * 2], index_row[5 + 2 + i * 2]))
 * 
 *         def __repr__(self):             # <<<<<<<<<<<<<<
 *             return \
 *                 '<SchemaIndex sid={}, id={}, name={}, ' \
 */

/* Python wrapper */
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_11SchemaIndex_8__init___1__repr__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_8asynctnt_6iproto_8protocol_11SchemaIndex_8__init___1__repr__ = {"__repr__", (PyCFunction)__pyx_pw_8asynctnt_6iproto_8protocol_11SchemaIndex_8__init___1__repr__, METH_O, 0};
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_11SchemaIndex_8__init___1__repr__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8asynctnt_6iproto_8protocol_11SchemaIndex_8__init_____repr__(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_11SchemaIndex_8__init_____repr__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "asynctnt/iproto/schema.pyx":19
 * 
 *         def __repr__(self):
 *             return \             # <<<<<<<<<<<<<<
 *                 '<SchemaIndex sid={}, id={}, name={}, ' \
 *                 'type={}, unique={}>'.format(
 */
  __Pyx_XDECREF(__pyx_r);

  /* "asynctnt/iproto/schema.pyx":21
 *             return \
 *                 '<SchemaIndex sid={}, id={}, name={}, ' \
 *                 'type={}, unique={}>'.format(             # <<<<<<<<<<<<<<
 *                     self.sid, self.iid, self.name, self.index_type, self.unique
 *                 )
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_SchemaIndex_sid_id_name_type_un, __pyx_n_s_format); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 21, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "asynctnt/iproto/schema.pyx":22
 *                 '<SchemaIndex sid={}, id={}, name={}, ' \
 *                 'type={}, unique={}>'.format(
 *                     self.sid, self.iid, self.name, self.index_type, self.unique             # <<<<<<<<<<<<<<
 *                 )
 * 
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_sid); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 22, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_iid); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 22, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_name); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 22, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_index_type); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 22, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_unique); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 22, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = NULL;
  __pyx_t_9 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_9 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[6] = {__pyx_t_8, __pyx_t_3, __pyx_t_4, __pyx_t_5, __pyx_t_6, __pyx_t_7};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_9, 5+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 21, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[6] = {__pyx_t_8, __pyx_t_3, __pyx_t_4, __pyx_t_5, __pyx_t_6, __pyx_t_7};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_9, 5+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 21, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  } else
  #endif
  {
    __pyx_t_10 = PyTuple_New(5+__pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 21, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    if (__pyx_t_8) {
      __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_8); __pyx_t_8 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_9, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_9, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_10, 2+__pyx_t_9, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_10, 3+__pyx_t_9, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_10, 4+__pyx_t_9, __pyx_t_7);
    __pyx_t_3 = 0;
    __pyx_t_4 = 0;
    __pyx_t_5 = 0;
    __pyx_t_6 = 0;
    __pyx_t_7 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 21, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "asynctnt/iproto/schema.pyx":18
 *                     (index_row[5 + 1 + i * 2], index_row[5 + 2 + i * 2]))
 * 
 *         def __repr__(self):             # <<<<<<<<<<<<<<
 *             return \
 *                 '<SchemaIndex sid={}, id={}, name={}, ' \
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("asynctnt.iproto.protocol.SchemaIndex.__init__.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/schema.pyx":3
 * cdef class SchemaIndex:
 * 
 *     def __init__(self, list index_row):             # <<<<<<<<<<<<<<
 *         self.sid = index_row[0]
 *         self.iid = index_row[1]
 */

static int __pyx_pf_8asynctnt_6iproto_8protocol_11SchemaIndex___init__(struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaIndex *__pyx_v_self, PyObject *__pyx_v_index_row) {
  PyObject *__pyx_v_k = NULL;
  PyObject *__pyx_v_v = NULL;
  PyObject *__pyx_v_i = NULL;
  CYTHON_UNUSED PyObject *__pyx_v___repr__ = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  Py_ssize_t __pyx_t_7;
  PyObject *(*__pyx_t_8)(PyObject *);
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *(*__pyx_t_12)(PyObject *);
  int __pyx_t_13;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "asynctnt/iproto/schema.pyx":4
 * 
 *     def __init__(self, list index_row):
 *         self.sid = index_row[0]             # <<<<<<<<<<<<<<
 *         self.iid = index_row[1]
 *         self.name = index_row[2]
 */
  if (unlikely(__pyx_v_index_row == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 4, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_index_row, 0, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_self->sid = __pyx_t_2;

  /* "asynctnt/iproto/schema.pyx":5
 *     def __init__(self, list index_row):
 *         self.sid = index_row[0]
 *         self.iid = index_row[1]             # <<<<<<<<<<<<<<
 *         self.name = index_row[2]
 *         self.index_type = index_row[3]
 */
  if (unlikely(__pyx_v_index_row == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 5, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_index_row, 1, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_self->iid = __pyx_t_2;

  /* "asynctnt/iproto/schema.pyx":6
 *         self.sid = index_row[0]
 *         self.iid = index_row[1]
 *         self.name = index_row[2]             # <<<<<<<<<<<<<<
 *         self.index_type = index_row[3]
 *         self.unique = index_row[4]
 */
  if (unlikely(__pyx_v_index_row == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 6, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_index_row, 2, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyString_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(1, 6, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->name);
  __Pyx_DECREF(__pyx_v_self->name);
  __pyx_v_self->name = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "asynctnt/iproto/schema.pyx":7
 *         self.iid = index_row[1]
 *         self.name = index_row[2]
 *         self.index_type = index_row[3]             # <<<<<<<<<<<<<<
 *         self.unique = index_row[4]
 *         self.parts = []
 */
  if (unlikely(__pyx_v_index_row == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 7, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_index_row, 3, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyString_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(1, 7, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->index_type);
  __Pyx_DECREF(__pyx_v_self->index_type);
  __pyx_v_self->index_type = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "asynctnt/iproto/schema.pyx":8
 *         self.name = index_row[2]
 *         self.index_type = index_row[3]
 *         self.unique = index_row[4]             # <<<<<<<<<<<<<<
 *         self.parts = []
 *         if isinstance(index_row[5], (list, tuple)):
 */
  if (unlikely(__pyx_v_index_row == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 8, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_index_row, 4, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->unique);
  __Pyx_DECREF(__pyx_v_self->unique);
  __pyx_v_self->unique = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "asynctnt/iproto/schema.pyx":9
 *         self.index_type = index_row[3]
 *         self.unique = index_row[4]
 *         self.parts = []             # <<<<<<<<<<<<<<
 *         if isinstance(index_row[5], (list, tuple)):
 *             for k, v in index_row[5]:
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 9, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->parts);
  __Pyx_DECREF(__pyx_v_self->parts);
  __pyx_v_self->parts = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "asynctnt/iproto/schema.pyx":10
 *         self.unique = index_row[4]
 *         self.parts = []
 *         if isinstance(index_row[5], (list, tuple)):             # <<<<<<<<<<<<<<
 *             for k, v in index_row[5]:
 *                 self.parts.append((k, v))
 */
  if (unlikely(__pyx_v_index_row == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 10, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_index_row, 5, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 10, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyList_Check(__pyx_t_1); 
  __pyx_t_5 = (__pyx_t_4 != 0);
  if (!__pyx_t_5) {
  } else {
    __pyx_t_3 = __pyx_t_5;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_5 = PyTuple_Check(__pyx_t_1); 
  __pyx_t_4 = (__pyx_t_5 != 0);
  __pyx_t_3 = __pyx_t_4;
  __pyx_L4_bool_binop_done:;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_4 = (__pyx_t_3 != 0);
  if (__pyx_t_4) {

    /* "asynctnt/iproto/schema.pyx":11
 *         self.parts = []
 *         if isinstance(index_row[5], (list, tuple)):
 *             for k, v in index_row[5]:             # <<<<<<<<<<<<<<
 *                 self.parts.append((k, v))
 *         else:
 */
    if (unlikely(__pyx_v_index_row == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(1, 11, __pyx_L1_error)
    }
    __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_index_row, 5, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 11, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
      __pyx_t_6 = __pyx_t_1; __Pyx_INCREF(__pyx_t_6); __pyx_t_7 = 0;
      __pyx_t_8 = NULL;
    } else {
      __pyx_t_7 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 11, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_8 = Py_TYPE(__pyx_t_6)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 11, __pyx_L1_error)
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    for (;;) {
      if (likely(!__pyx_t_8)) {
        if (likely(PyList_CheckExact(__pyx_t_6))) {
          if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_6)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_1 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_7); __Pyx_INCREF(__pyx_t_1); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(1, 11, __pyx_L1_error)
          #else
          __pyx_t_1 = PySequence_ITEM(__pyx_t_6, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 11, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          #endif
        } else {
          if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_6)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_7); __Pyx_INCREF(__pyx_t_1); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(1, 11, __pyx_L1_error)
          #else
          __pyx_t_1 = PySequence_ITEM(__pyx_t_6, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 11, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          #endif
        }
      } else {
        __pyx_t_1 = __pyx_t_8(__pyx_t_6);
        if (unlikely(!__pyx_t_1)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(1, 11, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_1);
      }
      if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
        PyObject* sequence = __pyx_t_1;
        #if !CYTHON_COMPILING_IN_PYPY
        Py_ssize_t size = Py_SIZE(sequence);
        #else
        Py_ssize_t size = PySequence_Size(sequence);
        #endif
        if (unlikely(size != 2)) {
          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          __PYX_ERR(1, 11, __pyx_L1_error)
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_9 = PyTuple_GET_ITEM(sequence, 0); 
          __pyx_t_10 = PyTuple_GET_ITEM(sequence, 1); 
        } else {
          __pyx_t_9 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_10 = PyList_GET_ITEM(sequence, 1); 
        }
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(__pyx_t_10);
        #else
        __pyx_t_9 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 11, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_10 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 11, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        #endif
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_11 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 11, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_12 = Py_TYPE(__pyx_t_11)->tp_iternext;
        index = 0; __pyx_t_9 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_9)) goto __pyx_L8_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_9);
        index = 1; __pyx_t_10 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_10)) goto __pyx_L8_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_10);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_11), 2) < 0) __PYX_ERR(1, 11, __pyx_L1_error)
        __pyx_t_12 = NULL;
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        goto __pyx_L9_unpacking_done;
        __pyx_L8_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __pyx_t_12 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        __PYX_ERR(1, 11, __pyx_L1_error)
        __pyx_L9_unpacking_done:;
      }
      __Pyx_XDECREF_SET(__pyx_v_k, __pyx_t_9);
      __pyx_t_9 = 0;
      __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_10);
      __pyx_t_10 = 0;

      /* "asynctnt/iproto/schema.pyx":12
 *         if isinstance(index_row[5], (list, tuple)):
 *             for k, v in index_row[5]:
 *                 self.parts.append((k, v))             # <<<<<<<<<<<<<<
 *         else:
 *             for i in range(index_row[5]):
 */
      if (unlikely(__pyx_v_self->parts == Py_None)) {
        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append");
        __PYX_ERR(1, 12, __pyx_L1_error)
      }
      __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_v_k);
      __Pyx_GIVEREF(__pyx_v_k);
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_k);
      __Pyx_INCREF(__pyx_v_v);
      __Pyx_GIVEREF(__pyx_v_v);
      PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_v);
      __pyx_t_13 = __Pyx_PyList_Append(__pyx_v_self->parts, __pyx_t_1); if (unlikely(__pyx_t_13 == -1)) __PYX_ERR(1, 12, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "asynctnt/iproto/schema.pyx":11
 *         self.parts = []
 *         if isinstance(index_row[5], (list, tuple)):
 *             for k, v in index_row[5]:             # <<<<<<<<<<<<<<
 *                 self.parts.append((k, v))
 *         else:
 */
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "asynctnt/iproto/schema.pyx":10
 *         self.unique = index_row[4]
 *         self.parts = []
 *         if isinstance(index_row[5], (list, tuple)):             # <<<<<<<<<<<<<<
 *             for k, v in index_row[5]:
 *                 self.parts.append((k, v))
 */
    goto __pyx_L3;
  }

  /* "asynctnt/iproto/schema.pyx":14
 *                 self.parts.append((k, v))
 *         else:
 *             for i in range(index_row[5]):             # <<<<<<<<<<<<<<
 *                 self.parts.append(
 *                     (index_row[5 + 1 + i * 2], index_row[5 + 2 + i * 2]))
 */
  /*else*/ {
    if (unlikely(__pyx_v_index_row == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(1, 14, __pyx_L1_error)
    }
    __pyx_t_6 = __Pyx_GetItemInt_List(__pyx_v_index_row, 5, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_6);
    __pyx_t_6 = 0;
    __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_1, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (likely(PyList_CheckExact(__pyx_t_6)) || PyTuple_CheckExact(__pyx_t_6)) {
      __pyx_t_1 = __pyx_t_6; __Pyx_INCREF(__pyx_t_1); __pyx_t_7 = 0;
      __pyx_t_8 = NULL;
    } else {
      __pyx_t_7 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_8 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 14, __pyx_L1_error)
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    for (;;) {
      if (likely(!__pyx_t_8)) {
        if (likely(PyList_CheckExact(__pyx_t_1))) {
          if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_1)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_6 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_7); __Pyx_INCREF(__pyx_t_6); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(1, 14, __pyx_L1_error)
          #else
          __pyx_t_6 = PySequence_ITEM(__pyx_t_1, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 14, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          #endif
        } else {
          if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_7); __Pyx_INCREF(__pyx_t_6); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(1, 14, __pyx_L1_error)
          #else
          __pyx_t_6 = PySequence_ITEM(__pyx_t_1, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 14, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          #endif
        }
      } else {
        __pyx_t_6 = __pyx_t_8(__pyx_t_1);
        if (unlikely(!__pyx_t_6)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(1, 14, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_6);
      }
      __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_6);
      __pyx_t_6 = 0;

      /* "asynctnt/iproto/schema.pyx":15
 *         else:
 *             for i in range(index_row[5]):
 *                 self.parts.append(             # <<<<<<<<<<<<<<
 *                     (index_row[5 + 1 + i * 2], index_row[5 + 2 + i * 2]))
 * 
 */
      if (unlikely(__pyx_v_self->parts == Py_None)) {
        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append");
        __PYX_ERR(1, 15, __pyx_L1_error)
      }

      /* "asynctnt/iproto/schema.pyx":16
 *             for i in range(index_row[5]):
 *                 self.parts.append(
 *                     (index_row[5 + 1 + i * 2], index_row[5 + 2 + i * 2]))             # <<<<<<<<<<<<<<
 * 
 *         def __repr__(self):
 */
      if (unlikely(__pyx_v_index_row == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(1, 16, __pyx_L1_error)
      }
      __pyx_t_6 = PyNumber_Multiply(__pyx_v_i, __pyx_int_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 16, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_10 = __Pyx_PyInt_AddCObj(__pyx_int_6, __pyx_t_6, 6, 0); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 16, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = PyObject_GetItem(__pyx_v_index_row, __pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 16, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      if (unlikely(__pyx_v_index_row == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(1, 16, __pyx_L1_error)
      }
      __pyx_t_10 = PyNumber_Multiply(__pyx_v_i, __pyx_int_2); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 16, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_9 = __Pyx_PyInt_AddCObj(__pyx_int_7, __pyx_t_10, 7, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 16, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_10 = PyObject_GetItem(__pyx_v_index_row, __pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 16, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 16, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_10);
      PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_10);
      __pyx_t_6 = 0;
      __pyx_t_10 = 0;

      /* "asynctnt/iproto/schema.pyx":15
 *         else:
 *             for i in range(index_row[5]):
 *                 self.parts.append(             # <<<<<<<<<<<<<<
 *                     (index_row[5 + 1 + i * 2], index_row[5 + 2 + i * 2]))
 * 
 */
      __pyx_t_13 = __Pyx_PyList_Append(__pyx_v_self->parts, __pyx_t_9); if (unlikely(__pyx_t_13 == -1)) __PYX_ERR(1, 15, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

      /* "asynctnt/iproto/schema.pyx":14
 *                 self.parts.append((k, v))
 *         else:
 *             for i in range(index_row[5]):             # <<<<<<<<<<<<<<
 *                 self.parts.append(
 *                     (index_row[5 + 1 + i * 2], index_row[5 + 2 + i * 2]))
 */
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
  __pyx_L3:;

  /* "asynctnt/iproto/schema.pyx":18
 *                     (index_row[5 + 1 + i * 2], index_row[5 + 2 + i * 2]))
 * 
 *         def __repr__(self):             # <<<<<<<<<<<<<<
 *             return \
 *                 '<SchemaIndex sid={}, id={}, name={}, ' \
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_8asynctnt_6iproto_8protocol_11SchemaIndex_8__init___1__repr__, 0, __pyx_n_s_init___locals___repr, NULL, __pyx_n_s_asynctnt_iproto_protocol, __pyx_d, ((PyObject *)__pyx_codeobj__23)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 18, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v___repr__ = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "asynctnt/iproto/schema.pyx":3
 * cdef class SchemaIndex:
 * 
 *     def __init__(self, list index_row):             # <<<<<<<<<<<<<<
 *         self.sid = index_row[0]
 *         self.iid = index_row[1]
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("asynctnt.iproto.protocol.SchemaIndex.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_k);
  __Pyx_XDECREF(__pyx_v_v);
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XDECREF(__pyx_v___repr__);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/schema.pxd":5
 * 
 * cdef class SchemaIndex:
 *     cdef public int sid             # <<<<<<<<<<<<<<
 *     cdef public int iid
 *     cdef public str name
 */

/* Python wrapper */
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_11SchemaIndex_3sid_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_11SchemaIndex_3sid_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8asynctnt_6iproto_8protocol_11SchemaIndex_3sid___get__(((struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaIndex *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_11SchemaIndex_3sid___get__(struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaIndex *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->sid); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asynctnt.iproto.protocol.SchemaIndex.sid.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_8asynctnt_6iproto_8protocol_11SchemaIndex_3sid_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8asynctnt_6iproto_8protocol_11SchemaIndex_3sid_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8asynctnt_6iproto_8protocol_11SchemaIndex_3sid_2__set__(((struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaIndex *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_8asynctnt_6iproto_8protocol_11SchemaIndex_3sid_2__set__(struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaIndex *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__set__", 0);
  __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(9, 5, __pyx_L1_error)
  __pyx_v_self->sid = __pyx_t_1;

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("asynctnt.iproto.protocol.SchemaIndex.sid.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/schema.pxd":6
 * cdef class SchemaIndex:
 *     cdef public int sid
 *     cdef public int iid             # <<<<<<<<<<<<<<
 *     cdef public str name
 *     cdef public str index_type
 */

/* Python wrapper */
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_11SchemaIndex_3iid_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_11SchemaIndex_3iid_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8asynctnt_6iproto_8protocol_11SchemaIndex_3iid___get__(((struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaIndex *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_11SchemaIndex_3iid___get__(struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaIndex *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->iid); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asynctnt.iproto.protocol.SchemaIndex.iid.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_8asynctnt_6iproto_8protocol_11SchemaIndex_3iid_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8asynctnt_6iproto_8protocol_11SchemaIndex_3iid_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8asynctnt_6iproto_8protocol_11SchemaIndex_3iid_2__set__(((struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaIndex *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_8asynctnt_6iproto_8protocol_11SchemaIndex_3iid_2__set__(struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaIndex *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__set__", 0);
  __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(9, 6, __pyx_L1_error)
  __pyx_v_self->iid = __pyx_t_1;

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("asynctnt.iproto.protocol.SchemaIndex.iid.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/schema.pxd":7
 *     cdef public int sid
 *     cdef public int iid
 *     cdef public str name             # <<<<<<<<<<<<<<
 *     cdef public str index_type
 *     cdef public object unique
 */

/* Python wrapper */
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_11SchemaIndex_4name_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_11SchemaIndex_4name_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8asynctnt_6iproto_8protocol_11SchemaIndex_4name___get__(((struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaIndex *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_11SchemaIndex_4name___get__(struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaIndex *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->name);
  __pyx_r = __pyx_v_self->name;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_8asynctnt_6iproto_8protocol_11SchemaIndex_4name_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8asynctnt_6iproto_8protocol_11SchemaIndex_4name_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8asynctnt_6iproto_8protocol_11SchemaIndex_4name_2__set__(((struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaIndex *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_8asynctnt_6iproto_8protocol_11SchemaIndex_4name_2__set__(struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaIndex *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__set__", 0);
  if (!(likely(PyString_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_v_value)->tp_name), 0))) __PYX_ERR(9, 7, __pyx_L1_error)
  __pyx_t_1 = __pyx_v_value;
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->name);
  __Pyx_DECREF(__pyx_v_self->name);
  __pyx_v_self->name = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asynctnt.iproto.protocol.SchemaIndex.name.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_8asynctnt_6iproto_8protocol_11SchemaIndex_4name_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_8asynctnt_6iproto_8protocol_11SchemaIndex_4name_5__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8asynctnt_6iproto_8protocol_11SchemaIndex_4name_4__del__(((struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaIndex *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_8asynctnt_6iproto_8protocol_11SchemaIndex_4name_4__del__(struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaIndex *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__", 0);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->name);
  __Pyx_DECREF(__pyx_v_self->name);
  __pyx_v_self->name = ((PyObject*)Py_None);

  /* function exit code */
  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/schema.pxd":8
 *     cdef public int iid
 *     cdef public str name
 *     cdef public str index_type             # <<<<<<<<<<<<<<
 *     cdef public object unique
 *     cdef public list parts
 */

/* Python wrapper */
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_11SchemaIndex_10index_type_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_11SchemaIndex_10index_type_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8asynctnt_6iproto_8protocol_11SchemaIndex_10index_type___get__(((struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaIndex *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_11SchemaIndex_10index_type___get__(struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaIndex *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->index_type);
  __pyx_r = __pyx_v_self->index_type;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_8asynctnt_6iproto_8protocol_11SchemaIndex_10index_type_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8asynctnt_6iproto_8protocol_11SchemaIndex_10index_type_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8asynctnt_6iproto_8protocol_11SchemaIndex_10index_type_2__set__(((struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaIndex *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_8asynctnt_6iproto_8protocol_11SchemaIndex_10index_type_2__set__(struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaIndex *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__set__", 0);
  if (!(likely(PyString_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_v_value)->tp_name), 0))) __PYX_ERR(9, 8, __pyx_L1_error)
  __pyx_t_1 = __pyx_v_value;
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->index_type);
  __Pyx_DECREF(__pyx_v_self->index_type);
  __pyx_v_self->index_type = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asynctnt.iproto.protocol.SchemaIndex.index_type.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_8asynctnt_6iproto_8protocol_11SchemaIndex_10index_type_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_8asynctnt_6iproto_8protocol_11SchemaIndex_10index_type_5__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8asynctnt_6iproto_8protocol_11SchemaIndex_10index_type_4__del__(((struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaIndex *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_8asynctnt_6iproto_8protocol_11SchemaIndex_10index_type_4__del__(struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaIndex *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__", 0);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->index_type);
  __Pyx_DECREF(__pyx_v_self->index_type);
  __pyx_v_self->index_type = ((PyObject*)Py_None);

  /* function exit code */
  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/schema.pxd":9
 *     cdef public str name
 *     cdef public str index_type
 *     cdef public object unique             # <<<<<<<<<<<<<<
 *     cdef public list parts
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_11SchemaIndex_6unique_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_11SchemaIndex_6unique_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8asynctnt_6iproto_8protocol_11SchemaIndex_6unique___get__(((struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaIndex *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_11SchemaIndex_6unique___get__(struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaIndex *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->unique);
  __pyx_r = __pyx_v_self->unique;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_8asynctnt_6iproto_8protocol_11SchemaIndex_6unique_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8asynctnt_6iproto_8protocol_11SchemaIndex_6unique_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8asynctnt_6iproto_8protocol_11SchemaIndex_6unique_2__set__(((struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaIndex *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_8asynctnt_6iproto_8protocol_11SchemaIndex_6unique_2__set__(struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaIndex *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__", 0);
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(__pyx_v_self->unique);
  __Pyx_DECREF(__pyx_v_self->unique);
  __pyx_v_self->unique = __pyx_v_value;

  /* function exit code */
  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_8asynctnt_6iproto_8protocol_11SchemaIndex_6unique_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_8asynctnt_6iproto_8protocol_11SchemaIndex_6unique_5__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8asynctnt_6iproto_8protocol_11SchemaIndex_6unique_4__del__(((struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaIndex *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_8asynctnt_6iproto_8protocol_11SchemaIndex_6unique_4__del__(struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaIndex *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__", 0);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->unique);
  __Pyx_DECREF(__pyx_v_self->unique);
  __pyx_v_self->unique = Py_None;

  /* function exit code */
  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/schema.pxd":10
 *     cdef public str index_type
 *     cdef public object unique
 *     cdef public list parts             # <<<<<<<<<<<<<<
 * 
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_11SchemaIndex_5parts_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_11SchemaIndex_5parts_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8asynctnt_6iproto_8protocol_11SchemaIndex_5parts___get__(((struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaIndex *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_11SchemaIndex_5parts___get__(struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaIndex *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->parts);
  __pyx_r = __pyx_v_self->parts;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_8asynctnt_6iproto_8protocol_11SchemaIndex_5parts_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8asynctnt_6iproto_8protocol_11SchemaIndex_5parts_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8asynctnt_6iproto_8protocol_11SchemaIndex_5parts_2__set__(((struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaIndex *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_8asynctnt_6iproto_8protocol_11SchemaIndex_5parts_2__set__(struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaIndex *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__set__", 0);
  if (!(likely(PyList_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_v_value)->tp_name), 0))) __PYX_ERR(9, 10, __pyx_L1_error)
  __pyx_t_1 = __pyx_v_value;
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->parts);
  __Pyx_DECREF(__pyx_v_self->parts);
  __pyx_v_self->parts = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asynctnt.iproto.protocol.SchemaIndex.parts.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_8asynctnt_6iproto_8protocol_11SchemaIndex_5parts_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_8asynctnt_6iproto_8protocol_11SchemaIndex_5parts_5__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8asynctnt_6iproto_8protocol_11SchemaIndex_5parts_4__del__(((struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaIndex *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_8asynctnt_6iproto_8protocol_11SchemaIndex_5parts_4__del__(struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaIndex *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__", 0);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->parts);
  __Pyx_DECREF(__pyx_v_self->parts);
  __pyx_v_self->parts = ((PyObject*)Py_None);

  /* function exit code */
  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/schema.pyx":27
 * 
 * cdef class SchemaSpace:
 *     def __init__(self, list space_row):             # <<<<<<<<<<<<<<
 *         self.sid = space_row[0]
 *         self.arity = space_row[1]
 */

/* Python wrapper */
static int __pyx_pw_8asynctnt_6iproto_8protocol_11SchemaSpace_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_8asynctnt_6iproto_8protocol_11SchemaSpace_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_space_row = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_space_row,0};
    PyObject* values[1] = {0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_space_row)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(1, 27, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    }
    __pyx_v_space_row = ((PyObject*)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 27, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("asynctnt.iproto.protocol.SchemaSpace.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_space_row), (&PyList_Type), 1, "space_row", 1))) __PYX_ERR(1, 27, __pyx_L1_error)
  __pyx_r = __pyx_pf_8asynctnt_6iproto_8protocol_11SchemaSpace___init__(((struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaSpace *)__pyx_v_self), __pyx_v_space_row);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_8asynctnt_6iproto_8protocol_11SchemaSpace___init__(struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaSpace *__pyx_v_self, PyObject *__pyx_v_space_row) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "asynctnt/iproto/schema.pyx":28
 * cdef class SchemaSpace:
 *     def __init__(self, list space_row):
 *         self.sid = space_row[0]             # <<<<<<<<<<<<<<
 *         self.arity = space_row[1]
 *         self.name = space_row[2]
 */
  if (unlikely(__pyx_v_space_row == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 28, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_space_row, 0, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 28, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 28, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_self->sid = __pyx_t_2;

  /* "asynctnt/iproto/schema.pyx":29
 *     def __init__(self, list space_row):
 *         self.sid = space_row[0]
 *         self.arity = space_row[1]             # <<<<<<<<<<<<<<
 *         self.name = space_row[2]
 *         self.indexes = {}
 */
  if (unlikely(__pyx_v_space_row == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 29, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_space_row, 1, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 29, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 29, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_self->arity = __pyx_t_2;

  /* "asynctnt/iproto/schema.pyx":30
 *         self.sid = space_row[0]
 *         self.arity = space_row[1]
 *         self.name = space_row[2]             # <<<<<<<<<<<<<<
 *         self.indexes = {}
 * 
 */
  if (unlikely(__pyx_v_space_row == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 30, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_space_row, 2, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 30, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyString_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(1, 30, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->name);
  __Pyx_DECREF(__pyx_v_self->name);
  __pyx_v_self->name = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "asynctnt/iproto/schema.pyx":31
 *         self.arity = space_row[1]
 *         self.name = space_row[2]
 *         self.indexes = {}             # <<<<<<<<<<<<<<
 * 
 *     cdef add_index(self, SchemaIndex idx):
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 31, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->indexes);
  __Pyx_DECREF(__pyx_v_self->indexes);
  __pyx_v_self->indexes = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "asynctnt/iproto/schema.pyx":27
 * 
 * cdef class SchemaSpace:
 *     def __init__(self, list space_row):             # <<<<<<<<<<<<<<
 *         self.sid = space_row[0]
 *         self.arity = space_row[1]
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asynctnt.iproto.protocol.SchemaSpace.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/schema.pyx":33
 *         self.indexes = {}
 * 
 *     cdef add_index(self, SchemaIndex idx):             # <<<<<<<<<<<<<<
 *         self.indexes[idx.iid] = idx
 *         if idx.name:
 */

static PyObject *__pyx_f_8asynctnt_6iproto_8protocol_11SchemaSpace_add_index(struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaSpace *__pyx_v_self, struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaIndex *__pyx_v_idx) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("add_index", 0);

  /* "asynctnt/iproto/schema.pyx":34
 * 
 *     cdef add_index(self, SchemaIndex idx):
 *         self.indexes[idx.iid] = idx             # <<<<<<<<<<<<<<
 *         if idx.name:
 *             self.indexes[idx.name] = idx
 */
  if (unlikely(__pyx_v_self->indexes == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(1, 34, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_idx->iid); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 34, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (unlikely(PyDict_SetItem(__pyx_v_self->indexes, __pyx_t_1, ((PyObject *)__pyx_v_idx)) < 0)) __PYX_ERR(1, 34, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asynctnt/iproto/schema.pyx":35
 *     cdef add_index(self, SchemaIndex idx):
 *         self.indexes[idx.iid] = idx
 *         if idx.name:             # <<<<<<<<<<<<<<
 *             self.indexes[idx.name] = idx
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_idx->name); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(1, 35, __pyx_L1_error)
  if (__pyx_t_2) {

    /* "asynctnt/iproto/schema.pyx":36
 *         self.indexes[idx.iid] = idx
 *         if idx.name:
 *             self.indexes[idx.name] = idx             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
 */
    if (unlikely(__pyx_v_self->indexes == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(1, 36, __pyx_L1_error)
    }
    if (unlikely(PyDict_SetItem(__pyx_v_self->indexes, __pyx_v_idx->name, ((PyObject *)__pyx_v_idx)) < 0)) __PYX_ERR(1, 36, __pyx_L1_error)

    /* "asynctnt/iproto/schema.pyx":35
 *     cdef add_index(self, SchemaIndex idx):
 *         self.indexes[idx.iid] = idx
 *         if idx.name:             # <<<<<<<<<<<<<<
 *             self.indexes[idx.name] = idx
 * 
 */
  }

  /* "asynctnt/iproto/schema.pyx":33
 *         self.indexes = {}
 * 
 *     cdef add_index(self, SchemaIndex idx):             # <<<<<<<<<<<<<<
 *         self.indexes[idx.iid] = idx
 *         if idx.name:
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asynctnt.iproto.protocol.SchemaSpace.add_index", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/schema.pyx":38
 *             self.indexes[idx.name] = idx
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return '<SchemaSpace id={}, name={}, arity={}>'.format(
 *             self.sid, self.name, self.arity
 */

/* Python wrapper */
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_11SchemaSpace_3__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_11SchemaSpace_3__repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8asynctnt_6iproto_8protocol_11SchemaSpace_2__repr__(((struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaSpace *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_11SchemaSpace_2__repr__(struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaSpace *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "asynctnt/iproto/schema.pyx":39
 * 
 *     def __repr__(self):
 *         return '<SchemaSpace id={}, name={}, arity={}>'.format(             # <<<<<<<<<<<<<<
 *             self.sid, self.name, self.arity
 *         )
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_SchemaSpace_id_name_arity, __pyx_n_s_format); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 39, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "asynctnt/iproto/schema.pyx":40
 *     def __repr__(self):
 *         return '<SchemaSpace id={}, name={}, arity={}>'.format(
 *             self.sid, self.name, self.arity             # <<<<<<<<<<<<<<
 *         )
 * 
 */
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_self->sid); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 40, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_self->arity); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 40, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_6 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_5, __pyx_t_3, __pyx_v_self->name, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 39, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_5, __pyx_t_3, __pyx_v_self->name, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 39, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  {
    __pyx_t_7 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 39, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (__pyx_t_5) {
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_t_3);
    __Pyx_INCREF(__pyx_v_self->name);
    __Pyx_GIVEREF(__pyx_v_self->name);
    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_v_self->name);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_6, __pyx_t_4);
    __pyx_t_3 = 0;
    __pyx_t_4 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 39, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "asynctnt/iproto/schema.pyx":38
 *             self.indexes[idx.name] = idx
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return '<SchemaSpace id={}, name={}, arity={}>'.format(
 *             self.sid, self.name, self.arity
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("asynctnt.iproto.protocol.SchemaSpace.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/schema.pxd":14
 * 
 * cdef class SchemaSpace:
 *     cdef public int sid             # <<<<<<<<<<<<<<
 *     cdef public int arity
 *     cdef public str name
 */

/* Python wrapper */
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_11SchemaSpace_3sid_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_11SchemaSpace_3sid_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8asynctnt_6iproto_8protocol_11SchemaSpace_3sid___get__(((struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaSpace *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_11SchemaSpace_3sid___get__(struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaSpace *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->sid); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 14, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asynctnt.iproto.protocol.SchemaSpace.sid.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_8asynctnt_6iproto_8protocol_11SchemaSpace_3sid_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8asynctnt_6iproto_8protocol_11SchemaSpace_3sid_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8asynctnt_6iproto_8protocol_11SchemaSpace_3sid_2__set__(((struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaSpace *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_8asynctnt_6iproto_8protocol_11SchemaSpace_3sid_2__set__(struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaSpace *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__set__", 0);
  __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(9, 14, __pyx_L1_error)
  __pyx_v_self->sid = __pyx_t_1;

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("asynctnt.iproto.protocol.SchemaSpace.sid.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/schema.pxd":15
 * cdef class SchemaSpace:
 *     cdef public int sid
 *     cdef public int arity             # <<<<<<<<<<<<<<
 *     cdef public str name
 *     cdef public dict indexes
 */

/* Python wrapper */
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_11SchemaSpace_5arity_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_11SchemaSpace_5arity_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8asynctnt_6iproto_8protocol_11SchemaSpace_5arity___get__(((struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaSpace *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_11SchemaSpace_5arity___get__(struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaSpace *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->arity); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 15, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asynctnt.iproto.protocol.SchemaSpace.arity.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_8asynctnt_6iproto_8protocol_11SchemaSpace_5arity_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8asynctnt_6iproto_8protocol_11SchemaSpace_5arity_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8asynctnt_6iproto_8protocol_11SchemaSpace_5arity_2__set__(((struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaSpace *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_8asynctnt_6iproto_8protocol_11SchemaSpace_5arity_2__set__(struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaSpace *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__set__", 0);
  __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(9, 15, __pyx_L1_error)
  __pyx_v_self->arity = __pyx_t_1;

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("asynctnt.iproto.protocol.SchemaSpace.arity.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/schema.pxd":16
 *     cdef public int sid
 *     cdef public int arity
 *     cdef public str name             # <<<<<<<<<<<<<<
 *     cdef public dict indexes
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_11SchemaSpace_4name_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_11SchemaSpace_4name_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8asynctnt_6iproto_8protocol_11SchemaSpace_4name___get__(((struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaSpace *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_11SchemaSpace_4name___get__(struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaSpace *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->name);
  __pyx_r = __pyx_v_self->name;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_8asynctnt_6iproto_8protocol_11SchemaSpace_4name_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8asynctnt_6iproto_8protocol_11SchemaSpace_4name_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8asynctnt_6iproto_8protocol_11SchemaSpace_4name_2__set__(((struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaSpace *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_8asynctnt_6iproto_8protocol_11SchemaSpace_4name_2__set__(struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaSpace *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__set__", 0);
  if (!(likely(PyString_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_v_value)->tp_name), 0))) __PYX_ERR(9, 16, __pyx_L1_error)
  __pyx_t_1 = __pyx_v_value;
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->name);
  __Pyx_DECREF(__pyx_v_self->name);
  __pyx_v_self->name = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asynctnt.iproto.protocol.SchemaSpace.name.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_8asynctnt_6iproto_8protocol_11SchemaSpace_4name_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_8asynctnt_6iproto_8protocol_11SchemaSpace_4name_5__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8asynctnt_6iproto_8protocol_11SchemaSpace_4name_4__del__(((struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaSpace *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_8asynctnt_6iproto_8protocol_11SchemaSpace_4name_4__del__(struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaSpace *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__", 0);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->name);
  __Pyx_DECREF(__pyx_v_self->name);
  __pyx_v_self->name = ((PyObject*)Py_None);

  /* function exit code */
  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/schema.pxd":17
 *     cdef public int arity
 *     cdef public str name
 *     cdef public dict indexes             # <<<<<<<<<<<<<<
 * 
 *     cdef add_index(self, SchemaIndex idx)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_11SchemaSpace_7indexes_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_11SchemaSpace_7indexes_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8asynctnt_6iproto_8protocol_11SchemaSpace_7indexes___get__(((struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaSpace *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_11SchemaSpace_7indexes___get__(struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaSpace *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->indexes);
  __pyx_r = __pyx_v_self->indexes;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_8asynctnt_6iproto_8protocol_11SchemaSpace_7indexes_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8asynctnt_6iproto_8protocol_11SchemaSpace_7indexes_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8asynctnt_6iproto_8protocol_11SchemaSpace_7indexes_2__set__(((struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaSpace *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_8asynctnt_6iproto_8protocol_11SchemaSpace_7indexes_2__set__(struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaSpace *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__set__", 0);
  if (!(likely(PyDict_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_v_value)->tp_name), 0))) __PYX_ERR(9, 17, __pyx_L1_error)
  __pyx_t_1 = __pyx_v_value;
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->indexes);
  __Pyx_DECREF(__pyx_v_self->indexes);
  __pyx_v_self->indexes = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asynctnt.iproto.protocol.SchemaSpace.indexes.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_8asynctnt_6iproto_8protocol_11SchemaSpace_7indexes_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_8asynctnt_6iproto_8protocol_11SchemaSpace_7indexes_5__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8asynctnt_6iproto_8protocol_11SchemaSpace_7indexes_4__del__(((struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaSpace *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_8asynctnt_6iproto_8protocol_11SchemaSpace_7indexes_4__del__(struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaSpace *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__", 0);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->indexes);
  __Pyx_DECREF(__pyx_v_self->indexes);
  __pyx_v_self->indexes = ((PyObject*)Py_None);

  /* function exit code */
  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/schema.pyx":45
 * 
 * cdef class Schema:
 *     def __init__(self, int64_t schema_id):             # <<<<<<<<<<<<<<
 *         self.id = schema_id
 *         self.schema = {}
 */

/* Python wrapper */
static int __pyx_pw_8asynctnt_6iproto_8protocol_6Schema_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_8asynctnt_6iproto_8protocol_6Schema_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int64_t __pyx_v_schema_id;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_schema_id,0};
    PyObject* values[1] = {0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_schema_id)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(1, 45, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    }
    __pyx_v_schema_id = __Pyx_PyInt_As_int64_t(values[0]); if (unlikely((__pyx_v_schema_id == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 45, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 45, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("asynctnt.iproto.protocol.Schema.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8asynctnt_6iproto_8protocol_6Schema___init__(((struct __pyx_obj_8asynctnt_6iproto_8protocol_Schema *)__pyx_v_self), __pyx_v_schema_id);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_8asynctnt_6iproto_8protocol_6Schema___init__(struct __pyx_obj_8asynctnt_6iproto_8protocol_Schema *__pyx_v_self, int64_t __pyx_v_schema_id) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "asynctnt/iproto/schema.pyx":46
 * cdef class Schema:
 *     def __init__(self, int64_t schema_id):
 *         self.id = schema_id             # <<<<<<<<<<<<<<
 *         self.schema = {}
 * 
 */
  __pyx_v_self->id = __pyx_v_schema_id;

  /* "asynctnt/iproto/schema.pyx":47
 *     def __init__(self, int64_t schema_id):
 *         self.id = schema_id
 *         self.schema = {}             # <<<<<<<<<<<<<<
 * 
 *     cpdef SchemaSpace get_space(self, space):
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 47, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->schema);
  __Pyx_DECREF(__pyx_v_self->schema);
  __pyx_v_self->schema = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "asynctnt/iproto/schema.pyx":45
 * 
 * cdef class Schema:
 *     def __init__(self, int64_t schema_id):             # <<<<<<<<<<<<<<
 *         self.id = schema_id
 *         self.schema = {}
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asynctnt.iproto.protocol.Schema.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/schema.pyx":49
 *         self.schema = {}
 * 
 *     cpdef SchemaSpace get_space(self, space):             # <<<<<<<<<<<<<<
 *         try:
 *             return self.schema[space]
 */

static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_6Schema_3get_space(PyObject *__pyx_v_self, PyObject *__pyx_v_space); /*proto*/
static struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaSpace *__pyx_f_8asynctnt_6iproto_8protocol_6Schema_get_space(struct __pyx_obj_8asynctnt_6iproto_8protocol_Schema *__pyx_v_self, PyObject *__pyx_v_space, int __pyx_skip_dispatch) {
  struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaSpace *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  __Pyx_RefNannySetupContext("get_space", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_space); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 49, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8asynctnt_6iproto_8protocol_6Schema_3get_space)) {
      __Pyx_XDECREF(((PyObject *)__pyx_r));
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
        }
      }
      if (!__pyx_t_4) {
        __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_space); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 49, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_space};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 49, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_space};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 49, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        {
          __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 49, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL;
          __Pyx_INCREF(__pyx_v_space);
          __Pyx_GIVEREF(__pyx_v_space);
          PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_space);
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 49, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_8asynctnt_6iproto_8protocol_SchemaSpace))))) __PYX_ERR(1, 49, __pyx_L1_error)
      __pyx_r = ((struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaSpace *)__pyx_t_2);
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "asynctnt/iproto/schema.pyx":50
 * 
 *     cpdef SchemaSpace get_space(self, space):
 *         try:             # <<<<<<<<<<<<<<
 *             return self.schema[space]
 *         except KeyError:
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
    __Pyx_XGOTREF(__pyx_t_6);
    __Pyx_XGOTREF(__pyx_t_7);
    __Pyx_XGOTREF(__pyx_t_8);
    /*try:*/ {

      /* "asynctnt/iproto/schema.pyx":51
 *     cpdef SchemaSpace get_space(self, space):
 *         try:
 *             return self.schema[space]             # <<<<<<<<<<<<<<
 *         except KeyError:
 *             return None
 */
      __Pyx_XDECREF(((PyObject *)__pyx_r));
      if (unlikely(__pyx_v_self->schema == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(1, 51, __pyx_L3_error)
      }
      __pyx_t_1 = __Pyx_PyDict_GetItem(__pyx_v_self->schema, __pyx_v_space); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 51, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_8asynctnt_6iproto_8protocol_SchemaSpace))))) __PYX_ERR(1, 51, __pyx_L3_error)
      __pyx_r = ((struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaSpace *)__pyx_t_1);
      __pyx_t_1 = 0;
      goto __pyx_L7_try_return;

      /* "asynctnt/iproto/schema.pyx":50
 * 
 *     cpdef SchemaSpace get_space(self, space):
 *         try:             # <<<<<<<<<<<<<<
 *             return self.schema[space]
 *         except KeyError:
 */
    }
    __pyx_L3_error:;
    __Pyx_PyThreadState_assign
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "asynctnt/iproto/schema.pyx":52
 *         try:
 *             return self.schema[space]
 *         except KeyError:             # <<<<<<<<<<<<<<
 *             return None
 * 
 */
    __pyx_t_9 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_KeyError);
    if (__pyx_t_9) {
      __Pyx_AddTraceback("asynctnt.iproto.protocol.Schema.get_space", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3) < 0) __PYX_ERR(1, 52, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GOTREF(__pyx_t_3);

      /* "asynctnt/iproto/schema.pyx":53
 *             return self.schema[space]
 *         except KeyError:
 *             return None             # <<<<<<<<<<<<<<
 * 
 *     cpdef SchemaIndex get_index(self, space, index):
 */
      __Pyx_XDECREF(((PyObject *)__pyx_r));
      __Pyx_INCREF(Py_None);
      __pyx_r = ((struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaSpace *)Py_None);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      goto __pyx_L6_except_return;
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "asynctnt/iproto/schema.pyx":50
 * 
 *     cpdef SchemaSpace get_space(self, space):
 *         try:             # <<<<<<<<<<<<<<
 *             return self.schema[space]
 *         except KeyError:
 */
    __Pyx_PyThreadState_assign
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_XGIVEREF(__pyx_t_7);
    __Pyx_XGIVEREF(__pyx_t_8);
    __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
    goto __pyx_L1_error;
    __pyx_L7_try_return:;
    __Pyx_PyThreadState_assign
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_XGIVEREF(__pyx_t_7);
    __Pyx_XGIVEREF(__pyx_t_8);
    __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
    goto __pyx_L0;
    __pyx_L6_except_return:;
    __Pyx_PyThreadState_assign
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_XGIVEREF(__pyx_t_7);
    __Pyx_XGIVEREF(__pyx_t_8);
    __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
    goto __pyx_L0;
  }

  /* "asynctnt/iproto/schema.pyx":49
 *         self.schema = {}
 * 
 *     cpdef SchemaSpace get_space(self, space):             # <<<<<<<<<<<<<<
 *         try:
 *             return self.schema[space]
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("asynctnt.iproto.protocol.Schema.get_space", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_6Schema_3get_space(PyObject *__pyx_v_self, PyObject *__pyx_v_space); /*proto*/
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_6Schema_3get_space(PyObject *__pyx_v_self, PyObject *__pyx_v_space) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_space (wrapper)", 0);
  __pyx_r = __pyx_pf_8asynctnt_6iproto_8protocol_6Schema_2get_space(((struct __pyx_obj_8asynctnt_6iproto_8protocol_Schema *)__pyx_v_self), ((PyObject *)__pyx_v_space));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_6Schema_2get_space(struct __pyx_obj_8asynctnt_6iproto_8protocol_Schema *__pyx_v_self, PyObject *__pyx_v_space) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("get_space", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_8asynctnt_6iproto_8protocol_6Schema_get_space(__pyx_v_self, __pyx_v_space, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 49, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asynctnt.iproto.protocol.Schema.get_space", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/schema.pyx":55
 *             return None
 * 
 *     cpdef SchemaIndex get_index(self, space, index):             # <<<<<<<<<<<<<<
 *         sp = self.get_space(space)
 *         if sp is None:
 */

static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_6Schema_5get_index(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaIndex *__pyx_f_8asynctnt_6iproto_8protocol_6Schema_get_index(struct __pyx_obj_8asynctnt_6iproto_8protocol_Schema *__pyx_v_self, PyObject *__pyx_v_space, PyObject *__pyx_v_index, int __pyx_skip_dispatch) {
  struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaSpace *__pyx_v_sp = NULL;
  struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaIndex *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  __Pyx_RefNannySetupContext("get_index", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_index); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 55, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8asynctnt_6iproto_8protocol_6Schema_5get_index)) {
      __Pyx_XDECREF(((PyObject *)__pyx_r));
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
      __pyx_t_5 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
          __pyx_t_5 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_space, __pyx_v_index};
        __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 55, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_GOTREF(__pyx_t_2);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_space, __pyx_v_index};
        __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 55, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_GOTREF(__pyx_t_2);
      } else
      #endif
      {
        __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 55, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        if (__pyx_t_4) {
          __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
        }
        __Pyx_INCREF(__pyx_v_space);
        __Pyx_GIVEREF(__pyx_v_space);
        PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_space);
        __Pyx_INCREF(__pyx_v_index);
        __Pyx_GIVEREF(__pyx_v_index);
        PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_index);
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 55, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_8asynctnt_6iproto_8protocol_SchemaIndex))))) __PYX_ERR(1, 55, __pyx_L1_error)
      __pyx_r = ((struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaIndex *)__pyx_t_2);
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "asynctnt/iproto/schema.pyx":56
 * 
 *     cpdef SchemaIndex get_index(self, space, index):
 *         sp = self.get_space(space)             # <<<<<<<<<<<<<<
 *         if sp is None:
 *             return None
 */
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_8asynctnt_6iproto_8protocol_Schema *)__pyx_v_self->__pyx_vtab)->get_space(__pyx_v_self, __pyx_v_space, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 56, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_sp = ((struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaSpace *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "asynctnt/iproto/schema.pyx":57
 *     cpdef SchemaIndex get_index(self, space, index):
 *         sp = self.get_space(space)
 *         if sp is None:             # <<<<<<<<<<<<<<
 *             return None
 *         try:
 */
  __pyx_t_7 = (((PyObject *)__pyx_v_sp) == Py_None);
  __pyx_t_8 = (__pyx_t_7 != 0);
  if (__pyx_t_8) {

    /* "asynctnt/iproto/schema.pyx":58
 *         sp = self.get_space(space)
 *         if sp is None:
 *             return None             # <<<<<<<<<<<<<<
 *         try:
 *             return sp.indexes[index]
 */
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    __Pyx_INCREF(Py_None);
    __pyx_r = ((struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaIndex *)Py_None);
    goto __pyx_L0;

    /* "asynctnt/iproto/schema.pyx":57
 *     cpdef SchemaIndex get_index(self, space, index):
 *         sp = self.get_space(space)
 *         if sp is None:             # <<<<<<<<<<<<<<
 *             return None
 *         try:
 */
  }

  /* "asynctnt/iproto/schema.pyx":59
 *         if sp is None:
 *             return None
 *         try:             # <<<<<<<<<<<<<<
 *             return sp.indexes[index]
 *         except KeyError:
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
    __Pyx_XGOTREF(__pyx_t_9);
    __Pyx_XGOTREF(__pyx_t_10);
    __Pyx_XGOTREF(__pyx_t_11);
    /*try:*/ {

      /* "asynctnt/iproto/schema.pyx":60
 *             return None
 *         try:
 *             return sp.indexes[index]             # <<<<<<<<<<<<<<
 *         except KeyError:
 *             return None
 */
      __Pyx_XDECREF(((PyObject *)__pyx_r));
      if (unlikely(__pyx_v_sp->indexes == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(1, 60, __pyx_L4_error)
      }
      __pyx_t_1 = __Pyx_PyDict_GetItem(__pyx_v_sp->indexes, __pyx_v_index); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 60, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_8asynctnt_6iproto_8protocol_SchemaIndex))))) __PYX_ERR(1, 60, __pyx_L4_error)
      __pyx_r = ((struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaIndex *)__pyx_t_1);
      __pyx_t_1 = 0;
      goto __pyx_L8_try_return;

      /* "asynctnt/iproto/schema.pyx":59
 *         if sp is None:
 *             return None
 *         try:             # <<<<<<<<<<<<<<
 *             return sp.indexes[index]
 *         except KeyError:
 */
    }
    __pyx_L4_error:;
    __Pyx_PyThreadState_assign
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "asynctnt/iproto/schema.pyx":61
 *         try:
 *             return sp.indexes[index]
 *         except KeyError:             # <<<<<<<<<<<<<<
 *             return None
 * 
 */
    __pyx_t_5 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_KeyError);
    if (__pyx_t_5) {
      __Pyx_AddTraceback("asynctnt.iproto.protocol.Schema.get_index", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3) < 0) __PYX_ERR(1, 61, __pyx_L6_except_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GOTREF(__pyx_t_3);

      /* "asynctnt/iproto/schema.pyx":62
 *             return sp.indexes[index]
 *         except KeyError:
 *             return None             # <<<<<<<<<<<<<<
 * 
 *     cpdef get_id(self):
 */
      __Pyx_XDECREF(((PyObject *)__pyx_r));
      __Pyx_INCREF(Py_None);
      __pyx_r = ((struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaIndex *)Py_None);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      goto __pyx_L7_except_return;
    }
    goto __pyx_L6_except_error;
    __pyx_L6_except_error:;

    /* "asynctnt/iproto/schema.pyx":59
 *         if sp is None:
 *             return None
 *         try:             # <<<<<<<<<<<<<<
 *             return sp.indexes[index]
 *         except KeyError:
 */
    __Pyx_PyThreadState_assign
    __Pyx_XGIVEREF(__pyx_t_9);
    __Pyx_XGIVEREF(__pyx_t_10);
    __Pyx_XGIVEREF(__pyx_t_11);
    __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
    goto __pyx_L1_error;
    __pyx_L8_try_return:;
    __Pyx_PyThreadState_assign
    __Pyx_XGIVEREF(__pyx_t_9);
    __Pyx_XGIVEREF(__pyx_t_10);
    __Pyx_XGIVEREF(__pyx_t_11);
    __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
    goto __pyx_L0;
    __pyx_L7_except_return:;
    __Pyx_PyThreadState_assign
    __Pyx_XGIVEREF(__pyx_t_9);
    __Pyx_XGIVEREF(__pyx_t_10);
    __Pyx_XGIVEREF(__pyx_t_11);
    __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
    goto __pyx_L0;
  }

  /* "asynctnt/iproto/schema.pyx":55
 *             return None
 * 
 *     cpdef SchemaIndex get_index(self, space, index):             # <<<<<<<<<<<<<<
 *         sp = self.get_space(space)
 *         if sp is None:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("asynctnt.iproto.protocol.Schema.get_index", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_sp);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_6Schema_5get_index(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_6Schema_5get_index(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_space = 0;
  PyObject *__pyx_v_index = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_index (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_space,&__pyx_n_s_index,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        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;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_space)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_index)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("get_index", 1, 2, 2, 1); __PYX_ERR(1, 55, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_index") < 0)) __PYX_ERR(1, 55, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_space = values[0];
    __pyx_v_index = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get_index", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 55, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("asynctnt.iproto.protocol.Schema.get_index", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8asynctnt_6iproto_8protocol_6Schema_4get_index(((struct __pyx_obj_8asynctnt_6iproto_8protocol_Schema *)__pyx_v_self), __pyx_v_space, __pyx_v_index);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_6Schema_4get_index(struct __pyx_obj_8asynctnt_6iproto_8protocol_Schema *__pyx_v_self, PyObject *__pyx_v_space, PyObject *__pyx_v_index) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("get_index", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_8asynctnt_6iproto_8protocol_6Schema_get_index(__pyx_v_self, __pyx_v_space, __pyx_v_index, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 55, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asynctnt.iproto.protocol.Schema.get_index", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/schema.pyx":64
 *             return None
 * 
 *     cpdef get_id(self):             # <<<<<<<<<<<<<<
 *         return self.id
 * 
 */

static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_6Schema_7get_id(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_f_8asynctnt_6iproto_8protocol_6Schema_get_id(struct __pyx_obj_8asynctnt_6iproto_8protocol_Schema *__pyx_v_self, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("get_id", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_id); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 64, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8asynctnt_6iproto_8protocol_6Schema_7get_id)) {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
        }
      }
      if (__pyx_t_4) {
        __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 64, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      } else {
        __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 64, __pyx_L1_error)
      }
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "asynctnt/iproto/schema.pyx":65
 * 
 *     cpdef get_id(self):
 *         return self.id             # <<<<<<<<<<<<<<
 * 
 *     cdef inline clear(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int64_t(__pyx_v_self->id); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 65, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "asynctnt/iproto/schema.pyx":64
 *             return None
 * 
 *     cpdef get_id(self):             # <<<<<<<<<<<<<<
 *         return self.id
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("asynctnt.iproto.protocol.Schema.get_id", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_6Schema_7get_id(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_6Schema_7get_id(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_id (wrapper)", 0);
  __pyx_r = __pyx_pf_8asynctnt_6iproto_8protocol_6Schema_6get_id(((struct __pyx_obj_8asynctnt_6iproto_8protocol_Schema *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_6Schema_6get_id(struct __pyx_obj_8asynctnt_6iproto_8protocol_Schema *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("get_id", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_8asynctnt_6iproto_8protocol_6Schema_get_id(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 64, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asynctnt.iproto.protocol.Schema.get_id", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/schema.pyx":67
 *         return self.id
 * 
 *     cdef inline clear(self):             # <<<<<<<<<<<<<<
 *         self.schema.clear()
 * 
 */

static CYTHON_INLINE PyObject *__pyx_f_8asynctnt_6iproto_8protocol_6Schema_clear(struct __pyx_obj_8asynctnt_6iproto_8protocol_Schema *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("clear", 0);

  /* "asynctnt/iproto/schema.pyx":68
 * 
 *     cdef inline clear(self):
 *         self.schema.clear()             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
 */
  if (unlikely(__pyx_v_self->schema == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "clear");
    __PYX_ERR(1, 68, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_PyDict_Clear(__pyx_v_self->schema); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(1, 68, __pyx_L1_error)

  /* "asynctnt/iproto/schema.pyx":67
 *         return self.id
 * 
 *     cdef inline clear(self):             # <<<<<<<<<<<<<<
 *         self.schema.clear()
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("asynctnt.iproto.protocol.Schema.clear", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/schema.pyx":70
 *         self.schema.clear()
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return '<Schema>'
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_6Schema_9__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_6Schema_9__repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8asynctnt_6iproto_8protocol_6Schema_8__repr__(((struct __pyx_obj_8asynctnt_6iproto_8protocol_Schema *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_6Schema_8__repr__(CYTHON_UNUSED struct __pyx_obj_8asynctnt_6iproto_8protocol_Schema *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "asynctnt/iproto/schema.pyx":71
 * 
 *     def __repr__(self):
 *         return '<Schema>'             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_kp_s_Schema);
  __pyx_r = __pyx_kp_s_Schema;
  goto __pyx_L0;

  /* "asynctnt/iproto/schema.pyx":70
 *         self.schema.clear()
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return '<Schema>'
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/schema.pyx":74
 * 
 * 
 * cdef Schema parse_schema(int64_t schema_id, spaces, indexes):             # <<<<<<<<<<<<<<
 *     cdef:
 *         Schema s
 */

static struct __pyx_obj_8asynctnt_6iproto_8protocol_Schema *__pyx_f_8asynctnt_6iproto_8protocol_parse_schema(int64_t __pyx_v_schema_id, PyObject *__pyx_v_spaces, PyObject *__pyx_v_indexes) {
  struct __pyx_obj_8asynctnt_6iproto_8protocol_Schema *__pyx_v_s = 0;
  struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaSpace *__pyx_v_sp = 0;
  struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaIndex *__pyx_v_idx = 0;
  PyObject *__pyx_v_space_row = NULL;
  PyObject *__pyx_v_index_row = NULL;
  struct __pyx_obj_8asynctnt_6iproto_8protocol_Schema *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  __Pyx_RefNannySetupContext("parse_schema", 0);

  /* "asynctnt/iproto/schema.pyx":79
 *         SchemaSpace sp
 *         SchemaIndex idx
 *     s = Schema(schema_id)             # <<<<<<<<<<<<<<
 *     for space_row in spaces:
 *         sp = SchemaSpace(space_row)
 */
  __pyx_t_1 = __Pyx_PyInt_From_int64_t(__pyx_v_schema_id); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 79, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 79, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8asynctnt_6iproto_8protocol_Schema), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 79, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_s = ((struct __pyx_obj_8asynctnt_6iproto_8protocol_Schema *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "asynctnt/iproto/schema.pyx":80
 *         SchemaIndex idx
 *     s = Schema(schema_id)
 *     for space_row in spaces:             # <<<<<<<<<<<<<<
 *         sp = SchemaSpace(space_row)
 *         s.schema[sp.sid] = sp
 */
  if (likely(PyList_CheckExact(__pyx_v_spaces)) || PyTuple_CheckExact(__pyx_v_spaces)) {
    __pyx_t_1 = __pyx_v_spaces; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_spaces); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 80, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 80, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_4)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(1, 80, __pyx_L1_error)
        #else
        __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 80, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        #endif
      } else {
        if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(1, 80, __pyx_L1_error)
        #else
        __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 80, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        #endif
      }
    } else {
      __pyx_t_2 = __pyx_t_4(__pyx_t_1);
      if (unlikely(!__pyx_t_2)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(1, 80, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_XDECREF_SET(__pyx_v_space_row, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "asynctnt/iproto/schema.pyx":81
 *     s = Schema(schema_id)
 *     for space_row in spaces:
 *         sp = SchemaSpace(space_row)             # <<<<<<<<<<<<<<
 *         s.schema[sp.sid] = sp
 *         if sp.name:
 */
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 81, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_v_space_row);
    __Pyx_GIVEREF(__pyx_v_space_row);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_space_row);
    __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8asynctnt_6iproto_8protocol_SchemaSpace), __pyx_t_2, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 81, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF_SET(__pyx_v_sp, ((struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaSpace *)__pyx_t_5));
    __pyx_t_5 = 0;

    /* "asynctnt/iproto/schema.pyx":82
 *     for space_row in spaces:
 *         sp = SchemaSpace(space_row)
 *         s.schema[sp.sid] = sp             # <<<<<<<<<<<<<<
 *         if sp.name:
 *             s.schema[sp.name] = sp
 */
    if (unlikely(__pyx_v_s->schema == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(1, 82, __pyx_L1_error)
    }
    __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_sp->sid); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 82, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (unlikely(PyDict_SetItem(__pyx_v_s->schema, __pyx_t_5, ((PyObject *)__pyx_v_sp)) < 0)) __PYX_ERR(1, 82, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "asynctnt/iproto/schema.pyx":83
 *         sp = SchemaSpace(space_row)
 *         s.schema[sp.sid] = sp
 *         if sp.name:             # <<<<<<<<<<<<<<
 *             s.schema[sp.name] = sp
 * 
 */
    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_sp->name); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 83, __pyx_L1_error)
    if (__pyx_t_6) {

      /* "asynctnt/iproto/schema.pyx":84
 *         s.schema[sp.sid] = sp
 *         if sp.name:
 *             s.schema[sp.name] = sp             # <<<<<<<<<<<<<<
 * 
 *     for index_row in indexes:
 */
      if (unlikely(__pyx_v_s->schema == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(1, 84, __pyx_L1_error)
      }
      if (unlikely(PyDict_SetItem(__pyx_v_s->schema, __pyx_v_sp->name, ((PyObject *)__pyx_v_sp)) < 0)) __PYX_ERR(1, 84, __pyx_L1_error)

      /* "asynctnt/iproto/schema.pyx":83
 *         sp = SchemaSpace(space_row)
 *         s.schema[sp.sid] = sp
 *         if sp.name:             # <<<<<<<<<<<<<<
 *             s.schema[sp.name] = sp
 * 
 */
    }

    /* "asynctnt/iproto/schema.pyx":80
 *         SchemaIndex idx
 *     s = Schema(schema_id)
 *     for space_row in spaces:             # <<<<<<<<<<<<<<
 *         sp = SchemaSpace(space_row)
 *         s.schema[sp.sid] = sp
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asynctnt/iproto/schema.pyx":86
 *             s.schema[sp.name] = sp
 * 
 *     for index_row in indexes:             # <<<<<<<<<<<<<<
 *         idx = SchemaIndex(index_row)
 *         sp = s.schema[idx.sid]
 */
  if (likely(PyList_CheckExact(__pyx_v_indexes)) || PyTuple_CheckExact(__pyx_v_indexes)) {
    __pyx_t_1 = __pyx_v_indexes; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_indexes); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 86, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 86, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_4)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_5 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(1, 86, __pyx_L1_error)
        #else
        __pyx_t_5 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 86, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        #endif
      } else {
        if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(1, 86, __pyx_L1_error)
        #else
        __pyx_t_5 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 86, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        #endif
      }
    } else {
      __pyx_t_5 = __pyx_t_4(__pyx_t_1);
      if (unlikely(!__pyx_t_5)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(1, 86, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_5);
    }
    __Pyx_XDECREF_SET(__pyx_v_index_row, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "asynctnt/iproto/schema.pyx":87
 * 
 *     for index_row in indexes:
 *         idx = SchemaIndex(index_row)             # <<<<<<<<<<<<<<
 *         sp = s.schema[idx.sid]
 *         sp.add_index(idx)
 */
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 87, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_v_index_row);
    __Pyx_GIVEREF(__pyx_v_index_row);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_index_row);
    __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8asynctnt_6iproto_8protocol_SchemaIndex), __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 87, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF_SET(__pyx_v_idx, ((struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaIndex *)__pyx_t_2));
    __pyx_t_2 = 0;

    /* "asynctnt/iproto/schema.pyx":88
 *     for index_row in indexes:
 *         idx = SchemaIndex(index_row)
 *         sp = s.schema[idx.sid]             # <<<<<<<<<<<<<<
 *         sp.add_index(idx)
 *     return s
 */
    if (unlikely(__pyx_v_s->schema == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(1, 88, __pyx_L1_error)
    }
    __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_idx->sid); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 88, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = __Pyx_PyDict_GetItem(__pyx_v_s->schema, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 88, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_8asynctnt_6iproto_8protocol_SchemaSpace))))) __PYX_ERR(1, 88, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_sp, ((struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaSpace *)__pyx_t_5));
    __pyx_t_5 = 0;

    /* "asynctnt/iproto/schema.pyx":89
 *         idx = SchemaIndex(index_row)
 *         sp = s.schema[idx.sid]
 *         sp.add_index(idx)             # <<<<<<<<<<<<<<
 *     return s
 */
    __pyx_t_5 = ((struct __pyx_vtabstruct_8asynctnt_6iproto_8protocol_SchemaSpace *)__pyx_v_sp->__pyx_vtab)->add_index(__pyx_v_sp, __pyx_v_idx); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 89, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "asynctnt/iproto/schema.pyx":86
 *             s.schema[sp.name] = sp
 * 
 *     for index_row in indexes:             # <<<<<<<<<<<<<<
 *         idx = SchemaIndex(index_row)
 *         sp = s.schema[idx.sid]
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asynctnt/iproto/schema.pyx":90
 *         sp = s.schema[idx.sid]
 *         sp.add_index(idx)
 *     return s             # <<<<<<<<<<<<<<
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_s));
  __pyx_r = __pyx_v_s;
  goto __pyx_L0;

  /* "asynctnt/iproto/schema.pyx":74
 * 
 * 
 * cdef Schema parse_schema(int64_t schema_id, spaces, indexes):             # <<<<<<<<<<<<<<
 *     cdef:
 *         Schema s
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("asynctnt.iproto.protocol.parse_schema", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_s);
  __Pyx_XDECREF((PyObject *)__pyx_v_sp);
  __Pyx_XDECREF((PyObject *)__pyx_v_idx);
  __Pyx_XDECREF(__pyx_v_space_row);
  __Pyx_XDECREF(__pyx_v_index_row);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/db.pyx":9
 * 
 * cdef class Db:
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._protocol = None
 *         self._encoding = None
 */

/* Python wrapper */
static int __pyx_pw_8asynctnt_6iproto_8protocol_2Db_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_8asynctnt_6iproto_8protocol_2Db_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;
  __pyx_r = __pyx_pf_8asynctnt_6iproto_8protocol_2Db___cinit__(((struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_8asynctnt_6iproto_8protocol_2Db___cinit__(struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "asynctnt/iproto/db.pyx":10
 * cdef class Db:
 *     def __cinit__(self):
 *         self._protocol = None             # <<<<<<<<<<<<<<
 *         self._encoding = None
 * 
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->_protocol);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_protocol));
  __pyx_v_self->_protocol = ((struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *)Py_None);

  /* "asynctnt/iproto/db.pyx":11
 *     def __cinit__(self):
 *         self._protocol = None
 *         self._encoding = None             # <<<<<<<<<<<<<<
 * 
 *     @staticmethod
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->_encoding);
  __Pyx_DECREF(__pyx_v_self->_encoding);
  __pyx_v_self->_encoding = ((PyObject*)Py_None);

  /* "asynctnt/iproto/db.pyx":9
 * 
 * cdef class Db:
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self._protocol = None
 *         self._encoding = None
 */

  /* function exit code */
  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/db.pyx":14
 * 
 *     @staticmethod
 *     cdef inline Db new(BaseProtocol protocol):             # <<<<<<<<<<<<<<
 *         cdef Db db = Db.__new__(Db)
 *         db._protocol = protocol
 */

static CYTHON_INLINE struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *__pyx_f_8asynctnt_6iproto_8protocol_2Db_new(struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *__pyx_v_protocol) {
  struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *__pyx_v_db = 0;
  struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("new", 0);

  /* "asynctnt/iproto/db.pyx":15
 *     @staticmethod
 *     cdef inline Db new(BaseProtocol protocol):
 *         cdef Db db = Db.__new__(Db)             # <<<<<<<<<<<<<<
 *         db._protocol = protocol
 *         db._encoding = protocol.encoding
 */
  __pyx_t_1 = __pyx_tp_new_8asynctnt_6iproto_8protocol_Db(((PyTypeObject *)__pyx_ptype_8asynctnt_6iproto_8protocol_Db), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 15, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_8asynctnt_6iproto_8protocol_Db)))) __PYX_ERR(10, 15, __pyx_L1_error)
  __pyx_v_db = ((struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "asynctnt/iproto/db.pyx":16
 *     cdef inline Db new(BaseProtocol protocol):
 *         cdef Db db = Db.__new__(Db)
 *         db._protocol = protocol             # <<<<<<<<<<<<<<
 *         db._encoding = protocol.encoding
 *         return db
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_protocol));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_protocol));
  __Pyx_GOTREF(__pyx_v_db->_protocol);
  __Pyx_DECREF(((PyObject *)__pyx_v_db->_protocol));
  __pyx_v_db->_protocol = __pyx_v_protocol;

  /* "asynctnt/iproto/db.pyx":17
 *         cdef Db db = Db.__new__(Db)
 *         db._protocol = protocol
 *         db._encoding = protocol.encoding             # <<<<<<<<<<<<<<
 *         return db
 * 
 */
  __pyx_t_1 = __pyx_v_protocol->__pyx_base.encoding;
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_db->_encoding);
  __Pyx_DECREF(__pyx_v_db->_encoding);
  __pyx_v_db->_encoding = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "asynctnt/iproto/db.pyx":18
 *         db._protocol = protocol
 *         db._encoding = protocol.encoding
 *         return db             # <<<<<<<<<<<<<<
 * 
 *     cdef inline uint64_t next_sync(self):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_db));
  __pyx_r = __pyx_v_db;
  goto __pyx_L0;

  /* "asynctnt/iproto/db.pyx":14
 * 
 *     @staticmethod
 *     cdef inline Db new(BaseProtocol protocol):             # <<<<<<<<<<<<<<
 *         cdef Db db = Db.__new__(Db)
 *         db._protocol = protocol
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asynctnt.iproto.protocol.Db.new", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_db);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/db.pyx":20
 *         return db
 * 
 *     cdef inline uint64_t next_sync(self):             # <<<<<<<<<<<<<<
 *         return self._protocol.next_sync()
 * 
 */

static CYTHON_INLINE uint64_t __pyx_f_8asynctnt_6iproto_8protocol_2Db_next_sync(struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *__pyx_v_self) {
  uint64_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("next_sync", 0);

  /* "asynctnt/iproto/db.pyx":21
 * 
 *     cdef inline uint64_t next_sync(self):
 *         return self._protocol.next_sync()             # <<<<<<<<<<<<<<
 * 
 *     async def execute(self, Request req, float timeout):
 */
  __pyx_r = ((struct __pyx_vtabstruct_8asynctnt_6iproto_8protocol_BaseProtocol *)__pyx_v_self->_protocol->__pyx_base.__pyx_vtab)->next_sync(__pyx_v_self->_protocol);
  goto __pyx_L0;

  /* "asynctnt/iproto/db.pyx":20
 *         return db
 * 
 *     cdef inline uint64_t next_sync(self):             # <<<<<<<<<<<<<<
 *         return self._protocol.next_sync()
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_8asynctnt_6iproto_8protocol_2Db_4generator(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */

/* "asynctnt/iproto/db.pyx":23
 *         return self._protocol.next_sync()
 * 
 *     async def execute(self, Request req, float timeout):             # <<<<<<<<<<<<<<
 *         cdef object fut
 *         try:
 */

/* Python wrapper */
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_2Db_3execute(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_2Db_3execute(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *__pyx_v_req = 0;
  float __pyx_v_timeout;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("execute (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_req,&__pyx_n_s_timeout,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        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;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_req)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_timeout)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("execute", 1, 2, 2, 1); __PYX_ERR(10, 23, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "execute") < 0)) __PYX_ERR(10, 23, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_req = ((struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *)values[0]);
    __pyx_v_timeout = __pyx_PyFloat_AsFloat(values[1]); if (unlikely((__pyx_v_timeout == (float)-1) && PyErr_Occurred())) __PYX_ERR(10, 23, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("execute", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 23, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("asynctnt.iproto.protocol.Db.execute", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_req), __pyx_ptype_8asynctnt_6iproto_8protocol_Request, 1, "req", 0))) __PYX_ERR(10, 23, __pyx_L1_error)
  __pyx_r = __pyx_pf_8asynctnt_6iproto_8protocol_2Db_2execute(((struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *)__pyx_v_self), __pyx_v_req, __pyx_v_timeout);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_2Db_2execute(struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *__pyx_v_self, struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *__pyx_v_req, float __pyx_v_timeout) {
  struct __pyx_obj_8asynctnt_6iproto_8protocol___pyx_scope_struct__execute *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("execute", 0);
  __pyx_cur_scope = (struct __pyx_obj_8asynctnt_6iproto_8protocol___pyx_scope_struct__execute *)__pyx_tp_new_8asynctnt_6iproto_8protocol___pyx_scope_struct__execute(__pyx_ptype_8asynctnt_6iproto_8protocol___pyx_scope_struct__execute, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_8asynctnt_6iproto_8protocol___pyx_scope_struct__execute *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(10, 23, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __pyx_cur_scope->__pyx_v_req = __pyx_v_req;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_req);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_req);
  __pyx_cur_scope->__pyx_v_timeout = __pyx_v_timeout;
  {
    __pyx_CoroutineObject *gen = __Pyx_Coroutine_New((__pyx_coroutine_body_t) __pyx_gb_8asynctnt_6iproto_8protocol_2Db_4generator, (PyObject *) __pyx_cur_scope, __pyx_n_s_execute, __pyx_n_s_Db_execute, __pyx_n_s_asynctnt_iproto_protocol); if (unlikely(!gen)) __PYX_ERR(10, 23, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("asynctnt.iproto.protocol.Db.execute", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_8asynctnt_6iproto_8protocol_2Db_4generator(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_8asynctnt_6iproto_8protocol___pyx_scope_struct__execute *__pyx_cur_scope = ((struct __pyx_obj_8asynctnt_6iproto_8protocol___pyx_scope_struct__execute *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  int64_t __pyx_t_12;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("None", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L12_resume_from_yield;
    case 2: goto __pyx_L16_resume_from_yield;
    case 3: goto __pyx_L17_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(10, 23, __pyx_L1_error)

  /* "asynctnt/iproto/db.pyx":25
 *     async def execute(self, Request req, float timeout):
 *         cdef object fut
 *         try:             # <<<<<<<<<<<<<<
 *             return await self._protocol.execute(req, timeout)
 *         except TarantoolDatabaseError as e:
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "asynctnt/iproto/db.pyx":26
 *         cdef object fut
 *         try:
 *             return await self._protocol.execute(req, timeout)             # <<<<<<<<<<<<<<
 *         except TarantoolDatabaseError as e:
 *             if e.code == ErrorCode.ER_WRONG_SCHEMA_VERSION:
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_4 = ((struct __pyx_vtabstruct_8asynctnt_6iproto_8protocol_BaseProtocol *)__pyx_cur_scope->__pyx_v_self->_protocol->__pyx_base.__pyx_vtab)->execute(__pyx_cur_scope->__pyx_v_self->_protocol, __pyx_cur_scope->__pyx_v_req, __pyx_cur_scope->__pyx_v_timeout); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 26, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_4);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XGOTREF(__pyx_r);
      if (likely(__pyx_r)) {
        __Pyx_XGIVEREF(__pyx_t_1);
        __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
        __Pyx_XGIVEREF(__pyx_t_2);
        __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
        __Pyx_XGIVEREF(__pyx_t_3);
        __pyx_cur_scope->__pyx_t_2 = __pyx_t_3;
        __Pyx_XGIVEREF(__pyx_r);
        __Pyx_RefNannyFinishContext();
        /* return from generator, yielding value */
        __pyx_generator->resume_label = 1;
        return __pyx_r;
        __pyx_L12_resume_from_yield:;
        __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
        __pyx_cur_scope->__pyx_t_0 = 0;
        __Pyx_XGOTREF(__pyx_t_1);
        __pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
        __pyx_cur_scope->__pyx_t_1 = 0;
        __Pyx_XGOTREF(__pyx_t_2);
        __pyx_t_3 = __pyx_cur_scope->__pyx_t_2;
        __pyx_cur_scope->__pyx_t_2 = 0;
        __Pyx_XGOTREF(__pyx_t_3);
        if (unlikely(!__pyx_sent_value)) __PYX_ERR(10, 26, __pyx_L4_error)
        __pyx_t_4 = __pyx_sent_value; __Pyx_INCREF(__pyx_t_4);
      } else {
        __pyx_t_4 = NULL;
        if (__Pyx_PyGen_FetchStopIterationValue(&__pyx_t_4) < 0) __PYX_ERR(10, 26, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_4);
      }
      __pyx_r = NULL; __Pyx_ReturnWithStopIteration(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = 0;
      goto __pyx_L8_try_return;

      /* "asynctnt/iproto/db.pyx":25
 *     async def execute(self, Request req, float timeout):
 *         cdef object fut
 *         try:             # <<<<<<<<<<<<<<
 *             return await self._protocol.execute(req, timeout)
 *         except TarantoolDatabaseError as e:
 */
    }
    __pyx_L4_error:;
    __Pyx_PyThreadState_assign
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "asynctnt/iproto/db.pyx":27
 *         try:
 *             return await self._protocol.execute(req, timeout)
 *         except TarantoolDatabaseError as e:             # <<<<<<<<<<<<<<
 *             if e.code == ErrorCode.ER_WRONG_SCHEMA_VERSION:
 *                 await self._protocol.refetch_schema()
 */
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_TarantoolDatabaseError); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 27, __pyx_L6_except_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyErr_ExceptionMatches(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_5) {
      __Pyx_AddTraceback("asynctnt.iproto.protocol.Db.execute", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(10, 27, __pyx_L6_except_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_6);
      __pyx_cur_scope->__pyx_v_e = __pyx_t_6;

      /* "asynctnt/iproto/db.pyx":28
 *             return await self._protocol.execute(req, timeout)
 *         except TarantoolDatabaseError as e:
 *             if e.code == ErrorCode.ER_WRONG_SCHEMA_VERSION:             # <<<<<<<<<<<<<<
 *                 await self._protocol.refetch_schema()
 * 
 */
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_e, __pyx_n_s_code); if (unlikely(!__pyx_t_8)) __PYX_ERR(10, 28, __pyx_L6_except_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_ErrorCode); if (unlikely(!__pyx_t_9)) __PYX_ERR(10, 28, __pyx_L6_except_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_ER_WRONG_SCHEMA_VERSION); if (unlikely(!__pyx_t_10)) __PYX_ERR(10, 28, __pyx_L6_except_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_9 = PyObject_RichCompare(__pyx_t_8, __pyx_t_10, Py_EQ); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) __PYX_ERR(10, 28, __pyx_L6_except_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(10, 28, __pyx_L6_except_error)
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (__pyx_t_11) {

        /* "asynctnt/iproto/db.pyx":29
 *         except TarantoolDatabaseError as e:
 *             if e.code == ErrorCode.ER_WRONG_SCHEMA_VERSION:
 *                 await self._protocol.refetch_schema()             # <<<<<<<<<<<<<<
 * 
 *                 # Retry request with updated schema_id
 */
        __pyx_t_10 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self->_protocol), __pyx_n_s_refetch_schema); if (unlikely(!__pyx_t_10)) __PYX_ERR(10, 29, __pyx_L6_except_error)
        __Pyx_GOTREF(__pyx_t_10);
        __pyx_t_8 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) {
          __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_10);
          if (likely(__pyx_t_8)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
            __Pyx_INCREF(__pyx_t_8);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_10, function);
          }
        }
        if (__pyx_t_8) {
          __pyx_t_9 = __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(10, 29, __pyx_L6_except_error)
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        } else {
          __pyx_t_9 = __Pyx_PyObject_CallNoArg(__pyx_t_10); if (unlikely(!__pyx_t_9)) __PYX_ERR(10, 29, __pyx_L6_except_error)
        }
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_9);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_XGOTREF(__pyx_r);
        if (likely(__pyx_r)) {
          __Pyx_XGIVEREF(__pyx_t_1);
          __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
          __Pyx_XGIVEREF(__pyx_t_2);
          __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
          __Pyx_XGIVEREF(__pyx_t_3);
          __pyx_cur_scope->__pyx_t_2 = __pyx_t_3;
          __Pyx_XGIVEREF(__pyx_t_4);
          __pyx_cur_scope->__pyx_t_3 = __pyx_t_4;
          __Pyx_XGIVEREF(__pyx_t_6);
          __pyx_cur_scope->__pyx_t_4 = __pyx_t_6;
          __Pyx_XGIVEREF(__pyx_t_7);
          __pyx_cur_scope->__pyx_t_5 = __pyx_t_7;
          __Pyx_XGIVEREF(__pyx_r);
          __Pyx_RefNannyFinishContext();
          /* return from generator, yielding value */
          __pyx_generator->resume_label = 2;
          return __pyx_r;
          __pyx_L16_resume_from_yield:;
          __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
          __pyx_cur_scope->__pyx_t_0 = 0;
          __Pyx_XGOTREF(__pyx_t_1);
          __pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
          __pyx_cur_scope->__pyx_t_1 = 0;
          __Pyx_XGOTREF(__pyx_t_2);
          __pyx_t_3 = __pyx_cur_scope->__pyx_t_2;
          __pyx_cur_scope->__pyx_t_2 = 0;
          __Pyx_XGOTREF(__pyx_t_3);
          __pyx_t_4 = __pyx_cur_scope->__pyx_t_3;
          __pyx_cur_scope->__pyx_t_3 = 0;
          __Pyx_XGOTREF(__pyx_t_4);
          __pyx_t_6 = __pyx_cur_scope->__pyx_t_4;
          __pyx_cur_scope->__pyx_t_4 = 0;
          __Pyx_XGOTREF(__pyx_t_6);
          __pyx_t_7 = __pyx_cur_scope->__pyx_t_5;
          __pyx_cur_scope->__pyx_t_5 = 0;
          __Pyx_XGOTREF(__pyx_t_7);
          if (unlikely(!__pyx_sent_value)) __PYX_ERR(10, 29, __pyx_L6_except_error)
        } else {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(10, 29, __pyx_L6_except_error)
          }
        }

        /* "asynctnt/iproto/db.pyx":32
 * 
 *                 # Retry request with updated schema_id
 *                 req.schema_id = self._protocol._schema_id             # <<<<<<<<<<<<<<
 *                 return await self._protocol.execute(req, timeout)
 *             raise
 */
        __pyx_t_12 = __pyx_cur_scope->__pyx_v_self->_protocol->_schema_id;
        __pyx_cur_scope->__pyx_v_req->schema_id = __pyx_t_12;

        /* "asynctnt/iproto/db.pyx":33
 *                 # Retry request with updated schema_id
 *                 req.schema_id = self._protocol._schema_id
 *                 return await self._protocol.execute(req, timeout)             # <<<<<<<<<<<<<<
 *             raise
 * 
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_9 = ((struct __pyx_vtabstruct_8asynctnt_6iproto_8protocol_BaseProtocol *)__pyx_cur_scope->__pyx_v_self->_protocol->__pyx_base.__pyx_vtab)->execute(__pyx_cur_scope->__pyx_v_self->_protocol, __pyx_cur_scope->__pyx_v_req, __pyx_cur_scope->__pyx_v_timeout); if (unlikely(!__pyx_t_9)) __PYX_ERR(10, 33, __pyx_L6_except_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_9);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_XGOTREF(__pyx_r);
        if (likely(__pyx_r)) {
          __Pyx_XGIVEREF(__pyx_t_1);
          __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
          __Pyx_XGIVEREF(__pyx_t_2);
          __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
          __Pyx_XGIVEREF(__pyx_t_3);
          __pyx_cur_scope->__pyx_t_2 = __pyx_t_3;
          __Pyx_XGIVEREF(__pyx_t_4);
          __pyx_cur_scope->__pyx_t_3 = __pyx_t_4;
          __Pyx_XGIVEREF(__pyx_t_6);
          __pyx_cur_scope->__pyx_t_4 = __pyx_t_6;
          __Pyx_XGIVEREF(__pyx_t_7);
          __pyx_cur_scope->__pyx_t_5 = __pyx_t_7;
          __Pyx_XGIVEREF(__pyx_r);
          __Pyx_RefNannyFinishContext();
          /* return from generator, yielding value */
          __pyx_generator->resume_label = 3;
          return __pyx_r;
          __pyx_L17_resume_from_yield:;
          __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
          __pyx_cur_scope->__pyx_t_0 = 0;
          __Pyx_XGOTREF(__pyx_t_1);
          __pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
          __pyx_cur_scope->__pyx_t_1 = 0;
          __Pyx_XGOTREF(__pyx_t_2);
          __pyx_t_3 = __pyx_cur_scope->__pyx_t_2;
          __pyx_cur_scope->__pyx_t_2 = 0;
          __Pyx_XGOTREF(__pyx_t_3);
          __pyx_t_4 = __pyx_cur_scope->__pyx_t_3;
          __pyx_cur_scope->__pyx_t_3 = 0;
          __Pyx_XGOTREF(__pyx_t_4);
          __pyx_t_6 = __pyx_cur_scope->__pyx_t_4;
          __pyx_cur_scope->__pyx_t_4 = 0;
          __Pyx_XGOTREF(__pyx_t_6);
          __pyx_t_7 = __pyx_cur_scope->__pyx_t_5;
          __pyx_cur_scope->__pyx_t_5 = 0;
          __Pyx_XGOTREF(__pyx_t_7);
          if (unlikely(!__pyx_sent_value)) __PYX_ERR(10, 33, __pyx_L6_except_error)
          __pyx_t_9 = __pyx_sent_value; __Pyx_INCREF(__pyx_t_9);
        } else {
          __pyx_t_9 = NULL;
          if (__Pyx_PyGen_FetchStopIterationValue(&__pyx_t_9) < 0) __PYX_ERR(10, 33, __pyx_L6_except_error)
          __Pyx_GOTREF(__pyx_t_9);
        }
        __pyx_r = NULL; __Pyx_ReturnWithStopIteration(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __pyx_t_9 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        goto __pyx_L7_except_return;

        /* "asynctnt/iproto/db.pyx":28
 *             return await self._protocol.execute(req, timeout)
 *         except TarantoolDatabaseError as e:
 *             if e.code == ErrorCode.ER_WRONG_SCHEMA_VERSION:             # <<<<<<<<<<<<<<
 *                 await self._protocol.refetch_schema()
 * 
 */
      }

      /* "asynctnt/iproto/db.pyx":34
 *                 req.schema_id = self._protocol._schema_id
 *                 return await self._protocol.execute(req, timeout)
 *             raise             # <<<<<<<<<<<<<<
 * 
 *     cdef Request _ping(self):
 */
      __Pyx_GIVEREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_6);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_ErrRestoreWithState(__pyx_t_4, __pyx_t_6, __pyx_t_7);
      __pyx_t_4 = 0; __pyx_t_6 = 0; __pyx_t_7 = 0; 
      __PYX_ERR(10, 34, __pyx_L6_except_error)
    }
    goto __pyx_L6_except_error;
    __pyx_L6_except_error:;

    /* "asynctnt/iproto/db.pyx":25
 *     async def execute(self, Request req, float timeout):
 *         cdef object fut
 *         try:             # <<<<<<<<<<<<<<
 *             return await self._protocol.execute(req, timeout)
 *         except TarantoolDatabaseError as e:
 */
    __Pyx_PyThreadState_assign
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L8_try_return:;
    __Pyx_PyThreadState_assign
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L0;
    __pyx_L7_except_return:;
    __Pyx_PyThreadState_assign
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L0;
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "asynctnt/iproto/db.pyx":23
 *         return self._protocol.next_sync()
 * 
 *     async def execute(self, Request req, float timeout):             # <<<<<<<<<<<<<<
 *         cdef object fut
 *         try:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("execute", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/db.pyx":36
 *             raise
 * 
 *     cdef Request _ping(self):             # <<<<<<<<<<<<<<
 *         return Request.new(tnt.TP_PING,
 *                            self.next_sync(),
 */

static struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *__pyx_f_8asynctnt_6iproto_8protocol_2Db__ping(struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *__pyx_v_self) {
  struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("_ping", 0);

  /* "asynctnt/iproto/db.pyx":37
 * 
 *     cdef Request _ping(self):
 *         return Request.new(tnt.TP_PING,             # <<<<<<<<<<<<<<
 *                            self.next_sync(),
 *                            self._protocol._schema_id,
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));

  /* "asynctnt/iproto/db.pyx":40
 *                            self.next_sync(),
 *                            self._protocol._schema_id,
 *                            None)             # <<<<<<<<<<<<<<
 * 
 *     cdef Request _call16(self, str func_name, list args):
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8asynctnt_6iproto_8protocol_7Request_new(__pyx_e_8asynctnt_6iproto_3tnt_TP_PING, __pyx_f_8asynctnt_6iproto_8protocol_2Db_next_sync(__pyx_v_self), __pyx_v_self->_protocol->_schema_id, ((struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *)Py_None))); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 37, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = ((struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "asynctnt/iproto/db.pyx":36
 *             raise
 * 
 *     cdef Request _ping(self):             # <<<<<<<<<<<<<<
 *         return Request.new(tnt.TP_PING,
 *                            self.next_sync(),
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asynctnt.iproto.protocol.Db._ping", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/db.pyx":42
 *                            None)
 * 
 *     cdef Request _call16(self, str func_name, list args):             # <<<<<<<<<<<<<<
 *         cdef:
 *             WriteBuffer buf
 */

static struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *__pyx_f_8asynctnt_6iproto_8protocol_2Db__call16(struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *__pyx_v_self, PyObject *__pyx_v_func_name, PyObject *__pyx_v_args) {
  struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *__pyx_v_buf = 0;
  struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  struct __pyx_opt_args_8asynctnt_6iproto_8protocol_11WriteBuffer_new __pyx_t_3;
  __Pyx_RefNannySetupContext("_call16", 0);

  /* "asynctnt/iproto/db.pyx":46
 *             WriteBuffer buf
 * 
 *         buf = WriteBuffer.new(self._encoding)             # <<<<<<<<<<<<<<
 *         buf.encode_request_call(func_name, args)
 *         return Request.new(tnt.TP_CALL_16,
 */
  __pyx_t_1 = __pyx_v_self->_encoding;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_3.__pyx_n = 1;
  __pyx_t_3.encoding = ((PyObject*)__pyx_t_1);
  __pyx_t_2 = ((PyObject *)__pyx_vtabptr_8asynctnt_6iproto_8protocol_WriteBuffer->new(&__pyx_t_3)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 46, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_buf = ((struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "asynctnt/iproto/db.pyx":47
 * 
 *         buf = WriteBuffer.new(self._encoding)
 *         buf.encode_request_call(func_name, args)             # <<<<<<<<<<<<<<
 *         return Request.new(tnt.TP_CALL_16,
 *                            self.next_sync(),
 */
  __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer_encode_request_call(__pyx_v_buf, __pyx_v_func_name, __pyx_v_args); if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 47, __pyx_L1_error)

  /* "asynctnt/iproto/db.pyx":48
 *         buf = WriteBuffer.new(self._encoding)
 *         buf.encode_request_call(func_name, args)
 *         return Request.new(tnt.TP_CALL_16,             # <<<<<<<<<<<<<<
 *                            self.next_sync(),
 *                            self._protocol._schema_id,
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));

  /* "asynctnt/iproto/db.pyx":51
 *                            self.next_sync(),
 *                            self._protocol._schema_id,
 *                            buf)             # <<<<<<<<<<<<<<
 * 
 *     cdef Request _call(self, str func_name, list args):
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_8asynctnt_6iproto_8protocol_7Request_new(__pyx_e_8asynctnt_6iproto_3tnt_TP_CALL_16, __pyx_f_8asynctnt_6iproto_8protocol_2Db_next_sync(__pyx_v_self), __pyx_v_self->_protocol->_schema_id, __pyx_v_buf)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 48, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = ((struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "asynctnt/iproto/db.pyx":42
 *                            None)
 * 
 *     cdef Request _call16(self, str func_name, list args):             # <<<<<<<<<<<<<<
 *         cdef:
 *             WriteBuffer buf
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("asynctnt.iproto.protocol.Db._call16", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_buf);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/db.pyx":53
 *                            buf)
 * 
 *     cdef Request _call(self, str func_name, list args):             # <<<<<<<<<<<<<<
 *         cdef:
 *             WriteBuffer buf
 */

static struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *__pyx_f_8asynctnt_6iproto_8protocol_2Db__call(struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *__pyx_v_self, PyObject *__pyx_v_func_name, PyObject *__pyx_v_args) {
  struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *__pyx_v_buf = 0;
  struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  struct __pyx_opt_args_8asynctnt_6iproto_8protocol_11WriteBuffer_new __pyx_t_3;
  __Pyx_RefNannySetupContext("_call", 0);

  /* "asynctnt/iproto/db.pyx":57
 *             WriteBuffer buf
 * 
 *         buf = WriteBuffer.new(self._encoding)             # <<<<<<<<<<<<<<
 *         buf.encode_request_call(func_name, args)
 *         return Request.new(tnt.TP_CALL,
 */
  __pyx_t_1 = __pyx_v_self->_encoding;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_3.__pyx_n = 1;
  __pyx_t_3.encoding = ((PyObject*)__pyx_t_1);
  __pyx_t_2 = ((PyObject *)__pyx_vtabptr_8asynctnt_6iproto_8protocol_WriteBuffer->new(&__pyx_t_3)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 57, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_buf = ((struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "asynctnt/iproto/db.pyx":58
 * 
 *         buf = WriteBuffer.new(self._encoding)
 *         buf.encode_request_call(func_name, args)             # <<<<<<<<<<<<<<
 *         return Request.new(tnt.TP_CALL,
 *                            self.next_sync(),
 */
  __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer_encode_request_call(__pyx_v_buf, __pyx_v_func_name, __pyx_v_args); if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 58, __pyx_L1_error)

  /* "asynctnt/iproto/db.pyx":59
 *         buf = WriteBuffer.new(self._encoding)
 *         buf.encode_request_call(func_name, args)
 *         return Request.new(tnt.TP_CALL,             # <<<<<<<<<<<<<<
 *                            self.next_sync(),
 *                            self._protocol._schema_id,
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));

  /* "asynctnt/iproto/db.pyx":62
 *                            self.next_sync(),
 *                            self._protocol._schema_id,
 *                            buf)             # <<<<<<<<<<<<<<
 * 
 *     cdef Request _eval(self, str expression, list args):
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_8asynctnt_6iproto_8protocol_7Request_new(__pyx_e_8asynctnt_6iproto_3tnt_TP_CALL, __pyx_f_8asynctnt_6iproto_8protocol_2Db_next_sync(__pyx_v_self), __pyx_v_self->_protocol->_schema_id, __pyx_v_buf)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 59, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = ((struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "asynctnt/iproto/db.pyx":53
 *                            buf)
 * 
 *     cdef Request _call(self, str func_name, list args):             # <<<<<<<<<<<<<<
 *         cdef:
 *             WriteBuffer buf
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("asynctnt.iproto.protocol.Db._call", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_buf);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/db.pyx":64
 *                            buf)
 * 
 *     cdef Request _eval(self, str expression, list args):             # <<<<<<<<<<<<<<
 *         cdef:
 *             WriteBuffer buf
 */

static struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *__pyx_f_8asynctnt_6iproto_8protocol_2Db__eval(struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *__pyx_v_self, PyObject *__pyx_v_expression, PyObject *__pyx_v_args) {
  struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *__pyx_v_buf = 0;
  struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  struct __pyx_opt_args_8asynctnt_6iproto_8protocol_11WriteBuffer_new __pyx_t_3;
  __Pyx_RefNannySetupContext("_eval", 0);

  /* "asynctnt/iproto/db.pyx":68
 *             WriteBuffer buf
 * 
 *         buf = WriteBuffer.new(self._encoding)             # <<<<<<<<<<<<<<
 *         buf.encode_request_eval(expression, args)
 *         return Request.new(tnt.TP_EVAL,
 */
  __pyx_t_1 = __pyx_v_self->_encoding;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_3.__pyx_n = 1;
  __pyx_t_3.encoding = ((PyObject*)__pyx_t_1);
  __pyx_t_2 = ((PyObject *)__pyx_vtabptr_8asynctnt_6iproto_8protocol_WriteBuffer->new(&__pyx_t_3)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 68, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_buf = ((struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "asynctnt/iproto/db.pyx":69
 * 
 *         buf = WriteBuffer.new(self._encoding)
 *         buf.encode_request_eval(expression, args)             # <<<<<<<<<<<<<<
 *         return Request.new(tnt.TP_EVAL,
 *                            self.next_sync(),
 */
  __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer_encode_request_eval(__pyx_v_buf, __pyx_v_expression, __pyx_v_args); if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 69, __pyx_L1_error)

  /* "asynctnt/iproto/db.pyx":70
 *         buf = WriteBuffer.new(self._encoding)
 *         buf.encode_request_eval(expression, args)
 *         return Request.new(tnt.TP_EVAL,             # <<<<<<<<<<<<<<
 *                            self.next_sync(),
 *                            self._protocol._schema_id,
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));

  /* "asynctnt/iproto/db.pyx":73
 *                            self.next_sync(),
 *                            self._protocol._schema_id,
 *                            buf)             # <<<<<<<<<<<<<<
 * 
 *     cdef Request _select(self, uint32_t space, uint32_t index, list key,
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_8asynctnt_6iproto_8protocol_7Request_new(__pyx_e_8asynctnt_6iproto_3tnt_TP_EVAL, __pyx_f_8asynctnt_6iproto_8protocol_2Db_next_sync(__pyx_v_self), __pyx_v_self->_protocol->_schema_id, __pyx_v_buf)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 70, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = ((struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "asynctnt/iproto/db.pyx":64
 *                            buf)
 * 
 *     cdef Request _eval(self, str expression, list args):             # <<<<<<<<<<<<<<
 *         cdef:
 *             WriteBuffer buf
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("asynctnt.iproto.protocol.Db._eval", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_buf);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/db.pyx":75
 *                            buf)
 * 
 *     cdef Request _select(self, uint32_t space, uint32_t index, list key,             # <<<<<<<<<<<<<<
 *                          uint64_t offset, uint64_t limit, uint32_t iterator):
 *         cdef:
 */

static struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *__pyx_f_8asynctnt_6iproto_8protocol_2Db__select(struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *__pyx_v_self, uint32_t __pyx_v_space, uint32_t __pyx_v_index, PyObject *__pyx_v_key, uint64_t __pyx_v_offset, uint64_t __pyx_v_limit, uint32_t __pyx_v_iterator) {
  struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *__pyx_v_buf = 0;
  struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  struct __pyx_opt_args_8asynctnt_6iproto_8protocol_11WriteBuffer_new __pyx_t_3;
  __Pyx_RefNannySetupContext("_select", 0);

  /* "asynctnt/iproto/db.pyx":80
 *             WriteBuffer buf
 * 
 *         buf = WriteBuffer.new(self._encoding)             # <<<<<<<<<<<<<<
 *         buf.encode_request_select(space, index, key,
 *                                   offset, limit, iterator)
 */
  __pyx_t_1 = __pyx_v_self->_encoding;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_3.__pyx_n = 1;
  __pyx_t_3.encoding = ((PyObject*)__pyx_t_1);
  __pyx_t_2 = ((PyObject *)__pyx_vtabptr_8asynctnt_6iproto_8protocol_WriteBuffer->new(&__pyx_t_3)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 80, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_buf = ((struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "asynctnt/iproto/db.pyx":81
 * 
 *         buf = WriteBuffer.new(self._encoding)
 *         buf.encode_request_select(space, index, key,             # <<<<<<<<<<<<<<
 *                                   offset, limit, iterator)
 *         return Request.new(tnt.TP_SELECT,
 */
  __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer_encode_request_select(__pyx_v_buf, __pyx_v_space, __pyx_v_index, __pyx_v_key, __pyx_v_offset, __pyx_v_limit, __pyx_v_iterator); if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 81, __pyx_L1_error)

  /* "asynctnt/iproto/db.pyx":83
 *         buf.encode_request_select(space, index, key,
 *                                   offset, limit, iterator)
 *         return Request.new(tnt.TP_SELECT,             # <<<<<<<<<<<<<<
 *                            self.next_sync(),
 *                            self._protocol._schema_id,
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));

  /* "asynctnt/iproto/db.pyx":86
 *                            self.next_sync(),
 *                            self._protocol._schema_id,
 *                            buf)             # <<<<<<<<<<<<<<
 * 
 *     cdef Request _insert(self, uint32_t space, list t, bint replace):
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_8asynctnt_6iproto_8protocol_7Request_new(__pyx_e_8asynctnt_6iproto_3tnt_TP_SELECT, __pyx_f_8asynctnt_6iproto_8protocol_2Db_next_sync(__pyx_v_self), __pyx_v_self->_protocol->_schema_id, __pyx_v_buf)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 83, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = ((struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "asynctnt/iproto/db.pyx":75
 *                            buf)
 * 
 *     cdef Request _select(self, uint32_t space, uint32_t index, list key,             # <<<<<<<<<<<<<<
 *                          uint64_t offset, uint64_t limit, uint32_t iterator):
 *         cdef:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("asynctnt.iproto.protocol.Db._select", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_buf);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/db.pyx":88
 *                            buf)
 * 
 *     cdef Request _insert(self, uint32_t space, list t, bint replace):             # <<<<<<<<<<<<<<
 *         cdef:
 *             tnt.tp_request_type op
 */

static struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *__pyx_f_8asynctnt_6iproto_8protocol_2Db__insert(struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *__pyx_v_self, uint32_t __pyx_v_space, PyObject *__pyx_v_t, int __pyx_v_replace) {
  enum __pyx_t_8asynctnt_6iproto_3tnt_tp_request_type __pyx_v_op;
  struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *__pyx_v_buf = 0;
  struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  enum __pyx_t_8asynctnt_6iproto_3tnt_tp_request_type __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  struct __pyx_opt_args_8asynctnt_6iproto_8protocol_11WriteBuffer_new __pyx_t_4;
  __Pyx_RefNannySetupContext("_insert", 0);

  /* "asynctnt/iproto/db.pyx":93
 *             WriteBuffer buf
 * 
 *         op = tnt.TP_INSERT if not replace else tnt.TP_REPLACE             # <<<<<<<<<<<<<<
 *         buf = WriteBuffer.new(self._encoding)
 *         buf.encode_request_insert(space, t)
 */
  if (((!(__pyx_v_replace != 0)) != 0)) {
    __pyx_t_1 = __pyx_e_8asynctnt_6iproto_3tnt_TP_INSERT;
  } else {
    __pyx_t_1 = __pyx_e_8asynctnt_6iproto_3tnt_TP_REPLACE;
  }
  __pyx_v_op = __pyx_t_1;

  /* "asynctnt/iproto/db.pyx":94
 * 
 *         op = tnt.TP_INSERT if not replace else tnt.TP_REPLACE
 *         buf = WriteBuffer.new(self._encoding)             # <<<<<<<<<<<<<<
 *         buf.encode_request_insert(space, t)
 *         return Request.new(op,
 */
  __pyx_t_2 = __pyx_v_self->_encoding;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_4.__pyx_n = 1;
  __pyx_t_4.encoding = ((PyObject*)__pyx_t_2);
  __pyx_t_3 = ((PyObject *)__pyx_vtabptr_8asynctnt_6iproto_8protocol_WriteBuffer->new(&__pyx_t_4)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 94, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_buf = ((struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "asynctnt/iproto/db.pyx":95
 *         op = tnt.TP_INSERT if not replace else tnt.TP_REPLACE
 *         buf = WriteBuffer.new(self._encoding)
 *         buf.encode_request_insert(space, t)             # <<<<<<<<<<<<<<
 *         return Request.new(op,
 *                            self.next_sync(),
 */
  __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer_encode_request_insert(__pyx_v_buf, __pyx_v_space, __pyx_v_t); if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 95, __pyx_L1_error)

  /* "asynctnt/iproto/db.pyx":96
 *         buf = WriteBuffer.new(self._encoding)
 *         buf.encode_request_insert(space, t)
 *         return Request.new(op,             # <<<<<<<<<<<<<<
 *                            self.next_sync(),
 *                            self._protocol._schema_id,
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));

  /* "asynctnt/iproto/db.pyx":99
 *                            self.next_sync(),
 *                            self._protocol._schema_id,
 *                            buf)             # <<<<<<<<<<<<<<
 * 
 *     cdef Request _delete(self, uint32_t space, uint32_t index, list key):
 */
  __pyx_t_3 = ((PyObject *)__pyx_f_8asynctnt_6iproto_8protocol_7Request_new(__pyx_v_op, __pyx_f_8asynctnt_6iproto_8protocol_2Db_next_sync(__pyx_v_self), __pyx_v_self->_protocol->_schema_id, __pyx_v_buf)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 96, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = ((struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *)__pyx_t_3);
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "asynctnt/iproto/db.pyx":88
 *                            buf)
 * 
 *     cdef Request _insert(self, uint32_t space, list t, bint replace):             # <<<<<<<<<<<<<<
 *         cdef:
 *             tnt.tp_request_type op
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("asynctnt.iproto.protocol.Db._insert", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_buf);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/db.pyx":101
 *                            buf)
 * 
 *     cdef Request _delete(self, uint32_t space, uint32_t index, list key):             # <<<<<<<<<<<<<<
 *         cdef:
 *             WriteBuffer buf
 */

static struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *__pyx_f_8asynctnt_6iproto_8protocol_2Db__delete(struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *__pyx_v_self, uint32_t __pyx_v_space, uint32_t __pyx_v_index, PyObject *__pyx_v_key) {
  struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *__pyx_v_buf = 0;
  struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  struct __pyx_opt_args_8asynctnt_6iproto_8protocol_11WriteBuffer_new __pyx_t_3;
  __Pyx_RefNannySetupContext("_delete", 0);

  /* "asynctnt/iproto/db.pyx":105
 *             WriteBuffer buf
 * 
 *         buf = WriteBuffer.new(self._encoding)             # <<<<<<<<<<<<<<
 *         buf.encode_request_delete(space, index, key)
 *         return Request.new(tnt.TP_DELETE,
 */
  __pyx_t_1 = __pyx_v_self->_encoding;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_3.__pyx_n = 1;
  __pyx_t_3.encoding = ((PyObject*)__pyx_t_1);
  __pyx_t_2 = ((PyObject *)__pyx_vtabptr_8asynctnt_6iproto_8protocol_WriteBuffer->new(&__pyx_t_3)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 105, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_buf = ((struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "asynctnt/iproto/db.pyx":106
 * 
 *         buf = WriteBuffer.new(self._encoding)
 *         buf.encode_request_delete(space, index, key)             # <<<<<<<<<<<<<<
 *         return Request.new(tnt.TP_DELETE,
 *                            self.next_sync(),
 */
  __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer_encode_request_delete(__pyx_v_buf, __pyx_v_space, __pyx_v_index, __pyx_v_key); if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 106, __pyx_L1_error)

  /* "asynctnt/iproto/db.pyx":107
 *         buf = WriteBuffer.new(self._encoding)
 *         buf.encode_request_delete(space, index, key)
 *         return Request.new(tnt.TP_DELETE,             # <<<<<<<<<<<<<<
 *                            self.next_sync(),
 *                            self._protocol._schema_id,
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));

  /* "asynctnt/iproto/db.pyx":110
 *                            self.next_sync(),
 *                            self._protocol._schema_id,
 *                            buf)             # <<<<<<<<<<<<<<
 * 
 *     cdef Request _update(self, uint32_t space, uint32_t index,
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_8asynctnt_6iproto_8protocol_7Request_new(__pyx_e_8asynctnt_6iproto_3tnt_TP_DELETE, __pyx_f_8asynctnt_6iproto_8protocol_2Db_next_sync(__pyx_v_self), __pyx_v_self->_protocol->_schema_id, __pyx_v_buf)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 107, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = ((struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "asynctnt/iproto/db.pyx":101
 *                            buf)
 * 
 *     cdef Request _delete(self, uint32_t space, uint32_t index, list key):             # <<<<<<<<<<<<<<
 *         cdef:
 *             WriteBuffer buf
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("asynctnt.iproto.protocol.Db._delete", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_buf);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/db.pyx":112
 *                            buf)
 * 
 *     cdef Request _update(self, uint32_t space, uint32_t index,             # <<<<<<<<<<<<<<
 *                          list key, list operations):
 *         cdef:
 */

static struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *__pyx_f_8asynctnt_6iproto_8protocol_2Db__update(struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *__pyx_v_self, uint32_t __pyx_v_space, uint32_t __pyx_v_index, PyObject *__pyx_v_key, PyObject *__pyx_v_operations) {
  struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *__pyx_v_buf = 0;
  struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  struct __pyx_opt_args_8asynctnt_6iproto_8protocol_11WriteBuffer_new __pyx_t_3;
  __Pyx_RefNannySetupContext("_update", 0);

  /* "asynctnt/iproto/db.pyx":117
 *             WriteBuffer buf
 * 
 *         buf = WriteBuffer.new(self._encoding)             # <<<<<<<<<<<<<<
 *         buf.encode_request_update(space, index, key, operations)
 *         return Request.new(tnt.TP_UPDATE,
 */
  __pyx_t_1 = __pyx_v_self->_encoding;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_3.__pyx_n = 1;
  __pyx_t_3.encoding = ((PyObject*)__pyx_t_1);
  __pyx_t_2 = ((PyObject *)__pyx_vtabptr_8asynctnt_6iproto_8protocol_WriteBuffer->new(&__pyx_t_3)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 117, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_buf = ((struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "asynctnt/iproto/db.pyx":118
 * 
 *         buf = WriteBuffer.new(self._encoding)
 *         buf.encode_request_update(space, index, key, operations)             # <<<<<<<<<<<<<<
 *         return Request.new(tnt.TP_UPDATE,
 *                            self.next_sync(),
 */
  __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer_encode_request_update(__pyx_v_buf, __pyx_v_space, __pyx_v_index, __pyx_v_key, __pyx_v_operations, NULL); if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 118, __pyx_L1_error)

  /* "asynctnt/iproto/db.pyx":119
 *         buf = WriteBuffer.new(self._encoding)
 *         buf.encode_request_update(space, index, key, operations)
 *         return Request.new(tnt.TP_UPDATE,             # <<<<<<<<<<<<<<
 *                            self.next_sync(),
 *                            self._protocol._schema_id,
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));

  /* "asynctnt/iproto/db.pyx":122
 *                            self.next_sync(),
 *                            self._protocol._schema_id,
 *                            buf)             # <<<<<<<<<<<<<<
 * 
 *     cdef Request _upsert(self, uint32_t space, list t, list operations):
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_8asynctnt_6iproto_8protocol_7Request_new(__pyx_e_8asynctnt_6iproto_3tnt_TP_UPDATE, __pyx_f_8asynctnt_6iproto_8protocol_2Db_next_sync(__pyx_v_self), __pyx_v_self->_protocol->_schema_id, __pyx_v_buf)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 119, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = ((struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "asynctnt/iproto/db.pyx":112
 *                            buf)
 * 
 *     cdef Request _update(self, uint32_t space, uint32_t index,             # <<<<<<<<<<<<<<
 *                          list key, list operations):
 *         cdef:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("asynctnt.iproto.protocol.Db._update", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_buf);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/db.pyx":124
 *                            buf)
 * 
 *     cdef Request _upsert(self, uint32_t space, list t, list operations):             # <<<<<<<<<<<<<<
 *         cdef:
 *             WriteBuffer buf
 */

static struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *__pyx_f_8asynctnt_6iproto_8protocol_2Db__upsert(struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *__pyx_v_self, uint32_t __pyx_v_space, PyObject *__pyx_v_t, PyObject *__pyx_v_operations) {
  struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *__pyx_v_buf = 0;
  struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  struct __pyx_opt_args_8asynctnt_6iproto_8protocol_11WriteBuffer_new __pyx_t_3;
  __Pyx_RefNannySetupContext("_upsert", 0);

  /* "asynctnt/iproto/db.pyx":128
 *             WriteBuffer buf
 * 
 *         buf = WriteBuffer.new(self._encoding)             # <<<<<<<<<<<<<<
 *         buf.encode_request_upsert(space, t, operations)
 *         return Request.new(tnt.TP_UPSERT,
 */
  __pyx_t_1 = __pyx_v_self->_encoding;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_3.__pyx_n = 1;
  __pyx_t_3.encoding = ((PyObject*)__pyx_t_1);
  __pyx_t_2 = ((PyObject *)__pyx_vtabptr_8asynctnt_6iproto_8protocol_WriteBuffer->new(&__pyx_t_3)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 128, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_buf = ((struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "asynctnt/iproto/db.pyx":129
 * 
 *         buf = WriteBuffer.new(self._encoding)
 *         buf.encode_request_upsert(space, t, operations)             # <<<<<<<<<<<<<<
 *         return Request.new(tnt.TP_UPSERT,
 *                            self.next_sync(),
 */
  __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer_encode_request_upsert(__pyx_v_buf, __pyx_v_space, __pyx_v_t, __pyx_v_operations); if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 129, __pyx_L1_error)

  /* "asynctnt/iproto/db.pyx":130
 *         buf = WriteBuffer.new(self._encoding)
 *         buf.encode_request_upsert(space, t, operations)
 *         return Request.new(tnt.TP_UPSERT,             # <<<<<<<<<<<<<<
 *                            self.next_sync(),
 *                            self._protocol._schema_id,
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));

  /* "asynctnt/iproto/db.pyx":133
 *                            self.next_sync(),
 *                            self._protocol._schema_id,
 *                            buf)             # <<<<<<<<<<<<<<
 * 
 *     cdef Request _auth(self, bytes salt, str username, str password):
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_8asynctnt_6iproto_8protocol_7Request_new(__pyx_e_8asynctnt_6iproto_3tnt_TP_UPSERT, __pyx_f_8asynctnt_6iproto_8protocol_2Db_next_sync(__pyx_v_self), __pyx_v_self->_protocol->_schema_id, __pyx_v_buf)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 130, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = ((struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "asynctnt/iproto/db.pyx":124
 *                            buf)
 * 
 *     cdef Request _upsert(self, uint32_t space, list t, list operations):             # <<<<<<<<<<<<<<
 *         cdef:
 *             WriteBuffer buf
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("asynctnt.iproto.protocol.Db._upsert", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_buf);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/db.pyx":135
 *                            buf)
 * 
 *     cdef Request _auth(self, bytes salt, str username, str password):             # <<<<<<<<<<<<<<
 *         cdef:
 *             WriteBuffer buf
 */

static struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *__pyx_f_8asynctnt_6iproto_8protocol_2Db__auth(struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *__pyx_v_self, PyObject *__pyx_v_salt, PyObject *__pyx_v_username, PyObject *__pyx_v_password) {
  struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *__pyx_v_buf = 0;
  PyObject *__pyx_v_username_bytes = 0;
  PyObject *__pyx_v_password_bytes = 0;
  PyObject *__pyx_v_hash1 = 0;
  PyObject *__pyx_v_hash2 = 0;
  PyObject *__pyx_v_scramble = 0;
  struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  struct __pyx_opt_args_8asynctnt_6iproto_8protocol_11WriteBuffer_new __pyx_t_3;
  struct __pyx_opt_args_8asynctnt_6iproto_8protocol_encode_unicode_string __pyx_t_4;
  __Pyx_RefNannySetupContext("_auth", 0);

  /* "asynctnt/iproto/db.pyx":142
 *             bytes hash1, hash2, scramble
 * 
 *         buf = WriteBuffer.new(self._encoding)             # <<<<<<<<<<<<<<
 * 
 *         username_bytes = encode_unicode_string(username, self._encoding)
 */
  __pyx_t_1 = __pyx_v_self->_encoding;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_3.__pyx_n = 1;
  __pyx_t_3.encoding = ((PyObject*)__pyx_t_1);
  __pyx_t_2 = ((PyObject *)__pyx_vtabptr_8asynctnt_6iproto_8protocol_WriteBuffer->new(&__pyx_t_3)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 142, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_buf = ((struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "asynctnt/iproto/db.pyx":144
 *         buf = WriteBuffer.new(self._encoding)
 * 
 *         username_bytes = encode_unicode_string(username, self._encoding)             # <<<<<<<<<<<<<<
 *         password_bytes = encode_unicode_string(password, self._encoding)
 * 
 */
  __pyx_t_2 = __pyx_v_self->_encoding;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_4.__pyx_n = 1;
  __pyx_t_4.encoding = ((PyObject*)__pyx_t_2);
  __pyx_t_1 = __pyx_f_8asynctnt_6iproto_8protocol_encode_unicode_string(__pyx_v_username, &__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 144, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_username_bytes = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "asynctnt/iproto/db.pyx":145
 * 
 *         username_bytes = encode_unicode_string(username, self._encoding)
 *         password_bytes = encode_unicode_string(password, self._encoding)             # <<<<<<<<<<<<<<
 * 
 *         hash1 = Db._sha1((password_bytes,))
 */
  __pyx_t_1 = __pyx_v_self->_encoding;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_4.__pyx_n = 1;
  __pyx_t_4.encoding = ((PyObject*)__pyx_t_1);
  __pyx_t_2 = __pyx_f_8asynctnt_6iproto_8protocol_encode_unicode_string(__pyx_v_password, &__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 145, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_password_bytes = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "asynctnt/iproto/db.pyx":147
 *         password_bytes = encode_unicode_string(password, self._encoding)
 * 
 *         hash1 = Db._sha1((password_bytes,))             # <<<<<<<<<<<<<<
 *         hash2 = Db._sha1((hash1,))
 *         scramble = Db._sha1((salt, hash2))
 */
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 147, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_password_bytes);
  __Pyx_GIVEREF(__pyx_v_password_bytes);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_password_bytes);
  __pyx_t_1 = __pyx_f_8asynctnt_6iproto_8protocol_2Db__sha1(((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 147, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_hash1 = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "asynctnt/iproto/db.pyx":148
 * 
 *         hash1 = Db._sha1((password_bytes,))
 *         hash2 = Db._sha1((hash1,))             # <<<<<<<<<<<<<<
 *         scramble = Db._sha1((salt, hash2))
 *         scramble = Db._strxor(hash1, scramble)
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 148, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_hash1);
  __Pyx_GIVEREF(__pyx_v_hash1);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_hash1);
  __pyx_t_2 = __pyx_f_8asynctnt_6iproto_8protocol_2Db__sha1(((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 148, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_hash2 = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "asynctnt/iproto/db.pyx":149
 *         hash1 = Db._sha1((password_bytes,))
 *         hash2 = Db._sha1((hash1,))
 *         scramble = Db._sha1((salt, hash2))             # <<<<<<<<<<<<<<
 *         scramble = Db._strxor(hash1, scramble)
 * 
 */
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 149, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_salt);
  __Pyx_GIVEREF(__pyx_v_salt);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_salt);
  __Pyx_INCREF(__pyx_v_hash2);
  __Pyx_GIVEREF(__pyx_v_hash2);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_hash2);
  __pyx_t_1 = __pyx_f_8asynctnt_6iproto_8protocol_2Db__sha1(((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 149, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_scramble = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "asynctnt/iproto/db.pyx":150
 *         hash2 = Db._sha1((hash1,))
 *         scramble = Db._sha1((salt, hash2))
 *         scramble = Db._strxor(hash1, scramble)             # <<<<<<<<<<<<<<
 * 
 *         buf.encode_request_auth(username_bytes, scramble)
 */
  __pyx_t_1 = __pyx_f_8asynctnt_6iproto_8protocol_2Db__strxor(__pyx_v_hash1, __pyx_v_scramble); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 150, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_scramble, ((PyObject*)__pyx_t_1));
  __pyx_t_1 = 0;

  /* "asynctnt/iproto/db.pyx":152
 *         scramble = Db._strxor(hash1, scramble)
 * 
 *         buf.encode_request_auth(username_bytes, scramble)             # <<<<<<<<<<<<<<
 *         return Request.new(tnt.TP_AUTH,
 *                            self.next_sync(),
 */
  __pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer_encode_request_auth(__pyx_v_buf, __pyx_v_username_bytes, __pyx_v_scramble); if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 152, __pyx_L1_error)

  /* "asynctnt/iproto/db.pyx":153
 * 
 *         buf.encode_request_auth(username_bytes, scramble)
 *         return Request.new(tnt.TP_AUTH,             # <<<<<<<<<<<<<<
 *                            self.next_sync(),
 *                            self._protocol._schema_id,
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));

  /* "asynctnt/iproto/db.pyx":156
 *                            self.next_sync(),
 *                            self._protocol._schema_id,
 *                            buf)             # <<<<<<<<<<<<<<
 * 
 *     @staticmethod
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_8asynctnt_6iproto_8protocol_7Request_new(__pyx_e_8asynctnt_6iproto_3tnt_TP_AUTH, __pyx_f_8asynctnt_6iproto_8protocol_2Db_next_sync(__pyx_v_self), __pyx_v_self->_protocol->_schema_id, __pyx_v_buf)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 153, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = ((struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "asynctnt/iproto/db.pyx":135
 *                            buf)
 * 
 *     cdef Request _auth(self, bytes salt, str username, str password):             # <<<<<<<<<<<<<<
 *         cdef:
 *             WriteBuffer buf
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("asynctnt.iproto.protocol.Db._auth", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_buf);
  __Pyx_XDECREF(__pyx_v_username_bytes);
  __Pyx_XDECREF(__pyx_v_password_bytes);
  __Pyx_XDECREF(__pyx_v_hash1);
  __Pyx_XDECREF(__pyx_v_hash2);
  __Pyx_XDECREF(__pyx_v_scramble);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/db.pyx":159
 * 
 *     @staticmethod
 *     cdef bytes _sha1(tuple values):             # <<<<<<<<<<<<<<
 *         cdef object sha = hashlib.sha1()
 *         for i in values:
 */

static PyObject *__pyx_f_8asynctnt_6iproto_8protocol_2Db__sha1(PyObject *__pyx_v_values) {
  PyObject *__pyx_v_sha = 0;
  PyObject *__pyx_v_i = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  __Pyx_RefNannySetupContext("_sha1", 0);

  /* "asynctnt/iproto/db.pyx":160
 *     @staticmethod
 *     cdef bytes _sha1(tuple values):
 *         cdef object sha = hashlib.sha1()             # <<<<<<<<<<<<<<
 *         for i in values:
 *             if i is not None:
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_hashlib); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 160, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_sha1); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 160, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (__pyx_t_2) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 160, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 160, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_sha = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "asynctnt/iproto/db.pyx":161
 *     cdef bytes _sha1(tuple values):
 *         cdef object sha = hashlib.sha1()
 *         for i in values:             # <<<<<<<<<<<<<<
 *             if i is not None:
 *                 sha.update(i)
 */
  if (unlikely(__pyx_v_values == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(10, 161, __pyx_L1_error)
  }
  __pyx_t_1 = __pyx_v_values; __Pyx_INCREF(__pyx_t_1); __pyx_t_4 = 0;
  for (;;) {
    if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(10, 161, __pyx_L1_error)
    #else
    __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 161, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "asynctnt/iproto/db.pyx":162
 *         cdef object sha = hashlib.sha1()
 *         for i in values:
 *             if i is not None:             # <<<<<<<<<<<<<<
 *                 sha.update(i)
 *         return sha.digest()
 */
    __pyx_t_5 = (__pyx_v_i != Py_None);
    __pyx_t_6 = (__pyx_t_5 != 0);
    if (__pyx_t_6) {

      /* "asynctnt/iproto/db.pyx":163
 *         for i in values:
 *             if i is not None:
 *                 sha.update(i)             # <<<<<<<<<<<<<<
 *         return sha.digest()
 * 
 */
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_sha, __pyx_n_s_update); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 163, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_7 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_7)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_7);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
        }
      }
      if (!__pyx_t_7) {
        __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_i); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 163, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_2)) {
          PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_v_i};
          __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 163, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_GOTREF(__pyx_t_3);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
          PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_v_i};
          __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 163, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_GOTREF(__pyx_t_3);
        } else
        #endif
        {
          __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(10, 163, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7); __pyx_t_7 = NULL;
          __Pyx_INCREF(__pyx_v_i);
          __Pyx_GIVEREF(__pyx_v_i);
          PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_v_i);
          __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_8, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 163, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "asynctnt/iproto/db.pyx":162
 *         cdef object sha = hashlib.sha1()
 *         for i in values:
 *             if i is not None:             # <<<<<<<<<<<<<<
 *                 sha.update(i)
 *         return sha.digest()
 */
    }

    /* "asynctnt/iproto/db.pyx":161
 *     cdef bytes _sha1(tuple values):
 *         cdef object sha = hashlib.sha1()
 *         for i in values:             # <<<<<<<<<<<<<<
 *             if i is not None:
 *                 sha.update(i)
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asynctnt/iproto/db.pyx":164
 *             if i is not None:
 *                 sha.update(i)
 *         return sha.digest()             # <<<<<<<<<<<<<<
 * 
 *     @staticmethod
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_sha, __pyx_n_s_digest); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 164, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (__pyx_t_2) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 164, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 164, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (!(likely(PyBytes_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(10, 164, __pyx_L1_error)
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "asynctnt/iproto/db.pyx":159
 * 
 *     @staticmethod
 *     cdef bytes _sha1(tuple values):             # <<<<<<<<<<<<<<
 *         cdef object sha = hashlib.sha1()
 *         for i in values:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("asynctnt.iproto.protocol.Db._sha1", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_sha);
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/db.pyx":167
 * 
 *     @staticmethod
 *     cdef bytes _strxor(bytes hash1, bytes scramble):             # <<<<<<<<<<<<<<
 *         cdef:
 *             char *hash1_str
 */

static PyObject *__pyx_f_8asynctnt_6iproto_8protocol_2Db__strxor(PyObject *__pyx_v_hash1, PyObject *__pyx_v_scramble) {
  char *__pyx_v_hash1_str;
  Py_ssize_t __pyx_v_hash1_len;
  char *__pyx_v_scramble_str;
  Py_ssize_t __pyx_v_scramble_len;
  Py_ssize_t __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  __Pyx_RefNannySetupContext("_strxor", 0);

  /* "asynctnt/iproto/db.pyx":174
 *             char *scramble_str
 *             ssize_t scramble_len
 *         cpython.bytes.PyBytes_AsStringAndSize(hash1,             # <<<<<<<<<<<<<<
 *                                               &hash1_str, &hash1_len)
 *         cpython.bytes.PyBytes_AsStringAndSize(scramble,
 */
  __pyx_t_1 = PyBytes_AsStringAndSize(__pyx_v_hash1, (&__pyx_v_hash1_str), ((Py_ssize_t *)(&__pyx_v_hash1_len))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(10, 174, __pyx_L1_error)

  /* "asynctnt/iproto/db.pyx":176
 *         cpython.bytes.PyBytes_AsStringAndSize(hash1,
 *                                               &hash1_str, &hash1_len)
 *         cpython.bytes.PyBytes_AsStringAndSize(scramble,             # <<<<<<<<<<<<<<
 *                                               &scramble_str, &scramble_len)
 *         for i in range(scramble_len):
 */
  __pyx_t_1 = PyBytes_AsStringAndSize(__pyx_v_scramble, (&__pyx_v_scramble_str), ((Py_ssize_t *)(&__pyx_v_scramble_len))); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(10, 176, __pyx_L1_error)

  /* "asynctnt/iproto/db.pyx":178
 *         cpython.bytes.PyBytes_AsStringAndSize(scramble,
 *                                               &scramble_str, &scramble_len)
 *         for i in range(scramble_len):             # <<<<<<<<<<<<<<
 *             scramble_str[i] = hash1_str[i] ^ scramble_str[i]
 *         return scramble
 */
  __pyx_t_2 = __pyx_v_scramble_len;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_i = __pyx_t_3;

    /* "asynctnt/iproto/db.pyx":179
 *                                               &scramble_str, &scramble_len)
 *         for i in range(scramble_len):
 *             scramble_str[i] = hash1_str[i] ^ scramble_str[i]             # <<<<<<<<<<<<<<
 *         return scramble
 * 
 */
    (__pyx_v_scramble_str[__pyx_v_i]) = ((__pyx_v_hash1_str[__pyx_v_i]) ^ (__pyx_v_scramble_str[__pyx_v_i]));
  }

  /* "asynctnt/iproto/db.pyx":180
 *         for i in range(scramble_len):
 *             scramble_str[i] = hash1_str[i] ^ scramble_str[i]
 *         return scramble             # <<<<<<<<<<<<<<
 * 
 *     # public methods
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_scramble);
  __pyx_r = __pyx_v_scramble;
  goto __pyx_L0;

  /* "asynctnt/iproto/db.pyx":167
 * 
 *     @staticmethod
 *     cdef bytes _strxor(bytes hash1, bytes scramble):             # <<<<<<<<<<<<<<
 *         cdef:
 *             char *hash1_str
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("asynctnt.iproto.protocol.Db._strxor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/db.pyx":184
 *     # public methods
 * 
 *     def ping(self, timeout=-1):             # <<<<<<<<<<<<<<
 *         return self.execute(
 *             self._ping(),
 */

/* Python wrapper */
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_2Db_6ping(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_2Db_6ping(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_timeout = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ping (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_timeout,0};
    PyObject* values[1] = {0};
    values[0] = ((PyObject *)__pyx_int_neg_1);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_timeout);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ping") < 0)) __PYX_ERR(10, 184, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_timeout = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ping", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 184, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("asynctnt.iproto.protocol.Db.ping", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8asynctnt_6iproto_8protocol_2Db_5ping(((struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *)__pyx_v_self), __pyx_v_timeout);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_2Db_5ping(struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *__pyx_v_self, PyObject *__pyx_v_timeout) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("ping", 0);

  /* "asynctnt/iproto/db.pyx":185
 * 
 *     def ping(self, timeout=-1):
 *         return self.execute(             # <<<<<<<<<<<<<<
 *             self._ping(),
 *             timeout
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_execute); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 185, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "asynctnt/iproto/db.pyx":186
 *     def ping(self, timeout=-1):
 *         return self.execute(
 *             self._ping(),             # <<<<<<<<<<<<<<
 *             timeout
 *         )
 */
  __pyx_t_3 = ((PyObject *)((struct __pyx_vtabstruct_8asynctnt_6iproto_8protocol_Db *)__pyx_v_self->__pyx_vtab)->_ping(__pyx_v_self)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 186, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "asynctnt/iproto/db.pyx":188
 *             self._ping(),
 *             timeout
 *         )             # <<<<<<<<<<<<<<
 * 
 *     def call16(self, func_name, args=None, timeout=-1):
 */
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_5 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_3, __pyx_v_timeout};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 185, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_3, __pyx_v_timeout};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 185, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else
  #endif
  {
    __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(10, 185, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (__pyx_t_4) {
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_t_3);
    __Pyx_INCREF(__pyx_v_timeout);
    __Pyx_GIVEREF(__pyx_v_timeout);
    PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_timeout);
    __pyx_t_3 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 185, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "asynctnt/iproto/db.pyx":184
 *     # public methods
 * 
 *     def ping(self, timeout=-1):             # <<<<<<<<<<<<<<
 *         return self.execute(
 *             self._ping(),
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("asynctnt.iproto.protocol.Db.ping", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/db.pyx":190
 *         )
 * 
 *     def call16(self, func_name, args=None, timeout=-1):             # <<<<<<<<<<<<<<
 *         return self.execute(
 *             self._call16(func_name, args),
 */

/* Python wrapper */
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_2Db_8call16(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_2Db_8call16(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_func_name = 0;
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_timeout = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("call16 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_func_name,&__pyx_n_s_args,&__pyx_n_s_timeout,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((PyObject *)__pyx_int_neg_1);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_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;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_func_name)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_args);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_timeout);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "call16") < 0)) __PYX_ERR(10, 190, __pyx_L3_error)
      }
    } else {
      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);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_func_name = values[0];
    __pyx_v_args = values[1];
    __pyx_v_timeout = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("call16", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 190, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("asynctnt.iproto.protocol.Db.call16", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8asynctnt_6iproto_8protocol_2Db_7call16(((struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *)__pyx_v_self), __pyx_v_func_name, __pyx_v_args, __pyx_v_timeout);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_2Db_7call16(struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *__pyx_v_self, PyObject *__pyx_v_func_name, PyObject *__pyx_v_args, PyObject *__pyx_v_timeout) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("call16", 0);

  /* "asynctnt/iproto/db.pyx":191
 * 
 *     def call16(self, func_name, args=None, timeout=-1):
 *         return self.execute(             # <<<<<<<<<<<<<<
 *             self._call16(func_name, args),
 *             timeout
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_execute); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 191, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "asynctnt/iproto/db.pyx":192
 *     def call16(self, func_name, args=None, timeout=-1):
 *         return self.execute(
 *             self._call16(func_name, args),             # <<<<<<<<<<<<<<
 *             timeout
 *         )
 */
  if (!(likely(PyString_CheckExact(__pyx_v_func_name))||((__pyx_v_func_name) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_v_func_name)->tp_name), 0))) __PYX_ERR(10, 192, __pyx_L1_error)
  if (!(likely(PyList_CheckExact(__pyx_v_args))||((__pyx_v_args) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_v_args)->tp_name), 0))) __PYX_ERR(10, 192, __pyx_L1_error)
  __pyx_t_3 = ((PyObject *)((struct __pyx_vtabstruct_8asynctnt_6iproto_8protocol_Db *)__pyx_v_self->__pyx_vtab)->_call16(__pyx_v_self, ((PyObject*)__pyx_v_func_name), ((PyObject*)__pyx_v_args))); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 192, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "asynctnt/iproto/db.pyx":194
 *             self._call16(func_name, args),
 *             timeout
 *         )             # <<<<<<<<<<<<<<
 * 
 *     def call(self, func_name, args=None, timeout=-1):
 */
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_5 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_3, __pyx_v_timeout};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 191, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_3, __pyx_v_timeout};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 191, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else
  #endif
  {
    __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(10, 191, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (__pyx_t_4) {
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_t_3);
    __Pyx_INCREF(__pyx_v_timeout);
    __Pyx_GIVEREF(__pyx_v_timeout);
    PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_timeout);
    __pyx_t_3 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 191, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "asynctnt/iproto/db.pyx":190
 *         )
 * 
 *     def call16(self, func_name, args=None, timeout=-1):             # <<<<<<<<<<<<<<
 *         return self.execute(
 *             self._call16(func_name, args),
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("asynctnt.iproto.protocol.Db.call16", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/db.pyx":196
 *         )
 * 
 *     def call(self, func_name, args=None, timeout=-1):             # <<<<<<<<<<<<<<
 *         return self.execute(
 *             self._call(func_name, args),
 */

/* Python wrapper */
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_2Db_10call(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_2Db_10call(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_func_name = 0;
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_timeout = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("call (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_func_name,&__pyx_n_s_args,&__pyx_n_s_timeout,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((PyObject *)__pyx_int_neg_1);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_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;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_func_name)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_args);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_timeout);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "call") < 0)) __PYX_ERR(10, 196, __pyx_L3_error)
      }
    } else {
      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);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_func_name = values[0];
    __pyx_v_args = values[1];
    __pyx_v_timeout = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("call", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 196, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("asynctnt.iproto.protocol.Db.call", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8asynctnt_6iproto_8protocol_2Db_9call(((struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *)__pyx_v_self), __pyx_v_func_name, __pyx_v_args, __pyx_v_timeout);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_2Db_9call(struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *__pyx_v_self, PyObject *__pyx_v_func_name, PyObject *__pyx_v_args, PyObject *__pyx_v_timeout) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("call", 0);

  /* "asynctnt/iproto/db.pyx":197
 * 
 *     def call(self, func_name, args=None, timeout=-1):
 *         return self.execute(             # <<<<<<<<<<<<<<
 *             self._call(func_name, args),
 *             timeout
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_execute); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 197, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "asynctnt/iproto/db.pyx":198
 *     def call(self, func_name, args=None, timeout=-1):
 *         return self.execute(
 *             self._call(func_name, args),             # <<<<<<<<<<<<<<
 *             timeout
 *         )
 */
  if (!(likely(PyString_CheckExact(__pyx_v_func_name))||((__pyx_v_func_name) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_v_func_name)->tp_name), 0))) __PYX_ERR(10, 198, __pyx_L1_error)
  if (!(likely(PyList_CheckExact(__pyx_v_args))||((__pyx_v_args) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_v_args)->tp_name), 0))) __PYX_ERR(10, 198, __pyx_L1_error)
  __pyx_t_3 = ((PyObject *)((struct __pyx_vtabstruct_8asynctnt_6iproto_8protocol_Db *)__pyx_v_self->__pyx_vtab)->_call(__pyx_v_self, ((PyObject*)__pyx_v_func_name), ((PyObject*)__pyx_v_args))); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 198, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "asynctnt/iproto/db.pyx":200
 *             self._call(func_name, args),
 *             timeout
 *         )             # <<<<<<<<<<<<<<
 * 
 *     def eval(self, expression, args=None, timeout=-1):
 */
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_5 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_3, __pyx_v_timeout};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 197, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_3, __pyx_v_timeout};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 197, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else
  #endif
  {
    __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(10, 197, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (__pyx_t_4) {
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_t_3);
    __Pyx_INCREF(__pyx_v_timeout);
    __Pyx_GIVEREF(__pyx_v_timeout);
    PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_timeout);
    __pyx_t_3 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 197, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "asynctnt/iproto/db.pyx":196
 *         )
 * 
 *     def call(self, func_name, args=None, timeout=-1):             # <<<<<<<<<<<<<<
 *         return self.execute(
 *             self._call(func_name, args),
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("asynctnt.iproto.protocol.Db.call", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/db.pyx":202
 *         )
 * 
 *     def eval(self, expression, args=None, timeout=-1):             # <<<<<<<<<<<<<<
 *         return self.execute(
 *             self._eval(expression, args),
 */

/* Python wrapper */
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_2Db_12eval(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_2Db_12eval(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_expression = 0;
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_timeout = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("eval (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_expression,&__pyx_n_s_args,&__pyx_n_s_timeout,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((PyObject *)__pyx_int_neg_1);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_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;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_expression)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_args);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_timeout);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "eval") < 0)) __PYX_ERR(10, 202, __pyx_L3_error)
      }
    } else {
      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);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_expression = values[0];
    __pyx_v_args = values[1];
    __pyx_v_timeout = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("eval", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 202, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("asynctnt.iproto.protocol.Db.eval", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8asynctnt_6iproto_8protocol_2Db_11eval(((struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *)__pyx_v_self), __pyx_v_expression, __pyx_v_args, __pyx_v_timeout);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_2Db_11eval(struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *__pyx_v_self, PyObject *__pyx_v_expression, PyObject *__pyx_v_args, PyObject *__pyx_v_timeout) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("eval", 0);

  /* "asynctnt/iproto/db.pyx":203
 * 
 *     def eval(self, expression, args=None, timeout=-1):
 *         return self.execute(             # <<<<<<<<<<<<<<
 *             self._eval(expression, args),
 *             timeout
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_execute); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 203, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "asynctnt/iproto/db.pyx":204
 *     def eval(self, expression, args=None, timeout=-1):
 *         return self.execute(
 *             self._eval(expression, args),             # <<<<<<<<<<<<<<
 *             timeout
 *         )
 */
  if (!(likely(PyString_CheckExact(__pyx_v_expression))||((__pyx_v_expression) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_v_expression)->tp_name), 0))) __PYX_ERR(10, 204, __pyx_L1_error)
  if (!(likely(PyList_CheckExact(__pyx_v_args))||((__pyx_v_args) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_v_args)->tp_name), 0))) __PYX_ERR(10, 204, __pyx_L1_error)
  __pyx_t_3 = ((PyObject *)((struct __pyx_vtabstruct_8asynctnt_6iproto_8protocol_Db *)__pyx_v_self->__pyx_vtab)->_eval(__pyx_v_self, ((PyObject*)__pyx_v_expression), ((PyObject*)__pyx_v_args))); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 204, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "asynctnt/iproto/db.pyx":206
 *             self._eval(expression, args),
 *             timeout
 *         )             # <<<<<<<<<<<<<<
 * 
 *     def select(self, space, key=None,
 */
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_5 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_3, __pyx_v_timeout};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 203, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_3, __pyx_v_timeout};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 203, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else
  #endif
  {
    __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(10, 203, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (__pyx_t_4) {
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_t_3);
    __Pyx_INCREF(__pyx_v_timeout);
    __Pyx_GIVEREF(__pyx_v_timeout);
    PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_timeout);
    __pyx_t_3 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 203, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "asynctnt/iproto/db.pyx":202
 *         )
 * 
 *     def eval(self, expression, args=None, timeout=-1):             # <<<<<<<<<<<<<<
 *         return self.execute(
 *             self._eval(expression, args),
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("asynctnt.iproto.protocol.Db.eval", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/db.pyx":208
 *         )
 * 
 *     def select(self, space, key=None,             # <<<<<<<<<<<<<<
 *                  offset=0, limit=0xffffffff, index=0, iterator=0, timeout=-1):
 *         space = self._protocol.transform_space(space)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_2Db_14select(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_2Db_14select(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_space = 0;
  PyObject *__pyx_v_key = 0;
  PyObject *__pyx_v_offset = 0;
  PyObject *__pyx_v_limit = 0;
  PyObject *__pyx_v_index = 0;
  PyObject *__pyx_v_iterator = 0;
  PyObject *__pyx_v_timeout = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("select (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_space,&__pyx_n_s_key,&__pyx_n_s_offset,&__pyx_n_s_limit,&__pyx_n_s_index,&__pyx_n_s_iterator,&__pyx_n_s_timeout,0};
    PyObject* values[7] = {0,0,0,0,0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((PyObject *)__pyx_int_0);
    values[3] = ((PyObject *)__pyx_int_4294967295);
    values[4] = ((PyObject *)__pyx_int_0);
    values[5] = ((PyObject *)__pyx_int_0);
    values[6] = ((PyObject *)__pyx_int_neg_1);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        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;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_space)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_key);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_offset);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_limit);
          if (value) { values[3] = value; kw_args--; }
        }
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_index);
          if (value) { values[4] = value; kw_args--; }
        }
        case  5:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_iterator);
          if (value) { values[5] = value; kw_args--; }
        }
        case  6:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_timeout);
          if (value) { values[6] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "select") < 0)) __PYX_ERR(10, 208, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        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);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_space = values[0];
    __pyx_v_key = values[1];
    __pyx_v_offset = values[2];
    __pyx_v_limit = values[3];
    __pyx_v_index = values[4];
    __pyx_v_iterator = values[5];
    __pyx_v_timeout = values[6];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("select", 0, 1, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 208, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("asynctnt.iproto.protocol.Db.select", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8asynctnt_6iproto_8protocol_2Db_13select(((struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *)__pyx_v_self), __pyx_v_space, __pyx_v_key, __pyx_v_offset, __pyx_v_limit, __pyx_v_index, __pyx_v_iterator, __pyx_v_timeout);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_2Db_13select(struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *__pyx_v_self, PyObject *__pyx_v_space, PyObject *__pyx_v_key, PyObject *__pyx_v_offset, PyObject *__pyx_v_limit, PyObject *__pyx_v_index, PyObject *__pyx_v_iterator, PyObject *__pyx_v_timeout) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  uint32_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  uint32_t __pyx_t_4;
  uint64_t __pyx_t_5;
  uint64_t __pyx_t_6;
  uint32_t __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  __Pyx_RefNannySetupContext("select", 0);
  __Pyx_INCREF(__pyx_v_space);
  __Pyx_INCREF(__pyx_v_index);
  __Pyx_INCREF(__pyx_v_iterator);

  /* "asynctnt/iproto/db.pyx":210
 *     def select(self, space, key=None,
 *                  offset=0, limit=0xffffffff, index=0, iterator=0, timeout=-1):
 *         space = self._protocol.transform_space(space)             # <<<<<<<<<<<<<<
 *         index = self._protocol.transform_index(space, index)
 *         iterator = self._protocol.transform_iterator(iterator)
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8asynctnt_6iproto_8protocol_BaseProtocol *)__pyx_v_self->_protocol->__pyx_base.__pyx_vtab)->transform_space(__pyx_v_self->_protocol, __pyx_v_space); if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 210, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyInt_From_uint32_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 210, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_space, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "asynctnt/iproto/db.pyx":211
 *                  offset=0, limit=0xffffffff, index=0, iterator=0, timeout=-1):
 *         space = self._protocol.transform_space(space)
 *         index = self._protocol.transform_index(space, index)             # <<<<<<<<<<<<<<
 *         iterator = self._protocol.transform_iterator(iterator)
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8asynctnt_6iproto_8protocol_BaseProtocol *)__pyx_v_self->_protocol->__pyx_base.__pyx_vtab)->transform_index(__pyx_v_self->_protocol, __pyx_v_space, __pyx_v_index); if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 211, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyInt_From_uint32_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 211, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "asynctnt/iproto/db.pyx":212
 *         space = self._protocol.transform_space(space)
 *         index = self._protocol.transform_index(space, index)
 *         iterator = self._protocol.transform_iterator(iterator)             # <<<<<<<<<<<<<<
 * 
 *         return self.execute(
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8asynctnt_6iproto_8protocol_BaseProtocol *)__pyx_v_self->_protocol->__pyx_base.__pyx_vtab)->transform_iterator(__pyx_v_self->_protocol, __pyx_v_iterator); if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 212, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyInt_From_uint32_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 212, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_iterator, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "asynctnt/iproto/db.pyx":214
 *         iterator = self._protocol.transform_iterator(iterator)
 * 
 *         return self.execute(             # <<<<<<<<<<<<<<
 *             self._select(space, index, key, offset, limit, iterator),
 *             timeout
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_execute); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 214, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "asynctnt/iproto/db.pyx":215
 * 
 *         return self.execute(
 *             self._select(space, index, key, offset, limit, iterator),             # <<<<<<<<<<<<<<
 *             timeout
 *         )
 */
  __pyx_t_1 = __Pyx_PyInt_As_uint32_t(__pyx_v_space); if (unlikely((__pyx_t_1 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(10, 215, __pyx_L1_error)
  __pyx_t_4 = __Pyx_PyInt_As_uint32_t(__pyx_v_index); if (unlikely((__pyx_t_4 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(10, 215, __pyx_L1_error)
  if (!(likely(PyList_CheckExact(__pyx_v_key))||((__pyx_v_key) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_v_key)->tp_name), 0))) __PYX_ERR(10, 215, __pyx_L1_error)
  __pyx_t_5 = __Pyx_PyInt_As_uint64_t(__pyx_v_offset); if (unlikely((__pyx_t_5 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(10, 215, __pyx_L1_error)
  __pyx_t_6 = __Pyx_PyInt_As_uint64_t(__pyx_v_limit); if (unlikely((__pyx_t_6 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(10, 215, __pyx_L1_error)
  __pyx_t_7 = __Pyx_PyInt_As_uint32_t(__pyx_v_iterator); if (unlikely((__pyx_t_7 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(10, 215, __pyx_L1_error)
  __pyx_t_8 = ((PyObject *)((struct __pyx_vtabstruct_8asynctnt_6iproto_8protocol_Db *)__pyx_v_self->__pyx_vtab)->_select(__pyx_v_self, __pyx_t_1, __pyx_t_4, ((PyObject*)__pyx_v_key), __pyx_t_5, __pyx_t_6, __pyx_t_7)); if (unlikely(!__pyx_t_8)) __PYX_ERR(10, 215, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);

  /* "asynctnt/iproto/db.pyx":217
 *             self._select(space, index, key, offset, limit, iterator),
 *             timeout
 *         )             # <<<<<<<<<<<<<<
 * 
 *     def insert(self, space, t, replace=False, timeout=-1):
 */
  __pyx_t_9 = NULL;
  __pyx_t_10 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_9)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_9);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_10 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_t_8, __pyx_v_timeout};
    __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 214, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_t_8, __pyx_v_timeout};
    __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 214, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  } else
  #endif
  {
    __pyx_t_11 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(10, 214, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    if (__pyx_t_9) {
      __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_9); __pyx_t_9 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_11, 0+__pyx_t_10, __pyx_t_8);
    __Pyx_INCREF(__pyx_v_timeout);
    __Pyx_GIVEREF(__pyx_v_timeout);
    PyTuple_SET_ITEM(__pyx_t_11, 1+__pyx_t_10, __pyx_v_timeout);
    __pyx_t_8 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_11, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 214, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "asynctnt/iproto/db.pyx":208
 *         )
 * 
 *     def select(self, space, key=None,             # <<<<<<<<<<<<<<
 *                  offset=0, limit=0xffffffff, index=0, iterator=0, timeout=-1):
 *         space = self._protocol.transform_space(space)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("asynctnt.iproto.protocol.Db.select", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_space);
  __Pyx_XDECREF(__pyx_v_index);
  __Pyx_XDECREF(__pyx_v_iterator);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/db.pyx":219
 *         )
 * 
 *     def insert(self, space, t, replace=False, timeout=-1):             # <<<<<<<<<<<<<<
 *         space = self._protocol.transform_space(space)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_2Db_16insert(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_2Db_16insert(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_space = 0;
  PyObject *__pyx_v_t = 0;
  PyObject *__pyx_v_replace = 0;
  PyObject *__pyx_v_timeout = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("insert (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_space,&__pyx_n_s_t,&__pyx_n_s_replace,&__pyx_n_s_timeout,0};
    PyObject* values[4] = {0,0,0,0};
    values[2] = ((PyObject *)Py_False);
    values[3] = ((PyObject *)__pyx_int_neg_1);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        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;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_space)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("insert", 0, 2, 4, 1); __PYX_ERR(10, 219, __pyx_L3_error)
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_replace);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_timeout);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "insert") < 0)) __PYX_ERR(10, 219, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_space = values[0];
    __pyx_v_t = values[1];
    __pyx_v_replace = values[2];
    __pyx_v_timeout = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("insert", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 219, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("asynctnt.iproto.protocol.Db.insert", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8asynctnt_6iproto_8protocol_2Db_15insert(((struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *)__pyx_v_self), __pyx_v_space, __pyx_v_t, __pyx_v_replace, __pyx_v_timeout);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_2Db_15insert(struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *__pyx_v_self, PyObject *__pyx_v_space, PyObject *__pyx_v_t, PyObject *__pyx_v_replace, PyObject *__pyx_v_timeout) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  uint32_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  __Pyx_RefNannySetupContext("insert", 0);
  __Pyx_INCREF(__pyx_v_space);

  /* "asynctnt/iproto/db.pyx":220
 * 
 *     def insert(self, space, t, replace=False, timeout=-1):
 *         space = self._protocol.transform_space(space)             # <<<<<<<<<<<<<<
 * 
 *         return self.execute(
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8asynctnt_6iproto_8protocol_BaseProtocol *)__pyx_v_self->_protocol->__pyx_base.__pyx_vtab)->transform_space(__pyx_v_self->_protocol, __pyx_v_space); if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 220, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyInt_From_uint32_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 220, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_space, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "asynctnt/iproto/db.pyx":222
 *         space = self._protocol.transform_space(space)
 * 
 *         return self.execute(             # <<<<<<<<<<<<<<
 *             self._insert(space, t, replace),
 *             timeout
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_execute); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 222, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "asynctnt/iproto/db.pyx":223
 * 
 *         return self.execute(
 *             self._insert(space, t, replace),             # <<<<<<<<<<<<<<
 *             timeout
 *         )
 */
  __pyx_t_1 = __Pyx_PyInt_As_uint32_t(__pyx_v_space); if (unlikely((__pyx_t_1 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(10, 223, __pyx_L1_error)
  if (!(likely(PyList_CheckExact(__pyx_v_t))||((__pyx_v_t) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_v_t)->tp_name), 0))) __PYX_ERR(10, 223, __pyx_L1_error)
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_replace); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(10, 223, __pyx_L1_error)
  __pyx_t_5 = ((PyObject *)((struct __pyx_vtabstruct_8asynctnt_6iproto_8protocol_Db *)__pyx_v_self->__pyx_vtab)->_insert(__pyx_v_self, __pyx_t_1, ((PyObject*)__pyx_v_t), __pyx_t_4)); if (unlikely(!__pyx_t_5)) __PYX_ERR(10, 223, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);

  /* "asynctnt/iproto/db.pyx":225
 *             self._insert(space, t, replace),
 *             timeout
 *         )             # <<<<<<<<<<<<<<
 * 
 *     def replace(self, space, t, timeout=-1):
 */
  __pyx_t_6 = NULL;
  __pyx_t_7 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_7 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_5, __pyx_v_timeout};
    __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 222, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_5, __pyx_v_timeout};
    __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 222, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else
  #endif
  {
    __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(10, 222, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    if (__pyx_t_6) {
      __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_5);
    __Pyx_INCREF(__pyx_v_timeout);
    __Pyx_GIVEREF(__pyx_v_timeout);
    PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_v_timeout);
    __pyx_t_5 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 222, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "asynctnt/iproto/db.pyx":219
 *         )
 * 
 *     def insert(self, space, t, replace=False, timeout=-1):             # <<<<<<<<<<<<<<
 *         space = self._protocol.transform_space(space)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("asynctnt.iproto.protocol.Db.insert", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_space);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/db.pyx":227
 *         )
 * 
 *     def replace(self, space, t, timeout=-1):             # <<<<<<<<<<<<<<
 *         return self.insert(space, t, replace=True, timeout=timeout)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_2Db_18replace(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_2Db_18replace(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_space = 0;
  PyObject *__pyx_v_t = 0;
  PyObject *__pyx_v_timeout = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("replace (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_space,&__pyx_n_s_t,&__pyx_n_s_timeout,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((PyObject *)__pyx_int_neg_1);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_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;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_space)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("replace", 0, 2, 3, 1); __PYX_ERR(10, 227, __pyx_L3_error)
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_timeout);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "replace") < 0)) __PYX_ERR(10, 227, __pyx_L3_error)
      }
    } else {
      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);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_space = values[0];
    __pyx_v_t = values[1];
    __pyx_v_timeout = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("replace", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 227, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("asynctnt.iproto.protocol.Db.replace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8asynctnt_6iproto_8protocol_2Db_17replace(((struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *)__pyx_v_self), __pyx_v_space, __pyx_v_t, __pyx_v_timeout);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_2Db_17replace(struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *__pyx_v_self, PyObject *__pyx_v_space, PyObject *__pyx_v_t, PyObject *__pyx_v_timeout) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("replace", 0);

  /* "asynctnt/iproto/db.pyx":228
 * 
 *     def replace(self, space, t, timeout=-1):
 *         return self.insert(space, t, replace=True, timeout=timeout)             # <<<<<<<<<<<<<<
 * 
 *     def delete(self, space, key, index=0, timeout=-1):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_insert); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 228, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 228, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_space);
  __Pyx_GIVEREF(__pyx_v_space);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_space);
  __Pyx_INCREF(__pyx_v_t);
  __Pyx_GIVEREF(__pyx_v_t);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_t);
  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 228, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_replace, Py_True) < 0) __PYX_ERR(10, 228, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_timeout, __pyx_v_timeout) < 0) __PYX_ERR(10, 228, __pyx_L1_error)
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 228, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "asynctnt/iproto/db.pyx":227
 *         )
 * 
 *     def replace(self, space, t, timeout=-1):             # <<<<<<<<<<<<<<
 *         return self.insert(space, t, replace=True, timeout=timeout)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("asynctnt.iproto.protocol.Db.replace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/db.pyx":230
 *         return self.insert(space, t, replace=True, timeout=timeout)
 * 
 *     def delete(self, space, key, index=0, timeout=-1):             # <<<<<<<<<<<<<<
 *         space = self._protocol.transform_space(space)
 *         index = self._protocol.transform_index(space, index)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_2Db_20delete(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_2Db_20delete(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_space = 0;
  PyObject *__pyx_v_key = 0;
  PyObject *__pyx_v_index = 0;
  PyObject *__pyx_v_timeout = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("delete (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_space,&__pyx_n_s_key,&__pyx_n_s_index,&__pyx_n_s_timeout,0};
    PyObject* values[4] = {0,0,0,0};
    values[2] = ((PyObject *)__pyx_int_0);
    values[3] = ((PyObject *)__pyx_int_neg_1);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        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;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_space)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_key)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("delete", 0, 2, 4, 1); __PYX_ERR(10, 230, __pyx_L3_error)
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_index);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_timeout);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "delete") < 0)) __PYX_ERR(10, 230, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_space = values[0];
    __pyx_v_key = values[1];
    __pyx_v_index = values[2];
    __pyx_v_timeout = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("delete", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 230, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("asynctnt.iproto.protocol.Db.delete", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8asynctnt_6iproto_8protocol_2Db_19delete(((struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *)__pyx_v_self), __pyx_v_space, __pyx_v_key, __pyx_v_index, __pyx_v_timeout);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_2Db_19delete(struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *__pyx_v_self, PyObject *__pyx_v_space, PyObject *__pyx_v_key, PyObject *__pyx_v_index, PyObject *__pyx_v_timeout) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  uint32_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  uint32_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  __Pyx_RefNannySetupContext("delete", 0);
  __Pyx_INCREF(__pyx_v_space);
  __Pyx_INCREF(__pyx_v_index);

  /* "asynctnt/iproto/db.pyx":231
 * 
 *     def delete(self, space, key, index=0, timeout=-1):
 *         space = self._protocol.transform_space(space)             # <<<<<<<<<<<<<<
 *         index = self._protocol.transform_index(space, index)
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8asynctnt_6iproto_8protocol_BaseProtocol *)__pyx_v_self->_protocol->__pyx_base.__pyx_vtab)->transform_space(__pyx_v_self->_protocol, __pyx_v_space); if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 231, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyInt_From_uint32_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 231, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_space, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "asynctnt/iproto/db.pyx":232
 *     def delete(self, space, key, index=0, timeout=-1):
 *         space = self._protocol.transform_space(space)
 *         index = self._protocol.transform_index(space, index)             # <<<<<<<<<<<<<<
 * 
 *         return self.execute(
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8asynctnt_6iproto_8protocol_BaseProtocol *)__pyx_v_self->_protocol->__pyx_base.__pyx_vtab)->transform_index(__pyx_v_self->_protocol, __pyx_v_space, __pyx_v_index); if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 232, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyInt_From_uint32_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 232, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "asynctnt/iproto/db.pyx":234
 *         index = self._protocol.transform_index(space, index)
 * 
 *         return self.execute(             # <<<<<<<<<<<<<<
 *             self._delete(space, index, key),
 *             timeout
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_execute); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 234, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "asynctnt/iproto/db.pyx":235
 * 
 *         return self.execute(
 *             self._delete(space, index, key),             # <<<<<<<<<<<<<<
 *             timeout
 *         )
 */
  __pyx_t_1 = __Pyx_PyInt_As_uint32_t(__pyx_v_space); if (unlikely((__pyx_t_1 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(10, 235, __pyx_L1_error)
  __pyx_t_4 = __Pyx_PyInt_As_uint32_t(__pyx_v_index); if (unlikely((__pyx_t_4 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(10, 235, __pyx_L1_error)
  if (!(likely(PyList_CheckExact(__pyx_v_key))||((__pyx_v_key) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_v_key)->tp_name), 0))) __PYX_ERR(10, 235, __pyx_L1_error)
  __pyx_t_5 = ((PyObject *)((struct __pyx_vtabstruct_8asynctnt_6iproto_8protocol_Db *)__pyx_v_self->__pyx_vtab)->_delete(__pyx_v_self, __pyx_t_1, __pyx_t_4, ((PyObject*)__pyx_v_key))); if (unlikely(!__pyx_t_5)) __PYX_ERR(10, 235, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);

  /* "asynctnt/iproto/db.pyx":237
 *             self._delete(space, index, key),
 *             timeout
 *         )             # <<<<<<<<<<<<<<
 * 
 *     def update(self, space, key, operations, index=0, timeout=-1):
 */
  __pyx_t_6 = NULL;
  __pyx_t_7 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_7 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_5, __pyx_v_timeout};
    __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 234, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_5, __pyx_v_timeout};
    __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 234, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else
  #endif
  {
    __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(10, 234, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    if (__pyx_t_6) {
      __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_5);
    __Pyx_INCREF(__pyx_v_timeout);
    __Pyx_GIVEREF(__pyx_v_timeout);
    PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_v_timeout);
    __pyx_t_5 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 234, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "asynctnt/iproto/db.pyx":230
 *         return self.insert(space, t, replace=True, timeout=timeout)
 * 
 *     def delete(self, space, key, index=0, timeout=-1):             # <<<<<<<<<<<<<<
 *         space = self._protocol.transform_space(space)
 *         index = self._protocol.transform_index(space, index)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("asynctnt.iproto.protocol.Db.delete", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_space);
  __Pyx_XDECREF(__pyx_v_index);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/db.pyx":239
 *         )
 * 
 *     def update(self, space, key, operations, index=0, timeout=-1):             # <<<<<<<<<<<<<<
 *         space = self._protocol.transform_space(space)
 *         index = self._protocol.transform_index(space, index)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_2Db_22update(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_2Db_22update(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_space = 0;
  PyObject *__pyx_v_key = 0;
  PyObject *__pyx_v_operations = 0;
  PyObject *__pyx_v_index = 0;
  PyObject *__pyx_v_timeout = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("update (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_space,&__pyx_n_s_key,&__pyx_n_s_operations,&__pyx_n_s_index,&__pyx_n_s_timeout,0};
    PyObject* values[5] = {0,0,0,0,0};
    values[3] = ((PyObject *)__pyx_int_0);
    values[4] = ((PyObject *)__pyx_int_neg_1);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        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;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_space)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_key)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("update", 0, 3, 5, 1); __PYX_ERR(10, 239, __pyx_L3_error)
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_operations)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("update", 0, 3, 5, 2); __PYX_ERR(10, 239, __pyx_L3_error)
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_index);
          if (value) { values[3] = value; kw_args--; }
        }
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_timeout);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "update") < 0)) __PYX_ERR(10, 239, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_space = values[0];
    __pyx_v_key = values[1];
    __pyx_v_operations = values[2];
    __pyx_v_index = values[3];
    __pyx_v_timeout = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("update", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 239, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("asynctnt.iproto.protocol.Db.update", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8asynctnt_6iproto_8protocol_2Db_21update(((struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *)__pyx_v_self), __pyx_v_space, __pyx_v_key, __pyx_v_operations, __pyx_v_index, __pyx_v_timeout);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_2Db_21update(struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *__pyx_v_self, PyObject *__pyx_v_space, PyObject *__pyx_v_key, PyObject *__pyx_v_operations, PyObject *__pyx_v_index, PyObject *__pyx_v_timeout) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  uint32_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  uint32_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  __Pyx_RefNannySetupContext("update", 0);
  __Pyx_INCREF(__pyx_v_space);
  __Pyx_INCREF(__pyx_v_index);

  /* "asynctnt/iproto/db.pyx":240
 * 
 *     def update(self, space, key, operations, index=0, timeout=-1):
 *         space = self._protocol.transform_space(space)             # <<<<<<<<<<<<<<
 *         index = self._protocol.transform_index(space, index)
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8asynctnt_6iproto_8protocol_BaseProtocol *)__pyx_v_self->_protocol->__pyx_base.__pyx_vtab)->transform_space(__pyx_v_self->_protocol, __pyx_v_space); if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 240, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyInt_From_uint32_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 240, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_space, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "asynctnt/iproto/db.pyx":241
 *     def update(self, space, key, operations, index=0, timeout=-1):
 *         space = self._protocol.transform_space(space)
 *         index = self._protocol.transform_index(space, index)             # <<<<<<<<<<<<<<
 * 
 *         return self.execute(
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8asynctnt_6iproto_8protocol_BaseProtocol *)__pyx_v_self->_protocol->__pyx_base.__pyx_vtab)->transform_index(__pyx_v_self->_protocol, __pyx_v_space, __pyx_v_index); if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 241, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyInt_From_uint32_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 241, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "asynctnt/iproto/db.pyx":243
 *         index = self._protocol.transform_index(space, index)
 * 
 *         return self.execute(             # <<<<<<<<<<<<<<
 *             self._update(space, index, key, operations),
 *             timeout
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_execute); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 243, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "asynctnt/iproto/db.pyx":244
 * 
 *         return self.execute(
 *             self._update(space, index, key, operations),             # <<<<<<<<<<<<<<
 *             timeout
 *         )
 */
  __pyx_t_1 = __Pyx_PyInt_As_uint32_t(__pyx_v_space); if (unlikely((__pyx_t_1 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(10, 244, __pyx_L1_error)
  __pyx_t_4 = __Pyx_PyInt_As_uint32_t(__pyx_v_index); if (unlikely((__pyx_t_4 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(10, 244, __pyx_L1_error)
  if (!(likely(PyList_CheckExact(__pyx_v_key))||((__pyx_v_key) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_v_key)->tp_name), 0))) __PYX_ERR(10, 244, __pyx_L1_error)
  if (!(likely(PyList_CheckExact(__pyx_v_operations))||((__pyx_v_operations) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_v_operations)->tp_name), 0))) __PYX_ERR(10, 244, __pyx_L1_error)
  __pyx_t_5 = ((PyObject *)((struct __pyx_vtabstruct_8asynctnt_6iproto_8protocol_Db *)__pyx_v_self->__pyx_vtab)->_update(__pyx_v_self, __pyx_t_1, __pyx_t_4, ((PyObject*)__pyx_v_key), ((PyObject*)__pyx_v_operations))); if (unlikely(!__pyx_t_5)) __PYX_ERR(10, 244, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);

  /* "asynctnt/iproto/db.pyx":246
 *             self._update(space, index, key, operations),
 *             timeout
 *         )             # <<<<<<<<<<<<<<
 * 
 *     def upsert(self, space, t, operations, timeout=-1):
 */
  __pyx_t_6 = NULL;
  __pyx_t_7 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_7 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_5, __pyx_v_timeout};
    __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 243, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_5, __pyx_v_timeout};
    __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 243, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else
  #endif
  {
    __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(10, 243, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    if (__pyx_t_6) {
      __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_5);
    __Pyx_INCREF(__pyx_v_timeout);
    __Pyx_GIVEREF(__pyx_v_timeout);
    PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_v_timeout);
    __pyx_t_5 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 243, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "asynctnt/iproto/db.pyx":239
 *         )
 * 
 *     def update(self, space, key, operations, index=0, timeout=-1):             # <<<<<<<<<<<<<<
 *         space = self._protocol.transform_space(space)
 *         index = self._protocol.transform_index(space, index)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("asynctnt.iproto.protocol.Db.update", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_space);
  __Pyx_XDECREF(__pyx_v_index);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/db.pyx":248
 *         )
 * 
 *     def upsert(self, space, t, operations, timeout=-1):             # <<<<<<<<<<<<<<
 *         space = self._protocol.transform_space(space)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_2Db_24upsert(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_2Db_24upsert(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_space = 0;
  PyObject *__pyx_v_t = 0;
  PyObject *__pyx_v_operations = 0;
  PyObject *__pyx_v_timeout = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("upsert (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_space,&__pyx_n_s_t,&__pyx_n_s_operations,&__pyx_n_s_timeout,0};
    PyObject* values[4] = {0,0,0,0};
    values[3] = ((PyObject *)__pyx_int_neg_1);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        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;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_space)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("upsert", 0, 3, 4, 1); __PYX_ERR(10, 248, __pyx_L3_error)
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_operations)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("upsert", 0, 3, 4, 2); __PYX_ERR(10, 248, __pyx_L3_error)
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_timeout);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "upsert") < 0)) __PYX_ERR(10, 248, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_space = values[0];
    __pyx_v_t = values[1];
    __pyx_v_operations = values[2];
    __pyx_v_timeout = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("upsert", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 248, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("asynctnt.iproto.protocol.Db.upsert", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8asynctnt_6iproto_8protocol_2Db_23upsert(((struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *)__pyx_v_self), __pyx_v_space, __pyx_v_t, __pyx_v_operations, __pyx_v_timeout);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_2Db_23upsert(struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *__pyx_v_self, PyObject *__pyx_v_space, PyObject *__pyx_v_t, PyObject *__pyx_v_operations, PyObject *__pyx_v_timeout) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  uint32_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  __Pyx_RefNannySetupContext("upsert", 0);
  __Pyx_INCREF(__pyx_v_space);

  /* "asynctnt/iproto/db.pyx":249
 * 
 *     def upsert(self, space, t, operations, timeout=-1):
 *         space = self._protocol.transform_space(space)             # <<<<<<<<<<<<<<
 * 
 *         return self.execute(
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8asynctnt_6iproto_8protocol_BaseProtocol *)__pyx_v_self->_protocol->__pyx_base.__pyx_vtab)->transform_space(__pyx_v_self->_protocol, __pyx_v_space); if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 249, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyInt_From_uint32_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 249, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_space, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "asynctnt/iproto/db.pyx":251
 *         space = self._protocol.transform_space(space)
 * 
 *         return self.execute(             # <<<<<<<<<<<<<<
 *             self._upsert(space, t, operations),
 *             timeout
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_execute); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 251, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "asynctnt/iproto/db.pyx":252
 * 
 *         return self.execute(
 *             self._upsert(space, t, operations),             # <<<<<<<<<<<<<<
 *             timeout
 *         )
 */
  __pyx_t_1 = __Pyx_PyInt_As_uint32_t(__pyx_v_space); if (unlikely((__pyx_t_1 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(10, 252, __pyx_L1_error)
  if (!(likely(PyList_CheckExact(__pyx_v_t))||((__pyx_v_t) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_v_t)->tp_name), 0))) __PYX_ERR(10, 252, __pyx_L1_error)
  if (!(likely(PyList_CheckExact(__pyx_v_operations))||((__pyx_v_operations) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_v_operations)->tp_name), 0))) __PYX_ERR(10, 252, __pyx_L1_error)
  __pyx_t_4 = ((PyObject *)((struct __pyx_vtabstruct_8asynctnt_6iproto_8protocol_Db *)__pyx_v_self->__pyx_vtab)->_upsert(__pyx_v_self, __pyx_t_1, ((PyObject*)__pyx_v_t), ((PyObject*)__pyx_v_operations))); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 252, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);

  /* "asynctnt/iproto/db.pyx":254
 *             self._upsert(space, t, operations),
 *             timeout
 *         )             # <<<<<<<<<<<<<<
 */
  __pyx_t_5 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_6 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_4, __pyx_v_timeout};
    __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 251, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_4, __pyx_v_timeout};
    __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 251, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  {
    __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(10, 251, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (__pyx_t_5) {
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_t_4);
    __Pyx_INCREF(__pyx_v_timeout);
    __Pyx_GIVEREF(__pyx_v_timeout);
    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_v_timeout);
    __pyx_t_4 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 251, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "asynctnt/iproto/db.pyx":248
 *         )
 * 
 *     def upsert(self, space, t, operations, timeout=-1):             # <<<<<<<<<<<<<<
 *         space = self._protocol.transform_space(space)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("asynctnt.iproto.protocol.Db.upsert", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_space);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/coreproto.pyx":20
 * 
 * cdef class CoreProtocol:
 *     def __init__(self,             # <<<<<<<<<<<<<<
 *                  host, port,
 *                  encoding=None,
 */

/* Python wrapper */
static int __pyx_pw_8asynctnt_6iproto_8protocol_12CoreProtocol_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_8asynctnt_6iproto_8protocol_12CoreProtocol_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_host = 0;
  PyObject *__pyx_v_port = 0;
  PyObject *__pyx_v_encoding = 0;
  PyObject *__pyx_v_initial_read_buffer_size = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_host,&__pyx_n_s_port,&__pyx_n_s_encoding,&__pyx_n_s_initial_read_buffer_size,0};
    PyObject* values[4] = {0,0,0,0};

    /* "asynctnt/iproto/coreproto.pyx":22
 *     def __init__(self,
 *                  host, port,
 *                  encoding=None,             # <<<<<<<<<<<<<<
 *                  initial_read_buffer_size=None):
 *         self.host = host
 */
    values[2] = ((PyObject *)Py_None);

    /* "asynctnt/iproto/coreproto.pyx":23
 *                  host, port,
 *                  encoding=None,
 *                  initial_read_buffer_size=None):             # <<<<<<<<<<<<<<
 *         self.host = host
 *         self.port = port
 */
    values[3] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        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;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_host)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_port)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 4, 1); __PYX_ERR(2, 20, __pyx_L3_error)
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_encoding);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_initial_read_buffer_size);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(2, 20, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_host = values[0];
    __pyx_v_port = values[1];
    __pyx_v_encoding = values[2];
    __pyx_v_initial_read_buffer_size = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 20, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("asynctnt.iproto.protocol.CoreProtocol.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8asynctnt_6iproto_8protocol_12CoreProtocol___init__(((struct __pyx_obj_8asynctnt_6iproto_8protocol_CoreProtocol *)__pyx_v_self), __pyx_v_host, __pyx_v_port, __pyx_v_encoding, __pyx_v_initial_read_buffer_size);

  /* "asynctnt/iproto/coreproto.pyx":20
 * 
 * cdef class CoreProtocol:
 *     def __init__(self,             # <<<<<<<<<<<<<<
 *                  host, port,
 *                  encoding=None,
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_8asynctnt_6iproto_8protocol_12CoreProtocol___init__(struct __pyx_obj_8asynctnt_6iproto_8protocol_CoreProtocol *__pyx_v_self, PyObject *__pyx_v_host, PyObject *__pyx_v_port, PyObject *__pyx_v_encoding, PyObject *__pyx_v_initial_read_buffer_size) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  struct __pyx_opt_args_8asynctnt_6iproto_8protocol_10ReadBuffer_new __pyx_t_7;
  __Pyx_RefNannySetupContext("__init__", 0);
  __Pyx_INCREF(__pyx_v_encoding);
  __Pyx_INCREF(__pyx_v_initial_read_buffer_size);

  /* "asynctnt/iproto/coreproto.pyx":24
 *                  encoding=None,
 *                  initial_read_buffer_size=None):
 *         self.host = host             # <<<<<<<<<<<<<<
 *         self.port = port
 * 
 */
  __Pyx_INCREF(__pyx_v_host);
  __Pyx_GIVEREF(__pyx_v_host);
  __Pyx_GOTREF(__pyx_v_self->host);
  __Pyx_DECREF(__pyx_v_self->host);
  __pyx_v_self->host = __pyx_v_host;

  /* "asynctnt/iproto/coreproto.pyx":25
 *                  initial_read_buffer_size=None):
 *         self.host = host
 *         self.port = port             # <<<<<<<<<<<<<<
 * 
 *         encoding = encoding or b'utf-8'
 */
  __Pyx_INCREF(__pyx_v_port);
  __Pyx_GIVEREF(__pyx_v_port);
  __Pyx_GOTREF(__pyx_v_self->port);
  __Pyx_DECREF(__pyx_v_self->port);
  __pyx_v_self->port = __pyx_v_port;

  /* "asynctnt/iproto/coreproto.pyx":27
 *         self.port = port
 * 
 *         encoding = encoding or b'utf-8'             # <<<<<<<<<<<<<<
 *         if isinstance(encoding, str):
 *             self.encoding = encoding.encode()
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_encoding); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(2, 27, __pyx_L1_error)
  if (!__pyx_t_2) {
  } else {
    __Pyx_INCREF(__pyx_v_encoding);
    __pyx_t_1 = __pyx_v_encoding;
    goto __pyx_L3_bool_binop_done;
  }
  __Pyx_INCREF(__pyx_kp_b_utf_8);
  __pyx_t_1 = __pyx_kp_b_utf_8;
  __pyx_L3_bool_binop_done:;
  __Pyx_DECREF_SET(__pyx_v_encoding, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "asynctnt/iproto/coreproto.pyx":28
 * 
 *         encoding = encoding or b'utf-8'
 *         if isinstance(encoding, str):             # <<<<<<<<<<<<<<
 *             self.encoding = encoding.encode()
 *         elif isinstance(self.encoding, bytes):
 */
  __pyx_t_2 = PyString_Check(__pyx_v_encoding); 
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "asynctnt/iproto/coreproto.pyx":29
 *         encoding = encoding or b'utf-8'
 *         if isinstance(encoding, str):
 *             self.encoding = encoding.encode()             # <<<<<<<<<<<<<<
 *         elif isinstance(self.encoding, bytes):
 *             self.encoding = encoding
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_encoding, __pyx_n_s_encode); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 29, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    if (__pyx_t_5) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 29, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else {
      __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 29, __pyx_L1_error)
    }
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (!(likely(PyBytes_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(2, 29, __pyx_L1_error)
    __Pyx_GIVEREF(__pyx_t_1);
    __Pyx_GOTREF(__pyx_v_self->encoding);
    __Pyx_DECREF(__pyx_v_self->encoding);
    __pyx_v_self->encoding = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "asynctnt/iproto/coreproto.pyx":28
 * 
 *         encoding = encoding or b'utf-8'
 *         if isinstance(encoding, str):             # <<<<<<<<<<<<<<
 *             self.encoding = encoding.encode()
 *         elif isinstance(self.encoding, bytes):
 */
    goto __pyx_L5;
  }

  /* "asynctnt/iproto/coreproto.pyx":30
 *         if isinstance(encoding, str):
 *             self.encoding = encoding.encode()
 *         elif isinstance(self.encoding, bytes):             # <<<<<<<<<<<<<<
 *             self.encoding = encoding
 *         else:
 */
  __pyx_t_1 = __pyx_v_self->encoding;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_3 = PyBytes_Check(__pyx_t_1); 
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_2 = (__pyx_t_3 != 0);
  if (__pyx_t_2) {

    /* "asynctnt/iproto/coreproto.pyx":31
 *             self.encoding = encoding.encode()
 *         elif isinstance(self.encoding, bytes):
 *             self.encoding = encoding             # <<<<<<<<<<<<<<
 *         else:
 *             raise TypeError('encoding must be either str or bytes')
 */
    if (!(likely(PyBytes_CheckExact(__pyx_v_encoding))||((__pyx_v_encoding) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_v_encoding)->tp_name), 0))) __PYX_ERR(2, 31, __pyx_L1_error)
    __pyx_t_1 = __pyx_v_encoding;
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __Pyx_GOTREF(__pyx_v_self->encoding);
    __Pyx_DECREF(__pyx_v_self->encoding);
    __pyx_v_self->encoding = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "asynctnt/iproto/coreproto.pyx":30
 *         if isinstance(encoding, str):
 *             self.encoding = encoding.encode()
 *         elif isinstance(self.encoding, bytes):             # <<<<<<<<<<<<<<
 *             self.encoding = encoding
 *         else:
 */
    goto __pyx_L5;
  }

  /* "asynctnt/iproto/coreproto.pyx":33
 *             self.encoding = encoding
 *         else:
 *             raise TypeError('encoding must be either str or bytes')             # <<<<<<<<<<<<<<
 * 
 *         initial_read_buffer_size = initial_read_buffer_size or 0x20000
 */
  /*else*/ {
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__24, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 33, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(2, 33, __pyx_L1_error)
  }
  __pyx_L5:;

  /* "asynctnt/iproto/coreproto.pyx":35
 *             raise TypeError('encoding must be either str or bytes')
 * 
 *         initial_read_buffer_size = initial_read_buffer_size or 0x20000             # <<<<<<<<<<<<<<
 *         self.transport = None
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_initial_read_buffer_size); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(2, 35, __pyx_L1_error)
  if (!__pyx_t_2) {
  } else {
    __Pyx_INCREF(__pyx_v_initial_read_buffer_size);
    __pyx_t_1 = __pyx_v_initial_read_buffer_size;
    goto __pyx_L6_bool_binop_done;
  }
  __pyx_t_4 = __Pyx_PyInt_From_long(0x20000); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 35, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = __pyx_t_4;
  __pyx_t_4 = 0;
  __pyx_L6_bool_binop_done:;
  __Pyx_DECREF_SET(__pyx_v_initial_read_buffer_size, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "asynctnt/iproto/coreproto.pyx":36
 * 
 *         initial_read_buffer_size = initial_read_buffer_size or 0x20000
 *         self.transport = None             # <<<<<<<<<<<<<<
 * 
 *         self.rbuf = ReadBuffer.new(encoding, initial_read_buffer_size)
 */
  if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_transport, Py_None) < 0) __PYX_ERR(2, 36, __pyx_L1_error)

  /* "asynctnt/iproto/coreproto.pyx":38
 *         self.transport = None
 * 
 *         self.rbuf = ReadBuffer.new(encoding, initial_read_buffer_size)             # <<<<<<<<<<<<<<
 *         self.state = PROTOCOL_IDLE
 *         self.con_state = CONNECTION_BAD
 */
  if (!(likely(PyString_CheckExact(__pyx_v_encoding))||((__pyx_v_encoding) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_v_encoding)->tp_name), 0))) __PYX_ERR(2, 38, __pyx_L1_error)
  __pyx_t_6 = __Pyx_PyInt_As_size_t(__pyx_v_initial_read_buffer_size); if (unlikely((__pyx_t_6 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 38, __pyx_L1_error)
  __pyx_t_7.__pyx_n = 1;
  __pyx_t_7.initial_buffer_size = __pyx_t_6;
  __pyx_t_1 = ((PyObject *)__pyx_vtabptr_8asynctnt_6iproto_8protocol_ReadBuffer->new(((PyObject*)__pyx_v_encoding), &__pyx_t_7)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 38, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->rbuf);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->rbuf));
  __pyx_v_self->rbuf = ((struct __pyx_obj_8asynctnt_6iproto_8protocol_ReadBuffer *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "asynctnt/iproto/coreproto.pyx":39
 * 
 *         self.rbuf = ReadBuffer.new(encoding, initial_read_buffer_size)
 *         self.state = PROTOCOL_IDLE             # <<<<<<<<<<<<<<
 *         self.con_state = CONNECTION_BAD
 *         self.reqs = {}
 */
  __pyx_v_self->state = __pyx_e_8asynctnt_6iproto_8protocol_PROTOCOL_IDLE;

  /* "asynctnt/iproto/coreproto.pyx":40
 *         self.rbuf = ReadBuffer.new(encoding, initial_read_buffer_size)
 *         self.state = PROTOCOL_IDLE
 *         self.con_state = CONNECTION_BAD             # <<<<<<<<<<<<<<
 *         self.reqs = {}
 * 
 */
  __pyx_v_self->con_state = __pyx_e_8asynctnt_6iproto_8protocol_CONNECTION_BAD;

  /* "asynctnt/iproto/coreproto.pyx":41
 *         self.state = PROTOCOL_IDLE
 *         self.con_state = CONNECTION_BAD
 *         self.reqs = {}             # <<<<<<<<<<<<<<
 * 
 *         self.version = None
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 41, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->reqs);
  __Pyx_DECREF(__pyx_v_self->reqs);
  __pyx_v_self->reqs = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "asynctnt/iproto/coreproto.pyx":43
 *         self.reqs = {}
 * 
 *         self.version = None             # <<<<<<<<<<<<<<
 *         self.salt = None
 * 
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->version);
  __Pyx_DECREF(__pyx_v_self->version);
  __pyx_v_self->version = ((PyObject*)Py_None);

  /* "asynctnt/iproto/coreproto.pyx":44
 * 
 *         self.version = None
 *         self.salt = None             # <<<<<<<<<<<<<<
 * 
 *     cdef bint _is_connected(self):
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->salt);
  __Pyx_DECREF(__pyx_v_self->salt);
  __pyx_v_self->salt = ((PyObject*)Py_None);

  /* "asynctnt/iproto/coreproto.pyx":20
 * 
 * cdef class CoreProtocol:
 *     def __init__(self,             # <<<<<<<<<<<<<<
 *                  host, port,
 *                  encoding=None,
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("asynctnt.iproto.protocol.CoreProtocol.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_encoding);
  __Pyx_XDECREF(__pyx_v_initial_read_buffer_size);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/coreproto.pyx":46
 *         self.salt = None
 * 
 *     cdef bint _is_connected(self):             # <<<<<<<<<<<<<<
 *         return self.con_state != CONNECTION_BAD
 * 
 */

static int __pyx_f_8asynctnt_6iproto_8protocol_12CoreProtocol__is_connected(struct __pyx_obj_8asynctnt_6iproto_8protocol_CoreProtocol *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_is_connected", 0);

  /* "asynctnt/iproto/coreproto.pyx":47
 * 
 *     cdef bint _is_connected(self):
 *         return self.con_state != CONNECTION_BAD             # <<<<<<<<<<<<<<
 * 
 *     cdef bint _is_fully_connected(self):
 */
  __pyx_r = (__pyx_v_self->con_state != __pyx_e_8asynctnt_6iproto_8protocol_CONNECTION_BAD);
  goto __pyx_L0;

  /* "asynctnt/iproto/coreproto.pyx":46
 *         self.salt = None
 * 
 *     cdef bint _is_connected(self):             # <<<<<<<<<<<<<<
 *         return self.con_state != CONNECTION_BAD
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/coreproto.pyx":49
 *         return self.con_state != CONNECTION_BAD
 * 
 *     cdef bint _is_fully_connected(self):             # <<<<<<<<<<<<<<
 *         return self.con_state == CONNECTION_FULL
 * 
 */

static int __pyx_f_8asynctnt_6iproto_8protocol_12CoreProtocol__is_fully_connected(struct __pyx_obj_8asynctnt_6iproto_8protocol_CoreProtocol *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_is_fully_connected", 0);

  /* "asynctnt/iproto/coreproto.pyx":50
 * 
 *     cdef bint _is_fully_connected(self):
 *         return self.con_state == CONNECTION_FULL             # <<<<<<<<<<<<<<
 * 
 *     def is_connected(self):
 */
  __pyx_r = (__pyx_v_self->con_state == __pyx_e_8asynctnt_6iproto_8protocol_CONNECTION_FULL);
  goto __pyx_L0;

  /* "asynctnt/iproto/coreproto.pyx":49
 *         return self.con_state != CONNECTION_BAD
 * 
 *     cdef bint _is_fully_connected(self):             # <<<<<<<<<<<<<<
 *         return self.con_state == CONNECTION_FULL
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/coreproto.pyx":52
 *         return self.con_state == CONNECTION_FULL
 * 
 *     def is_connected(self):             # <<<<<<<<<<<<<<
 *         return self._is_connected()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_12CoreProtocol_3is_connected(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_12CoreProtocol_3is_connected(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("is_connected (wrapper)", 0);
  __pyx_r = __pyx_pf_8asynctnt_6iproto_8protocol_12CoreProtocol_2is_connected(((struct __pyx_obj_8asynctnt_6iproto_8protocol_CoreProtocol *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_12CoreProtocol_2is_connected(struct __pyx_obj_8asynctnt_6iproto_8protocol_CoreProtocol *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("is_connected", 0);

  /* "asynctnt/iproto/coreproto.pyx":53
 * 
 *     def is_connected(self):
 *         return self._is_connected()             # <<<<<<<<<<<<<<
 * 
 *     def is_fully_connected(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(((struct __pyx_vtabstruct_8asynctnt_6iproto_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_is_connected(__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 53, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "asynctnt/iproto/coreproto.pyx":52
 *         return self.con_state == CONNECTION_FULL
 * 
 *     def is_connected(self):             # <<<<<<<<<<<<<<
 *         return self._is_connected()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asynctnt.iproto.protocol.CoreProtocol.is_connected", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/coreproto.pyx":55
 *         return self._is_connected()
 * 
 *     def is_fully_connected(self):             # <<<<<<<<<<<<<<
 *         return self._is_fully_connected()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_12CoreProtocol_5is_fully_connected(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_12CoreProtocol_5is_fully_connected(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("is_fully_connected (wrapper)", 0);
  __pyx_r = __pyx_pf_8asynctnt_6iproto_8protocol_12CoreProtocol_4is_fully_connected(((struct __pyx_obj_8asynctnt_6iproto_8protocol_CoreProtocol *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_12CoreProtocol_4is_fully_connected(struct __pyx_obj_8asynctnt_6iproto_8protocol_CoreProtocol *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("is_fully_connected", 0);

  /* "asynctnt/iproto/coreproto.pyx":56
 * 
 *     def is_fully_connected(self):
 *         return self._is_fully_connected()             # <<<<<<<<<<<<<<
 * 
 *     def get_version(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(((struct __pyx_vtabstruct_8asynctnt_6iproto_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_is_fully_connected(__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 56, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "asynctnt/iproto/coreproto.pyx":55
 *         return self._is_connected()
 * 
 *     def is_fully_connected(self):             # <<<<<<<<<<<<<<
 *         return self._is_fully_connected()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asynctnt.iproto.protocol.CoreProtocol.is_fully_connected", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/coreproto.pyx":58
 *         return self._is_fully_connected()
 * 
 *     def get_version(self):             # <<<<<<<<<<<<<<
 *         return self.version
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_12CoreProtocol_7get_version(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_12CoreProtocol_7get_version(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_version (wrapper)", 0);
  __pyx_r = __pyx_pf_8asynctnt_6iproto_8protocol_12CoreProtocol_6get_version(((struct __pyx_obj_8asynctnt_6iproto_8protocol_CoreProtocol *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_12CoreProtocol_6get_version(struct __pyx_obj_8asynctnt_6iproto_8protocol_CoreProtocol *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_version", 0);

  /* "asynctnt/iproto/coreproto.pyx":59
 * 
 *     def get_version(self):
 *         return self.version             # <<<<<<<<<<<<<<
 * 
 *     cdef void _write(self, buf):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->version);
  __pyx_r = __pyx_v_self->version;
  goto __pyx_L0;

  /* "asynctnt/iproto/coreproto.pyx":58
 *         return self._is_fully_connected()
 * 
 *     def get_version(self):             # <<<<<<<<<<<<<<
 *         return self.version
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/coreproto.pyx":61
 *         return self.version
 * 
 *     cdef void _write(self, buf):             # <<<<<<<<<<<<<<
 *         # return
 *         self.transport.write(memoryview(buf))
 */

static void __pyx_f_8asynctnt_6iproto_8protocol_12CoreProtocol__write(struct __pyx_obj_8asynctnt_6iproto_8protocol_CoreProtocol *__pyx_v_self, PyObject *__pyx_v_buf) {
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("_write", 0);

  /* "asynctnt/iproto/coreproto.pyx":63
 *     cdef void _write(self, buf):
 *         # return
 *         self.transport.write(memoryview(buf))             # <<<<<<<<<<<<<<
 * 
 *     cdef void _on_data_received(self, data):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_transport); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 63, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_write); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 63, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 63, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_buf);
  __Pyx_GIVEREF(__pyx_v_buf);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_buf);
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_memoryview, __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 63, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (!__pyx_t_2) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 63, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_4};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 63, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_4};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 63, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    {
      __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 63, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); __pyx_t_2 = NULL;
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 63, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asynctnt/iproto/coreproto.pyx":61
 *         return self.version
 * 
 *     cdef void _write(self, buf):             # <<<<<<<<<<<<<<
 *         # return
 *         self.transport.write(memoryview(buf))
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_WriteUnraisable("asynctnt.iproto.protocol.CoreProtocol._write", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "asynctnt/iproto/coreproto.pyx":65
 *         self.transport.write(memoryview(buf))
 * 
 *     cdef void _on_data_received(self, data):             # <<<<<<<<<<<<<<
 *         cdef:
 *             size_t ruse, curr
 */

static void __pyx_f_8asynctnt_6iproto_8protocol_12CoreProtocol__on_data_received(struct __pyx_obj_8asynctnt_6iproto_8protocol_CoreProtocol *__pyx_v_self, PyObject *__pyx_v_data) {
  char const *__pyx_v_p;
  char const *__pyx_v_q;
  uint32_t __pyx_v_packet_len;
  PyObject *__pyx_v_req_p;
  struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *__pyx_v_req = 0;
  struct __pyx_obj_8asynctnt_6iproto_8protocol_Response *__pyx_v_resp = 0;
  PyObject *__pyx_v_waiter = 0;
  PyObject *__pyx_v_sync_obj = 0;
  char *__pyx_v_data_str;
  Py_ssize_t __pyx_v_data_len;
  Py_ssize_t __pyx_v_buf_len;
  char *__pyx_v_end;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  char *__pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  __Pyx_RefNannySetupContext("_on_data_received", 0);

  /* "asynctnt/iproto/coreproto.pyx":81
 *             ssize_t buf_len
 * 
 *         if not cpython.PyBytes_CheckExact(data):             # <<<<<<<<<<<<<<
 *             raise BufferError('_on_data_received: expected bytes object')
 * 
 */
  __pyx_t_1 = ((!(PyBytes_CheckExact(__pyx_v_data) != 0)) != 0);
  if (__pyx_t_1) {

    /* "asynctnt/iproto/coreproto.pyx":82
 * 
 *         if not cpython.PyBytes_CheckExact(data):
 *             raise BufferError('_on_data_received: expected bytes object')             # <<<<<<<<<<<<<<
 * 
 *         data_str = NULL
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_BufferError, __pyx_tuple__25, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 82, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(2, 82, __pyx_L1_error)

    /* "asynctnt/iproto/coreproto.pyx":81
 *             ssize_t buf_len
 * 
 *         if not cpython.PyBytes_CheckExact(data):             # <<<<<<<<<<<<<<
 *             raise BufferError('_on_data_received: expected bytes object')
 * 
 */
  }

  /* "asynctnt/iproto/coreproto.pyx":84
 *             raise BufferError('_on_data_received: expected bytes object')
 * 
 *         data_str = NULL             # <<<<<<<<<<<<<<
 *         data_len = 0
 *         cpython.bytes.PyBytes_AsStringAndSize(<bytes>data,
 */
  __pyx_v_data_str = NULL;

  /* "asynctnt/iproto/coreproto.pyx":85
 * 
 *         data_str = NULL
 *         data_len = 0             # <<<<<<<<<<<<<<
 *         cpython.bytes.PyBytes_AsStringAndSize(<bytes>data,
 *                                               &data_str,
 */
  __pyx_v_data_len = 0;

  /* "asynctnt/iproto/coreproto.pyx":86
 *         data_str = NULL
 *         data_len = 0
 *         cpython.bytes.PyBytes_AsStringAndSize(<bytes>data,             # <<<<<<<<<<<<<<
 *                                               &data_str,
 *                                               &data_len)
 */
  __pyx_t_3 = PyBytes_AsStringAndSize(__pyx_v_data, (&__pyx_v_data_str), ((Py_ssize_t *)(&__pyx_v_data_len))); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(2, 86, __pyx_L1_error)

  /* "asynctnt/iproto/coreproto.pyx":89
 *                                               &data_str,
 *                                               &data_len)
 *         if data_len == 0:             # <<<<<<<<<<<<<<
 *             return
 * 
 */
  __pyx_t_1 = ((__pyx_v_data_len == 0) != 0);
  if (__pyx_t_1) {

    /* "asynctnt/iproto/coreproto.pyx":90
 *                                               &data_len)
 *         if data_len == 0:
 *             return             # <<<<<<<<<<<<<<
 * 
 *         self.rbuf.extend(data_str, data_len)
 */
    goto __pyx_L0;

    /* "asynctnt/iproto/coreproto.pyx":89
 *                                               &data_str,
 *                                               &data_len)
 *         if data_len == 0:             # <<<<<<<<<<<<<<
 *             return
 * 
 */
  }

  /* "asynctnt/iproto/coreproto.pyx":92
 *             return
 * 
 *         self.rbuf.extend(data_str, data_len)             # <<<<<<<<<<<<<<
 * 
 *         if self.state == PROTOCOL_GREETING:
 */
  __pyx_t_3 = __pyx_f_8asynctnt_6iproto_8protocol_10ReadBuffer_extend(__pyx_v_self->rbuf, __pyx_v_data_str, __pyx_v_data_len); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(2, 92, __pyx_L1_error)

  /* "asynctnt/iproto/coreproto.pyx":94
 *         self.rbuf.extend(data_str, data_len)
 * 
 *         if self.state == PROTOCOL_GREETING:             # <<<<<<<<<<<<<<
 *             if self.rbuf.use < IPROTO_GREETING_SIZE:
 *                 # not enough for greeting
 */
  switch (__pyx_v_self->state) {
    case __pyx_e_8asynctnt_6iproto_8protocol_PROTOCOL_GREETING:

    /* "asynctnt/iproto/coreproto.pyx":95
 * 
 *         if self.state == PROTOCOL_GREETING:
 *             if self.rbuf.use < IPROTO_GREETING_SIZE:             # <<<<<<<<<<<<<<
 *                 # not enough for greeting
 *                 return
 */
    __pyx_t_1 = ((__pyx_v_self->rbuf->use < 0x80) != 0);
    if (__pyx_t_1) {

      /* "asynctnt/iproto/coreproto.pyx":97
 *             if self.rbuf.use < IPROTO_GREETING_SIZE:
 *                 # not enough for greeting
 *                 return             # <<<<<<<<<<<<<<
 *             self._process__greeting()
 *             self.rbuf.move(IPROTO_GREETING_SIZE)
 */
      goto __pyx_L0;

      /* "asynctnt/iproto/coreproto.pyx":95
 * 
 *         if self.state == PROTOCOL_GREETING:
 *             if self.rbuf.use < IPROTO_GREETING_SIZE:             # <<<<<<<<<<<<<<
 *                 # not enough for greeting
 *                 return
 */
    }

    /* "asynctnt/iproto/coreproto.pyx":98
 *                 # not enough for greeting
 *                 return
 *             self._process__greeting()             # <<<<<<<<<<<<<<
 *             self.rbuf.move(IPROTO_GREETING_SIZE)
 *         elif self.state == PROTOCOL_NORMAL:
 */
    ((struct __pyx_vtabstruct_8asynctnt_6iproto_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_process__greeting(__pyx_v_self);

    /* "asynctnt/iproto/coreproto.pyx":99
 *                 return
 *             self._process__greeting()
 *             self.rbuf.move(IPROTO_GREETING_SIZE)             # <<<<<<<<<<<<<<
 *         elif self.state == PROTOCOL_NORMAL:
 *             p = self.rbuf.buf
 */
    __pyx_f_8asynctnt_6iproto_8protocol_10ReadBuffer_move(__pyx_v_self->rbuf, 0x80);

    /* "asynctnt/iproto/coreproto.pyx":94
 *         self.rbuf.extend(data_str, data_len)
 * 
 *         if self.state == PROTOCOL_GREETING:             # <<<<<<<<<<<<<<
 *             if self.rbuf.use < IPROTO_GREETING_SIZE:
 *                 # not enough for greeting
 */
    break;

    /* "asynctnt/iproto/coreproto.pyx":100
 *             self._process__greeting()
 *             self.rbuf.move(IPROTO_GREETING_SIZE)
 *         elif self.state == PROTOCOL_NORMAL:             # <<<<<<<<<<<<<<
 *             p = self.rbuf.buf
 *             end = &self.rbuf.buf[self.rbuf.use]
 */
    case __pyx_e_8asynctnt_6iproto_8protocol_PROTOCOL_NORMAL:

    /* "asynctnt/iproto/coreproto.pyx":101
 *             self.rbuf.move(IPROTO_GREETING_SIZE)
 *         elif self.state == PROTOCOL_NORMAL:
 *             p = self.rbuf.buf             # <<<<<<<<<<<<<<
 *             end = &self.rbuf.buf[self.rbuf.use]
 * 
 */
    __pyx_t_4 = __pyx_v_self->rbuf->buf;
    __pyx_v_p = __pyx_t_4;

    /* "asynctnt/iproto/coreproto.pyx":102
 *         elif self.state == PROTOCOL_NORMAL:
 *             p = self.rbuf.buf
 *             end = &self.rbuf.buf[self.rbuf.use]             # <<<<<<<<<<<<<<
 * 
 *             while p < end:
 */
    __pyx_v_end = (&(__pyx_v_self->rbuf->buf[__pyx_v_self->rbuf->use]));

    /* "asynctnt/iproto/coreproto.pyx":104
 *             end = &self.rbuf.buf[self.rbuf.use]
 * 
 *             while p < end:             # <<<<<<<<<<<<<<
 *                 q = p  # q is temporary to parse packet length
 *                 buf_len = end - p
 */
    while (1) {
      __pyx_t_1 = ((__pyx_v_p < __pyx_v_end) != 0);
      if (!__pyx_t_1) break;

      /* "asynctnt/iproto/coreproto.pyx":105
 * 
 *             while p < end:
 *                 q = p  # q is temporary to parse packet length             # <<<<<<<<<<<<<<
 *                 buf_len = end - p
 *                 if buf_len < 5:
 */
      __pyx_v_q = __pyx_v_p;

      /* "asynctnt/iproto/coreproto.pyx":106
 *             while p < end:
 *                 q = p  # q is temporary to parse packet length
 *                 buf_len = end - p             # <<<<<<<<<<<<<<
 *                 if buf_len < 5:
 *                     # not enough
 */
      __pyx_v_buf_len = (__pyx_v_end - __pyx_v_p);

      /* "asynctnt/iproto/coreproto.pyx":107
 *                 q = p  # q is temporary to parse packet length
 *                 buf_len = end - p
 *                 if buf_len < 5:             # <<<<<<<<<<<<<<
 *                     # not enough
 *                     break
 */
      __pyx_t_1 = ((__pyx_v_buf_len < 5) != 0);
      if (__pyx_t_1) {

        /* "asynctnt/iproto/coreproto.pyx":109
 *                 if buf_len < 5:
 *                     # not enough
 *                     break             # <<<<<<<<<<<<<<
 * 
 *                 q = &q[1]  # skip to 2nd byte of packet length
 */
        goto __pyx_L7_break;

        /* "asynctnt/iproto/coreproto.pyx":107
 *                 q = p  # q is temporary to parse packet length
 *                 buf_len = end - p
 *                 if buf_len < 5:             # <<<<<<<<<<<<<<
 *                     # not enough
 *                     break
 */
      }

      /* "asynctnt/iproto/coreproto.pyx":111
 *                     break
 * 
 *                 q = &q[1]  # skip to 2nd byte of packet length             # <<<<<<<<<<<<<<
 *                 packet_len = mp_load_u32(&q)
 * 
 */
      __pyx_v_q = (&(__pyx_v_q[1]));

      /* "asynctnt/iproto/coreproto.pyx":112
 * 
 *                 q = &q[1]  # skip to 2nd byte of packet length
 *                 packet_len = mp_load_u32(&q)             # <<<<<<<<<<<<<<
 * 
 *                 if buf_len < 5 + packet_len:
 */
      __pyx_v_packet_len = mp_load_u32((&__pyx_v_q));

      /* "asynctnt/iproto/coreproto.pyx":114
 *                 packet_len = mp_load_u32(&q)
 * 
 *                 if buf_len < 5 + packet_len:             # <<<<<<<<<<<<<<
 *                     # not enough to read an entire packet
 *                     break
 */
      __pyx_t_1 = ((__pyx_v_buf_len < (5 + __pyx_v_packet_len)) != 0);
      if (__pyx_t_1) {

        /* "asynctnt/iproto/coreproto.pyx":116
 *                 if buf_len < 5 + packet_len:
 *                     # not enough to read an entire packet
 *                     break             # <<<<<<<<<<<<<<
 * 
 *                 p = &p[5]  # skip length header
 */
        goto __pyx_L7_break;

        /* "asynctnt/iproto/coreproto.pyx":114
 *                 packet_len = mp_load_u32(&q)
 * 
 *                 if buf_len < 5 + packet_len:             # <<<<<<<<<<<<<<
 *                     # not enough to read an entire packet
 *                     break
 */
      }

      /* "asynctnt/iproto/coreproto.pyx":118
 *                     break
 * 
 *                 p = &p[5]  # skip length header             # <<<<<<<<<<<<<<
 *                 resp = response_parse(p, packet_len, self.encoding)
 *                 p = &p[packet_len]  # skip entire packet
 */
      __pyx_v_p = (&(__pyx_v_p[5]));

      /* "asynctnt/iproto/coreproto.pyx":119
 * 
 *                 p = &p[5]  # skip length header
 *                 resp = response_parse(p, packet_len, self.encoding)             # <<<<<<<<<<<<<<
 *                 p = &p[packet_len]  # skip entire packet
 * 
 */
      __pyx_t_2 = __pyx_v_self->encoding;
      __Pyx_INCREF(__pyx_t_2);
      __pyx_t_5 = ((PyObject *)__pyx_f_8asynctnt_6iproto_8protocol_response_parse(__pyx_v_p, __pyx_v_packet_len, ((PyObject*)__pyx_t_2))); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 119, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF_SET(__pyx_v_resp, ((struct __pyx_obj_8asynctnt_6iproto_8protocol_Response *)__pyx_t_5));
      __pyx_t_5 = 0;

      /* "asynctnt/iproto/coreproto.pyx":120
 *                 p = &p[5]  # skip length header
 *                 resp = response_parse(p, packet_len, self.encoding)
 *                 p = &p[packet_len]  # skip entire packet             # <<<<<<<<<<<<<<
 * 
 *                 sync_obj = <object>resp.sync
 */
      __pyx_v_p = (&(__pyx_v_p[__pyx_v_packet_len]));

      /* "asynctnt/iproto/coreproto.pyx":122
 *                 p = &p[packet_len]  # skip entire packet
 * 
 *                 sync_obj = <object>resp.sync             # <<<<<<<<<<<<<<
 * 
 *                 req_p = cpython.dict.PyDict_GetItem(self.reqs, sync_obj)
 */
      __pyx_t_5 = __Pyx_PyInt_From_uint64_t(__pyx_v_resp->sync); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 122, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_2 = __pyx_t_5;
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF_SET(__pyx_v_sync_obj, __pyx_t_2);
      __pyx_t_2 = 0;

      /* "asynctnt/iproto/coreproto.pyx":124
 *                 sync_obj = <object>resp.sync
 * 
 *                 req_p = cpython.dict.PyDict_GetItem(self.reqs, sync_obj)             # <<<<<<<<<<<<<<
 *                 if req_p is NULL:
 *                     logger.warning('sync %d not found', resp.sync)
 */
      __pyx_t_2 = __pyx_v_self->reqs;
      __Pyx_INCREF(__pyx_t_2);
      __pyx_v_req_p = PyDict_GetItem(__pyx_t_2, __pyx_v_sync_obj);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "asynctnt/iproto/coreproto.pyx":125
 * 
 *                 req_p = cpython.dict.PyDict_GetItem(self.reqs, sync_obj)
 *                 if req_p is NULL:             # <<<<<<<<<<<<<<
 *                     logger.warning('sync %d not found', resp.sync)
 *                     continue
 */
      __pyx_t_1 = ((__pyx_v_req_p == NULL) != 0);
      if (__pyx_t_1) {

        /* "asynctnt/iproto/coreproto.pyx":126
 *                 req_p = cpython.dict.PyDict_GetItem(self.reqs, sync_obj)
 *                 if req_p is NULL:
 *                     logger.warning('sync %d not found', resp.sync)             # <<<<<<<<<<<<<<
 *                     continue
 * 
 */
        __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 126, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_warning); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 126, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_5 = __Pyx_PyInt_From_uint64_t(__pyx_v_resp->sync); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 126, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_7 = NULL;
        __pyx_t_3 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
          __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
          if (likely(__pyx_t_7)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
            __Pyx_INCREF(__pyx_t_7);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_6, function);
            __pyx_t_3 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_6)) {
          PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_kp_s_sync_d_not_found, __pyx_t_5};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_3, 2+__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 126, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
          PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_kp_s_sync_d_not_found, __pyx_t_5};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_3, 2+__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 126, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        } else
        #endif
        {
          __pyx_t_8 = PyTuple_New(2+__pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 126, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          if (__pyx_t_7) {
            __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7); __pyx_t_7 = NULL;
          }
          __Pyx_INCREF(__pyx_kp_s_sync_d_not_found);
          __Pyx_GIVEREF(__pyx_kp_s_sync_d_not_found);
          PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_3, __pyx_kp_s_sync_d_not_found);
          __Pyx_GIVEREF(__pyx_t_5);
          PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_3, __pyx_t_5);
          __pyx_t_5 = 0;
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 126, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        }
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

        /* "asynctnt/iproto/coreproto.pyx":127
 *                 if req_p is NULL:
 *                     logger.warning('sync %d not found', resp.sync)
 *                     continue             # <<<<<<<<<<<<<<
 * 
 *                 req = <Request>req_p
 */
        goto __pyx_L6_continue;

        /* "asynctnt/iproto/coreproto.pyx":125
 * 
 *                 req_p = cpython.dict.PyDict_GetItem(self.reqs, sync_obj)
 *                 if req_p is NULL:             # <<<<<<<<<<<<<<
 *                     logger.warning('sync %d not found', resp.sync)
 *                     continue
 */
      }

      /* "asynctnt/iproto/coreproto.pyx":129
 *                     continue
 * 
 *                 req = <Request>req_p             # <<<<<<<<<<<<<<
 * 
 *                 cpython.dict.PyDict_DelItem(self.reqs, sync_obj)
 */
      __pyx_t_2 = ((PyObject *)__pyx_v_req_p);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_XDECREF_SET(__pyx_v_req, ((struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *)__pyx_t_2));
      __pyx_t_2 = 0;

      /* "asynctnt/iproto/coreproto.pyx":131
 *                 req = <Request>req_p
 * 
 *                 cpython.dict.PyDict_DelItem(self.reqs, sync_obj)             # <<<<<<<<<<<<<<
 * 
 *                 waiter = req.waiter
 */
      __pyx_t_2 = __pyx_v_self->reqs;
      __Pyx_INCREF(__pyx_t_2);
      __pyx_t_3 = PyDict_DelItem(__pyx_t_2, __pyx_v_sync_obj); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(2, 131, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "asynctnt/iproto/coreproto.pyx":133
 *                 cpython.dict.PyDict_DelItem(self.reqs, sync_obj)
 * 
 *                 waiter = req.waiter             # <<<<<<<<<<<<<<
 *                 if waiter is not None \
 *                         and not waiter.done():
 */
      __pyx_t_2 = __pyx_v_req->waiter;
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_XDECREF_SET(__pyx_v_waiter, __pyx_t_2);
      __pyx_t_2 = 0;

      /* "asynctnt/iproto/coreproto.pyx":134
 * 
 *                 waiter = req.waiter
 *                 if waiter is not None \             # <<<<<<<<<<<<<<
 *                         and not waiter.done():
 *                     if resp.code != 0:
 */
      __pyx_t_9 = (__pyx_v_waiter != Py_None);
      __pyx_t_10 = (__pyx_t_9 != 0);
      if (__pyx_t_10) {
      } else {
        __pyx_t_1 = __pyx_t_10;
        goto __pyx_L12_bool_binop_done;
      }

      /* "asynctnt/iproto/coreproto.pyx":135
 *                 waiter = req.waiter
 *                 if waiter is not None \
 *                         and not waiter.done():             # <<<<<<<<<<<<<<
 *                     if resp.code != 0:
 *                         waiter.set_exception(
 */
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_waiter, __pyx_n_s_done); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 135, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_8 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
        __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_6);
        if (likely(__pyx_t_8)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
          __Pyx_INCREF(__pyx_t_8);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_6, function);
        }
      }
      if (__pyx_t_8) {
        __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 135, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      } else {
        __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 135, __pyx_L1_error)
      }
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(2, 135, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_9 = ((!__pyx_t_10) != 0);
      __pyx_t_1 = __pyx_t_9;
      __pyx_L12_bool_binop_done:;

      /* "asynctnt/iproto/coreproto.pyx":134
 * 
 *                 waiter = req.waiter
 *                 if waiter is not None \             # <<<<<<<<<<<<<<
 *                         and not waiter.done():
 *                     if resp.code != 0:
 */
      if (__pyx_t_1) {

        /* "asynctnt/iproto/coreproto.pyx":136
 *                 if waiter is not None \
 *                         and not waiter.done():
 *                     if resp.code != 0:             # <<<<<<<<<<<<<<
 *                         waiter.set_exception(
 *                             TarantoolDatabaseError(resp.code, resp.errmsg))
 */
        __pyx_t_1 = ((__pyx_v_resp->code != 0) != 0);
        if (__pyx_t_1) {

          /* "asynctnt/iproto/coreproto.pyx":137
 *                         and not waiter.done():
 *                     if resp.code != 0:
 *                         waiter.set_exception(             # <<<<<<<<<<<<<<
 *                             TarantoolDatabaseError(resp.code, resp.errmsg))
 *                     else:
 */
          __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_waiter, __pyx_n_s_set_exception); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 137, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);

          /* "asynctnt/iproto/coreproto.pyx":138
 *                     if resp.code != 0:
 *                         waiter.set_exception(
 *                             TarantoolDatabaseError(resp.code, resp.errmsg))             # <<<<<<<<<<<<<<
 *                     else:
 *                         waiter.set_result(resp)
 */
          __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_TarantoolDatabaseError); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 138, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          __pyx_t_7 = __Pyx_PyInt_From_uint32_t(__pyx_v_resp->code); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 138, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_11 = NULL;
          __pyx_t_3 = 0;
          if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
            __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_5);
            if (likely(__pyx_t_11)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
              __Pyx_INCREF(__pyx_t_11);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_5, function);
              __pyx_t_3 = 1;
            }
          }
          #if CYTHON_FAST_PYCALL
          if (PyFunction_Check(__pyx_t_5)) {
            PyObject *__pyx_temp[3] = {__pyx_t_11, __pyx_t_7, __pyx_v_resp->errmsg};
            __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_3, 2+__pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 138, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
            __Pyx_GOTREF(__pyx_t_8);
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          } else
          #endif
          #if CYTHON_FAST_PYCCALL
          if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
            PyObject *__pyx_temp[3] = {__pyx_t_11, __pyx_t_7, __pyx_v_resp->errmsg};
            __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_3, 2+__pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 138, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
            __Pyx_GOTREF(__pyx_t_8);
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          } else
          #endif
          {
            __pyx_t_12 = PyTuple_New(2+__pyx_t_3); if (unlikely(!__pyx_t_12)) __PYX_ERR(2, 138, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_12);
            if (__pyx_t_11) {
              __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_11); __pyx_t_11 = NULL;
            }
            __Pyx_GIVEREF(__pyx_t_7);
            PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_3, __pyx_t_7);
            __Pyx_INCREF(__pyx_v_resp->errmsg);
            __Pyx_GIVEREF(__pyx_v_resp->errmsg);
            PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_3, __pyx_v_resp->errmsg);
            __pyx_t_7 = 0;
            __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_12, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 138, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_8);
            __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          }
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __pyx_t_5 = NULL;
          if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
            __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
            if (likely(__pyx_t_5)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
              __Pyx_INCREF(__pyx_t_5);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_6, function);
            }
          }
          if (!__pyx_t_5) {
            __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 137, __pyx_L1_error)
            __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
            __Pyx_GOTREF(__pyx_t_2);
          } else {
            #if CYTHON_FAST_PYCALL
            if (PyFunction_Check(__pyx_t_6)) {
              PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_8};
              __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 137, __pyx_L1_error)
              __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
              __Pyx_GOTREF(__pyx_t_2);
              __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
            } else
            #endif
            #if CYTHON_FAST_PYCCALL
            if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
              PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_8};
              __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 137, __pyx_L1_error)
              __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
              __Pyx_GOTREF(__pyx_t_2);
              __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
            } else
            #endif
            {
              __pyx_t_12 = PyTuple_New(1+1); if (unlikely(!__pyx_t_12)) __PYX_ERR(2, 137, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_12);
              __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_5); __pyx_t_5 = NULL;
              __Pyx_GIVEREF(__pyx_t_8);
              PyTuple_SET_ITEM(__pyx_t_12, 0+1, __pyx_t_8);
              __pyx_t_8 = 0;
              __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_12, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 137, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_2);
              __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
            }
          }
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

          /* "asynctnt/iproto/coreproto.pyx":136
 *                 if waiter is not None \
 *                         and not waiter.done():
 *                     if resp.code != 0:             # <<<<<<<<<<<<<<
 *                         waiter.set_exception(
 *                             TarantoolDatabaseError(resp.code, resp.errmsg))
 */
          goto __pyx_L14;
        }

        /* "asynctnt/iproto/coreproto.pyx":140
 *                             TarantoolDatabaseError(resp.code, resp.errmsg))
 *                     else:
 *                         waiter.set_result(resp)             # <<<<<<<<<<<<<<
 * 
 *                 if p == end:
 */
        /*else*/ {
          __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_waiter, __pyx_n_s_set_result); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 140, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          __pyx_t_12 = NULL;
          if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
            __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_6);
            if (likely(__pyx_t_12)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
              __Pyx_INCREF(__pyx_t_12);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_6, function);
            }
          }
          if (!__pyx_t_12) {
            __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_6, ((PyObject *)__pyx_v_resp)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 140, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_2);
          } else {
            #if CYTHON_FAST_PYCALL
            if (PyFunction_Check(__pyx_t_6)) {
              PyObject *__pyx_temp[2] = {__pyx_t_12, ((PyObject *)__pyx_v_resp)};
              __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 140, __pyx_L1_error)
              __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
              __Pyx_GOTREF(__pyx_t_2);
            } else
            #endif
            #if CYTHON_FAST_PYCCALL
            if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
              PyObject *__pyx_temp[2] = {__pyx_t_12, ((PyObject *)__pyx_v_resp)};
              __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 140, __pyx_L1_error)
              __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
              __Pyx_GOTREF(__pyx_t_2);
            } else
            #endif
            {
              __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 140, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_8);
              __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_12); __pyx_t_12 = NULL;
              __Pyx_INCREF(((PyObject *)__pyx_v_resp));
              __Pyx_GIVEREF(((PyObject *)__pyx_v_resp));
              PyTuple_SET_ITEM(__pyx_t_8, 0+1, ((PyObject *)__pyx_v_resp));
              __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 140, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_2);
              __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
            }
          }
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        }
        __pyx_L14:;

        /* "asynctnt/iproto/coreproto.pyx":134
 * 
 *                 waiter = req.waiter
 *                 if waiter is not None \             # <<<<<<<<<<<<<<
 *                         and not waiter.done():
 *                     if resp.code != 0:
 */
      }

      /* "asynctnt/iproto/coreproto.pyx":142
 *                         waiter.set_result(resp)
 * 
 *                 if p == end:             # <<<<<<<<<<<<<<
 *                     self.rbuf.use = 0
 *                     break
 */
      __pyx_t_1 = ((__pyx_v_p == __pyx_v_end) != 0);
      if (__pyx_t_1) {

        /* "asynctnt/iproto/coreproto.pyx":143
 * 
 *                 if p == end:
 *                     self.rbuf.use = 0             # <<<<<<<<<<<<<<
 *                     break
 * 
 */
        __pyx_v_self->rbuf->use = 0;

        /* "asynctnt/iproto/coreproto.pyx":144
 *                 if p == end:
 *                     self.rbuf.use = 0
 *                     break             # <<<<<<<<<<<<<<
 * 
 *             self.rbuf.use = end - p
 */
        goto __pyx_L7_break;

        /* "asynctnt/iproto/coreproto.pyx":142
 *                         waiter.set_result(resp)
 * 
 *                 if p == end:             # <<<<<<<<<<<<<<
 *                     self.rbuf.use = 0
 *                     break
 */
      }
      __pyx_L6_continue:;
    }
    __pyx_L7_break:;

    /* "asynctnt/iproto/coreproto.pyx":146
 *                     break
 * 
 *             self.rbuf.use = end - p             # <<<<<<<<<<<<<<
 *             if self.rbuf.use > 0:
 *                 self.rbuf.move_offset(p - self.rbuf.buf, self.rbuf.use)
 */
    __pyx_v_self->rbuf->use = (__pyx_v_end - __pyx_v_p);

    /* "asynctnt/iproto/coreproto.pyx":147
 * 
 *             self.rbuf.use = end - p
 *             if self.rbuf.use > 0:             # <<<<<<<<<<<<<<
 *                 self.rbuf.move_offset(p - self.rbuf.buf, self.rbuf.use)
 *         else:
 */
    __pyx_t_1 = ((__pyx_v_self->rbuf->use > 0) != 0);
    if (__pyx_t_1) {

      /* "asynctnt/iproto/coreproto.pyx":148
 *             self.rbuf.use = end - p
 *             if self.rbuf.use > 0:
 *                 self.rbuf.move_offset(p - self.rbuf.buf, self.rbuf.use)             # <<<<<<<<<<<<<<
 *         else:
 *             # TODO: raise exception
 */
      __pyx_f_8asynctnt_6iproto_8protocol_10ReadBuffer_move_offset(__pyx_v_self->rbuf, (__pyx_v_p - __pyx_v_self->rbuf->buf), __pyx_v_self->rbuf->use); if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 148, __pyx_L1_error)

      /* "asynctnt/iproto/coreproto.pyx":147
 * 
 *             self.rbuf.use = end - p
 *             if self.rbuf.use > 0:             # <<<<<<<<<<<<<<
 *                 self.rbuf.move_offset(p - self.rbuf.buf, self.rbuf.use)
 *         else:
 */
    }

    /* "asynctnt/iproto/coreproto.pyx":100
 *             self._process__greeting()
 *             self.rbuf.move(IPROTO_GREETING_SIZE)
 *         elif self.state == PROTOCOL_NORMAL:             # <<<<<<<<<<<<<<
 *             p = self.rbuf.buf
 *             end = &self.rbuf.buf[self.rbuf.use]
 */
    break;
    default:
    break;
  }

  /* "asynctnt/iproto/coreproto.pyx":65
 *         self.transport.write(memoryview(buf))
 * 
 *     cdef void _on_data_received(self, data):             # <<<<<<<<<<<<<<
 *         cdef:
 *             size_t ruse, curr
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_WriteUnraisable("asynctnt.iproto.protocol.CoreProtocol._on_data_received", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0);
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_req);
  __Pyx_XDECREF((PyObject *)__pyx_v_resp);
  __Pyx_XDECREF(__pyx_v_waiter);
  __Pyx_XDECREF(__pyx_v_sync_obj);
  __Pyx_RefNannyFinishContext();
}

/* "asynctnt/iproto/coreproto.pyx":153
 *             pass
 * 
 *     cdef void _process__greeting(self):             # <<<<<<<<<<<<<<
 *         cdef size_t ver_length = TARANTOOL_VERSION_LENGTH
 *         rbuf = self.rbuf
 */

static void __pyx_f_8asynctnt_6iproto_8protocol_12CoreProtocol__process__greeting(struct __pyx_obj_8asynctnt_6iproto_8protocol_CoreProtocol *__pyx_v_self) {
  size_t __pyx_v_ver_length;
  CYTHON_UNUSED struct __pyx_obj_8asynctnt_6iproto_8protocol_ReadBuffer *__pyx_v_rbuf = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("_process__greeting", 0);

  /* "asynctnt/iproto/coreproto.pyx":154
 * 
 *     cdef void _process__greeting(self):
 *         cdef size_t ver_length = TARANTOOL_VERSION_LENGTH             # <<<<<<<<<<<<<<
 *         rbuf = self.rbuf
 *         self.version = self._parse_version(self.rbuf.get_slice_end(ver_length))
 */
  __pyx_v_ver_length = 64;

  /* "asynctnt/iproto/coreproto.pyx":155
 *     cdef void _process__greeting(self):
 *         cdef size_t ver_length = TARANTOOL_VERSION_LENGTH
 *         rbuf = self.rbuf             # <<<<<<<<<<<<<<
 *         self.version = self._parse_version(self.rbuf.get_slice_end(ver_length))
 *         self.salt = base64.b64decode(
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_self->rbuf);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_rbuf = ((struct __pyx_obj_8asynctnt_6iproto_8protocol_ReadBuffer *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "asynctnt/iproto/coreproto.pyx":156
 *         cdef size_t ver_length = TARANTOOL_VERSION_LENGTH
 *         rbuf = self.rbuf
 *         self.version = self._parse_version(self.rbuf.get_slice_end(ver_length))             # <<<<<<<<<<<<<<
 *         self.salt = base64.b64decode(
 *             self.rbuf.get_slice(ver_length,
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_parse_version); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 156, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __pyx_f_8asynctnt_6iproto_8protocol_10ReadBuffer_get_slice_end(__pyx_v_self->rbuf, __pyx_v_ver_length); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 156, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (!__pyx_t_4) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 156, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_3};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 156, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_3};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 156, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    {
      __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 156, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL;
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 156, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(PyTuple_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(2, 156, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->version);
  __Pyx_DECREF(__pyx_v_self->version);
  __pyx_v_self->version = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "asynctnt/iproto/coreproto.pyx":157
 *         rbuf = self.rbuf
 *         self.version = self._parse_version(self.rbuf.get_slice_end(ver_length))
 *         self.salt = base64.b64decode(             # <<<<<<<<<<<<<<
 *             self.rbuf.get_slice(ver_length,
 *                                 ver_length + SALT_LENGTH)
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_base64); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 157, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_b64decode); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 157, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asynctnt/iproto/coreproto.pyx":158
 *         self.version = self._parse_version(self.rbuf.get_slice_end(ver_length))
 *         self.salt = base64.b64decode(
 *             self.rbuf.get_slice(ver_length,             # <<<<<<<<<<<<<<
 *                                 ver_length + SALT_LENGTH)
 *         )[:SCRAMBLE_SIZE]
 */
  __pyx_t_2 = __pyx_f_8asynctnt_6iproto_8protocol_10ReadBuffer_get_slice(__pyx_v_self->rbuf, __pyx_v_ver_length, (__pyx_v_ver_length + 44)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 158, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  if (!__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 157, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_2};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 157, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_2};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 157, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else
    #endif
    {
      __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 157, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL;
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_t_2);
      __pyx_t_2 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 157, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "asynctnt/iproto/coreproto.pyx":160
 *             self.rbuf.get_slice(ver_length,
 *                                 ver_length + SALT_LENGTH)
 *         )[:SCRAMBLE_SIZE]             # <<<<<<<<<<<<<<
 *         self.state = PROTOCOL_NORMAL
 *         self._on_greeting_received()
 */
  __pyx_t_5 = __Pyx_PyObject_GetSlice(__pyx_t_1, 0, 20, NULL, NULL, &__pyx_slice__26, 0, 1, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 160, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!(likely(PyBytes_CheckExact(__pyx_t_5))||((__pyx_t_5) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_5)->tp_name), 0))) __PYX_ERR(2, 160, __pyx_L1_error)

  /* "asynctnt/iproto/coreproto.pyx":157
 *         rbuf = self.rbuf
 *         self.version = self._parse_version(self.rbuf.get_slice_end(ver_length))
 *         self.salt = base64.b64decode(             # <<<<<<<<<<<<<<
 *             self.rbuf.get_slice(ver_length,
 *                                 ver_length + SALT_LENGTH)
 */
  __Pyx_GIVEREF(__pyx_t_5);
  __Pyx_GOTREF(__pyx_v_self->salt);
  __Pyx_DECREF(__pyx_v_self->salt);
  __pyx_v_self->salt = ((PyObject*)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "asynctnt/iproto/coreproto.pyx":161
 *                                 ver_length + SALT_LENGTH)
 *         )[:SCRAMBLE_SIZE]
 *         self.state = PROTOCOL_NORMAL             # <<<<<<<<<<<<<<
 *         self._on_greeting_received()
 * 
 */
  __pyx_v_self->state = __pyx_e_8asynctnt_6iproto_8protocol_PROTOCOL_NORMAL;

  /* "asynctnt/iproto/coreproto.pyx":162
 *         )[:SCRAMBLE_SIZE]
 *         self.state = PROTOCOL_NORMAL
 *         self._on_greeting_received()             # <<<<<<<<<<<<<<
 * 
 *     def _parse_version(self, version):
 */
  ((struct __pyx_vtabstruct_8asynctnt_6iproto_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_on_greeting_received(__pyx_v_self);

  /* "asynctnt/iproto/coreproto.pyx":153
 *             pass
 * 
 *     cdef void _process__greeting(self):             # <<<<<<<<<<<<<<
 *         cdef size_t ver_length = TARANTOOL_VERSION_LENGTH
 *         rbuf = self.rbuf
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_WriteUnraisable("asynctnt.iproto.protocol.CoreProtocol._process__greeting", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0);
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_rbuf);
  __Pyx_RefNannyFinishContext();
}

/* "asynctnt/iproto/coreproto.pyx":164
 *         self._on_greeting_received()
 * 
 *     def _parse_version(self, version):             # <<<<<<<<<<<<<<
 *         m = VERSION_STRING_REGEX.match(version.decode('ascii'))
 *         if m is not None:
 */

/* Python wrapper */
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_12CoreProtocol_9_parse_version(PyObject *__pyx_v_self, PyObject *__pyx_v_version); /*proto*/
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_12CoreProtocol_9_parse_version(PyObject *__pyx_v_self, PyObject *__pyx_v_version) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_parse_version (wrapper)", 0);
  __pyx_r = __pyx_pf_8asynctnt_6iproto_8protocol_12CoreProtocol_8_parse_version(((struct __pyx_obj_8asynctnt_6iproto_8protocol_CoreProtocol *)__pyx_v_self), ((PyObject *)__pyx_v_version));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_12CoreProtocol_8_parse_version(CYTHON_UNUSED struct __pyx_obj_8asynctnt_6iproto_8protocol_CoreProtocol *__pyx_v_self, PyObject *__pyx_v_version) {
  PyObject *__pyx_v_m = NULL;
  PyObject *__pyx_v_ver = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_t_7;
  __Pyx_RefNannySetupContext("_parse_version", 0);

  /* "asynctnt/iproto/coreproto.pyx":165
 * 
 *     def _parse_version(self, version):
 *         m = VERSION_STRING_REGEX.match(version.decode('ascii'))             # <<<<<<<<<<<<<<
 *         if m is not None:
 *             ver = m.group(1)
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_VERSION_STRING_REGEX); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 165, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_match); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 165, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_version, __pyx_n_s_decode); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 165, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__27, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 165, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (!__pyx_t_2) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 165, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_4};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 165, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_4};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 165, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    {
      __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 165, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); __pyx_t_2 = NULL;
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 165, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_m = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "asynctnt/iproto/coreproto.pyx":166
 *     def _parse_version(self, version):
 *         m = VERSION_STRING_REGEX.match(version.decode('ascii'))
 *         if m is not None:             # <<<<<<<<<<<<<<
 *             ver = m.group(1)
 *             return tuple(map(int, ver.split('.')))
 */
  __pyx_t_6 = (__pyx_v_m != Py_None);
  __pyx_t_7 = (__pyx_t_6 != 0);
  if (__pyx_t_7) {

    /* "asynctnt/iproto/coreproto.pyx":167
 *         m = VERSION_STRING_REGEX.match(version.decode('ascii'))
 *         if m is not None:
 *             ver = m.group(1)             # <<<<<<<<<<<<<<
 *             return tuple(map(int, ver.split('.')))
 * 
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_m, __pyx_n_s_group); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 167, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__28, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 167, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_ver = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "asynctnt/iproto/coreproto.pyx":168
 *         if m is not None:
 *             ver = m.group(1)
 *             return tuple(map(int, ver.split('.')))             # <<<<<<<<<<<<<<
 * 
 *     cdef void _on_connection_made(self):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_ver, __pyx_n_s_split); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 168, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__30, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 168, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 168, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(((PyObject *)(&PyInt_Type)));
    __Pyx_GIVEREF(((PyObject *)(&PyInt_Type)));
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)(&PyInt_Type)));
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_map, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 168, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PySequence_Tuple(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 168, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "asynctnt/iproto/coreproto.pyx":166
 *     def _parse_version(self, version):
 *         m = VERSION_STRING_REGEX.match(version.decode('ascii'))
 *         if m is not None:             # <<<<<<<<<<<<<<
 *             ver = m.group(1)
 *             return tuple(map(int, ver.split('.')))
 */
  }

  /* "asynctnt/iproto/coreproto.pyx":164
 *         self._on_greeting_received()
 * 
 *     def _parse_version(self, version):             # <<<<<<<<<<<<<<
 *         m = VERSION_STRING_REGEX.match(version.decode('ascii'))
 *         if m is not None:
 */

  /* function exit code */
  __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_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("asynctnt.iproto.protocol.CoreProtocol._parse_version", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_m);
  __Pyx_XDECREF(__pyx_v_ver);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/coreproto.pyx":170
 *             return tuple(map(int, ver.split('.')))
 * 
 *     cdef void _on_connection_made(self):             # <<<<<<<<<<<<<<
 *         pass
 * 
 */

static void __pyx_f_8asynctnt_6iproto_8protocol_12CoreProtocol__on_connection_made(CYTHON_UNUSED struct __pyx_obj_8asynctnt_6iproto_8protocol_CoreProtocol *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_on_connection_made", 0);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "asynctnt/iproto/coreproto.pyx":173
 *         pass
 * 
 *     cdef void _on_connection_lost(self, exc):             # <<<<<<<<<<<<<<
 *         cdef:
 *             Request req
 */

static void __pyx_f_8asynctnt_6iproto_8protocol_12CoreProtocol__on_connection_lost(struct __pyx_obj_8asynctnt_6iproto_8protocol_CoreProtocol *__pyx_v_self, PyObject *__pyx_v_exc) {
  struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *__pyx_v_req = 0;
  PyObject *__pyx_v_pkey;
  PyObject *__pyx_v_pvalue;
  Py_ssize_t __pyx_v_pos;
  CYTHON_UNUSED uint64_t __pyx_v_sync;
  PyObject *__pyx_v_waiter = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  uint64_t __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  __Pyx_RefNannySetupContext("_on_connection_lost", 0);

  /* "asynctnt/iproto/coreproto.pyx":181
 *             Py_ssize_t pos
 * 
 *         pos = 0             # <<<<<<<<<<<<<<
 *         while cpython.dict.PyDict_Next(self.reqs, &pos, &pkey, &pvalue):
 *             sync = <uint64_t><object>pkey
 */
  __pyx_v_pos = 0;

  /* "asynctnt/iproto/coreproto.pyx":182
 * 
 *         pos = 0
 *         while cpython.dict.PyDict_Next(self.reqs, &pos, &pkey, &pvalue):             # <<<<<<<<<<<<<<
 *             sync = <uint64_t><object>pkey
 *             req = <Request>pvalue
 */
  while (1) {
    __pyx_t_1 = __pyx_v_self->reqs;
    __Pyx_INCREF(__pyx_t_1);
    __pyx_t_2 = (PyDict_Next(__pyx_t_1, (&__pyx_v_pos), (&__pyx_v_pkey), (&__pyx_v_pvalue)) != 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (!__pyx_t_2) break;

    /* "asynctnt/iproto/coreproto.pyx":183
 *         pos = 0
 *         while cpython.dict.PyDict_Next(self.reqs, &pos, &pkey, &pvalue):
 *             sync = <uint64_t><object>pkey             # <<<<<<<<<<<<<<
 *             req = <Request>pvalue
 * 
 */
    __pyx_t_3 = __Pyx_PyInt_As_uint64_t(((PyObject *)__pyx_v_pkey)); if (unlikely((__pyx_t_3 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(2, 183, __pyx_L1_error)
    __pyx_v_sync = ((uint64_t)__pyx_t_3);

    /* "asynctnt/iproto/coreproto.pyx":184
 *         while cpython.dict.PyDict_Next(self.reqs, &pos, &pkey, &pvalue):
 *             sync = <uint64_t><object>pkey
 *             req = <Request>pvalue             # <<<<<<<<<<<<<<
 * 
 *             waiter = req.waiter
 */
    __pyx_t_1 = ((PyObject *)__pyx_v_pvalue);
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_XDECREF_SET(__pyx_v_req, ((struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *)__pyx_t_1));
    __pyx_t_1 = 0;

    /* "asynctnt/iproto/coreproto.pyx":186
 *             req = <Request>pvalue
 * 
 *             waiter = req.waiter             # <<<<<<<<<<<<<<
 *             if waiter and not waiter.done():
 *                 if exc is None:
 */
    __pyx_t_1 = __pyx_v_req->waiter;
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_XDECREF_SET(__pyx_v_waiter, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "asynctnt/iproto/coreproto.pyx":187
 * 
 *             waiter = req.waiter
 *             if waiter and not waiter.done():             # <<<<<<<<<<<<<<
 *                 if exc is None:
 *                     waiter.set_exception(
 */
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_waiter); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(2, 187, __pyx_L1_error)
    if (__pyx_t_4) {
    } else {
      __pyx_t_2 = __pyx_t_4;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_waiter, __pyx_n_s_done); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 187, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    if (__pyx_t_6) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 187, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else {
      __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 187, __pyx_L1_error)
    }
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(2, 187, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_7 = ((!__pyx_t_4) != 0);
    __pyx_t_2 = __pyx_t_7;
    __pyx_L6_bool_binop_done:;
    if (__pyx_t_2) {

      /* "asynctnt/iproto/coreproto.pyx":188
 *             waiter = req.waiter
 *             if waiter and not waiter.done():
 *                 if exc is None:             # <<<<<<<<<<<<<<
 *                     waiter.set_exception(
 *                         TarantoolNotConnectedError(
 */
      __pyx_t_2 = (__pyx_v_exc == Py_None);
      __pyx_t_7 = (__pyx_t_2 != 0);
      if (__pyx_t_7) {

        /* "asynctnt/iproto/coreproto.pyx":189
 *             if waiter and not waiter.done():
 *                 if exc is None:
 *                     waiter.set_exception(             # <<<<<<<<<<<<<<
 *                         TarantoolNotConnectedError(
 *                             'Lost connection to Tarantool')
 */
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_waiter, __pyx_n_s_set_exception); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 189, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);

        /* "asynctnt/iproto/coreproto.pyx":190
 *                 if exc is None:
 *                     waiter.set_exception(
 *                         TarantoolNotConnectedError(             # <<<<<<<<<<<<<<
 *                             'Lost connection to Tarantool')
 *                     )
 */
        __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_TarantoolNotConnectedError); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 190, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_tuple__31, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 190, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_6 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
          __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
          if (likely(__pyx_t_6)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
            __Pyx_INCREF(__pyx_t_6);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_5, function);
          }
        }
        if (!__pyx_t_6) {
          __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 189, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          __Pyx_GOTREF(__pyx_t_1);
        } else {
          #if CYTHON_FAST_PYCALL
          if (PyFunction_Check(__pyx_t_5)) {
            PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_8};
            __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 189, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
            __Pyx_GOTREF(__pyx_t_1);
            __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          } else
          #endif
          #if CYTHON_FAST_PYCCALL
          if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
            PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_8};
            __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 189, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
            __Pyx_GOTREF(__pyx_t_1);
            __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          } else
          #endif
          {
            __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 189, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_9);
            __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_6); __pyx_t_6 = NULL;
            __Pyx_GIVEREF(__pyx_t_8);
            PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_t_8);
            __pyx_t_8 = 0;
            __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 189, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_1);
            __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          }
        }
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

        /* "asynctnt/iproto/coreproto.pyx":188
 *             waiter = req.waiter
 *             if waiter and not waiter.done():
 *                 if exc is None:             # <<<<<<<<<<<<<<
 *                     waiter.set_exception(
 *                         TarantoolNotConnectedError(
 */
        goto __pyx_L8;
      }

      /* "asynctnt/iproto/coreproto.pyx":194
 *                     )
 *                 else:
 *                     waiter.set_exception(exc)             # <<<<<<<<<<<<<<
 * 
 *     cdef void _on_greeting_received(self):
 */
      /*else*/ {
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_waiter, __pyx_n_s_set_exception); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 194, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_9 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
          __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_5);
          if (likely(__pyx_t_9)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
            __Pyx_INCREF(__pyx_t_9);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_5, function);
          }
        }
        if (!__pyx_t_9) {
          __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_exc); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 194, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
        } else {
          #if CYTHON_FAST_PYCALL
          if (PyFunction_Check(__pyx_t_5)) {
            PyObject *__pyx_temp[2] = {__pyx_t_9, __pyx_v_exc};
            __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 194, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
            __Pyx_GOTREF(__pyx_t_1);
          } else
          #endif
          #if CYTHON_FAST_PYCCALL
          if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
            PyObject *__pyx_temp[2] = {__pyx_t_9, __pyx_v_exc};
            __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 194, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
            __Pyx_GOTREF(__pyx_t_1);
          } else
          #endif
          {
            __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 194, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_8);
            __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_9); __pyx_t_9 = NULL;
            __Pyx_INCREF(__pyx_v_exc);
            __Pyx_GIVEREF(__pyx_v_exc);
            PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_v_exc);
            __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 194, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_1);
            __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          }
        }
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      }
      __pyx_L8:;

      /* "asynctnt/iproto/coreproto.pyx":187
 * 
 *             waiter = req.waiter
 *             if waiter and not waiter.done():             # <<<<<<<<<<<<<<
 *                 if exc is None:
 *                     waiter.set_exception(
 */
    }
  }

  /* "asynctnt/iproto/coreproto.pyx":173
 *         pass
 * 
 *     cdef void _on_connection_lost(self, exc):             # <<<<<<<<<<<<<<
 *         cdef:
 *             Request req
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_WriteUnraisable("asynctnt.iproto.protocol.CoreProtocol._on_connection_lost", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0);
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_req);
  __Pyx_XDECREF(__pyx_v_waiter);
  __Pyx_RefNannyFinishContext();
}

/* "asynctnt/iproto/coreproto.pyx":196
 *                     waiter.set_exception(exc)
 * 
 *     cdef void _on_greeting_received(self):             # <<<<<<<<<<<<<<
 *         pass
 * 
 */

static void __pyx_f_8asynctnt_6iproto_8protocol_12CoreProtocol__on_greeting_received(CYTHON_UNUSED struct __pyx_obj_8asynctnt_6iproto_8protocol_CoreProtocol *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_on_greeting_received", 0);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "asynctnt/iproto/coreproto.pyx":201
 *     # asyncio callbacks
 * 
 *     def data_received(self, data):             # <<<<<<<<<<<<<<
 *         self._on_data_received(data)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_12CoreProtocol_11data_received(PyObject *__pyx_v_self, PyObject *__pyx_v_data); /*proto*/
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_12CoreProtocol_11data_received(PyObject *__pyx_v_self, PyObject *__pyx_v_data) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("data_received (wrapper)", 0);
  __pyx_r = __pyx_pf_8asynctnt_6iproto_8protocol_12CoreProtocol_10data_received(((struct __pyx_obj_8asynctnt_6iproto_8protocol_CoreProtocol *)__pyx_v_self), ((PyObject *)__pyx_v_data));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_12CoreProtocol_10data_received(struct __pyx_obj_8asynctnt_6iproto_8protocol_CoreProtocol *__pyx_v_self, PyObject *__pyx_v_data) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("data_received", 0);

  /* "asynctnt/iproto/coreproto.pyx":202
 * 
 *     def data_received(self, data):
 *         self._on_data_received(data)             # <<<<<<<<<<<<<<
 * 
 *     def connection_made(self, transport):
 */
  ((struct __pyx_vtabstruct_8asynctnt_6iproto_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_on_data_received(__pyx_v_self, __pyx_v_data);

  /* "asynctnt/iproto/coreproto.pyx":201
 *     # asyncio callbacks
 * 
 *     def data_received(self, data):             # <<<<<<<<<<<<<<
 *         self._on_data_received(data)
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/coreproto.pyx":204
 *         self._on_data_received(data)
 * 
 *     def connection_made(self, transport):             # <<<<<<<<<<<<<<
 *         self.transport = transport
 *         self.con_state = CONNECTION_CONNECTED
 */

/* Python wrapper */
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_12CoreProtocol_13connection_made(PyObject *__pyx_v_self, PyObject *__pyx_v_transport); /*proto*/
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_12CoreProtocol_13connection_made(PyObject *__pyx_v_self, PyObject *__pyx_v_transport) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("connection_made (wrapper)", 0);
  __pyx_r = __pyx_pf_8asynctnt_6iproto_8protocol_12CoreProtocol_12connection_made(((struct __pyx_obj_8asynctnt_6iproto_8protocol_CoreProtocol *)__pyx_v_self), ((PyObject *)__pyx_v_transport));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_12CoreProtocol_12connection_made(struct __pyx_obj_8asynctnt_6iproto_8protocol_CoreProtocol *__pyx_v_self, PyObject *__pyx_v_transport) {
  PyObject *__pyx_v_sock = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  __Pyx_RefNannySetupContext("connection_made", 0);

  /* "asynctnt/iproto/coreproto.pyx":205
 * 
 *     def connection_made(self, transport):
 *         self.transport = transport             # <<<<<<<<<<<<<<
 *         self.con_state = CONNECTION_CONNECTED
 * 
 */
  if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_transport, __pyx_v_transport) < 0) __PYX_ERR(2, 205, __pyx_L1_error)

  /* "asynctnt/iproto/coreproto.pyx":206
 *     def connection_made(self, transport):
 *         self.transport = transport
 *         self.con_state = CONNECTION_CONNECTED             # <<<<<<<<<<<<<<
 * 
 *         sock = transport.get_extra_info('socket')
 */
  __pyx_v_self->con_state = __pyx_e_8asynctnt_6iproto_8protocol_CONNECTION_CONNECTED;

  /* "asynctnt/iproto/coreproto.pyx":208
 *         self.con_state = CONNECTION_CONNECTED
 * 
 *         sock = transport.get_extra_info('socket')             # <<<<<<<<<<<<<<
 *         if sock is not None and \
 *                 (not hasattr(socket, 'AF_UNIX') or
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_transport, __pyx_n_s_get_extra_info); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 208, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__32, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 208, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_sock = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "asynctnt/iproto/coreproto.pyx":209
 * 
 *         sock = transport.get_extra_info('socket')
 *         if sock is not None and \             # <<<<<<<<<<<<<<
 *                 (not hasattr(socket, 'AF_UNIX') or
 *                          sock.family != socket.AF_UNIX):
 */
  __pyx_t_4 = (__pyx_v_sock != Py_None);
  __pyx_t_5 = (__pyx_t_4 != 0);
  if (__pyx_t_5) {
  } else {
    __pyx_t_3 = __pyx_t_5;
    goto __pyx_L4_bool_binop_done;
  }

  /* "asynctnt/iproto/coreproto.pyx":210
 *         sock = transport.get_extra_info('socket')
 *         if sock is not None and \
 *                 (not hasattr(socket, 'AF_UNIX') or             # <<<<<<<<<<<<<<
 *                          sock.family != socket.AF_UNIX):
 *             sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_socket); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 210, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = PyObject_HasAttr(__pyx_t_2, __pyx_n_s_AF_UNIX); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(2, 210, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = ((!(__pyx_t_5 != 0)) != 0);
  if (!__pyx_t_4) {
  } else {
    __pyx_t_3 = __pyx_t_4;
    goto __pyx_L4_bool_binop_done;
  }

  /* "asynctnt/iproto/coreproto.pyx":211
 *         if sock is not None and \
 *                 (not hasattr(socket, 'AF_UNIX') or
 *                          sock.family != socket.AF_UNIX):             # <<<<<<<<<<<<<<
 *             sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_sock, __pyx_n_s_family); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 211, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_socket); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 211, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_AF_UNIX); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 211, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_t_6, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 211, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(2, 211, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __pyx_t_4;
  __pyx_L4_bool_binop_done:;

  /* "asynctnt/iproto/coreproto.pyx":209
 * 
 *         sock = transport.get_extra_info('socket')
 *         if sock is not None and \             # <<<<<<<<<<<<<<
 *                 (not hasattr(socket, 'AF_UNIX') or
 *                          sock.family != socket.AF_UNIX):
 */
  if (__pyx_t_3) {

    /* "asynctnt/iproto/coreproto.pyx":212
 *                 (not hasattr(socket, 'AF_UNIX') or
 *                          sock.family != socket.AF_UNIX):
 *             sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)             # <<<<<<<<<<<<<<
 * 
 *         self.state = PROTOCOL_GREETING
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_sock, __pyx_n_s_setsockopt); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 212, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_socket); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 212, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_IPPROTO_TCP); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 212, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_socket); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 212, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_TCP_NODELAY); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 212, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = NULL;
    __pyx_t_9 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
        __pyx_t_9 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_6)) {
      PyObject *__pyx_temp[4] = {__pyx_t_2, __pyx_t_7, __pyx_t_8, __pyx_int_1};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_9, 3+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 212, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
      PyObject *__pyx_temp[4] = {__pyx_t_2, __pyx_t_7, __pyx_t_8, __pyx_int_1};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_9, 3+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 212, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    } else
    #endif
    {
      __pyx_t_10 = PyTuple_New(3+__pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 212, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      if (__pyx_t_2) {
        __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_2); __pyx_t_2 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_9, __pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_9, __pyx_t_8);
      __Pyx_INCREF(__pyx_int_1);
      __Pyx_GIVEREF(__pyx_int_1);
      PyTuple_SET_ITEM(__pyx_t_10, 2+__pyx_t_9, __pyx_int_1);
      __pyx_t_7 = 0;
      __pyx_t_8 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 212, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "asynctnt/iproto/coreproto.pyx":209
 * 
 *         sock = transport.get_extra_info('socket')
 *         if sock is not None and \             # <<<<<<<<<<<<<<
 *                 (not hasattr(socket, 'AF_UNIX') or
 *                          sock.family != socket.AF_UNIX):
 */
  }

  /* "asynctnt/iproto/coreproto.pyx":214
 *             sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
 * 
 *         self.state = PROTOCOL_GREETING             # <<<<<<<<<<<<<<
 *         self._on_connection_made()
 * 
 */
  __pyx_v_self->state = __pyx_e_8asynctnt_6iproto_8protocol_PROTOCOL_GREETING;

  /* "asynctnt/iproto/coreproto.pyx":215
 * 
 *         self.state = PROTOCOL_GREETING
 *         self._on_connection_made()             # <<<<<<<<<<<<<<
 * 
 *     def connection_lost(self, exc):
 */
  ((struct __pyx_vtabstruct_8asynctnt_6iproto_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_on_connection_made(__pyx_v_self);

  /* "asynctnt/iproto/coreproto.pyx":204
 *         self._on_data_received(data)
 * 
 *     def connection_made(self, transport):             # <<<<<<<<<<<<<<
 *         self.transport = transport
 *         self.con_state = CONNECTION_CONNECTED
 */

  /* function exit code */
  __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_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("asynctnt.iproto.protocol.CoreProtocol.connection_made", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_sock);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/coreproto.pyx":217
 *         self._on_connection_made()
 * 
 *     def connection_lost(self, exc):             # <<<<<<<<<<<<<<
 *         self.con_state = CONNECTION_BAD
 *         # self.schema = None
 */

/* Python wrapper */
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_12CoreProtocol_15connection_lost(PyObject *__pyx_v_self, PyObject *__pyx_v_exc); /*proto*/
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_12CoreProtocol_15connection_lost(PyObject *__pyx_v_self, PyObject *__pyx_v_exc) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("connection_lost (wrapper)", 0);
  __pyx_r = __pyx_pf_8asynctnt_6iproto_8protocol_12CoreProtocol_14connection_lost(((struct __pyx_obj_8asynctnt_6iproto_8protocol_CoreProtocol *)__pyx_v_self), ((PyObject *)__pyx_v_exc));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_12CoreProtocol_14connection_lost(struct __pyx_obj_8asynctnt_6iproto_8protocol_CoreProtocol *__pyx_v_self, PyObject *__pyx_v_exc) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("connection_lost", 0);

  /* "asynctnt/iproto/coreproto.pyx":218
 * 
 *     def connection_lost(self, exc):
 *         self.con_state = CONNECTION_BAD             # <<<<<<<<<<<<<<
 *         # self.schema = None
 *         self.version = None
 */
  __pyx_v_self->con_state = __pyx_e_8asynctnt_6iproto_8protocol_CONNECTION_BAD;

  /* "asynctnt/iproto/coreproto.pyx":220
 *         self.con_state = CONNECTION_BAD
 *         # self.schema = None
 *         self.version = None             # <<<<<<<<<<<<<<
 *         self.salt = None
 *         self.rbuf = None
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->version);
  __Pyx_DECREF(__pyx_v_self->version);
  __pyx_v_self->version = ((PyObject*)Py_None);

  /* "asynctnt/iproto/coreproto.pyx":221
 *         # self.schema = None
 *         self.version = None
 *         self.salt = None             # <<<<<<<<<<<<<<
 *         self.rbuf = None
 * 
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->salt);
  __Pyx_DECREF(__pyx_v_self->salt);
  __pyx_v_self->salt = ((PyObject*)Py_None);

  /* "asynctnt/iproto/coreproto.pyx":222
 *         self.version = None
 *         self.salt = None
 *         self.rbuf = None             # <<<<<<<<<<<<<<
 * 
 *         self._on_connection_lost(exc)
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->rbuf);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->rbuf));
  __pyx_v_self->rbuf = ((struct __pyx_obj_8asynctnt_6iproto_8protocol_ReadBuffer *)Py_None);

  /* "asynctnt/iproto/coreproto.pyx":224
 *         self.rbuf = None
 * 
 *         self._on_connection_lost(exc)             # <<<<<<<<<<<<<<
 */
  ((struct __pyx_vtabstruct_8asynctnt_6iproto_8protocol_CoreProtocol *)__pyx_v_self->__pyx_vtab)->_on_connection_lost(__pyx_v_self, __pyx_v_exc);

  /* "asynctnt/iproto/coreproto.pyx":217
 *         self._on_connection_made()
 * 
 *     def connection_lost(self, exc):             # <<<<<<<<<<<<<<
 *         self.con_state = CONNECTION_BAD
 *         # self.schema = None
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/protocol.pyx":39
 * 
 * cdef class BaseProtocol(CoreProtocol):
 *     def __init__(self, host, port,             # <<<<<<<<<<<<<<
 *                  username, password,
 *                  fetch_schema,
 */

/* Python wrapper */
static int __pyx_pw_8asynctnt_6iproto_8protocol_12BaseProtocol_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_8asynctnt_6iproto_8protocol_12BaseProtocol_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_host = 0;
  PyObject *__pyx_v_port = 0;
  PyObject *__pyx_v_username = 0;
  PyObject *__pyx_v_password = 0;
  PyObject *__pyx_v_fetch_schema = 0;
  PyObject *__pyx_v_auto_refetch_schema = 0;
  PyObject *__pyx_v_connected_fut = 0;
  PyObject *__pyx_v_on_connection_made = 0;
  PyObject *__pyx_v_on_connection_lost = 0;
  PyObject *__pyx_v_loop = 0;
  PyObject *__pyx_v_request_timeout = 0;
  PyObject *__pyx_v_encoding = 0;
  PyObject *__pyx_v_initial_read_buffer_size = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_host,&__pyx_n_s_port,&__pyx_n_s_username,&__pyx_n_s_password,&__pyx_n_s_fetch_schema,&__pyx_n_s_auto_refetch_schema,&__pyx_n_s_connected_fut,&__pyx_n_s_on_connection_made,&__pyx_n_s_on_connection_lost,&__pyx_n_s_loop,&__pyx_n_s_request_timeout,&__pyx_n_s_encoding,&__pyx_n_s_initial_read_buffer_size,0};
    PyObject* values[13] = {0,0,0,0,0,0,0,0,0,0,0,0,0};

    /* "asynctnt/iproto/protocol.pyx":46
 *                  on_connection_made, on_connection_lost,
 *                  loop,
 *                  request_timeout=None,             # <<<<<<<<<<<<<<
 *                  encoding=None,
 *                  initial_read_buffer_size=None):
 */
    values[10] = ((PyObject *)Py_None);

    /* "asynctnt/iproto/protocol.pyx":47
 *                  loop,
 *                  request_timeout=None,
 *                  encoding=None,             # <<<<<<<<<<<<<<
 *                  initial_read_buffer_size=None):
 *         CoreProtocol.__init__(self, host, port, encoding,
 */
    values[11] = ((PyObject *)Py_None);

    /* "asynctnt/iproto/protocol.pyx":48
 *                  request_timeout=None,
 *                  encoding=None,
 *                  initial_read_buffer_size=None):             # <<<<<<<<<<<<<<
 *         CoreProtocol.__init__(self, host, port, encoding,
 *                               initial_read_buffer_size)
 */
    values[12] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        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;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_host)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_port)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 10, 13, 1); __PYX_ERR(3, 39, __pyx_L3_error)
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_username)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 10, 13, 2); __PYX_ERR(3, 39, __pyx_L3_error)
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_password)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 10, 13, 3); __PYX_ERR(3, 39, __pyx_L3_error)
        }
        case  4:
        if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_fetch_schema)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 10, 13, 4); __PYX_ERR(3, 39, __pyx_L3_error)
        }
        case  5:
        if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_auto_refetch_schema)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 10, 13, 5); __PYX_ERR(3, 39, __pyx_L3_error)
        }
        case  6:
        if (likely((values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_connected_fut)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 10, 13, 6); __PYX_ERR(3, 39, __pyx_L3_error)
        }
        case  7:
        if (likely((values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_on_connection_made)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 10, 13, 7); __PYX_ERR(3, 39, __pyx_L3_error)
        }
        case  8:
        if (likely((values[8] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_on_connection_lost)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 10, 13, 8); __PYX_ERR(3, 39, __pyx_L3_error)
        }
        case  9:
        if (likely((values[9] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_loop)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 10, 13, 9); __PYX_ERR(3, 39, __pyx_L3_error)
        }
        case 10:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_request_timeout);
          if (value) { values[10] = value; kw_args--; }
        }
        case 11:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_encoding);
          if (value) { values[11] = value; kw_args--; }
        }
        case 12:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_initial_read_buffer_size);
          if (value) { values[12] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(3, 39, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_host = values[0];
    __pyx_v_port = values[1];
    __pyx_v_username = values[2];
    __pyx_v_password = values[3];
    __pyx_v_fetch_schema = values[4];
    __pyx_v_auto_refetch_schema = values[5];
    __pyx_v_connected_fut = values[6];
    __pyx_v_on_connection_made = values[7];
    __pyx_v_on_connection_lost = values[8];
    __pyx_v_loop = values[9];
    __pyx_v_request_timeout = values[10];
    __pyx_v_encoding = values[11];
    __pyx_v_initial_read_buffer_size = values[12];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 10, 13, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(3, 39, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("asynctnt.iproto.protocol.BaseProtocol.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8asynctnt_6iproto_8protocol_12BaseProtocol___init__(((struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *)__pyx_v_self), __pyx_v_host, __pyx_v_port, __pyx_v_username, __pyx_v_password, __pyx_v_fetch_schema, __pyx_v_auto_refetch_schema, __pyx_v_connected_fut, __pyx_v_on_connection_made, __pyx_v_on_connection_lost, __pyx_v_loop, __pyx_v_request_timeout, __pyx_v_encoding, __pyx_v_initial_read_buffer_size);

  /* "asynctnt/iproto/protocol.pyx":39
 * 
 * cdef class BaseProtocol(CoreProtocol):
 *     def __init__(self, host, port,             # <<<<<<<<<<<<<<
 *                  username, password,
 *                  fetch_schema,
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_8asynctnt_6iproto_8protocol_12BaseProtocol___init__(struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *__pyx_v_self, PyObject *__pyx_v_host, PyObject *__pyx_v_port, PyObject *__pyx_v_username, PyObject *__pyx_v_password, PyObject *__pyx_v_fetch_schema, PyObject *__pyx_v_auto_refetch_schema, PyObject *__pyx_v_connected_fut, PyObject *__pyx_v_on_connection_made, PyObject *__pyx_v_on_connection_lost, PyObject *__pyx_v_loop, PyObject *__pyx_v_request_timeout, PyObject *__pyx_v_encoding, PyObject *__pyx_v_initial_read_buffer_size) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "asynctnt/iproto/protocol.pyx":49
 *                  encoding=None,
 *                  initial_read_buffer_size=None):
 *         CoreProtocol.__init__(self, host, port, encoding,             # <<<<<<<<<<<<<<
 *                               initial_read_buffer_size)
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_8asynctnt_6iproto_8protocol_CoreProtocol), __pyx_n_s_init); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 49, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "asynctnt/iproto/protocol.pyx":50
 *                  initial_read_buffer_size=None):
 *         CoreProtocol.__init__(self, host, port, encoding,
 *                               initial_read_buffer_size)             # <<<<<<<<<<<<<<
 * 
 *         self.loop = loop
 */
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[6] = {__pyx_t_3, ((PyObject *)__pyx_v_self), __pyx_v_host, __pyx_v_port, __pyx_v_encoding, __pyx_v_initial_read_buffer_size};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 5+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 49, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[6] = {__pyx_t_3, ((PyObject *)__pyx_v_self), __pyx_v_host, __pyx_v_port, __pyx_v_encoding, __pyx_v_initial_read_buffer_size};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 5+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 49, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(5+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 49, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_INCREF(((PyObject *)__pyx_v_self));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, ((PyObject *)__pyx_v_self));
    __Pyx_INCREF(__pyx_v_host);
    __Pyx_GIVEREF(__pyx_v_host);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_host);
    __Pyx_INCREF(__pyx_v_port);
    __Pyx_GIVEREF(__pyx_v_port);
    PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_4, __pyx_v_port);
    __Pyx_INCREF(__pyx_v_encoding);
    __Pyx_GIVEREF(__pyx_v_encoding);
    PyTuple_SET_ITEM(__pyx_t_5, 3+__pyx_t_4, __pyx_v_encoding);
    __Pyx_INCREF(__pyx_v_initial_read_buffer_size);
    __Pyx_GIVEREF(__pyx_v_initial_read_buffer_size);
    PyTuple_SET_ITEM(__pyx_t_5, 4+__pyx_t_4, __pyx_v_initial_read_buffer_size);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 49, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asynctnt/iproto/protocol.pyx":52
 *                               initial_read_buffer_size)
 * 
 *         self.loop = loop             # <<<<<<<<<<<<<<
 * 
 *         self.username = username
 */
  __Pyx_INCREF(__pyx_v_loop);
  __Pyx_GIVEREF(__pyx_v_loop);
  __Pyx_GOTREF(__pyx_v_self->loop);
  __Pyx_DECREF(__pyx_v_self->loop);
  __pyx_v_self->loop = __pyx_v_loop;

  /* "asynctnt/iproto/protocol.pyx":54
 *         self.loop = loop
 * 
 *         self.username = username             # <<<<<<<<<<<<<<
 *         self.password = password
 *         self.fetch_schema = fetch_schema
 */
  if (!(likely(PyString_CheckExact(__pyx_v_username))||((__pyx_v_username) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_v_username)->tp_name), 0))) __PYX_ERR(3, 54, __pyx_L1_error)
  __pyx_t_1 = __pyx_v_username;
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->username);
  __Pyx_DECREF(__pyx_v_self->username);
  __pyx_v_self->username = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "asynctnt/iproto/protocol.pyx":55
 * 
 *         self.username = username
 *         self.password = password             # <<<<<<<<<<<<<<
 *         self.fetch_schema = fetch_schema
 *         self.auto_refetch_schema = auto_refetch_schema
 */
  if (!(likely(PyString_CheckExact(__pyx_v_password))||((__pyx_v_password) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_v_password)->tp_name), 0))) __PYX_ERR(3, 55, __pyx_L1_error)
  __pyx_t_1 = __pyx_v_password;
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->password);
  __Pyx_DECREF(__pyx_v_self->password);
  __pyx_v_self->password = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "asynctnt/iproto/protocol.pyx":56
 *         self.username = username
 *         self.password = password
 *         self.fetch_schema = fetch_schema             # <<<<<<<<<<<<<<
 *         self.auto_refetch_schema = auto_refetch_schema
 *         self.request_timeout = request_timeout or 0
 */
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_fetch_schema); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(3, 56, __pyx_L1_error)
  __pyx_v_self->fetch_schema = __pyx_t_6;

  /* "asynctnt/iproto/protocol.pyx":57
 *         self.password = password
 *         self.fetch_schema = fetch_schema
 *         self.auto_refetch_schema = auto_refetch_schema             # <<<<<<<<<<<<<<
 *         self.request_timeout = request_timeout or 0
 *         self.connected_fut = connected_fut
 */
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_auto_refetch_schema); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(3, 57, __pyx_L1_error)
  __pyx_v_self->auto_refetch_schema = __pyx_t_6;

  /* "asynctnt/iproto/protocol.pyx":58
 *         self.fetch_schema = fetch_schema
 *         self.auto_refetch_schema = auto_refetch_schema
 *         self.request_timeout = request_timeout or 0             # <<<<<<<<<<<<<<
 *         self.connected_fut = connected_fut
 *         self.on_connection_made_cb = on_connection_made
 */
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_request_timeout); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(3, 58, __pyx_L1_error)
  if (!__pyx_t_6) {
  } else {
    __Pyx_INCREF(__pyx_v_request_timeout);
    __pyx_t_1 = __pyx_v_request_timeout;
    goto __pyx_L3_bool_binop_done;
  }
  __pyx_t_2 = __Pyx_PyInt_From_long(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 58, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_L3_bool_binop_done:;
  if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_request_timeout, __pyx_t_1) < 0) __PYX_ERR(3, 58, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asynctnt/iproto/protocol.pyx":59
 *         self.auto_refetch_schema = auto_refetch_schema
 *         self.request_timeout = request_timeout or 0
 *         self.connected_fut = connected_fut             # <<<<<<<<<<<<<<
 *         self.on_connection_made_cb = on_connection_made
 *         self.on_connection_lost_cb = on_connection_lost
 */
  __Pyx_INCREF(__pyx_v_connected_fut);
  __Pyx_GIVEREF(__pyx_v_connected_fut);
  __Pyx_GOTREF(__pyx_v_self->connected_fut);
  __Pyx_DECREF(__pyx_v_self->connected_fut);
  __pyx_v_self->connected_fut = __pyx_v_connected_fut;

  /* "asynctnt/iproto/protocol.pyx":60
 *         self.request_timeout = request_timeout or 0
 *         self.connected_fut = connected_fut
 *         self.on_connection_made_cb = on_connection_made             # <<<<<<<<<<<<<<
 *         self.on_connection_lost_cb = on_connection_lost
 * 
 */
  if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_on_connection_made_cb, __pyx_v_on_connection_made) < 0) __PYX_ERR(3, 60, __pyx_L1_error)

  /* "asynctnt/iproto/protocol.pyx":61
 *         self.connected_fut = connected_fut
 *         self.on_connection_made_cb = on_connection_made
 *         self.on_connection_lost_cb = on_connection_lost             # <<<<<<<<<<<<<<
 * 
 *         self._on_request_completed_cb = self._on_request_completed
 */
  if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_on_connection_lost_cb, __pyx_v_on_connection_lost) < 0) __PYX_ERR(3, 61, __pyx_L1_error)

  /* "asynctnt/iproto/protocol.pyx":63
 *         self.on_connection_lost_cb = on_connection_lost
 * 
 *         self._on_request_completed_cb = self._on_request_completed             # <<<<<<<<<<<<<<
 *         self._on_request_timeout_cb = self._on_request_timeout
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_on_request_completed); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 63, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_on_request_completed_cb);
  __Pyx_DECREF(__pyx_v_self->_on_request_completed_cb);
  __pyx_v_self->_on_request_completed_cb = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "asynctnt/iproto/protocol.pyx":64
 * 
 *         self._on_request_completed_cb = self._on_request_completed
 *         self._on_request_timeout_cb = self._on_request_timeout             # <<<<<<<<<<<<<<
 * 
 *         self._sync = 0
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_on_request_timeout); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 64, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_on_request_timeout_cb);
  __Pyx_DECREF(__pyx_v_self->_on_request_timeout_cb);
  __pyx_v_self->_on_request_timeout_cb = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "asynctnt/iproto/protocol.pyx":66
 *         self._on_request_timeout_cb = self._on_request_timeout
 * 
 *         self._sync = 0             # <<<<<<<<<<<<<<
 *         self._schema = None
 *         self._schema_id = -1
 */
  __pyx_v_self->_sync = 0;

  /* "asynctnt/iproto/protocol.pyx":67
 * 
 *         self._sync = 0
 *         self._schema = None             # <<<<<<<<<<<<<<
 *         self._schema_id = -1
 *         self._db = self._create_db()
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->_schema);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_schema));
  __pyx_v_self->_schema = ((struct __pyx_obj_8asynctnt_6iproto_8protocol_Schema *)Py_None);

  /* "asynctnt/iproto/protocol.pyx":68
 *         self._sync = 0
 *         self._schema = None
 *         self._schema_id = -1             # <<<<<<<<<<<<<<
 *         self._db = self._create_db()
 * 
 */
  __pyx_v_self->_schema_id = -1L;

  /* "asynctnt/iproto/protocol.pyx":69
 *         self._schema = None
 *         self._schema_id = -1
 *         self._db = self._create_db()             # <<<<<<<<<<<<<<
 * 
 *         try:
 */
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_8asynctnt_6iproto_8protocol_BaseProtocol *)__pyx_v_self->__pyx_base.__pyx_vtab)->_create_db(__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 69, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_db);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_db));
  __pyx_v_self->_db = ((struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "asynctnt/iproto/protocol.pyx":71
 *         self._db = self._create_db()
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             self.create_future = self.loop.create_future
 *         except AttributeError:
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
    __Pyx_XGOTREF(__pyx_t_7);
    __Pyx_XGOTREF(__pyx_t_8);
    __Pyx_XGOTREF(__pyx_t_9);
    /*try:*/ {

      /* "asynctnt/iproto/protocol.pyx":72
 * 
 *         try:
 *             self.create_future = self.loop.create_future             # <<<<<<<<<<<<<<
 *         except AttributeError:
 *             self.create_future = self._create_future_fallback
 */
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->loop, __pyx_n_s_create_future); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 72, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_create_future, __pyx_t_1) < 0) __PYX_ERR(3, 72, __pyx_L5_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "asynctnt/iproto/protocol.pyx":71
 *         self._db = self._create_db()
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             self.create_future = self.loop.create_future
 *         except AttributeError:
 */
    }
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    goto __pyx_L12_try_end;
    __pyx_L5_error:;
    __Pyx_PyThreadState_assign
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "asynctnt/iproto/protocol.pyx":73
 *         try:
 *             self.create_future = self.loop.create_future
 *         except AttributeError:             # <<<<<<<<<<<<<<
 *             self.create_future = self._create_future_fallback
 * 
 */
    __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
    if (__pyx_t_4) {
      __Pyx_AddTraceback("asynctnt.iproto.protocol.BaseProtocol.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_2, &__pyx_t_5) < 0) __PYX_ERR(3, 73, __pyx_L7_except_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GOTREF(__pyx_t_5);

      /* "asynctnt/iproto/protocol.pyx":74
 *             self.create_future = self.loop.create_future
 *         except AttributeError:
 *             self.create_future = self._create_future_fallback             # <<<<<<<<<<<<<<
 * 
 *     def _create_future_fallback(self):  # pragma: no cover
 */
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_create_future_fallback); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 74, __pyx_L7_except_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_create_future, __pyx_t_3) < 0) __PYX_ERR(3, 74, __pyx_L7_except_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L6_exception_handled;
    }
    goto __pyx_L7_except_error;
    __pyx_L7_except_error:;

    /* "asynctnt/iproto/protocol.pyx":71
 *         self._db = self._create_db()
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             self.create_future = self.loop.create_future
 *         except AttributeError:
 */
    __Pyx_PyThreadState_assign
    __Pyx_XGIVEREF(__pyx_t_7);
    __Pyx_XGIVEREF(__pyx_t_8);
    __Pyx_XGIVEREF(__pyx_t_9);
    __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
    goto __pyx_L1_error;
    __pyx_L6_exception_handled:;
    __Pyx_PyThreadState_assign
    __Pyx_XGIVEREF(__pyx_t_7);
    __Pyx_XGIVEREF(__pyx_t_8);
    __Pyx_XGIVEREF(__pyx_t_9);
    __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
    __pyx_L12_try_end:;
  }

  /* "asynctnt/iproto/protocol.pyx":39
 * 
 * cdef class BaseProtocol(CoreProtocol):
 *     def __init__(self, host, port,             # <<<<<<<<<<<<<<
 *                  username, password,
 *                  fetch_schema,
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("asynctnt.iproto.protocol.BaseProtocol.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/protocol.pyx":76
 *             self.create_future = self._create_future_fallback
 * 
 *     def _create_future_fallback(self):  # pragma: no cover             # <<<<<<<<<<<<<<
 *         return asyncio.Future(loop=self.loop)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_12BaseProtocol_3_create_future_fallback(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_12BaseProtocol_3_create_future_fallback(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_create_future_fallback (wrapper)", 0);
  __pyx_r = __pyx_pf_8asynctnt_6iproto_8protocol_12BaseProtocol_2_create_future_fallback(((struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_12BaseProtocol_2_create_future_fallback(struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("_create_future_fallback", 0);

  /* "asynctnt/iproto/protocol.pyx":77
 * 
 *     def _create_future_fallback(self):  # pragma: no cover
 *         return asyncio.Future(loop=self.loop)             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_asyncio); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 77, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Future); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 77, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 77, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_loop, __pyx_v_self->loop) < 0) __PYX_ERR(3, 77, __pyx_L1_error)
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_empty_tuple, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 77, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "asynctnt/iproto/protocol.pyx":76
 *             self.create_future = self._create_future_fallback
 * 
 *     def _create_future_fallback(self):  # pragma: no cover             # <<<<<<<<<<<<<<
 *         return asyncio.Future(loop=self.loop)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("asynctnt.iproto.protocol.BaseProtocol._create_future_fallback", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/protocol.pyx":80
 * 
 *     @property
 *     def schema(self):             # <<<<<<<<<<<<<<
 *         return self._schema
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_12BaseProtocol_6schema_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_12BaseProtocol_6schema_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8asynctnt_6iproto_8protocol_12BaseProtocol_6schema___get__(((struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_12BaseProtocol_6schema___get__(struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "asynctnt/iproto/protocol.pyx":81
 *     @property
 *     def schema(self):
 *         return self._schema             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->_schema));
  __pyx_r = ((PyObject *)__pyx_v_self->_schema);
  goto __pyx_L0;

  /* "asynctnt/iproto/protocol.pyx":80
 * 
 *     @property
 *     def schema(self):             # <<<<<<<<<<<<<<
 *         return self._schema
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/protocol.pyx":84
 * 
 *     @property
 *     def schema_id(self):             # <<<<<<<<<<<<<<
 *         return self._schema_id
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_12BaseProtocol_9schema_id_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_12BaseProtocol_9schema_id_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8asynctnt_6iproto_8protocol_12BaseProtocol_9schema_id___get__(((struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_12BaseProtocol_9schema_id___get__(struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "asynctnt/iproto/protocol.pyx":85
 *     @property
 *     def schema_id(self):
 *         return self._schema_id             # <<<<<<<<<<<<<<
 * 
 *     cdef void _set_connection_ready(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int64_t(__pyx_v_self->_schema_id); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 85, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "asynctnt/iproto/protocol.pyx":84
 * 
 *     @property
 *     def schema_id(self):             # <<<<<<<<<<<<<<
 *         return self._schema_id
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asynctnt.iproto.protocol.BaseProtocol.schema_id.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/protocol.pyx":87
 *         return self._schema_id
 * 
 *     cdef void _set_connection_ready(self):             # <<<<<<<<<<<<<<
 *         if not self.connected_fut.done():
 *             self.connected_fut.set_result(True)
 */

static void __pyx_f_8asynctnt_6iproto_8protocol_12BaseProtocol__set_connection_ready(struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("_set_connection_ready", 0);

  /* "asynctnt/iproto/protocol.pyx":88
 * 
 *     cdef void _set_connection_ready(self):
 *         if not self.connected_fut.done():             # <<<<<<<<<<<<<<
 *             self.connected_fut.set_result(True)
 *             self.con_state = CONNECTION_FULL
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->connected_fut, __pyx_n_s_done); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 88, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 88, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 88, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(3, 88, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_5 = ((!__pyx_t_4) != 0);
  if (__pyx_t_5) {

    /* "asynctnt/iproto/protocol.pyx":89
 *     cdef void _set_connection_ready(self):
 *         if not self.connected_fut.done():
 *             self.connected_fut.set_result(True)             # <<<<<<<<<<<<<<
 *             self.con_state = CONNECTION_FULL
 * 
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->connected_fut, __pyx_n_s_set_result); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 89, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__33, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 89, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "asynctnt/iproto/protocol.pyx":90
 *         if not self.connected_fut.done():
 *             self.connected_fut.set_result(True)
 *             self.con_state = CONNECTION_FULL             # <<<<<<<<<<<<<<
 * 
 *     cdef void _set_connection_error(self, e):
 */
    __pyx_v_self->__pyx_base.con_state = __pyx_e_8asynctnt_6iproto_8protocol_CONNECTION_FULL;

    /* "asynctnt/iproto/protocol.pyx":88
 * 
 *     cdef void _set_connection_ready(self):
 *         if not self.connected_fut.done():             # <<<<<<<<<<<<<<
 *             self.connected_fut.set_result(True)
 *             self.con_state = CONNECTION_FULL
 */
  }

  /* "asynctnt/iproto/protocol.pyx":87
 *         return self._schema_id
 * 
 *     cdef void _set_connection_ready(self):             # <<<<<<<<<<<<<<
 *         if not self.connected_fut.done():
 *             self.connected_fut.set_result(True)
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_WriteUnraisable("asynctnt.iproto.protocol.BaseProtocol._set_connection_ready", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "asynctnt/iproto/protocol.pyx":92
 *             self.con_state = CONNECTION_FULL
 * 
 *     cdef void _set_connection_error(self, e):             # <<<<<<<<<<<<<<
 *         if not self.connected_fut.done():
 *             self.connected_fut.set_exception(e)
 */

static void __pyx_f_8asynctnt_6iproto_8protocol_12BaseProtocol__set_connection_error(struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *__pyx_v_self, PyObject *__pyx_v_e) {
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("_set_connection_error", 0);

  /* "asynctnt/iproto/protocol.pyx":93
 * 
 *     cdef void _set_connection_error(self, e):
 *         if not self.connected_fut.done():             # <<<<<<<<<<<<<<
 *             self.connected_fut.set_exception(e)
 *             self.con_state = CONNECTION_BAD
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->connected_fut, __pyx_n_s_done); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 93, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 93, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 93, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(3, 93, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_5 = ((!__pyx_t_4) != 0);
  if (__pyx_t_5) {

    /* "asynctnt/iproto/protocol.pyx":94
 *     cdef void _set_connection_error(self, e):
 *         if not self.connected_fut.done():
 *             self.connected_fut.set_exception(e)             # <<<<<<<<<<<<<<
 *             self.con_state = CONNECTION_BAD
 * 
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->connected_fut, __pyx_n_s_set_exception); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 94, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    if (!__pyx_t_3) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_e); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 94, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_2)) {
        PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_e};
        __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 94, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_1);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
        PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_e};
        __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 94, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_1);
      } else
      #endif
      {
        __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 94, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3); __pyx_t_3 = NULL;
        __Pyx_INCREF(__pyx_v_e);
        __Pyx_GIVEREF(__pyx_v_e);
        PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_v_e);
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 94, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "asynctnt/iproto/protocol.pyx":95
 *         if not self.connected_fut.done():
 *             self.connected_fut.set_exception(e)
 *             self.con_state = CONNECTION_BAD             # <<<<<<<<<<<<<<
 * 
 *     cdef void _on_greeting_received(self):
 */
    __pyx_v_self->__pyx_base.con_state = __pyx_e_8asynctnt_6iproto_8protocol_CONNECTION_BAD;

    /* "asynctnt/iproto/protocol.pyx":93
 * 
 *     cdef void _set_connection_error(self, e):
 *         if not self.connected_fut.done():             # <<<<<<<<<<<<<<
 *             self.connected_fut.set_exception(e)
 *             self.con_state = CONNECTION_BAD
 */
  }

  /* "asynctnt/iproto/protocol.pyx":92
 *             self.con_state = CONNECTION_FULL
 * 
 *     cdef void _set_connection_error(self, e):             # <<<<<<<<<<<<<<
 *         if not self.connected_fut.done():
 *             self.connected_fut.set_exception(e)
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_WriteUnraisable("asynctnt.iproto.protocol.BaseProtocol._set_connection_error", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "asynctnt/iproto/protocol.pyx":97
 *             self.con_state = CONNECTION_BAD
 * 
 *     cdef void _on_greeting_received(self):             # <<<<<<<<<<<<<<
 *         if self.username and self.password:
 *             self._do_auth(self.username, self.password)
 */

static void __pyx_f_8asynctnt_6iproto_8protocol_12BaseProtocol__on_greeting_received(struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("_on_greeting_received", 0);

  /* "asynctnt/iproto/protocol.pyx":98
 * 
 *     cdef void _on_greeting_received(self):
 *         if self.username and self.password:             # <<<<<<<<<<<<<<
 *             self._do_auth(self.username, self.password)
 *         elif self.fetch_schema:
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_self->username); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(3, 98, __pyx_L1_error)
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_self->password); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(3, 98, __pyx_L1_error)
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "asynctnt/iproto/protocol.pyx":99
 *     cdef void _on_greeting_received(self):
 *         if self.username and self.password:
 *             self._do_auth(self.username, self.password)             # <<<<<<<<<<<<<<
 *         elif self.fetch_schema:
 *             self._do_fetch_schema()
 */
    __pyx_t_3 = __pyx_v_self->username;
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_4 = __pyx_v_self->password;
    __Pyx_INCREF(__pyx_t_4);
    ((struct __pyx_vtabstruct_8asynctnt_6iproto_8protocol_BaseProtocol *)__pyx_v_self->__pyx_base.__pyx_vtab)->_do_auth(__pyx_v_self, ((PyObject*)__pyx_t_3), ((PyObject*)__pyx_t_4));
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "asynctnt/iproto/protocol.pyx":98
 * 
 *     cdef void _on_greeting_received(self):
 *         if self.username and self.password:             # <<<<<<<<<<<<<<
 *             self._do_auth(self.username, self.password)
 *         elif self.fetch_schema:
 */
    goto __pyx_L3;
  }

  /* "asynctnt/iproto/protocol.pyx":100
 *         if self.username and self.password:
 *             self._do_auth(self.username, self.password)
 *         elif self.fetch_schema:             # <<<<<<<<<<<<<<
 *             self._do_fetch_schema()
 *         else:
 */
  __pyx_t_1 = (__pyx_v_self->fetch_schema != 0);
  if (__pyx_t_1) {

    /* "asynctnt/iproto/protocol.pyx":101
 *             self._do_auth(self.username, self.password)
 *         elif self.fetch_schema:
 *             self._do_fetch_schema()             # <<<<<<<<<<<<<<
 *         else:
 *             self._set_connection_ready()
 */
    __pyx_t_4 = ((struct __pyx_vtabstruct_8asynctnt_6iproto_8protocol_BaseProtocol *)__pyx_v_self->__pyx_base.__pyx_vtab)->_do_fetch_schema(__pyx_v_self); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 101, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "asynctnt/iproto/protocol.pyx":100
 *         if self.username and self.password:
 *             self._do_auth(self.username, self.password)
 *         elif self.fetch_schema:             # <<<<<<<<<<<<<<
 *             self._do_fetch_schema()
 *         else:
 */
    goto __pyx_L3;
  }

  /* "asynctnt/iproto/protocol.pyx":103
 *             self._do_fetch_schema()
 *         else:
 *             self._set_connection_ready()             # <<<<<<<<<<<<<<
 * 
 *     cdef void _do_auth(self, str username, str password):
 */
  /*else*/ {
    ((struct __pyx_vtabstruct_8asynctnt_6iproto_8protocol_BaseProtocol *)__pyx_v_self->__pyx_base.__pyx_vtab)->_set_connection_ready(__pyx_v_self);
  }
  __pyx_L3:;

  /* "asynctnt/iproto/protocol.pyx":97
 *             self.con_state = CONNECTION_BAD
 * 
 *     cdef void _on_greeting_received(self):             # <<<<<<<<<<<<<<
 *         if self.username and self.password:
 *             self._do_auth(self.username, self.password)
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_WriteUnraisable("asynctnt.iproto.protocol.BaseProtocol._on_greeting_received", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "asynctnt/iproto/protocol.pyx":112
 *         )
 * 
 *         def on_authorized(f):             # <<<<<<<<<<<<<<
 *             if f.cancelled():
 *                 self._set_connection_error(asyncio.futures.CancelledError())
 */

/* Python wrapper */
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_12BaseProtocol_8_do_auth_1on_authorized(PyObject *__pyx_self, PyObject *__pyx_v_f); /*proto*/
static PyMethodDef __pyx_mdef_8asynctnt_6iproto_8protocol_12BaseProtocol_8_do_auth_1on_authorized = {"on_authorized", (PyCFunction)__pyx_pw_8asynctnt_6iproto_8protocol_12BaseProtocol_8_do_auth_1on_authorized, METH_O, 0};
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_12BaseProtocol_8_do_auth_1on_authorized(PyObject *__pyx_self, PyObject *__pyx_v_f) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("on_authorized (wrapper)", 0);
  __pyx_r = __pyx_pf_8asynctnt_6iproto_8protocol_12BaseProtocol_8_do_auth_on_authorized(__pyx_self, ((PyObject *)__pyx_v_f));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_12BaseProtocol_8_do_auth_on_authorized(PyObject *__pyx_self, PyObject *__pyx_v_f) {
  struct __pyx_obj_8asynctnt_6iproto_8protocol___pyx_scope_struct_1__do_auth *__pyx_cur_scope;
  struct __pyx_obj_8asynctnt_6iproto_8protocol___pyx_scope_struct_1__do_auth *__pyx_outer_scope;
  PyObject *__pyx_v_e = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  __Pyx_RefNannySetupContext("on_authorized", 0);
  __pyx_outer_scope = (struct __pyx_obj_8asynctnt_6iproto_8protocol___pyx_scope_struct_1__do_auth *) __Pyx_CyFunction_GetClosure(__pyx_self);
  __pyx_cur_scope = __pyx_outer_scope;

  /* "asynctnt/iproto/protocol.pyx":113
 * 
 *         def on_authorized(f):
 *             if f.cancelled():             # <<<<<<<<<<<<<<
 *                 self._set_connection_error(asyncio.futures.CancelledError())
 *                 return
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_cancelled); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 113, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 113, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 113, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(3, 113, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_4) {

    /* "asynctnt/iproto/protocol.pyx":114
 *         def on_authorized(f):
 *             if f.cancelled():
 *                 self._set_connection_error(asyncio.futures.CancelledError())             # <<<<<<<<<<<<<<
 *                 return
 *             e = f.exception()
 */
    if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(3, 114, __pyx_L1_error) }
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_asyncio); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 114, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_futures); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 114, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_CancelledError); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 114, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    if (__pyx_t_3) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 114, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else {
      __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 114, __pyx_L1_error)
    }
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    ((struct __pyx_vtabstruct_8asynctnt_6iproto_8protocol_BaseProtocol *)__pyx_cur_scope->__pyx_v_self->__pyx_base.__pyx_vtab)->_set_connection_error(__pyx_cur_scope->__pyx_v_self, __pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "asynctnt/iproto/protocol.pyx":115
 *             if f.cancelled():
 *                 self._set_connection_error(asyncio.futures.CancelledError())
 *                 return             # <<<<<<<<<<<<<<
 *             e = f.exception()
 *             if not e:
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "asynctnt/iproto/protocol.pyx":113
 * 
 *         def on_authorized(f):
 *             if f.cancelled():             # <<<<<<<<<<<<<<
 *                 self._set_connection_error(asyncio.futures.CancelledError())
 *                 return
 */
  }

  /* "asynctnt/iproto/protocol.pyx":116
 *                 self._set_connection_error(asyncio.futures.CancelledError())
 *                 return
 *             e = f.exception()             # <<<<<<<<<<<<<<
 *             if not e:
 *                 logger.debug('Tarantool[%s:%s] Authorized successfully',
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_exception); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 116, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 116, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 116, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_e = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "asynctnt/iproto/protocol.pyx":117
 *                 return
 *             e = f.exception()
 *             if not e:             # <<<<<<<<<<<<<<
 *                 logger.debug('Tarantool[%s:%s] Authorized successfully',
 *                              self.host, self.port)
 */
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_e); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(3, 117, __pyx_L1_error)
  __pyx_t_5 = ((!__pyx_t_4) != 0);
  if (__pyx_t_5) {

    /* "asynctnt/iproto/protocol.pyx":118
 *             e = f.exception()
 *             if not e:
 *                 logger.debug('Tarantool[%s:%s] Authorized successfully',             # <<<<<<<<<<<<<<
 *                              self.host, self.port)
 * 
 */
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 118, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_debug); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 118, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "asynctnt/iproto/protocol.pyx":119
 *             if not e:
 *                 logger.debug('Tarantool[%s:%s] Authorized successfully',
 *                              self.host, self.port)             # <<<<<<<<<<<<<<
 * 
 *                 if self.fetch_schema:
 */
    if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(3, 119, __pyx_L1_error) }
    if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(3, 119, __pyx_L1_error) }
    __pyx_t_2 = NULL;
    __pyx_t_6 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
        __pyx_t_6 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[4] = {__pyx_t_2, __pyx_kp_s_Tarantool_s_s_Authorized_success, __pyx_cur_scope->__pyx_v_self->__pyx_base.host, __pyx_cur_scope->__pyx_v_self->__pyx_base.port};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 118, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[4] = {__pyx_t_2, __pyx_kp_s_Tarantool_s_s_Authorized_success, __pyx_cur_scope->__pyx_v_self->__pyx_base.host, __pyx_cur_scope->__pyx_v_self->__pyx_base.port};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 118, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    {
      __pyx_t_7 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(3, 118, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      if (__pyx_t_2) {
        __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2); __pyx_t_2 = NULL;
      }
      __Pyx_INCREF(__pyx_kp_s_Tarantool_s_s_Authorized_success);
      __Pyx_GIVEREF(__pyx_kp_s_Tarantool_s_s_Authorized_success);
      PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_kp_s_Tarantool_s_s_Authorized_success);
      __Pyx_INCREF(__pyx_cur_scope->__pyx_v_self->__pyx_base.host);
      __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_self->__pyx_base.host);
      PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_cur_scope->__pyx_v_self->__pyx_base.host);
      __Pyx_INCREF(__pyx_cur_scope->__pyx_v_self->__pyx_base.port);
      __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_self->__pyx_base.port);
      PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_6, __pyx_cur_scope->__pyx_v_self->__pyx_base.port);
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 118, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "asynctnt/iproto/protocol.pyx":121
 *                              self.host, self.port)
 * 
 *                 if self.fetch_schema:             # <<<<<<<<<<<<<<
 *                     self._do_fetch_schema()
 *                 else:
 */
    if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(3, 121, __pyx_L1_error) }
    __pyx_t_5 = (__pyx_cur_scope->__pyx_v_self->fetch_schema != 0);
    if (__pyx_t_5) {

      /* "asynctnt/iproto/protocol.pyx":122
 * 
 *                 if self.fetch_schema:
 *                     self._do_fetch_schema()             # <<<<<<<<<<<<<<
 *                 else:
 *                     self._set_connection_ready()
 */
      if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(3, 122, __pyx_L1_error) }
      __pyx_t_1 = ((struct __pyx_vtabstruct_8asynctnt_6iproto_8protocol_BaseProtocol *)__pyx_cur_scope->__pyx_v_self->__pyx_base.__pyx_vtab)->_do_fetch_schema(__pyx_cur_scope->__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 122, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "asynctnt/iproto/protocol.pyx":121
 *                              self.host, self.port)
 * 
 *                 if self.fetch_schema:             # <<<<<<<<<<<<<<
 *                     self._do_fetch_schema()
 *                 else:
 */
      goto __pyx_L5;
    }

    /* "asynctnt/iproto/protocol.pyx":124
 *                     self._do_fetch_schema()
 *                 else:
 *                     self._set_connection_ready()             # <<<<<<<<<<<<<<
 *             else:
 *                 logger.error('Tarantool[%s:%s] Authorization failed: %s',
 */
    /*else*/ {
      if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(3, 124, __pyx_L1_error) }
      ((struct __pyx_vtabstruct_8asynctnt_6iproto_8protocol_BaseProtocol *)__pyx_cur_scope->__pyx_v_self->__pyx_base.__pyx_vtab)->_set_connection_ready(__pyx_cur_scope->__pyx_v_self);
    }
    __pyx_L5:;

    /* "asynctnt/iproto/protocol.pyx":117
 *                 return
 *             e = f.exception()
 *             if not e:             # <<<<<<<<<<<<<<
 *                 logger.debug('Tarantool[%s:%s] Authorized successfully',
 *                              self.host, self.port)
 */
    goto __pyx_L4;
  }

  /* "asynctnt/iproto/protocol.pyx":126
 *                     self._set_connection_ready()
 *             else:
 *                 logger.error('Tarantool[%s:%s] Authorization failed: %s',             # <<<<<<<<<<<<<<
 *                              self.host, self.port, str(e))
 *                 self._set_connection_error(e)
 */
  /*else*/ {
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 126, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_error); if (unlikely(!__pyx_t_7)) __PYX_ERR(3, 126, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "asynctnt/iproto/protocol.pyx":127
 *             else:
 *                 logger.error('Tarantool[%s:%s] Authorization failed: %s',
 *                              self.host, self.port, str(e))             # <<<<<<<<<<<<<<
 *                 self._set_connection_error(e)
 * 
 */
    if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(3, 127, __pyx_L1_error) }
    if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(3, 127, __pyx_L1_error) }
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 127, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_e);
    __Pyx_GIVEREF(__pyx_v_e);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_e);
    __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)(&PyString_Type)), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 127, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = NULL;
    __pyx_t_6 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
        __pyx_t_6 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_7)) {
      PyObject *__pyx_temp[5] = {__pyx_t_3, __pyx_kp_s_Tarantool_s_s_Authorization_fail, __pyx_cur_scope->__pyx_v_self->__pyx_base.host, __pyx_cur_scope->__pyx_v_self->__pyx_base.port, __pyx_t_2};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_6, 4+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 126, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
      PyObject *__pyx_temp[5] = {__pyx_t_3, __pyx_kp_s_Tarantool_s_s_Authorization_fail, __pyx_cur_scope->__pyx_v_self->__pyx_base.host, __pyx_cur_scope->__pyx_v_self->__pyx_base.port, __pyx_t_2};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_6, 4+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 126, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else
    #endif
    {
      __pyx_t_8 = PyTuple_New(4+__pyx_t_6); if (unlikely(!__pyx_t_8)) __PYX_ERR(3, 126, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      if (__pyx_t_3) {
        __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_3); __pyx_t_3 = NULL;
      }
      __Pyx_INCREF(__pyx_kp_s_Tarantool_s_s_Authorization_fail);
      __Pyx_GIVEREF(__pyx_kp_s_Tarantool_s_s_Authorization_fail);
      PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_6, __pyx_kp_s_Tarantool_s_s_Authorization_fail);
      __Pyx_INCREF(__pyx_cur_scope->__pyx_v_self->__pyx_base.host);
      __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_self->__pyx_base.host);
      PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_6, __pyx_cur_scope->__pyx_v_self->__pyx_base.host);
      __Pyx_INCREF(__pyx_cur_scope->__pyx_v_self->__pyx_base.port);
      __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_self->__pyx_base.port);
      PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_6, __pyx_cur_scope->__pyx_v_self->__pyx_base.port);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_8, 3+__pyx_t_6, __pyx_t_2);
      __pyx_t_2 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 126, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    }
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "asynctnt/iproto/protocol.pyx":128
 *                 logger.error('Tarantool[%s:%s] Authorization failed: %s',
 *                              self.host, self.port, str(e))
 *                 self._set_connection_error(e)             # <<<<<<<<<<<<<<
 * 
 *         fut.add_done_callback(on_authorized)
 */
    if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(3, 128, __pyx_L1_error) }
    ((struct __pyx_vtabstruct_8asynctnt_6iproto_8protocol_BaseProtocol *)__pyx_cur_scope->__pyx_v_self->__pyx_base.__pyx_vtab)->_set_connection_error(__pyx_cur_scope->__pyx_v_self, __pyx_v_e);
  }
  __pyx_L4:;

  /* "asynctnt/iproto/protocol.pyx":112
 *         )
 * 
 *         def on_authorized(f):             # <<<<<<<<<<<<<<
 *             if f.cancelled():
 *                 self._set_connection_error(asyncio.futures.CancelledError())
 */

  /* function exit code */
  __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_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("asynctnt.iproto.protocol.BaseProtocol._do_auth.on_authorized", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_e);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/protocol.pyx":105
 *             self._set_connection_ready()
 * 
 *     cdef void _do_auth(self, str username, str password):             # <<<<<<<<<<<<<<
 *         # No extra error handling from Db.execute
 *         fut = self.execute(
 */

static void __pyx_f_8asynctnt_6iproto_8protocol_12BaseProtocol__do_auth(struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *__pyx_v_self, PyObject *__pyx_v_username, PyObject *__pyx_v_password) {
  struct __pyx_obj_8asynctnt_6iproto_8protocol___pyx_scope_struct_1__do_auth *__pyx_cur_scope;
  PyObject *__pyx_v_fut = NULL;
  PyObject *__pyx_v_on_authorized = 0;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("_do_auth", 0);
  __pyx_cur_scope = (struct __pyx_obj_8asynctnt_6iproto_8protocol___pyx_scope_struct_1__do_auth *)__pyx_tp_new_8asynctnt_6iproto_8protocol___pyx_scope_struct_1__do_auth(__pyx_ptype_8asynctnt_6iproto_8protocol___pyx_scope_struct_1__do_auth, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_8asynctnt_6iproto_8protocol___pyx_scope_struct_1__do_auth *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(3, 105, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);

  /* "asynctnt/iproto/protocol.pyx":108
 *         # No extra error handling from Db.execute
 *         fut = self.execute(
 *             self._db._auth(self.salt, username, password),             # <<<<<<<<<<<<<<
 *             0
 *         )
 */
  __pyx_t_1 = __pyx_cur_scope->__pyx_v_self->__pyx_base.salt;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = ((PyObject *)((struct __pyx_vtabstruct_8asynctnt_6iproto_8protocol_Db *)__pyx_cur_scope->__pyx_v_self->_db->__pyx_vtab)->_auth(__pyx_cur_scope->__pyx_v_self->_db, ((PyObject*)__pyx_t_1), __pyx_v_username, __pyx_v_password)); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 108, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asynctnt/iproto/protocol.pyx":107
 *     cdef void _do_auth(self, str username, str password):
 *         # No extra error handling from Db.execute
 *         fut = self.execute(             # <<<<<<<<<<<<<<
 *             self._db._auth(self.salt, username, password),
 *             0
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8asynctnt_6iproto_8protocol_BaseProtocol *)__pyx_cur_scope->__pyx_v_self->__pyx_base.__pyx_vtab)->execute(__pyx_cur_scope->__pyx_v_self, ((struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *)__pyx_t_2), 0.0); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 107, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_fut = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "asynctnt/iproto/protocol.pyx":112
 *         )
 * 
 *         def on_authorized(f):             # <<<<<<<<<<<<<<
 *             if f.cancelled():
 *                 self._set_connection_error(asyncio.futures.CancelledError())
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_8asynctnt_6iproto_8protocol_12BaseProtocol_8_do_auth_1on_authorized, 0, __pyx_n_s_BaseProtocol__do_auth_locals_on, ((PyObject*)__pyx_cur_scope), __pyx_n_s_asynctnt_iproto_protocol, __pyx_d, ((PyObject *)__pyx_codeobj__35)); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 112, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_on_authorized = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "asynctnt/iproto/protocol.pyx":130
 *                 self._set_connection_error(e)
 * 
 *         fut.add_done_callback(on_authorized)             # <<<<<<<<<<<<<<
 * 
 *     cdef object _do_fetch_schema(self):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_fut, __pyx_n_s_add_done_callback); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 130, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (!__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_on_authorized); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 130, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_on_authorized};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 130, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_on_authorized};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 130, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    {
      __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 130, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL;
      __Pyx_INCREF(__pyx_v_on_authorized);
      __Pyx_GIVEREF(__pyx_v_on_authorized);
      PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_on_authorized);
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 130, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asynctnt/iproto/protocol.pyx":105
 *             self._set_connection_ready()
 * 
 *     cdef void _do_auth(self, str username, str password):             # <<<<<<<<<<<<<<
 *         # No extra error handling from Db.execute
 *         fut = self.execute(
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_WriteUnraisable("asynctnt.iproto.protocol.BaseProtocol._do_auth", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_fut);
  __Pyx_XDECREF(__pyx_v_on_authorized);
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_RefNannyFinishContext();
}

/* "asynctnt/iproto/protocol.pyx":135
 *         fut = self.create_future()
 * 
 *         def on_fetch(f):             # <<<<<<<<<<<<<<
 *             if f.cancelled():
 *                 self._set_connection_error(asyncio.futures.CancelledError())
 */

/* Python wrapper */
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_12BaseProtocol_16_do_fetch_schema_1on_fetch(PyObject *__pyx_self, PyObject *__pyx_v_f); /*proto*/
static PyMethodDef __pyx_mdef_8asynctnt_6iproto_8protocol_12BaseProtocol_16_do_fetch_schema_1on_fetch = {"on_fetch", (PyCFunction)__pyx_pw_8asynctnt_6iproto_8protocol_12BaseProtocol_16_do_fetch_schema_1on_fetch, METH_O, 0};
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_12BaseProtocol_16_do_fetch_schema_1on_fetch(PyObject *__pyx_self, PyObject *__pyx_v_f) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("on_fetch (wrapper)", 0);
  __pyx_r = __pyx_pf_8asynctnt_6iproto_8protocol_12BaseProtocol_16_do_fetch_schema_on_fetch(__pyx_self, ((PyObject *)__pyx_v_f));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_12BaseProtocol_16_do_fetch_schema_on_fetch(PyObject *__pyx_self, PyObject *__pyx_v_f) {
  struct __pyx_obj_8asynctnt_6iproto_8protocol___pyx_scope_struct_2__do_fetch_schema *__pyx_cur_scope;
  struct __pyx_obj_8asynctnt_6iproto_8protocol___pyx_scope_struct_2__do_fetch_schema *__pyx_outer_scope;
  PyObject *__pyx_v_e = NULL;
  PyObject *__pyx_v_spaces = NULL;
  PyObject *__pyx_v_indexes = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *(*__pyx_t_7)(PyObject *);
  Py_ssize_t __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  int64_t __pyx_t_12;
  __Pyx_RefNannySetupContext("on_fetch", 0);
  __pyx_outer_scope = (struct __pyx_obj_8asynctnt_6iproto_8protocol___pyx_scope_struct_2__do_fetch_schema *) __Pyx_CyFunction_GetClosure(__pyx_self);
  __pyx_cur_scope = __pyx_outer_scope;

  /* "asynctnt/iproto/protocol.pyx":136
 * 
 *         def on_fetch(f):
 *             if f.cancelled():             # <<<<<<<<<<<<<<
 *                 self._set_connection_error(asyncio.futures.CancelledError())
 *                 return
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_cancelled); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 136, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 136, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 136, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(3, 136, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_4) {

    /* "asynctnt/iproto/protocol.pyx":137
 *         def on_fetch(f):
 *             if f.cancelled():
 *                 self._set_connection_error(asyncio.futures.CancelledError())             # <<<<<<<<<<<<<<
 *                 return
 *             e = f.exception()
 */
    if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(3, 137, __pyx_L1_error) }
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_asyncio); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 137, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_futures); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 137, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_CancelledError); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 137, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    if (__pyx_t_3) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 137, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else {
      __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 137, __pyx_L1_error)
    }
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    ((struct __pyx_vtabstruct_8asynctnt_6iproto_8protocol_BaseProtocol *)__pyx_cur_scope->__pyx_v_self->__pyx_base.__pyx_vtab)->_set_connection_error(__pyx_cur_scope->__pyx_v_self, __pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "asynctnt/iproto/protocol.pyx":138
 *             if f.cancelled():
 *                 self._set_connection_error(asyncio.futures.CancelledError())
 *                 return             # <<<<<<<<<<<<<<
 *             e = f.exception()
 *             if not e:
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "asynctnt/iproto/protocol.pyx":136
 * 
 *         def on_fetch(f):
 *             if f.cancelled():             # <<<<<<<<<<<<<<
 *                 self._set_connection_error(asyncio.futures.CancelledError())
 *                 return
 */
  }

  /* "asynctnt/iproto/protocol.pyx":139
 *                 self._set_connection_error(asyncio.futures.CancelledError())
 *                 return
 *             e = f.exception()             # <<<<<<<<<<<<<<
 *             if not e:
 *                 spaces, indexes = f.result()
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_exception); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 139, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 139, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 139, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_e = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "asynctnt/iproto/protocol.pyx":140
 *                 return
 *             e = f.exception()
 *             if not e:             # <<<<<<<<<<<<<<
 *                 spaces, indexes = f.result()
 *                 logger.debug('Tarantool[%s:%s] Schema fetch succeeded. '
 */
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_e); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(3, 140, __pyx_L1_error)
  __pyx_t_5 = ((!__pyx_t_4) != 0);
  if (__pyx_t_5) {

    /* "asynctnt/iproto/protocol.pyx":141
 *             e = f.exception()
 *             if not e:
 *                 spaces, indexes = f.result()             # <<<<<<<<<<<<<<
 *                 logger.debug('Tarantool[%s:%s] Schema fetch succeeded. '
 *                              'Spaces: %d, Indexes: %d.',
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_result); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 141, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    if (__pyx_t_3) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 141, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else {
      __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 141, __pyx_L1_error)
    }
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
      PyObject* sequence = __pyx_t_1;
      #if !CYTHON_COMPILING_IN_PYPY
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(3, 141, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      #else
      __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 141, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 141, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_6 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 141, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext;
      index = 0; __pyx_t_2 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_2)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_2);
      index = 1; __pyx_t_3 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_3)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_3);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 2) < 0) __PYX_ERR(3, 141, __pyx_L1_error)
      __pyx_t_7 = NULL;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L6_unpacking_done;
      __pyx_L5_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_7 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(3, 141, __pyx_L1_error)
      __pyx_L6_unpacking_done:;
    }
    __pyx_v_spaces = __pyx_t_2;
    __pyx_t_2 = 0;
    __pyx_v_indexes = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "asynctnt/iproto/protocol.pyx":142
 *             if not e:
 *                 spaces, indexes = f.result()
 *                 logger.debug('Tarantool[%s:%s] Schema fetch succeeded. '             # <<<<<<<<<<<<<<
 *                              'Spaces: %d, Indexes: %d.',
 *                              self.host, self.port,
 */
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 142, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_debug); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 142, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "asynctnt/iproto/protocol.pyx":144
 *                 logger.debug('Tarantool[%s:%s] Schema fetch succeeded. '
 *                              'Spaces: %d, Indexes: %d.',
 *                              self.host, self.port,             # <<<<<<<<<<<<<<
 *                              len(spaces.body), len(indexes.body))
 *                 self._schema = parse_schema(spaces.schema_id,
 */
    if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(3, 144, __pyx_L1_error) }
    if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(3, 144, __pyx_L1_error) }

    /* "asynctnt/iproto/protocol.pyx":145
 *                              'Spaces: %d, Indexes: %d.',
 *                              self.host, self.port,
 *                              len(spaces.body), len(indexes.body))             # <<<<<<<<<<<<<<
 *                 self._schema = parse_schema(spaces.schema_id,
 *                                             spaces.body, indexes.body)
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_spaces, __pyx_n_s_body); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 145, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_8 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_8 == -1)) __PYX_ERR(3, 145, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 145, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_indexes, __pyx_n_s_body); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 145, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_8 = PyObject_Length(__pyx_t_6); if (unlikely(__pyx_t_8 == -1)) __PYX_ERR(3, 145, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = PyInt_FromSsize_t(__pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 145, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_9 = NULL;
    __pyx_t_10 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
        __pyx_t_10 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[6] = {__pyx_t_9, __pyx_kp_s_Tarantool_s_s_Schema_fetch_succe, __pyx_cur_scope->__pyx_v_self->__pyx_base.host, __pyx_cur_scope->__pyx_v_self->__pyx_base.port, __pyx_t_3, __pyx_t_6};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_10, 5+__pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 142, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[6] = {__pyx_t_9, __pyx_kp_s_Tarantool_s_s_Schema_fetch_succe, __pyx_cur_scope->__pyx_v_self->__pyx_base.host, __pyx_cur_scope->__pyx_v_self->__pyx_base.port, __pyx_t_3, __pyx_t_6};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_10, 5+__pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 142, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else
    #endif
    {
      __pyx_t_11 = PyTuple_New(5+__pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(3, 142, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      if (__pyx_t_9) {
        __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_9); __pyx_t_9 = NULL;
      }
      __Pyx_INCREF(__pyx_kp_s_Tarantool_s_s_Schema_fetch_succe);
      __Pyx_GIVEREF(__pyx_kp_s_Tarantool_s_s_Schema_fetch_succe);
      PyTuple_SET_ITEM(__pyx_t_11, 0+__pyx_t_10, __pyx_kp_s_Tarantool_s_s_Schema_fetch_succe);
      __Pyx_INCREF(__pyx_cur_scope->__pyx_v_self->__pyx_base.host);
      __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_self->__pyx_base.host);
      PyTuple_SET_ITEM(__pyx_t_11, 1+__pyx_t_10, __pyx_cur_scope->__pyx_v_self->__pyx_base.host);
      __Pyx_INCREF(__pyx_cur_scope->__pyx_v_self->__pyx_base.port);
      __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_self->__pyx_base.port);
      PyTuple_SET_ITEM(__pyx_t_11, 2+__pyx_t_10, __pyx_cur_scope->__pyx_v_self->__pyx_base.port);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_11, 3+__pyx_t_10, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_11, 4+__pyx_t_10, __pyx_t_6);
      __pyx_t_3 = 0;
      __pyx_t_6 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_11, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 142, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "asynctnt/iproto/protocol.pyx":146
 *                              self.host, self.port,
 *                              len(spaces.body), len(indexes.body))
 *                 self._schema = parse_schema(spaces.schema_id,             # <<<<<<<<<<<<<<
 *                                             spaces.body, indexes.body)
 *                 if self.auto_refetch_schema:
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_spaces, __pyx_n_s_schema_id); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 146, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_12 = __Pyx_PyInt_As_int64_t(__pyx_t_1); if (unlikely((__pyx_t_12 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(3, 146, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "asynctnt/iproto/protocol.pyx":147
 *                              len(spaces.body), len(indexes.body))
 *                 self._schema = parse_schema(spaces.schema_id,
 *                                             spaces.body, indexes.body)             # <<<<<<<<<<<<<<
 *                 if self.auto_refetch_schema:
 *                     # if no refetch, them we should not
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_spaces, __pyx_n_s_body); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 147, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_indexes, __pyx_n_s_body); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 147, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);

    /* "asynctnt/iproto/protocol.pyx":146
 *                              self.host, self.port,
 *                              len(spaces.body), len(indexes.body))
 *                 self._schema = parse_schema(spaces.schema_id,             # <<<<<<<<<<<<<<
 *                                             spaces.body, indexes.body)
 *                 if self.auto_refetch_schema:
 */
    __pyx_t_11 = ((PyObject *)__pyx_f_8asynctnt_6iproto_8protocol_parse_schema(__pyx_t_12, __pyx_t_1, __pyx_t_2)); if (unlikely(!__pyx_t_11)) __PYX_ERR(3, 146, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(3, 146, __pyx_L1_error) }
    __Pyx_GIVEREF(__pyx_t_11);
    __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_self->_schema);
    __Pyx_DECREF(((PyObject *)__pyx_cur_scope->__pyx_v_self->_schema));
    __pyx_cur_scope->__pyx_v_self->_schema = ((struct __pyx_obj_8asynctnt_6iproto_8protocol_Schema *)__pyx_t_11);
    __pyx_t_11 = 0;

    /* "asynctnt/iproto/protocol.pyx":148
 *                 self._schema = parse_schema(spaces.schema_id,
 *                                             spaces.body, indexes.body)
 *                 if self.auto_refetch_schema:             # <<<<<<<<<<<<<<
 *                     # if no refetch, them we should not
 *                     # send schema_id at all (leave it -1)
 */
    if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(3, 148, __pyx_L1_error) }
    __pyx_t_5 = (__pyx_cur_scope->__pyx_v_self->auto_refetch_schema != 0);
    if (__pyx_t_5) {

      /* "asynctnt/iproto/protocol.pyx":151
 *                     # if no refetch, them we should not
 *                     # send schema_id at all (leave it -1)
 *                     self._schema_id = self._schema.id             # <<<<<<<<<<<<<<
 *                 else:
 *                     self._schema_id = -1
 */
      if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(3, 151, __pyx_L1_error) }
      __pyx_t_12 = __pyx_cur_scope->__pyx_v_self->_schema->id;
      if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(3, 151, __pyx_L1_error) }
      __pyx_cur_scope->__pyx_v_self->_schema_id = __pyx_t_12;

      /* "asynctnt/iproto/protocol.pyx":148
 *                 self._schema = parse_schema(spaces.schema_id,
 *                                             spaces.body, indexes.body)
 *                 if self.auto_refetch_schema:             # <<<<<<<<<<<<<<
 *                     # if no refetch, them we should not
 *                     # send schema_id at all (leave it -1)
 */
      goto __pyx_L7;
    }

    /* "asynctnt/iproto/protocol.pyx":153
 *                     self._schema_id = self._schema.id
 *                 else:
 *                     self._schema_id = -1             # <<<<<<<<<<<<<<
 *                 self._set_connection_ready()
 *                 fut.set_result(self._schema)
 */
    /*else*/ {
      if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(3, 153, __pyx_L1_error) }
      __pyx_cur_scope->__pyx_v_self->_schema_id = -1L;
    }
    __pyx_L7:;

    /* "asynctnt/iproto/protocol.pyx":154
 *                 else:
 *                     self._schema_id = -1
 *                 self._set_connection_ready()             # <<<<<<<<<<<<<<
 *                 fut.set_result(self._schema)
 *             else:
 */
    if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(3, 154, __pyx_L1_error) }
    ((struct __pyx_vtabstruct_8asynctnt_6iproto_8protocol_BaseProtocol *)__pyx_cur_scope->__pyx_v_self->__pyx_base.__pyx_vtab)->_set_connection_ready(__pyx_cur_scope->__pyx_v_self);

    /* "asynctnt/iproto/protocol.pyx":155
 *                     self._schema_id = -1
 *                 self._set_connection_ready()
 *                 fut.set_result(self._schema)             # <<<<<<<<<<<<<<
 *             else:
 *                 logger.error('Tarantool[%s:%s] Schema fetch failed: %s',
 */
    if (unlikely(!__pyx_cur_scope->__pyx_v_fut)) { __Pyx_RaiseClosureNameError("fut"); __PYX_ERR(3, 155, __pyx_L1_error) }
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_fut, __pyx_n_s_set_result); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 155, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(3, 155, __pyx_L1_error) }
    __pyx_t_1 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    if (!__pyx_t_1) {
      __pyx_t_11 = __Pyx_PyObject_CallOneArg(__pyx_t_2, ((PyObject *)__pyx_cur_scope->__pyx_v_self->_schema)); if (unlikely(!__pyx_t_11)) __PYX_ERR(3, 155, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_2)) {
        PyObject *__pyx_temp[2] = {__pyx_t_1, ((PyObject *)__pyx_cur_scope->__pyx_v_self->_schema)};
        __pyx_t_11 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_11)) __PYX_ERR(3, 155, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_GOTREF(__pyx_t_11);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
        PyObject *__pyx_temp[2] = {__pyx_t_1, ((PyObject *)__pyx_cur_scope->__pyx_v_self->_schema)};
        __pyx_t_11 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_11)) __PYX_ERR(3, 155, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_GOTREF(__pyx_t_11);
      } else
      #endif
      {
        __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 155, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1); __pyx_t_1 = NULL;
        __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_self->_schema));
        __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_self->_schema));
        PyTuple_SET_ITEM(__pyx_t_6, 0+1, ((PyObject *)__pyx_cur_scope->__pyx_v_self->_schema));
        __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_11)) __PYX_ERR(3, 155, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

    /* "asynctnt/iproto/protocol.pyx":140
 *                 return
 *             e = f.exception()
 *             if not e:             # <<<<<<<<<<<<<<
 *                 spaces, indexes = f.result()
 *                 logger.debug('Tarantool[%s:%s] Schema fetch succeeded. '
 */
    goto __pyx_L4;
  }

  /* "asynctnt/iproto/protocol.pyx":157
 *                 fut.set_result(self._schema)
 *             else:
 *                 logger.error('Tarantool[%s:%s] Schema fetch failed: %s',             # <<<<<<<<<<<<<<
 *                              self.host, self.port, str(e))
 *                 if isinstance(e, asyncio.TimeoutError):
 */
  /*else*/ {
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 157, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_error); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 157, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "asynctnt/iproto/protocol.pyx":158
 *             else:
 *                 logger.error('Tarantool[%s:%s] Schema fetch failed: %s',
 *                              self.host, self.port, str(e))             # <<<<<<<<<<<<<<
 *                 if isinstance(e, asyncio.TimeoutError):
 *                     e = asyncio.TimeoutError('Schema fetch timeout')
 */
    if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(3, 158, __pyx_L1_error) }
    if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(3, 158, __pyx_L1_error) }
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 158, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_v_e);
    __Pyx_GIVEREF(__pyx_v_e);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_e);
    __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)(&PyString_Type)), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 158, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = NULL;
    __pyx_t_10 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
        __pyx_t_10 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_6)) {
      PyObject *__pyx_temp[5] = {__pyx_t_2, __pyx_kp_s_Tarantool_s_s_Schema_fetch_faile, __pyx_cur_scope->__pyx_v_self->__pyx_base.host, __pyx_cur_scope->__pyx_v_self->__pyx_base.port, __pyx_t_1};
      __pyx_t_11 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_10, 4+__pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(3, 157, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
      PyObject *__pyx_temp[5] = {__pyx_t_2, __pyx_kp_s_Tarantool_s_s_Schema_fetch_faile, __pyx_cur_scope->__pyx_v_self->__pyx_base.host, __pyx_cur_scope->__pyx_v_self->__pyx_base.port, __pyx_t_1};
      __pyx_t_11 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_10, 4+__pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(3, 157, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else
    #endif
    {
      __pyx_t_3 = PyTuple_New(4+__pyx_t_10); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 157, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (__pyx_t_2) {
        __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __pyx_t_2 = NULL;
      }
      __Pyx_INCREF(__pyx_kp_s_Tarantool_s_s_Schema_fetch_faile);
      __Pyx_GIVEREF(__pyx_kp_s_Tarantool_s_s_Schema_fetch_faile);
      PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_10, __pyx_kp_s_Tarantool_s_s_Schema_fetch_faile);
      __Pyx_INCREF(__pyx_cur_scope->__pyx_v_self->__pyx_base.host);
      __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_self->__pyx_base.host);
      PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_10, __pyx_cur_scope->__pyx_v_self->__pyx_base.host);
      __Pyx_INCREF(__pyx_cur_scope->__pyx_v_self->__pyx_base.port);
      __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_self->__pyx_base.port);
      PyTuple_SET_ITEM(__pyx_t_3, 2+__pyx_t_10, __pyx_cur_scope->__pyx_v_self->__pyx_base.port);
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_3, 3+__pyx_t_10, __pyx_t_1);
      __pyx_t_1 = 0;
      __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_3, NULL); if (unlikely(!__pyx_t_11)) __PYX_ERR(3, 157, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

    /* "asynctnt/iproto/protocol.pyx":159
 *                 logger.error('Tarantool[%s:%s] Schema fetch failed: %s',
 *                              self.host, self.port, str(e))
 *                 if isinstance(e, asyncio.TimeoutError):             # <<<<<<<<<<<<<<
 *                     e = asyncio.TimeoutError('Schema fetch timeout')
 *                 self._set_connection_error(e)
 */
    __pyx_t_11 = __Pyx_GetModuleGlobalName(__pyx_n_s_asyncio); if (unlikely(!__pyx_t_11)) __PYX_ERR(3, 159, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_TimeoutError); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 159, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __pyx_t_5 = PyObject_IsInstance(__pyx_v_e, __pyx_t_6); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(3, 159, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_4 = (__pyx_t_5 != 0);
    if (__pyx_t_4) {

      /* "asynctnt/iproto/protocol.pyx":160
 *                              self.host, self.port, str(e))
 *                 if isinstance(e, asyncio.TimeoutError):
 *                     e = asyncio.TimeoutError('Schema fetch timeout')             # <<<<<<<<<<<<<<
 *                 self._set_connection_error(e)
 *                 fut.set_exception(e)
 */
      __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_asyncio); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 160, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_TimeoutError); if (unlikely(!__pyx_t_11)) __PYX_ERR(3, 160, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_tuple__36, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 160, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_DECREF_SET(__pyx_v_e, __pyx_t_6);
      __pyx_t_6 = 0;

      /* "asynctnt/iproto/protocol.pyx":159
 *                 logger.error('Tarantool[%s:%s] Schema fetch failed: %s',
 *                              self.host, self.port, str(e))
 *                 if isinstance(e, asyncio.TimeoutError):             # <<<<<<<<<<<<<<
 *                     e = asyncio.TimeoutError('Schema fetch timeout')
 *                 self._set_connection_error(e)
 */
    }

    /* "asynctnt/iproto/protocol.pyx":161
 *                 if isinstance(e, asyncio.TimeoutError):
 *                     e = asyncio.TimeoutError('Schema fetch timeout')
 *                 self._set_connection_error(e)             # <<<<<<<<<<<<<<
 *                 fut.set_exception(e)
 * 
 */
    if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(3, 161, __pyx_L1_error) }
    ((struct __pyx_vtabstruct_8asynctnt_6iproto_8protocol_BaseProtocol *)__pyx_cur_scope->__pyx_v_self->__pyx_base.__pyx_vtab)->_set_connection_error(__pyx_cur_scope->__pyx_v_self, __pyx_v_e);

    /* "asynctnt/iproto/protocol.pyx":162
 *                     e = asyncio.TimeoutError('Schema fetch timeout')
 *                 self._set_connection_error(e)
 *                 fut.set_exception(e)             # <<<<<<<<<<<<<<
 * 
 *         self._schema_id = -1
 */
    if (unlikely(!__pyx_cur_scope->__pyx_v_fut)) { __Pyx_RaiseClosureNameError("fut"); __PYX_ERR(3, 162, __pyx_L1_error) }
    __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_fut, __pyx_n_s_set_exception); if (unlikely(!__pyx_t_11)) __PYX_ERR(3, 162, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_11))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_11);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_11, function);
      }
    }
    if (!__pyx_t_3) {
      __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_v_e); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 162, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_11)) {
        PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_e};
        __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_11, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 162, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_6);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_11)) {
        PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_e};
        __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_11, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 162, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_6);
      } else
      #endif
      {
        __pyx_t_1 = PyTuple_New(1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 162, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); __pyx_t_3 = NULL;
        __Pyx_INCREF(__pyx_v_e);
        __Pyx_GIVEREF(__pyx_v_e);
        PyTuple_SET_ITEM(__pyx_t_1, 0+1, __pyx_v_e);
        __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_1, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 162, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __pyx_L4:;

  /* "asynctnt/iproto/protocol.pyx":135
 *         fut = self.create_future()
 * 
 *         def on_fetch(f):             # <<<<<<<<<<<<<<
 *             if f.cancelled():
 *                 self._set_connection_error(asyncio.futures.CancelledError())
 */

  /* function exit code */
  __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_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("asynctnt.iproto.protocol.BaseProtocol._do_fetch_schema.on_fetch", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_e);
  __Pyx_XDECREF(__pyx_v_spaces);
  __Pyx_XDECREF(__pyx_v_indexes);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/protocol.pyx":132
 *         fut.add_done_callback(on_authorized)
 * 
 *     cdef object _do_fetch_schema(self):             # <<<<<<<<<<<<<<
 *         fut = self.create_future()
 * 
 */

static PyObject *__pyx_f_8asynctnt_6iproto_8protocol_12BaseProtocol__do_fetch_schema(struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *__pyx_v_self) {
  struct __pyx_obj_8asynctnt_6iproto_8protocol___pyx_scope_struct_2__do_fetch_schema *__pyx_cur_scope;
  PyObject *__pyx_v_on_fetch = 0;
  PyObject *__pyx_v_fut_vspace = NULL;
  PyObject *__pyx_v_fut_vindex = NULL;
  PyObject *__pyx_v_gather_fut = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("_do_fetch_schema", 0);
  __pyx_cur_scope = (struct __pyx_obj_8asynctnt_6iproto_8protocol___pyx_scope_struct_2__do_fetch_schema *)__pyx_tp_new_8asynctnt_6iproto_8protocol___pyx_scope_struct_2__do_fetch_schema(__pyx_ptype_8asynctnt_6iproto_8protocol___pyx_scope_struct_2__do_fetch_schema, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_8asynctnt_6iproto_8protocol___pyx_scope_struct_2__do_fetch_schema *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(3, 132, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);

  /* "asynctnt/iproto/protocol.pyx":133
 * 
 *     cdef object _do_fetch_schema(self):
 *         fut = self.create_future()             # <<<<<<<<<<<<<<
 * 
 *         def on_fetch(f):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_create_future); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 133, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 133, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 133, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_cur_scope->__pyx_v_fut = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "asynctnt/iproto/protocol.pyx":135
 *         fut = self.create_future()
 * 
 *         def on_fetch(f):             # <<<<<<<<<<<<<<
 *             if f.cancelled():
 *                 self._set_connection_error(asyncio.futures.CancelledError())
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_8asynctnt_6iproto_8protocol_12BaseProtocol_16_do_fetch_schema_1on_fetch, 0, __pyx_n_s_BaseProtocol__do_fetch_schema_lo, ((PyObject*)__pyx_cur_scope), __pyx_n_s_asynctnt_iproto_protocol, __pyx_d, ((PyObject *)__pyx_codeobj__38)); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 135, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_on_fetch = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "asynctnt/iproto/protocol.pyx":164
 *                 fut.set_exception(e)
 * 
 *         self._schema_id = -1             # <<<<<<<<<<<<<<
 *         fut_vspace = self._db.select(SPACE_VSPACE, timeout=0)
 *         fut_vindex = self._db.select(SPACE_VINDEX, timeout=0)
 */
  __pyx_cur_scope->__pyx_v_self->_schema_id = -1L;

  /* "asynctnt/iproto/protocol.pyx":165
 * 
 *         self._schema_id = -1
 *         fut_vspace = self._db.select(SPACE_VSPACE, timeout=0)             # <<<<<<<<<<<<<<
 *         fut_vindex = self._db.select(SPACE_VINDEX, timeout=0)
 *         gather_fut = asyncio.gather(fut_vspace, fut_vindex,
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self->_db), __pyx_n_s_select); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 165, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 165, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_timeout, __pyx_int_0) < 0) __PYX_ERR(3, 165, __pyx_L1_error)
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__39, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 165, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_fut_vspace = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "asynctnt/iproto/protocol.pyx":166
 *         self._schema_id = -1
 *         fut_vspace = self._db.select(SPACE_VSPACE, timeout=0)
 *         fut_vindex = self._db.select(SPACE_VINDEX, timeout=0)             # <<<<<<<<<<<<<<
 *         gather_fut = asyncio.gather(fut_vspace, fut_vindex,
 *                                     return_exceptions=False,
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self->_db), __pyx_n_s_select); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 166, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 166, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_timeout, __pyx_int_0) < 0) __PYX_ERR(3, 166, __pyx_L1_error)
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__40, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 166, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_fut_vindex = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "asynctnt/iproto/protocol.pyx":167
 *         fut_vspace = self._db.select(SPACE_VSPACE, timeout=0)
 *         fut_vindex = self._db.select(SPACE_VINDEX, timeout=0)
 *         gather_fut = asyncio.gather(fut_vspace, fut_vindex,             # <<<<<<<<<<<<<<
 *                                     return_exceptions=False,
 *                                     loop=self.loop)
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_asyncio); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 167, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_gather); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 167, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 167, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_fut_vspace);
  __Pyx_GIVEREF(__pyx_v_fut_vspace);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_fut_vspace);
  __Pyx_INCREF(__pyx_v_fut_vindex);
  __Pyx_GIVEREF(__pyx_v_fut_vindex);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_fut_vindex);

  /* "asynctnt/iproto/protocol.pyx":168
 *         fut_vindex = self._db.select(SPACE_VINDEX, timeout=0)
 *         gather_fut = asyncio.gather(fut_vspace, fut_vindex,
 *                                     return_exceptions=False,             # <<<<<<<<<<<<<<
 *                                     loop=self.loop)
 *         gather_fut.add_done_callback(on_fetch)
 */
  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 168, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_return_exceptions, Py_False) < 0) __PYX_ERR(3, 168, __pyx_L1_error)

  /* "asynctnt/iproto/protocol.pyx":169
 *         gather_fut = asyncio.gather(fut_vspace, fut_vindex,
 *                                     return_exceptions=False,
 *                                     loop=self.loop)             # <<<<<<<<<<<<<<
 *         gather_fut.add_done_callback(on_fetch)
 *         return fut
 */
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_loop, __pyx_cur_scope->__pyx_v_self->loop) < 0) __PYX_ERR(3, 168, __pyx_L1_error)

  /* "asynctnt/iproto/protocol.pyx":167
 *         fut_vspace = self._db.select(SPACE_VSPACE, timeout=0)
 *         fut_vindex = self._db.select(SPACE_VINDEX, timeout=0)
 *         gather_fut = asyncio.gather(fut_vspace, fut_vindex,             # <<<<<<<<<<<<<<
 *                                     return_exceptions=False,
 *                                     loop=self.loop)
 */
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 167, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_gather_fut = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "asynctnt/iproto/protocol.pyx":170
 *                                     return_exceptions=False,
 *                                     loop=self.loop)
 *         gather_fut.add_done_callback(on_fetch)             # <<<<<<<<<<<<<<
 *         return fut
 * 
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_gather_fut, __pyx_n_s_add_done_callback); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 170, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (!__pyx_t_1) {
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_on_fetch); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 170, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_v_on_fetch};
      __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 170, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_GOTREF(__pyx_t_4);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_v_on_fetch};
      __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 170, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_GOTREF(__pyx_t_4);
    } else
    #endif
    {
      __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 170, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __pyx_t_1 = NULL;
      __Pyx_INCREF(__pyx_v_on_fetch);
      __Pyx_GIVEREF(__pyx_v_on_fetch);
      PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_v_on_fetch);
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 170, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "asynctnt/iproto/protocol.pyx":171
 *                                     loop=self.loop)
 *         gather_fut.add_done_callback(on_fetch)
 *         return fut             # <<<<<<<<<<<<<<
 * 
 *     cdef void _on_connection_made(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_fut);
  __pyx_r = __pyx_cur_scope->__pyx_v_fut;
  goto __pyx_L0;

  /* "asynctnt/iproto/protocol.pyx":132
 *         fut.add_done_callback(on_authorized)
 * 
 *     cdef object _do_fetch_schema(self):             # <<<<<<<<<<<<<<
 *         fut = self.create_future()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("asynctnt.iproto.protocol.BaseProtocol._do_fetch_schema", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_on_fetch);
  __Pyx_XDECREF(__pyx_v_fut_vspace);
  __Pyx_XDECREF(__pyx_v_fut_vindex);
  __Pyx_XDECREF(__pyx_v_gather_fut);
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/protocol.pyx":173
 *         return fut
 * 
 *     cdef void _on_connection_made(self):             # <<<<<<<<<<<<<<
 *         CoreProtocol._on_connection_made(self)
 * 
 */

static void __pyx_f_8asynctnt_6iproto_8protocol_12BaseProtocol__on_connection_made(struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("_on_connection_made", 0);

  /* "asynctnt/iproto/protocol.pyx":174
 * 
 *     cdef void _on_connection_made(self):
 *         CoreProtocol._on_connection_made(self)             # <<<<<<<<<<<<<<
 * 
 *         if self.on_connection_made_cb:
 */
  __pyx_f_8asynctnt_6iproto_8protocol_12CoreProtocol__on_connection_made(((struct __pyx_obj_8asynctnt_6iproto_8protocol_CoreProtocol *)__pyx_v_self));

  /* "asynctnt/iproto/protocol.pyx":176
 *         CoreProtocol._on_connection_made(self)
 * 
 *         if self.on_connection_made_cb:             # <<<<<<<<<<<<<<
 *             self.on_connection_made_cb()
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_on_connection_made_cb); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 176, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(3, 176, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "asynctnt/iproto/protocol.pyx":177
 * 
 *         if self.on_connection_made_cb:
 *             self.on_connection_made_cb()             # <<<<<<<<<<<<<<
 * 
 *     cdef void _on_connection_lost(self, exc):
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_on_connection_made_cb); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 177, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    if (__pyx_t_4) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 177, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else {
      __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 177, __pyx_L1_error)
    }
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "asynctnt/iproto/protocol.pyx":176
 *         CoreProtocol._on_connection_made(self)
 * 
 *         if self.on_connection_made_cb:             # <<<<<<<<<<<<<<
 *             self.on_connection_made_cb()
 * 
 */
  }

  /* "asynctnt/iproto/protocol.pyx":173
 *         return fut
 * 
 *     cdef void _on_connection_made(self):             # <<<<<<<<<<<<<<
 *         CoreProtocol._on_connection_made(self)
 * 
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_WriteUnraisable("asynctnt.iproto.protocol.BaseProtocol._on_connection_made", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "asynctnt/iproto/protocol.pyx":179
 *             self.on_connection_made_cb()
 * 
 *     cdef void _on_connection_lost(self, exc):             # <<<<<<<<<<<<<<
 *         CoreProtocol._on_connection_lost(self, exc)
 * 
 */

static void __pyx_f_8asynctnt_6iproto_8protocol_12BaseProtocol__on_connection_lost(struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *__pyx_v_self, PyObject *__pyx_v_exc) {
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("_on_connection_lost", 0);

  /* "asynctnt/iproto/protocol.pyx":180
 * 
 *     cdef void _on_connection_lost(self, exc):
 *         CoreProtocol._on_connection_lost(self, exc)             # <<<<<<<<<<<<<<
 * 
 *         if self.on_connection_lost_cb:
 */
  __pyx_f_8asynctnt_6iproto_8protocol_12CoreProtocol__on_connection_lost(((struct __pyx_obj_8asynctnt_6iproto_8protocol_CoreProtocol *)__pyx_v_self), __pyx_v_exc);

  /* "asynctnt/iproto/protocol.pyx":182
 *         CoreProtocol._on_connection_lost(self, exc)
 * 
 *         if self.on_connection_lost_cb:             # <<<<<<<<<<<<<<
 *             self.on_connection_lost_cb(exc)
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_on_connection_lost_cb); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 182, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(3, 182, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "asynctnt/iproto/protocol.pyx":183
 * 
 *         if self.on_connection_lost_cb:
 *             self.on_connection_lost_cb(exc)             # <<<<<<<<<<<<<<
 * 
 *     cdef uint64_t next_sync(self):
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_on_connection_lost_cb); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 183, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    if (!__pyx_t_4) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_exc); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 183, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_exc};
        __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 183, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_GOTREF(__pyx_t_1);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_exc};
        __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 183, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_GOTREF(__pyx_t_1);
      } else
      #endif
      {
        __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 183, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL;
        __Pyx_INCREF(__pyx_v_exc);
        __Pyx_GIVEREF(__pyx_v_exc);
        PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_exc);
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 183, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "asynctnt/iproto/protocol.pyx":182
 *         CoreProtocol._on_connection_lost(self, exc)
 * 
 *         if self.on_connection_lost_cb:             # <<<<<<<<<<<<<<
 *             self.on_connection_lost_cb(exc)
 * 
 */
  }

  /* "asynctnt/iproto/protocol.pyx":179
 *             self.on_connection_made_cb()
 * 
 *     cdef void _on_connection_lost(self, exc):             # <<<<<<<<<<<<<<
 *         CoreProtocol._on_connection_lost(self, exc)
 * 
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_WriteUnraisable("asynctnt.iproto.protocol.BaseProtocol._on_connection_lost", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "asynctnt/iproto/protocol.pyx":185
 *             self.on_connection_lost_cb(exc)
 * 
 *     cdef uint64_t next_sync(self):             # <<<<<<<<<<<<<<
 *         self._sync += 1
 *         return self._sync
 */

static uint64_t __pyx_f_8asynctnt_6iproto_8protocol_12BaseProtocol_next_sync(struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *__pyx_v_self) {
  uint64_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("next_sync", 0);

  /* "asynctnt/iproto/protocol.pyx":186
 * 
 *     cdef uint64_t next_sync(self):
 *         self._sync += 1             # <<<<<<<<<<<<<<
 *         return self._sync
 * 
 */
  __pyx_v_self->_sync = (__pyx_v_self->_sync + 1);

  /* "asynctnt/iproto/protocol.pyx":187
 *     cdef uint64_t next_sync(self):
 *         self._sync += 1
 *         return self._sync             # <<<<<<<<<<<<<<
 * 
 *     def _on_request_timeout(self, waiter):
 */
  __pyx_r = __pyx_v_self->_sync;
  goto __pyx_L0;

  /* "asynctnt/iproto/protocol.pyx":185
 *             self.on_connection_lost_cb(exc)
 * 
 *     cdef uint64_t next_sync(self):             # <<<<<<<<<<<<<<
 *         self._sync += 1
 *         return self._sync
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/protocol.pyx":189
 *         return self._sync
 * 
 *     def _on_request_timeout(self, waiter):             # <<<<<<<<<<<<<<
 *         cdef Request req
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_12BaseProtocol_5_on_request_timeout(PyObject *__pyx_v_self, PyObject *__pyx_v_waiter); /*proto*/
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_12BaseProtocol_5_on_request_timeout(PyObject *__pyx_v_self, PyObject *__pyx_v_waiter) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_on_request_timeout (wrapper)", 0);
  __pyx_r = __pyx_pf_8asynctnt_6iproto_8protocol_12BaseProtocol_4_on_request_timeout(((struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *)__pyx_v_self), ((PyObject *)__pyx_v_waiter));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_12BaseProtocol_4_on_request_timeout(CYTHON_UNUSED struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *__pyx_v_self, PyObject *__pyx_v_waiter) {
  struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *__pyx_v_req = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  __Pyx_RefNannySetupContext("_on_request_timeout", 0);

  /* "asynctnt/iproto/protocol.pyx":192
 *         cdef Request req
 * 
 *         if waiter.done():             # <<<<<<<<<<<<<<
 *             return
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_waiter, __pyx_n_s_done); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 192, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 192, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 192, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(3, 192, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_4) {

    /* "asynctnt/iproto/protocol.pyx":193
 * 
 *         if waiter.done():
 *             return             # <<<<<<<<<<<<<<
 * 
 *         req = waiter._req
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "asynctnt/iproto/protocol.pyx":192
 *         cdef Request req
 * 
 *         if waiter.done():             # <<<<<<<<<<<<<<
 *             return
 * 
 */
  }

  /* "asynctnt/iproto/protocol.pyx":195
 *             return
 * 
 *         req = waiter._req             # <<<<<<<<<<<<<<
 *         req.timeout_handle.cancel()
 *         req.timeout_handle = None
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_waiter, __pyx_n_s_req_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 195, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_8asynctnt_6iproto_8protocol_Request))))) __PYX_ERR(3, 195, __pyx_L1_error)
  __pyx_v_req = ((struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "asynctnt/iproto/protocol.pyx":196
 * 
 *         req = waiter._req
 *         req.timeout_handle.cancel()             # <<<<<<<<<<<<<<
 *         req.timeout_handle = None
 *         waiter.set_exception(
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_req->timeout_handle, __pyx_n_s_cancel); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 196, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 196, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 196, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asynctnt/iproto/protocol.pyx":197
 *         req = waiter._req
 *         req.timeout_handle.cancel()
 *         req.timeout_handle = None             # <<<<<<<<<<<<<<
 *         waiter.set_exception(
 *             asyncio.TimeoutError(
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_req->timeout_handle);
  __Pyx_DECREF(__pyx_v_req->timeout_handle);
  __pyx_v_req->timeout_handle = Py_None;

  /* "asynctnt/iproto/protocol.pyx":198
 *         req.timeout_handle.cancel()
 *         req.timeout_handle = None
 *         waiter.set_exception(             # <<<<<<<<<<<<<<
 *             asyncio.TimeoutError(
 *                 '{} exceeded timeout'.format(req.__class__.__name__))
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_waiter, __pyx_n_s_set_exception); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 198, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "asynctnt/iproto/protocol.pyx":199
 *         req.timeout_handle = None
 *         waiter.set_exception(
 *             asyncio.TimeoutError(             # <<<<<<<<<<<<<<
 *                 '{} exceeded timeout'.format(req.__class__.__name__))
 *         )
 */
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_asyncio); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 199, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_TimeoutError); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 199, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "asynctnt/iproto/protocol.pyx":200
 *         waiter.set_exception(
 *             asyncio.TimeoutError(
 *                 '{} exceeded timeout'.format(req.__class__.__name__))             # <<<<<<<<<<<<<<
 *         )
 * 
 */
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_exceeded_timeout, __pyx_n_s_format); if (unlikely(!__pyx_t_7)) __PYX_ERR(3, 200, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_req), __pyx_n_s_class); if (unlikely(!__pyx_t_8)) __PYX_ERR(3, 200, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_name_2); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 200, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_7, function);
    }
  }
  if (!__pyx_t_8) {
    __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 200, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_GOTREF(__pyx_t_5);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_7)) {
      PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_t_9};
      __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 200, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
      PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_t_9};
      __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 200, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    } else
    #endif
    {
      __pyx_t_10 = PyTuple_New(1+1); if (unlikely(!__pyx_t_10)) __PYX_ERR(3, 200, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_8); __pyx_t_8 = NULL;
      __Pyx_GIVEREF(__pyx_t_9);
      PyTuple_SET_ITEM(__pyx_t_10, 0+1, __pyx_t_9);
      __pyx_t_9 = 0;
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_10, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 200, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  if (!__pyx_t_7) {
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 199, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_3);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_6)) {
      PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_5};
      __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 199, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
      PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_5};
      __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 199, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    {
      __pyx_t_10 = PyTuple_New(1+1); if (unlikely(!__pyx_t_10)) __PYX_ERR(3, 199, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_7); __pyx_t_7 = NULL;
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_10, 0+1, __pyx_t_5);
      __pyx_t_5 = 0;
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_10, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 199, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (!__pyx_t_6) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 198, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_3};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 198, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_3};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 198, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    {
      __pyx_t_10 = PyTuple_New(1+1); if (unlikely(!__pyx_t_10)) __PYX_ERR(3, 198, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_6); __pyx_t_6 = NULL;
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_10, 0+1, __pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 198, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asynctnt/iproto/protocol.pyx":189
 *         return self._sync
 * 
 *     def _on_request_timeout(self, waiter):             # <<<<<<<<<<<<<<
 *         cdef Request req
 * 
 */

  /* function exit code */
  __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_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("asynctnt.iproto.protocol.BaseProtocol._on_request_timeout", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_req);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/protocol.pyx":203
 *         )
 * 
 *     def _on_request_completed(self, fut):             # <<<<<<<<<<<<<<
 *         cdef Request req = fut._req
 *         fut._req = None
 */

/* Python wrapper */
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_12BaseProtocol_7_on_request_completed(PyObject *__pyx_v_self, PyObject *__pyx_v_fut); /*proto*/
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_12BaseProtocol_7_on_request_completed(PyObject *__pyx_v_self, PyObject *__pyx_v_fut) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_on_request_completed (wrapper)", 0);
  __pyx_r = __pyx_pf_8asynctnt_6iproto_8protocol_12BaseProtocol_6_on_request_completed(((struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *)__pyx_v_self), ((PyObject *)__pyx_v_fut));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_12BaseProtocol_6_on_request_completed(CYTHON_UNUSED struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *__pyx_v_self, PyObject *__pyx_v_fut) {
  struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *__pyx_v_req = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("_on_request_completed", 0);

  /* "asynctnt/iproto/protocol.pyx":204
 * 
 *     def _on_request_completed(self, fut):
 *         cdef Request req = fut._req             # <<<<<<<<<<<<<<
 *         fut._req = None
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_fut, __pyx_n_s_req_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 204, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_8asynctnt_6iproto_8protocol_Request))))) __PYX_ERR(3, 204, __pyx_L1_error)
  __pyx_v_req = ((struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "asynctnt/iproto/protocol.pyx":205
 *     def _on_request_completed(self, fut):
 *         cdef Request req = fut._req
 *         fut._req = None             # <<<<<<<<<<<<<<
 * 
 *         if req.timeout_handle is not None:
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_fut, __pyx_n_s_req_2, Py_None) < 0) __PYX_ERR(3, 205, __pyx_L1_error)

  /* "asynctnt/iproto/protocol.pyx":207
 *         fut._req = None
 * 
 *         if req.timeout_handle is not None:             # <<<<<<<<<<<<<<
 *             req.timeout_handle.cancel()
 *             req.timeout_handle = None
 */
  __pyx_t_2 = (__pyx_v_req->timeout_handle != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "asynctnt/iproto/protocol.pyx":208
 * 
 *         if req.timeout_handle is not None:
 *             req.timeout_handle.cancel()             # <<<<<<<<<<<<<<
 *             req.timeout_handle = None
 * 
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_req->timeout_handle, __pyx_n_s_cancel); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 208, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    if (__pyx_t_5) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 208, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else {
      __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 208, __pyx_L1_error)
    }
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "asynctnt/iproto/protocol.pyx":209
 *         if req.timeout_handle is not None:
 *             req.timeout_handle.cancel()
 *             req.timeout_handle = None             # <<<<<<<<<<<<<<
 * 
 *     cdef object _new_waiter_for_request(self, Request req, float timeout):
 */
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_GOTREF(__pyx_v_req->timeout_handle);
    __Pyx_DECREF(__pyx_v_req->timeout_handle);
    __pyx_v_req->timeout_handle = Py_None;

    /* "asynctnt/iproto/protocol.pyx":207
 *         fut._req = None
 * 
 *         if req.timeout_handle is not None:             # <<<<<<<<<<<<<<
 *             req.timeout_handle.cancel()
 *             req.timeout_handle = None
 */
  }

  /* "asynctnt/iproto/protocol.pyx":203
 *         )
 * 
 *     def _on_request_completed(self, fut):             # <<<<<<<<<<<<<<
 *         cdef Request req = fut._req
 *         fut._req = None
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("asynctnt.iproto.protocol.BaseProtocol._on_request_completed", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_req);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/protocol.pyx":211
 *             req.timeout_handle = None
 * 
 *     cdef object _new_waiter_for_request(self, Request req, float timeout):             # <<<<<<<<<<<<<<
 *         fut = self.create_future()
 *         fut._req = req  # to be able to retrieve request after done()
 */

static PyObject *__pyx_f_8asynctnt_6iproto_8protocol_12BaseProtocol__new_waiter_for_request(struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *__pyx_v_self, struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *__pyx_v_req, float __pyx_v_timeout) {
  PyObject *__pyx_v_fut = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  float __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  __Pyx_RefNannySetupContext("_new_waiter_for_request", 0);

  /* "asynctnt/iproto/protocol.pyx":212
 * 
 *     cdef object _new_waiter_for_request(self, Request req, float timeout):
 *         fut = self.create_future()             # <<<<<<<<<<<<<<
 *         fut._req = req  # to be able to retrieve request after done()
 *         req.waiter = fut
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_create_future); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 212, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 212, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 212, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_fut = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "asynctnt/iproto/protocol.pyx":213
 *     cdef object _new_waiter_for_request(self, Request req, float timeout):
 *         fut = self.create_future()
 *         fut._req = req  # to be able to retrieve request after done()             # <<<<<<<<<<<<<<
 *         req.waiter = fut
 * 
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_fut, __pyx_n_s_req_2, ((PyObject *)__pyx_v_req)) < 0) __PYX_ERR(3, 213, __pyx_L1_error)

  /* "asynctnt/iproto/protocol.pyx":214
 *         fut = self.create_future()
 *         fut._req = req  # to be able to retrieve request after done()
 *         req.waiter = fut             # <<<<<<<<<<<<<<
 * 
 *         if timeout < 0:
 */
  __Pyx_INCREF(__pyx_v_fut);
  __Pyx_GIVEREF(__pyx_v_fut);
  __Pyx_GOTREF(__pyx_v_req->waiter);
  __Pyx_DECREF(__pyx_v_req->waiter);
  __pyx_v_req->waiter = __pyx_v_fut;

  /* "asynctnt/iproto/protocol.pyx":216
 *         req.waiter = fut
 * 
 *         if timeout < 0:             # <<<<<<<<<<<<<<
 *             timeout = self.request_timeout
 *         if timeout is not None and timeout > 0:
 */
  __pyx_t_4 = ((__pyx_v_timeout < 0.0) != 0);
  if (__pyx_t_4) {

    /* "asynctnt/iproto/protocol.pyx":217
 * 
 *         if timeout < 0:
 *             timeout = self.request_timeout             # <<<<<<<<<<<<<<
 *         if timeout is not None and timeout > 0:
 *             req.timeout_handle = \
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_request_timeout); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 217, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = __pyx_PyFloat_AsFloat(__pyx_t_1); if (unlikely((__pyx_t_5 == (float)-1) && PyErr_Occurred())) __PYX_ERR(3, 217, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_timeout = __pyx_t_5;

    /* "asynctnt/iproto/protocol.pyx":216
 *         req.waiter = fut
 * 
 *         if timeout < 0:             # <<<<<<<<<<<<<<
 *             timeout = self.request_timeout
 *         if timeout is not None and timeout > 0:
 */
  }

  /* "asynctnt/iproto/protocol.pyx":218
 *         if timeout < 0:
 *             timeout = self.request_timeout
 *         if timeout is not None and timeout > 0:             # <<<<<<<<<<<<<<
 *             req.timeout_handle = \
 *                 self.loop.call_later(timeout,
 */
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_timeout); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 218, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_6 = (__pyx_t_1 != Py_None);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_7 = (__pyx_t_6 != 0);
  if (__pyx_t_7) {
  } else {
    __pyx_t_4 = __pyx_t_7;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_7 = ((__pyx_v_timeout > 0.0) != 0);
  __pyx_t_4 = __pyx_t_7;
  __pyx_L5_bool_binop_done:;
  if (__pyx_t_4) {

    /* "asynctnt/iproto/protocol.pyx":220
 *         if timeout is not None and timeout > 0:
 *             req.timeout_handle = \
 *                 self.loop.call_later(timeout,             # <<<<<<<<<<<<<<
 *                                      self._on_request_timeout_cb, fut)
 *             fut.add_done_callback(self._on_request_completed_cb)
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->loop, __pyx_n_s_call_later); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 220, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyFloat_FromDouble(__pyx_v_timeout); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 220, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);

    /* "asynctnt/iproto/protocol.pyx":221
 *             req.timeout_handle = \
 *                 self.loop.call_later(timeout,
 *                                      self._on_request_timeout_cb, fut)             # <<<<<<<<<<<<<<
 *             fut.add_done_callback(self._on_request_completed_cb)
 *         return fut
 */
    __pyx_t_8 = NULL;
    __pyx_t_9 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
        __pyx_t_9 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[4] = {__pyx_t_8, __pyx_t_3, __pyx_v_self->_on_request_timeout_cb, __pyx_v_fut};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_9, 3+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 220, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[4] = {__pyx_t_8, __pyx_t_3, __pyx_v_self->_on_request_timeout_cb, __pyx_v_fut};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_9, 3+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 220, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    {
      __pyx_t_10 = PyTuple_New(3+__pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(3, 220, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      if (__pyx_t_8) {
        __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_8); __pyx_t_8 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_9, __pyx_t_3);
      __Pyx_INCREF(__pyx_v_self->_on_request_timeout_cb);
      __Pyx_GIVEREF(__pyx_v_self->_on_request_timeout_cb);
      PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_9, __pyx_v_self->_on_request_timeout_cb);
      __Pyx_INCREF(__pyx_v_fut);
      __Pyx_GIVEREF(__pyx_v_fut);
      PyTuple_SET_ITEM(__pyx_t_10, 2+__pyx_t_9, __pyx_v_fut);
      __pyx_t_3 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 220, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "asynctnt/iproto/protocol.pyx":219
 *             timeout = self.request_timeout
 *         if timeout is not None and timeout > 0:
 *             req.timeout_handle = \             # <<<<<<<<<<<<<<
 *                 self.loop.call_later(timeout,
 *                                      self._on_request_timeout_cb, fut)
 */
    __Pyx_GIVEREF(__pyx_t_1);
    __Pyx_GOTREF(__pyx_v_req->timeout_handle);
    __Pyx_DECREF(__pyx_v_req->timeout_handle);
    __pyx_v_req->timeout_handle = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "asynctnt/iproto/protocol.pyx":222
 *                 self.loop.call_later(timeout,
 *                                      self._on_request_timeout_cb, fut)
 *             fut.add_done_callback(self._on_request_completed_cb)             # <<<<<<<<<<<<<<
 *         return fut
 * 
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_fut, __pyx_n_s_add_done_callback); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 222, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_10 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_10)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_10);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    if (!__pyx_t_10) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_self->_on_request_completed_cb); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 222, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_2)) {
        PyObject *__pyx_temp[2] = {__pyx_t_10, __pyx_v_self->_on_request_completed_cb};
        __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 222, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_GOTREF(__pyx_t_1);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
        PyObject *__pyx_temp[2] = {__pyx_t_10, __pyx_v_self->_on_request_completed_cb};
        __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 222, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_GOTREF(__pyx_t_1);
      } else
      #endif
      {
        __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 222, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_10); __pyx_t_10 = NULL;
        __Pyx_INCREF(__pyx_v_self->_on_request_completed_cb);
        __Pyx_GIVEREF(__pyx_v_self->_on_request_completed_cb);
        PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_v_self->_on_request_completed_cb);
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 222, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "asynctnt/iproto/protocol.pyx":218
 *         if timeout < 0:
 *             timeout = self.request_timeout
 *         if timeout is not None and timeout > 0:             # <<<<<<<<<<<<<<
 *             req.timeout_handle = \
 *                 self.loop.call_later(timeout,
 */
  }

  /* "asynctnt/iproto/protocol.pyx":223
 *                                      self._on_request_timeout_cb, fut)
 *             fut.add_done_callback(self._on_request_completed_cb)
 *         return fut             # <<<<<<<<<<<<<<
 * 
 *     cdef Db _create_db(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_fut);
  __pyx_r = __pyx_v_fut;
  goto __pyx_L0;

  /* "asynctnt/iproto/protocol.pyx":211
 *             req.timeout_handle = None
 * 
 *     cdef object _new_waiter_for_request(self, Request req, float timeout):             # <<<<<<<<<<<<<<
 *         fut = self.create_future()
 *         fut._req = req  # to be able to retrieve request after done()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("asynctnt.iproto.protocol.BaseProtocol._new_waiter_for_request", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_fut);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/protocol.pyx":225
 *         return fut
 * 
 *     cdef Db _create_db(self):             # <<<<<<<<<<<<<<
 *         return Db.new(self)
 * 
 */

static struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *__pyx_f_8asynctnt_6iproto_8protocol_12BaseProtocol__create_db(struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *__pyx_v_self) {
  struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("_create_db", 0);

  /* "asynctnt/iproto/protocol.pyx":226
 * 
 *     cdef Db _create_db(self):
 *         return Db.new(self)             # <<<<<<<<<<<<<<
 * 
 *     def create_db(self):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_1 = ((PyObject *)__pyx_f_8asynctnt_6iproto_8protocol_2Db_new(__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 226, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = ((struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "asynctnt/iproto/protocol.pyx":225
 *         return fut
 * 
 *     cdef Db _create_db(self):             # <<<<<<<<<<<<<<
 *         return Db.new(self)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asynctnt.iproto.protocol.BaseProtocol._create_db", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/protocol.pyx":228
 *         return Db.new(self)
 * 
 *     def create_db(self):             # <<<<<<<<<<<<<<
 *         return self._create_db()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_12BaseProtocol_9create_db(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_12BaseProtocol_9create_db(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("create_db (wrapper)", 0);
  __pyx_r = __pyx_pf_8asynctnt_6iproto_8protocol_12BaseProtocol_8create_db(((struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_12BaseProtocol_8create_db(struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("create_db", 0);

  /* "asynctnt/iproto/protocol.pyx":229
 * 
 *     def create_db(self):
 *         return self._create_db()             # <<<<<<<<<<<<<<
 * 
 *     def get_common_db(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_8asynctnt_6iproto_8protocol_BaseProtocol *)__pyx_v_self->__pyx_base.__pyx_vtab)->_create_db(__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 229, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "asynctnt/iproto/protocol.pyx":228
 *         return Db.new(self)
 * 
 *     def create_db(self):             # <<<<<<<<<<<<<<
 *         return self._create_db()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asynctnt.iproto.protocol.BaseProtocol.create_db", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/protocol.pyx":231
 *         return self._create_db()
 * 
 *     def get_common_db(self):             # <<<<<<<<<<<<<<
 *         return self._db
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_12BaseProtocol_11get_common_db(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_12BaseProtocol_11get_common_db(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_common_db (wrapper)", 0);
  __pyx_r = __pyx_pf_8asynctnt_6iproto_8protocol_12BaseProtocol_10get_common_db(((struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_12BaseProtocol_10get_common_db(struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_common_db", 0);

  /* "asynctnt/iproto/protocol.pyx":232
 * 
 *     def get_common_db(self):
 *         return self._db             # <<<<<<<<<<<<<<
 * 
 *     cdef object execute(self, Request req, float timeout):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->_db));
  __pyx_r = ((PyObject *)__pyx_v_self->_db);
  goto __pyx_L0;

  /* "asynctnt/iproto/protocol.pyx":231
 *         return self._create_db()
 * 
 *     def get_common_db(self):             # <<<<<<<<<<<<<<
 *         return self._db
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/protocol.pyx":234
 *         return self._db
 * 
 *     cdef object execute(self, Request req, float timeout):             # <<<<<<<<<<<<<<
 *         if self.con_state == CONNECTION_BAD:
 *             raise TarantoolNotConnectedError('Tarantool is not connected')
 */

static PyObject *__pyx_f_8asynctnt_6iproto_8protocol_12BaseProtocol_execute(struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *__pyx_v_self, struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *__pyx_v_req, float __pyx_v_timeout) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("execute", 0);

  /* "asynctnt/iproto/protocol.pyx":235
 * 
 *     cdef object execute(self, Request req, float timeout):
 *         if self.con_state == CONNECTION_BAD:             # <<<<<<<<<<<<<<
 *             raise TarantoolNotConnectedError('Tarantool is not connected')
 * 
 */
  __pyx_t_1 = ((__pyx_v_self->__pyx_base.con_state == __pyx_e_8asynctnt_6iproto_8protocol_CONNECTION_BAD) != 0);
  if (__pyx_t_1) {

    /* "asynctnt/iproto/protocol.pyx":236
 *     cdef object execute(self, Request req, float timeout):
 *         if self.con_state == CONNECTION_BAD:
 *             raise TarantoolNotConnectedError('Tarantool is not connected')             # <<<<<<<<<<<<<<
 * 
 *         cpython.dict.PyDict_SetItem(self.reqs, req.sync, req)
 */
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_TarantoolNotConnectedError); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 236, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__41, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 236, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(3, 236, __pyx_L1_error)

    /* "asynctnt/iproto/protocol.pyx":235
 * 
 *     cdef object execute(self, Request req, float timeout):
 *         if self.con_state == CONNECTION_BAD:             # <<<<<<<<<<<<<<
 *             raise TarantoolNotConnectedError('Tarantool is not connected')
 * 
 */
  }

  /* "asynctnt/iproto/protocol.pyx":238
 *             raise TarantoolNotConnectedError('Tarantool is not connected')
 * 
 *         cpython.dict.PyDict_SetItem(self.reqs, req.sync, req)             # <<<<<<<<<<<<<<
 *         self._write(req.build())
 * 
 */
  __pyx_t_3 = __pyx_v_self->__pyx_base.reqs;
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyInt_From_uint64_t(__pyx_v_req->sync); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 238, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyDict_SetItem(__pyx_t_3, __pyx_t_2, ((PyObject *)__pyx_v_req)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(3, 238, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asynctnt/iproto/protocol.pyx":239
 * 
 *         cpython.dict.PyDict_SetItem(self.reqs, req.sync, req)
 *         self._write(req.build())             # <<<<<<<<<<<<<<
 * 
 *         return self._new_waiter_for_request(req, timeout)
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_8asynctnt_6iproto_8protocol_7Request_build(__pyx_v_req)); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 239, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  ((struct __pyx_vtabstruct_8asynctnt_6iproto_8protocol_BaseProtocol *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._write(((struct __pyx_obj_8asynctnt_6iproto_8protocol_CoreProtocol *)__pyx_v_self), __pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asynctnt/iproto/protocol.pyx":241
 *         self._write(req.build())
 * 
 *         return self._new_waiter_for_request(req, timeout)             # <<<<<<<<<<<<<<
 * 
 *     cdef uint32_t transform_iterator(self, iterator) except *:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((struct __pyx_vtabstruct_8asynctnt_6iproto_8protocol_BaseProtocol *)__pyx_v_self->__pyx_base.__pyx_vtab)->_new_waiter_for_request(__pyx_v_self, __pyx_v_req, __pyx_v_timeout); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 241, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "asynctnt/iproto/protocol.pyx":234
 *         return self._db
 * 
 *     cdef object execute(self, Request req, float timeout):             # <<<<<<<<<<<<<<
 *         if self.con_state == CONNECTION_BAD:
 *             raise TarantoolNotConnectedError('Tarantool is not connected')
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("asynctnt.iproto.protocol.BaseProtocol.execute", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/protocol.pyx":243
 *         return self._new_waiter_for_request(req, timeout)
 * 
 *     cdef uint32_t transform_iterator(self, iterator) except *:             # <<<<<<<<<<<<<<
 *         if isinstance(iterator, int):
 *             return iterator
 */

static uint32_t __pyx_f_8asynctnt_6iproto_8protocol_12BaseProtocol_transform_iterator(CYTHON_UNUSED struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *__pyx_v_self, PyObject *__pyx_v_iterator) {
  uint32_t __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  uint32_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("transform_iterator", 0);

  /* "asynctnt/iproto/protocol.pyx":244
 * 
 *     cdef uint32_t transform_iterator(self, iterator) except *:
 *         if isinstance(iterator, int):             # <<<<<<<<<<<<<<
 *             return iterator
 *         if isinstance(iterator, Iterator):
 */
  __pyx_t_1 = PyInt_Check(__pyx_v_iterator); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "asynctnt/iproto/protocol.pyx":245
 *     cdef uint32_t transform_iterator(self, iterator) except *:
 *         if isinstance(iterator, int):
 *             return iterator             # <<<<<<<<<<<<<<
 *         if isinstance(iterator, Iterator):
 *             return iterator.value
 */
    __pyx_t_3 = __Pyx_PyInt_As_uint32_t(__pyx_v_iterator); if (unlikely((__pyx_t_3 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(3, 245, __pyx_L1_error)
    __pyx_r = __pyx_t_3;
    goto __pyx_L0;

    /* "asynctnt/iproto/protocol.pyx":244
 * 
 *     cdef uint32_t transform_iterator(self, iterator) except *:
 *         if isinstance(iterator, int):             # <<<<<<<<<<<<<<
 *             return iterator
 *         if isinstance(iterator, Iterator):
 */
  }

  /* "asynctnt/iproto/protocol.pyx":246
 *         if isinstance(iterator, int):
 *             return iterator
 *         if isinstance(iterator, Iterator):             # <<<<<<<<<<<<<<
 *             return iterator.value
 *         if isinstance(iterator, str):
 */
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_Iterator); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 246, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = PyObject_IsInstance(__pyx_v_iterator, __pyx_t_4); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(3, 246, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "asynctnt/iproto/protocol.pyx":247
 *             return iterator
 *         if isinstance(iterator, Iterator):
 *             return iterator.value             # <<<<<<<<<<<<<<
 *         if isinstance(iterator, str):
 *             return Iterator[iterator]
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_iterator, __pyx_n_s_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 247, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = __Pyx_PyInt_As_uint32_t(__pyx_t_4); if (unlikely((__pyx_t_3 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(3, 247, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_r = __pyx_t_3;
    goto __pyx_L0;

    /* "asynctnt/iproto/protocol.pyx":246
 *         if isinstance(iterator, int):
 *             return iterator
 *         if isinstance(iterator, Iterator):             # <<<<<<<<<<<<<<
 *             return iterator.value
 *         if isinstance(iterator, str):
 */
  }

  /* "asynctnt/iproto/protocol.pyx":248
 *         if isinstance(iterator, Iterator):
 *             return iterator.value
 *         if isinstance(iterator, str):             # <<<<<<<<<<<<<<
 *             return Iterator[iterator]
 *         else:
 */
  __pyx_t_1 = PyString_Check(__pyx_v_iterator); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "asynctnt/iproto/protocol.pyx":249
 *             return iterator.value
 *         if isinstance(iterator, str):
 *             return Iterator[iterator]             # <<<<<<<<<<<<<<
 *         else:
 *             raise TypeError('Iterator is of unsupported type '
 */
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_Iterator); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 249, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyObject_GetItem(__pyx_t_4, __pyx_v_iterator); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 249, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_3 = __Pyx_PyInt_As_uint32_t(__pyx_t_5); if (unlikely((__pyx_t_3 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(3, 249, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_r = __pyx_t_3;
    goto __pyx_L0;

    /* "asynctnt/iproto/protocol.pyx":248
 *         if isinstance(iterator, Iterator):
 *             return iterator.value
 *         if isinstance(iterator, str):             # <<<<<<<<<<<<<<
 *             return Iterator[iterator]
 *         else:
 */
  }

  /* "asynctnt/iproto/protocol.pyx":251
 *             return Iterator[iterator]
 *         else:
 *             raise TypeError('Iterator is of unsupported type '             # <<<<<<<<<<<<<<
 *                             '(asynctnt.Iterator, int, str)')
 * 
 */
  /*else*/ {
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__42, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 251, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_Raise(__pyx_t_5, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __PYX_ERR(3, 251, __pyx_L1_error)
  }

  /* "asynctnt/iproto/protocol.pyx":243
 *         return self._new_waiter_for_request(req, timeout)
 * 
 *     cdef uint32_t transform_iterator(self, iterator) except *:             # <<<<<<<<<<<<<<
 *         if isinstance(iterator, int):
 *             return iterator
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("asynctnt.iproto.protocol.BaseProtocol.transform_iterator", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/protocol.pyx":254
 *                             '(asynctnt.Iterator, int, str)')
 * 
 *     cdef uint32_t transform_space(self, space) except *:             # <<<<<<<<<<<<<<
 *         if isinstance(space, str):
 *             if self._schema is None:
 */

static uint32_t __pyx_f_8asynctnt_6iproto_8protocol_12BaseProtocol_transform_space(struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *__pyx_v_self, PyObject *__pyx_v_space) {
  struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaSpace *__pyx_v_sp = NULL;
  uint32_t __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  uint32_t __pyx_t_9;
  __Pyx_RefNannySetupContext("transform_space", 0);

  /* "asynctnt/iproto/protocol.pyx":255
 * 
 *     cdef uint32_t transform_space(self, space) except *:
 *         if isinstance(space, str):             # <<<<<<<<<<<<<<
 *             if self._schema is None:
 *                 raise TarantoolSchemaError('Schema not fetched')
 */
  __pyx_t_1 = PyString_Check(__pyx_v_space); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "asynctnt/iproto/protocol.pyx":256
 *     cdef uint32_t transform_space(self, space) except *:
 *         if isinstance(space, str):
 *             if self._schema is None:             # <<<<<<<<<<<<<<
 *                 raise TarantoolSchemaError('Schema not fetched')
 * 
 */
    __pyx_t_2 = (((PyObject *)__pyx_v_self->_schema) == Py_None);
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (__pyx_t_1) {

      /* "asynctnt/iproto/protocol.pyx":257
 *         if isinstance(space, str):
 *             if self._schema is None:
 *                 raise TarantoolSchemaError('Schema not fetched')             # <<<<<<<<<<<<<<
 * 
 *             sp = self._schema.get_space(space)
 */
      __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_TarantoolSchemaError); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 257, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__43, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 257, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_Raise(__pyx_t_4, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __PYX_ERR(3, 257, __pyx_L1_error)

      /* "asynctnt/iproto/protocol.pyx":256
 *     cdef uint32_t transform_space(self, space) except *:
 *         if isinstance(space, str):
 *             if self._schema is None:             # <<<<<<<<<<<<<<
 *                 raise TarantoolSchemaError('Schema not fetched')
 * 
 */
    }

    /* "asynctnt/iproto/protocol.pyx":259
 *                 raise TarantoolSchemaError('Schema not fetched')
 * 
 *             sp = self._schema.get_space(space)             # <<<<<<<<<<<<<<
 *             if sp is None:
 *                 raise TarantoolSchemaError('Space {} not found'.format(space))
 */
    __pyx_t_4 = ((PyObject *)((struct __pyx_vtabstruct_8asynctnt_6iproto_8protocol_Schema *)__pyx_v_self->_schema->__pyx_vtab)->get_space(__pyx_v_self->_schema, __pyx_v_space, 0)); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 259, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_v_sp = ((struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaSpace *)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "asynctnt/iproto/protocol.pyx":260
 * 
 *             sp = self._schema.get_space(space)
 *             if sp is None:             # <<<<<<<<<<<<<<
 *                 raise TarantoolSchemaError('Space {} not found'.format(space))
 *             return sp.sid
 */
    __pyx_t_1 = (((PyObject *)__pyx_v_sp) == Py_None);
    __pyx_t_2 = (__pyx_t_1 != 0);
    if (__pyx_t_2) {

      /* "asynctnt/iproto/protocol.pyx":261
 *             sp = self._schema.get_space(space)
 *             if sp is None:
 *                 raise TarantoolSchemaError('Space {} not found'.format(space))             # <<<<<<<<<<<<<<
 *             return sp.sid
 *         return space
 */
      __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_TarantoolSchemaError); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 261, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_Space_not_found, __pyx_n_s_format); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 261, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
        __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
        if (likely(__pyx_t_7)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
          __Pyx_INCREF(__pyx_t_7);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_6, function);
        }
      }
      if (!__pyx_t_7) {
        __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_space); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 261, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_6)) {
          PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_v_space};
          __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 261, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_GOTREF(__pyx_t_5);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
          PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_v_space};
          __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 261, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_GOTREF(__pyx_t_5);
        } else
        #endif
        {
          __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(3, 261, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7); __pyx_t_7 = NULL;
          __Pyx_INCREF(__pyx_v_space);
          __Pyx_GIVEREF(__pyx_v_space);
          PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_v_space);
          __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 261, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
        }
      }
      if (!__pyx_t_6) {
        __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 261, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_5};
          __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 261, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_5};
          __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 261, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        } else
        #endif
        {
          __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(3, 261, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL;
          __Pyx_GIVEREF(__pyx_t_5);
          PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_t_5);
          __pyx_t_5 = 0;
          __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_8, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 261, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_Raise(__pyx_t_4, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __PYX_ERR(3, 261, __pyx_L1_error)

      /* "asynctnt/iproto/protocol.pyx":260
 * 
 *             sp = self._schema.get_space(space)
 *             if sp is None:             # <<<<<<<<<<<<<<
 *                 raise TarantoolSchemaError('Space {} not found'.format(space))
 *             return sp.sid
 */
    }

    /* "asynctnt/iproto/protocol.pyx":262
 *             if sp is None:
 *                 raise TarantoolSchemaError('Space {} not found'.format(space))
 *             return sp.sid             # <<<<<<<<<<<<<<
 *         return space
 * 
 */
    __pyx_r = __pyx_v_sp->sid;
    goto __pyx_L0;

    /* "asynctnt/iproto/protocol.pyx":255
 * 
 *     cdef uint32_t transform_space(self, space) except *:
 *         if isinstance(space, str):             # <<<<<<<<<<<<<<
 *             if self._schema is None:
 *                 raise TarantoolSchemaError('Schema not fetched')
 */
  }

  /* "asynctnt/iproto/protocol.pyx":263
 *                 raise TarantoolSchemaError('Space {} not found'.format(space))
 *             return sp.sid
 *         return space             # <<<<<<<<<<<<<<
 * 
 *     cdef uint32_t transform_index(self, space, index) except *:
 */
  __pyx_t_9 = __Pyx_PyInt_As_uint32_t(__pyx_v_space); if (unlikely((__pyx_t_9 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(3, 263, __pyx_L1_error)
  __pyx_r = __pyx_t_9;
  goto __pyx_L0;

  /* "asynctnt/iproto/protocol.pyx":254
 *                             '(asynctnt.Iterator, int, str)')
 * 
 *     cdef uint32_t transform_space(self, space) except *:             # <<<<<<<<<<<<<<
 *         if isinstance(space, str):
 *             if self._schema is None:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("asynctnt.iproto.protocol.BaseProtocol.transform_space", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_sp);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/protocol.pyx":265
 *         return space
 * 
 *     cdef uint32_t transform_index(self, space, index) except *:             # <<<<<<<<<<<<<<
 *         if isinstance(index, str):
 *             if self._schema is None:
 */

static uint32_t __pyx_f_8asynctnt_6iproto_8protocol_12BaseProtocol_transform_index(struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *__pyx_v_self, PyObject *__pyx_v_space, PyObject *__pyx_v_index) {
  struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaIndex *__pyx_v_idx = NULL;
  uint32_t __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  uint32_t __pyx_t_10;
  __Pyx_RefNannySetupContext("transform_index", 0);

  /* "asynctnt/iproto/protocol.pyx":266
 * 
 *     cdef uint32_t transform_index(self, space, index) except *:
 *         if isinstance(index, str):             # <<<<<<<<<<<<<<
 *             if self._schema is None:
 *                 raise TarantoolSchemaError('Schema not fetched')
 */
  __pyx_t_1 = PyString_Check(__pyx_v_index); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "asynctnt/iproto/protocol.pyx":267
 *     cdef uint32_t transform_index(self, space, index) except *:
 *         if isinstance(index, str):
 *             if self._schema is None:             # <<<<<<<<<<<<<<
 *                 raise TarantoolSchemaError('Schema not fetched')
 * 
 */
    __pyx_t_2 = (((PyObject *)__pyx_v_self->_schema) == Py_None);
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (__pyx_t_1) {

      /* "asynctnt/iproto/protocol.pyx":268
 *         if isinstance(index, str):
 *             if self._schema is None:
 *                 raise TarantoolSchemaError('Schema not fetched')             # <<<<<<<<<<<<<<
 * 
 *             idx = self._schema.get_index(space, index)
 */
      __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_TarantoolSchemaError); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 268, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__44, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 268, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_Raise(__pyx_t_4, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __PYX_ERR(3, 268, __pyx_L1_error)

      /* "asynctnt/iproto/protocol.pyx":267
 *     cdef uint32_t transform_index(self, space, index) except *:
 *         if isinstance(index, str):
 *             if self._schema is None:             # <<<<<<<<<<<<<<
 *                 raise TarantoolSchemaError('Schema not fetched')
 * 
 */
    }

    /* "asynctnt/iproto/protocol.pyx":270
 *                 raise TarantoolSchemaError('Schema not fetched')
 * 
 *             idx = self._schema.get_index(space, index)             # <<<<<<<<<<<<<<
 *             if idx is None:
 *                 raise TarantoolSchemaError(
 */
    __pyx_t_4 = ((PyObject *)((struct __pyx_vtabstruct_8asynctnt_6iproto_8protocol_Schema *)__pyx_v_self->_schema->__pyx_vtab)->get_index(__pyx_v_self->_schema, __pyx_v_space, __pyx_v_index, 0)); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 270, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_v_idx = ((struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaIndex *)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "asynctnt/iproto/protocol.pyx":271
 * 
 *             idx = self._schema.get_index(space, index)
 *             if idx is None:             # <<<<<<<<<<<<<<
 *                 raise TarantoolSchemaError(
 *                     'Index {} for space {} not found'.format(index, space))
 */
    __pyx_t_1 = (((PyObject *)__pyx_v_idx) == Py_None);
    __pyx_t_2 = (__pyx_t_1 != 0);
    if (__pyx_t_2) {

      /* "asynctnt/iproto/protocol.pyx":272
 *             idx = self._schema.get_index(space, index)
 *             if idx is None:
 *                 raise TarantoolSchemaError(             # <<<<<<<<<<<<<<
 *                     'Index {} for space {} not found'.format(index, space))
 *             return idx.iid
 */
      __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_TarantoolSchemaError); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 272, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);

      /* "asynctnt/iproto/protocol.pyx":273
 *             if idx is None:
 *                 raise TarantoolSchemaError(
 *                     'Index {} for space {} not found'.format(index, space))             # <<<<<<<<<<<<<<
 *             return idx.iid
 *         return index
 */
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_Index_for_space_not_found, __pyx_n_s_format); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 273, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = NULL;
      __pyx_t_8 = 0;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
        __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
        if (likely(__pyx_t_7)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
          __Pyx_INCREF(__pyx_t_7);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_6, function);
          __pyx_t_8 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_6)) {
        PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_v_index, __pyx_v_space};
        __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 273, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_5);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
        PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_v_index, __pyx_v_space};
        __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 273, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_5);
      } else
      #endif
      {
        __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 273, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        if (__pyx_t_7) {
          __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
        }
        __Pyx_INCREF(__pyx_v_index);
        __Pyx_GIVEREF(__pyx_v_index);
        PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_v_index);
        __Pyx_INCREF(__pyx_v_space);
        __Pyx_GIVEREF(__pyx_v_space);
        PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_v_space);
        __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_9, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 273, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      }
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
        }
      }
      if (!__pyx_t_6) {
        __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 272, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_5};
          __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 272, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_5};
          __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 272, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        } else
        #endif
        {
          __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 272, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_6); __pyx_t_6 = NULL;
          __Pyx_GIVEREF(__pyx_t_5);
          PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_t_5);
          __pyx_t_5 = 0;
          __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_9, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 272, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_Raise(__pyx_t_4, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __PYX_ERR(3, 272, __pyx_L1_error)

      /* "asynctnt/iproto/protocol.pyx":271
 * 
 *             idx = self._schema.get_index(space, index)
 *             if idx is None:             # <<<<<<<<<<<<<<
 *                 raise TarantoolSchemaError(
 *                     'Index {} for space {} not found'.format(index, space))
 */
    }

    /* "asynctnt/iproto/protocol.pyx":274
 *                 raise TarantoolSchemaError(
 *                     'Index {} for space {} not found'.format(index, space))
 *             return idx.iid             # <<<<<<<<<<<<<<
 *         return index
 * 
 */
    __pyx_r = __pyx_v_idx->iid;
    goto __pyx_L0;

    /* "asynctnt/iproto/protocol.pyx":266
 * 
 *     cdef uint32_t transform_index(self, space, index) except *:
 *         if isinstance(index, str):             # <<<<<<<<<<<<<<
 *             if self._schema is None:
 *                 raise TarantoolSchemaError('Schema not fetched')
 */
  }

  /* "asynctnt/iproto/protocol.pyx":275
 *                     'Index {} for space {} not found'.format(index, space))
 *             return idx.iid
 *         return index             # <<<<<<<<<<<<<<
 * 
 *     def refetch_schema(self):
 */
  __pyx_t_10 = __Pyx_PyInt_As_uint32_t(__pyx_v_index); if (unlikely((__pyx_t_10 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(3, 275, __pyx_L1_error)
  __pyx_r = __pyx_t_10;
  goto __pyx_L0;

  /* "asynctnt/iproto/protocol.pyx":265
 *         return space
 * 
 *     cdef uint32_t transform_index(self, space, index) except *:             # <<<<<<<<<<<<<<
 *         if isinstance(index, str):
 *             if self._schema is None:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("asynctnt.iproto.protocol.BaseProtocol.transform_index", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_idx);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "asynctnt/iproto/protocol.pyx":277
 *         return index
 * 
 *     def refetch_schema(self):             # <<<<<<<<<<<<<<
 *         return self._do_fetch_schema()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_12BaseProtocol_13refetch_schema(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_8asynctnt_6iproto_8protocol_12BaseProtocol_13refetch_schema(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("refetch_schema (wrapper)", 0);
  __pyx_r = __pyx_pf_8asynctnt_6iproto_8protocol_12BaseProtocol_12refetch_schema(((struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8asynctnt_6iproto_8protocol_12BaseProtocol_12refetch_schema(struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("refetch_schema", 0);

  /* "asynctnt/iproto/protocol.pyx":278
 * 
 *     def refetch_schema(self):
 *         return self._do_fetch_schema()             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_8asynctnt_6iproto_8protocol_BaseProtocol *)__pyx_v_self->__pyx_base.__pyx_vtab)->_do_fetch_schema(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 278, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "asynctnt/iproto/protocol.pyx":277
 *         return index
 * 
 *     def refetch_schema(self):             # <<<<<<<<<<<<<<
 *         return self._do_fetch_schema()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("asynctnt.iproto.protocol.BaseProtocol.refetch_schema", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static struct __pyx_vtabstruct_8asynctnt_6iproto_8protocol_WriteBuffer __pyx_vtable_8asynctnt_6iproto_8protocol_WriteBuffer;

static struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *__pyx_freelist_8asynctnt_6iproto_8protocol_WriteBuffer[256];
static int __pyx_freecount_8asynctnt_6iproto_8protocol_WriteBuffer = 0;

static PyObject *__pyx_tp_new_8asynctnt_6iproto_8protocol_WriteBuffer(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *p;
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_8asynctnt_6iproto_8protocol_WriteBuffer > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer)))) {
    o = (PyObject*)__pyx_freelist_8asynctnt_6iproto_8protocol_WriteBuffer[--__pyx_freecount_8asynctnt_6iproto_8protocol_WriteBuffer];
    memset(o, 0, sizeof(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer));
    (void) PyObject_INIT(o, t);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *)o);
  p->__pyx_vtab = __pyx_vtabptr_8asynctnt_6iproto_8protocol_WriteBuffer;
  p->_encoding = ((PyObject*)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_8asynctnt_6iproto_8protocol_11WriteBuffer_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_8asynctnt_6iproto_8protocol_WriteBuffer(PyObject *o) {
  struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *p = (struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *)o;
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pw_8asynctnt_6iproto_8protocol_11WriteBuffer_3__dealloc__(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->_encoding);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_8asynctnt_6iproto_8protocol_WriteBuffer < 256) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer)))) {
    __pyx_freelist_8asynctnt_6iproto_8protocol_WriteBuffer[__pyx_freecount_8asynctnt_6iproto_8protocol_WriteBuffer++] = ((struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static PyMethodDef __pyx_methods_8asynctnt_6iproto_8protocol_WriteBuffer[] = {
  {0, 0, 0, 0}
};

static PyBufferProcs __pyx_tp_as_buffer_WriteBuffer = {
  #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
  __pyx_pw_8asynctnt_6iproto_8protocol_11WriteBuffer_5__getbuffer__, /*bf_getbuffer*/
  __pyx_pw_8asynctnt_6iproto_8protocol_11WriteBuffer_7__releasebuffer__, /*bf_releasebuffer*/
};

static PyTypeObject __pyx_type_8asynctnt_6iproto_8protocol_WriteBuffer = {
  PyVarObject_HEAD_INIT(0, 0)
  "asynctnt.iproto.protocol.WriteBuffer", /*tp_name*/
  sizeof(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_8asynctnt_6iproto_8protocol_WriteBuffer, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_WriteBuffer, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER, /*tp_flags*/
  0, /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_8asynctnt_6iproto_8protocol_WriteBuffer, /*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_8asynctnt_6iproto_8protocol_WriteBuffer, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_8asynctnt_6iproto_8protocol_ReadBuffer __pyx_vtable_8asynctnt_6iproto_8protocol_ReadBuffer;

static PyObject *__pyx_tp_new_8asynctnt_6iproto_8protocol_ReadBuffer(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_8asynctnt_6iproto_8protocol_ReadBuffer *p;
  PyObject *o;
  o = (*t->tp_alloc)(t, 0);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_8asynctnt_6iproto_8protocol_ReadBuffer *)o);
  p->__pyx_vtab = __pyx_vtabptr_8asynctnt_6iproto_8protocol_ReadBuffer;
  p->encoding = ((PyObject*)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_8asynctnt_6iproto_8protocol_10ReadBuffer_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_8asynctnt_6iproto_8protocol_ReadBuffer(PyObject *o) {
  struct __pyx_obj_8asynctnt_6iproto_8protocol_ReadBuffer *p = (struct __pyx_obj_8asynctnt_6iproto_8protocol_ReadBuffer *)o;
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pw_8asynctnt_6iproto_8protocol_10ReadBuffer_3__dealloc__(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->encoding);
  (*Py_TYPE(o)->tp_free)(o);
}

static PyMethodDef __pyx_methods_8asynctnt_6iproto_8protocol_ReadBuffer[] = {
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_8asynctnt_6iproto_8protocol_ReadBuffer = {
  PyVarObject_HEAD_INIT(0, 0)
  "asynctnt.iproto.protocol.ReadBuffer", /*tp_name*/
  sizeof(struct __pyx_obj_8asynctnt_6iproto_8protocol_ReadBuffer), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_8asynctnt_6iproto_8protocol_ReadBuffer, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER, /*tp_flags*/
  0, /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_8asynctnt_6iproto_8protocol_ReadBuffer, /*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_8asynctnt_6iproto_8protocol_ReadBuffer, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_8asynctnt_6iproto_8protocol_Request __pyx_vtable_8asynctnt_6iproto_8protocol_Request;

static struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *__pyx_freelist_8asynctnt_6iproto_8protocol_Request[256];
static int __pyx_freecount_8asynctnt_6iproto_8protocol_Request = 0;

static PyObject *__pyx_tp_new_8asynctnt_6iproto_8protocol_Request(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *p;
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_8asynctnt_6iproto_8protocol_Request > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_8asynctnt_6iproto_8protocol_Request)))) {
    o = (PyObject*)__pyx_freelist_8asynctnt_6iproto_8protocol_Request[--__pyx_freecount_8asynctnt_6iproto_8protocol_Request];
    memset(o, 0, sizeof(struct __pyx_obj_8asynctnt_6iproto_8protocol_Request));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *)o);
  p->__pyx_vtab = __pyx_vtabptr_8asynctnt_6iproto_8protocol_Request;
  p->buf = ((struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *)Py_None); Py_INCREF(Py_None);
  p->buf_body = ((struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *)Py_None); Py_INCREF(Py_None);
  p->waiter = Py_None; Py_INCREF(Py_None);
  p->timeout_handle = Py_None; Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_8asynctnt_6iproto_8protocol_Request(PyObject *o) {
  struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *p = (struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->buf);
  Py_CLEAR(p->buf_body);
  Py_CLEAR(p->waiter);
  Py_CLEAR(p->timeout_handle);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_8asynctnt_6iproto_8protocol_Request < 256) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_8asynctnt_6iproto_8protocol_Request)))) {
    __pyx_freelist_8asynctnt_6iproto_8protocol_Request[__pyx_freecount_8asynctnt_6iproto_8protocol_Request++] = ((struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_8asynctnt_6iproto_8protocol_Request(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *p = (struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *)o;
  if (p->buf) {
    e = (*v)(((PyObject*)p->buf), a); if (e) return e;
  }
  if (p->buf_body) {
    e = (*v)(((PyObject*)p->buf_body), a); if (e) return e;
  }
  if (p->waiter) {
    e = (*v)(p->waiter, a); if (e) return e;
  }
  if (p->timeout_handle) {
    e = (*v)(p->timeout_handle, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_8asynctnt_6iproto_8protocol_Request(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *p = (struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *)o;
  tmp = ((PyObject*)p->buf);
  p->buf = ((struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->buf_body);
  p->buf_body = ((struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->waiter);
  p->waiter = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->timeout_handle);
  p->timeout_handle = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_8asynctnt_6iproto_8protocol_Request[] = {
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_8asynctnt_6iproto_8protocol_Request = {
  PyVarObject_HEAD_INIT(0, 0)
  "asynctnt.iproto.protocol.Request", /*tp_name*/
  sizeof(struct __pyx_obj_8asynctnt_6iproto_8protocol_Request), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_8asynctnt_6iproto_8protocol_Request, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  __pyx_pw_8asynctnt_6iproto_8protocol_7Request_1__repr__, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_8asynctnt_6iproto_8protocol_Request, /*tp_traverse*/
  __pyx_tp_clear_8asynctnt_6iproto_8protocol_Request, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_8asynctnt_6iproto_8protocol_Request, /*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_8asynctnt_6iproto_8protocol_Request, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_8asynctnt_6iproto_8protocol_Response __pyx_vtable_8asynctnt_6iproto_8protocol_Response;

static PyObject *__pyx_tp_new_8asynctnt_6iproto_8protocol_Response(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_8asynctnt_6iproto_8protocol_Response *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_8asynctnt_6iproto_8protocol_Response *)o);
  p->__pyx_vtab = __pyx_vtabptr_8asynctnt_6iproto_8protocol_Response;
  p->errmsg = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->body = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->encoding = ((PyObject*)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_8asynctnt_6iproto_8protocol_Response(PyObject *o) {
  struct __pyx_obj_8asynctnt_6iproto_8protocol_Response *p = (struct __pyx_obj_8asynctnt_6iproto_8protocol_Response *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->errmsg);
  Py_CLEAR(p->body);
  Py_CLEAR(p->encoding);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_8asynctnt_6iproto_8protocol_Response(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_8asynctnt_6iproto_8protocol_Response *p = (struct __pyx_obj_8asynctnt_6iproto_8protocol_Response *)o;
  if (p->body) {
    e = (*v)(p->body, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_8asynctnt_6iproto_8protocol_Response(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_8asynctnt_6iproto_8protocol_Response *p = (struct __pyx_obj_8asynctnt_6iproto_8protocol_Response *)o;
  tmp = ((PyObject*)p->body);
  p->body = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_8asynctnt_6iproto_8protocol_8Response_code(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8asynctnt_6iproto_8protocol_8Response_4code_1__get__(o);
}

static int __pyx_setprop_8asynctnt_6iproto_8protocol_8Response_code(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_8asynctnt_6iproto_8protocol_8Response_4code_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_8asynctnt_6iproto_8protocol_8Response_sync(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8asynctnt_6iproto_8protocol_8Response_4sync_1__get__(o);
}

static int __pyx_setprop_8asynctnt_6iproto_8protocol_8Response_sync(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_8asynctnt_6iproto_8protocol_8Response_4sync_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_8asynctnt_6iproto_8protocol_8Response_schema_id(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8asynctnt_6iproto_8protocol_8Response_9schema_id_1__get__(o);
}

static int __pyx_setprop_8asynctnt_6iproto_8protocol_8Response_schema_id(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_8asynctnt_6iproto_8protocol_8Response_9schema_id_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_8asynctnt_6iproto_8protocol_8Response_errmsg(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8asynctnt_6iproto_8protocol_8Response_6errmsg_1__get__(o);
}

static int __pyx_setprop_8asynctnt_6iproto_8protocol_8Response_errmsg(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_8asynctnt_6iproto_8protocol_8Response_6errmsg_3__set__(o, v);
  }
  else {
    return __pyx_pw_8asynctnt_6iproto_8protocol_8Response_6errmsg_5__del__(o);
  }
}

static PyObject *__pyx_getprop_8asynctnt_6iproto_8protocol_8Response_body(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8asynctnt_6iproto_8protocol_8Response_4body_1__get__(o);
}

static int __pyx_setprop_8asynctnt_6iproto_8protocol_8Response_body(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_8asynctnt_6iproto_8protocol_8Response_4body_3__set__(o, v);
  }
  else {
    return __pyx_pw_8asynctnt_6iproto_8protocol_8Response_4body_5__del__(o);
  }
}

static PyObject *__pyx_getprop_8asynctnt_6iproto_8protocol_8Response_encoding(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8asynctnt_6iproto_8protocol_8Response_8encoding_1__get__(o);
}

static int __pyx_setprop_8asynctnt_6iproto_8protocol_8Response_encoding(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_8asynctnt_6iproto_8protocol_8Response_8encoding_3__set__(o, v);
  }
  else {
    return __pyx_pw_8asynctnt_6iproto_8protocol_8Response_8encoding_5__del__(o);
  }
}

static PyMethodDef __pyx_methods_8asynctnt_6iproto_8protocol_Response[] = {
  {"body2yaml", (PyCFunction)__pyx_pw_8asynctnt_6iproto_8protocol_8Response_3body2yaml, METH_NOARGS, 0},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_8asynctnt_6iproto_8protocol_Response[] = {
  {(char *)"code", __pyx_getprop_8asynctnt_6iproto_8protocol_8Response_code, __pyx_setprop_8asynctnt_6iproto_8protocol_8Response_code, (char *)0, 0},
  {(char *)"sync", __pyx_getprop_8asynctnt_6iproto_8protocol_8Response_sync, __pyx_setprop_8asynctnt_6iproto_8protocol_8Response_sync, (char *)0, 0},
  {(char *)"schema_id", __pyx_getprop_8asynctnt_6iproto_8protocol_8Response_schema_id, __pyx_setprop_8asynctnt_6iproto_8protocol_8Response_schema_id, (char *)0, 0},
  {(char *)"errmsg", __pyx_getprop_8asynctnt_6iproto_8protocol_8Response_errmsg, __pyx_setprop_8asynctnt_6iproto_8protocol_8Response_errmsg, (char *)0, 0},
  {(char *)"body", __pyx_getprop_8asynctnt_6iproto_8protocol_8Response_body, __pyx_setprop_8asynctnt_6iproto_8protocol_8Response_body, (char *)0, 0},
  {(char *)"encoding", __pyx_getprop_8asynctnt_6iproto_8protocol_8Response_encoding, __pyx_setprop_8asynctnt_6iproto_8protocol_8Response_encoding, (char *)0, 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_8asynctnt_6iproto_8protocol_Response = {
  PyVarObject_HEAD_INIT(0, 0)
  "asynctnt.iproto.protocol.Response", /*tp_name*/
  sizeof(struct __pyx_obj_8asynctnt_6iproto_8protocol_Response), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_8asynctnt_6iproto_8protocol_Response, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  __pyx_pw_8asynctnt_6iproto_8protocol_8Response_1__repr__, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_8asynctnt_6iproto_8protocol_Response, /*tp_traverse*/
  __pyx_tp_clear_8asynctnt_6iproto_8protocol_Response, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_8asynctnt_6iproto_8protocol_Response, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_8asynctnt_6iproto_8protocol_Response, /*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_8asynctnt_6iproto_8protocol_Response, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static PyObject *__pyx_tp_new_8asynctnt_6iproto_8protocol_SchemaIndex(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaIndex *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaIndex *)o);
  p->name = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->index_type = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->unique = Py_None; Py_INCREF(Py_None);
  p->parts = ((PyObject*)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_8asynctnt_6iproto_8protocol_SchemaIndex(PyObject *o) {
  struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaIndex *p = (struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaIndex *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->name);
  Py_CLEAR(p->index_type);
  Py_CLEAR(p->unique);
  Py_CLEAR(p->parts);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_8asynctnt_6iproto_8protocol_SchemaIndex(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaIndex *p = (struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaIndex *)o;
  if (p->unique) {
    e = (*v)(p->unique, a); if (e) return e;
  }
  if (p->parts) {
    e = (*v)(p->parts, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_8asynctnt_6iproto_8protocol_SchemaIndex(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaIndex *p = (struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaIndex *)o;
  tmp = ((PyObject*)p->unique);
  p->unique = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->parts);
  p->parts = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_8asynctnt_6iproto_8protocol_11SchemaIndex_sid(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8asynctnt_6iproto_8protocol_11SchemaIndex_3sid_1__get__(o);
}

static int __pyx_setprop_8asynctnt_6iproto_8protocol_11SchemaIndex_sid(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_8asynctnt_6iproto_8protocol_11SchemaIndex_3sid_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_8asynctnt_6iproto_8protocol_11SchemaIndex_iid(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8asynctnt_6iproto_8protocol_11SchemaIndex_3iid_1__get__(o);
}

static int __pyx_setprop_8asynctnt_6iproto_8protocol_11SchemaIndex_iid(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_8asynctnt_6iproto_8protocol_11SchemaIndex_3iid_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_8asynctnt_6iproto_8protocol_11SchemaIndex_name(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8asynctnt_6iproto_8protocol_11SchemaIndex_4name_1__get__(o);
}

static int __pyx_setprop_8asynctnt_6iproto_8protocol_11SchemaIndex_name(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_8asynctnt_6iproto_8protocol_11SchemaIndex_4name_3__set__(o, v);
  }
  else {
    return __pyx_pw_8asynctnt_6iproto_8protocol_11SchemaIndex_4name_5__del__(o);
  }
}

static PyObject *__pyx_getprop_8asynctnt_6iproto_8protocol_11SchemaIndex_index_type(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8asynctnt_6iproto_8protocol_11SchemaIndex_10index_type_1__get__(o);
}

static int __pyx_setprop_8asynctnt_6iproto_8protocol_11SchemaIndex_index_type(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_8asynctnt_6iproto_8protocol_11SchemaIndex_10index_type_3__set__(o, v);
  }
  else {
    return __pyx_pw_8asynctnt_6iproto_8protocol_11SchemaIndex_10index_type_5__del__(o);
  }
}

static PyObject *__pyx_getprop_8asynctnt_6iproto_8protocol_11SchemaIndex_unique(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8asynctnt_6iproto_8protocol_11SchemaIndex_6unique_1__get__(o);
}

static int __pyx_setprop_8asynctnt_6iproto_8protocol_11SchemaIndex_unique(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_8asynctnt_6iproto_8protocol_11SchemaIndex_6unique_3__set__(o, v);
  }
  else {
    return __pyx_pw_8asynctnt_6iproto_8protocol_11SchemaIndex_6unique_5__del__(o);
  }
}

static PyObject *__pyx_getprop_8asynctnt_6iproto_8protocol_11SchemaIndex_parts(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8asynctnt_6iproto_8protocol_11SchemaIndex_5parts_1__get__(o);
}

static int __pyx_setprop_8asynctnt_6iproto_8protocol_11SchemaIndex_parts(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_8asynctnt_6iproto_8protocol_11SchemaIndex_5parts_3__set__(o, v);
  }
  else {
    return __pyx_pw_8asynctnt_6iproto_8protocol_11SchemaIndex_5parts_5__del__(o);
  }
}

static PyMethodDef __pyx_methods_8asynctnt_6iproto_8protocol_SchemaIndex[] = {
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_8asynctnt_6iproto_8protocol_SchemaIndex[] = {
  {(char *)"sid", __pyx_getprop_8asynctnt_6iproto_8protocol_11SchemaIndex_sid, __pyx_setprop_8asynctnt_6iproto_8protocol_11SchemaIndex_sid, (char *)0, 0},
  {(char *)"iid", __pyx_getprop_8asynctnt_6iproto_8protocol_11SchemaIndex_iid, __pyx_setprop_8asynctnt_6iproto_8protocol_11SchemaIndex_iid, (char *)0, 0},
  {(char *)"name", __pyx_getprop_8asynctnt_6iproto_8protocol_11SchemaIndex_name, __pyx_setprop_8asynctnt_6iproto_8protocol_11SchemaIndex_name, (char *)0, 0},
  {(char *)"index_type", __pyx_getprop_8asynctnt_6iproto_8protocol_11SchemaIndex_index_type, __pyx_setprop_8asynctnt_6iproto_8protocol_11SchemaIndex_index_type, (char *)0, 0},
  {(char *)"unique", __pyx_getprop_8asynctnt_6iproto_8protocol_11SchemaIndex_unique, __pyx_setprop_8asynctnt_6iproto_8protocol_11SchemaIndex_unique, (char *)0, 0},
  {(char *)"parts", __pyx_getprop_8asynctnt_6iproto_8protocol_11SchemaIndex_parts, __pyx_setprop_8asynctnt_6iproto_8protocol_11SchemaIndex_parts, (char *)0, 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_8asynctnt_6iproto_8protocol_SchemaIndex = {
  PyVarObject_HEAD_INIT(0, 0)
  "asynctnt.iproto.protocol.SchemaIndex", /*tp_name*/
  sizeof(struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaIndex), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_8asynctnt_6iproto_8protocol_SchemaIndex, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_8asynctnt_6iproto_8protocol_SchemaIndex, /*tp_traverse*/
  __pyx_tp_clear_8asynctnt_6iproto_8protocol_SchemaIndex, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_8asynctnt_6iproto_8protocol_SchemaIndex, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_8asynctnt_6iproto_8protocol_SchemaIndex, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_8asynctnt_6iproto_8protocol_11SchemaIndex_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_8asynctnt_6iproto_8protocol_SchemaIndex, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_8asynctnt_6iproto_8protocol_SchemaSpace __pyx_vtable_8asynctnt_6iproto_8protocol_SchemaSpace;

static PyObject *__pyx_tp_new_8asynctnt_6iproto_8protocol_SchemaSpace(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaSpace *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaSpace *)o);
  p->__pyx_vtab = __pyx_vtabptr_8asynctnt_6iproto_8protocol_SchemaSpace;
  p->name = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->indexes = ((PyObject*)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_8asynctnt_6iproto_8protocol_SchemaSpace(PyObject *o) {
  struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaSpace *p = (struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaSpace *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->name);
  Py_CLEAR(p->indexes);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_8asynctnt_6iproto_8protocol_SchemaSpace(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaSpace *p = (struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaSpace *)o;
  if (p->indexes) {
    e = (*v)(p->indexes, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_8asynctnt_6iproto_8protocol_SchemaSpace(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaSpace *p = (struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaSpace *)o;
  tmp = ((PyObject*)p->indexes);
  p->indexes = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_8asynctnt_6iproto_8protocol_11SchemaSpace_sid(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8asynctnt_6iproto_8protocol_11SchemaSpace_3sid_1__get__(o);
}

static int __pyx_setprop_8asynctnt_6iproto_8protocol_11SchemaSpace_sid(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_8asynctnt_6iproto_8protocol_11SchemaSpace_3sid_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_8asynctnt_6iproto_8protocol_11SchemaSpace_arity(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8asynctnt_6iproto_8protocol_11SchemaSpace_5arity_1__get__(o);
}

static int __pyx_setprop_8asynctnt_6iproto_8protocol_11SchemaSpace_arity(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_8asynctnt_6iproto_8protocol_11SchemaSpace_5arity_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_8asynctnt_6iproto_8protocol_11SchemaSpace_name(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8asynctnt_6iproto_8protocol_11SchemaSpace_4name_1__get__(o);
}

static int __pyx_setprop_8asynctnt_6iproto_8protocol_11SchemaSpace_name(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_8asynctnt_6iproto_8protocol_11SchemaSpace_4name_3__set__(o, v);
  }
  else {
    return __pyx_pw_8asynctnt_6iproto_8protocol_11SchemaSpace_4name_5__del__(o);
  }
}

static PyObject *__pyx_getprop_8asynctnt_6iproto_8protocol_11SchemaSpace_indexes(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8asynctnt_6iproto_8protocol_11SchemaSpace_7indexes_1__get__(o);
}

static int __pyx_setprop_8asynctnt_6iproto_8protocol_11SchemaSpace_indexes(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_8asynctnt_6iproto_8protocol_11SchemaSpace_7indexes_3__set__(o, v);
  }
  else {
    return __pyx_pw_8asynctnt_6iproto_8protocol_11SchemaSpace_7indexes_5__del__(o);
  }
}

static PyMethodDef __pyx_methods_8asynctnt_6iproto_8protocol_SchemaSpace[] = {
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_8asynctnt_6iproto_8protocol_SchemaSpace[] = {
  {(char *)"sid", __pyx_getprop_8asynctnt_6iproto_8protocol_11SchemaSpace_sid, __pyx_setprop_8asynctnt_6iproto_8protocol_11SchemaSpace_sid, (char *)0, 0},
  {(char *)"arity", __pyx_getprop_8asynctnt_6iproto_8protocol_11SchemaSpace_arity, __pyx_setprop_8asynctnt_6iproto_8protocol_11SchemaSpace_arity, (char *)0, 0},
  {(char *)"name", __pyx_getprop_8asynctnt_6iproto_8protocol_11SchemaSpace_name, __pyx_setprop_8asynctnt_6iproto_8protocol_11SchemaSpace_name, (char *)0, 0},
  {(char *)"indexes", __pyx_getprop_8asynctnt_6iproto_8protocol_11SchemaSpace_indexes, __pyx_setprop_8asynctnt_6iproto_8protocol_11SchemaSpace_indexes, (char *)0, 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_8asynctnt_6iproto_8protocol_SchemaSpace = {
  PyVarObject_HEAD_INIT(0, 0)
  "asynctnt.iproto.protocol.SchemaSpace", /*tp_name*/
  sizeof(struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaSpace), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_8asynctnt_6iproto_8protocol_SchemaSpace, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  __pyx_pw_8asynctnt_6iproto_8protocol_11SchemaSpace_3__repr__, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_8asynctnt_6iproto_8protocol_SchemaSpace, /*tp_traverse*/
  __pyx_tp_clear_8asynctnt_6iproto_8protocol_SchemaSpace, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_8asynctnt_6iproto_8protocol_SchemaSpace, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_8asynctnt_6iproto_8protocol_SchemaSpace, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_8asynctnt_6iproto_8protocol_11SchemaSpace_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_8asynctnt_6iproto_8protocol_SchemaSpace, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_8asynctnt_6iproto_8protocol_Schema __pyx_vtable_8asynctnt_6iproto_8protocol_Schema;

static PyObject *__pyx_tp_new_8asynctnt_6iproto_8protocol_Schema(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_8asynctnt_6iproto_8protocol_Schema *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_8asynctnt_6iproto_8protocol_Schema *)o);
  p->__pyx_vtab = __pyx_vtabptr_8asynctnt_6iproto_8protocol_Schema;
  p->schema = ((PyObject*)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_8asynctnt_6iproto_8protocol_Schema(PyObject *o) {
  struct __pyx_obj_8asynctnt_6iproto_8protocol_Schema *p = (struct __pyx_obj_8asynctnt_6iproto_8protocol_Schema *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->schema);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_8asynctnt_6iproto_8protocol_Schema(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_8asynctnt_6iproto_8protocol_Schema *p = (struct __pyx_obj_8asynctnt_6iproto_8protocol_Schema *)o;
  if (p->schema) {
    e = (*v)(p->schema, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_8asynctnt_6iproto_8protocol_Schema(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_8asynctnt_6iproto_8protocol_Schema *p = (struct __pyx_obj_8asynctnt_6iproto_8protocol_Schema *)o;
  tmp = ((PyObject*)p->schema);
  p->schema = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_8asynctnt_6iproto_8protocol_Schema[] = {
  {"get_space", (PyCFunction)__pyx_pw_8asynctnt_6iproto_8protocol_6Schema_3get_space, METH_O, 0},
  {"get_index", (PyCFunction)__pyx_pw_8asynctnt_6iproto_8protocol_6Schema_5get_index, METH_VARARGS|METH_KEYWORDS, 0},
  {"get_id", (PyCFunction)__pyx_pw_8asynctnt_6iproto_8protocol_6Schema_7get_id, METH_NOARGS, 0},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_8asynctnt_6iproto_8protocol_Schema = {
  PyVarObject_HEAD_INIT(0, 0)
  "asynctnt.iproto.protocol.Schema", /*tp_name*/
  sizeof(struct __pyx_obj_8asynctnt_6iproto_8protocol_Schema), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_8asynctnt_6iproto_8protocol_Schema, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  __pyx_pw_8asynctnt_6iproto_8protocol_6Schema_9__repr__, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_8asynctnt_6iproto_8protocol_Schema, /*tp_traverse*/
  __pyx_tp_clear_8asynctnt_6iproto_8protocol_Schema, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_8asynctnt_6iproto_8protocol_Schema, /*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*/
  __pyx_pw_8asynctnt_6iproto_8protocol_6Schema_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_8asynctnt_6iproto_8protocol_Schema, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_8asynctnt_6iproto_8protocol_Db __pyx_vtable_8asynctnt_6iproto_8protocol_Db;

static PyObject *__pyx_tp_new_8asynctnt_6iproto_8protocol_Db(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *)o);
  p->__pyx_vtab = __pyx_vtabptr_8asynctnt_6iproto_8protocol_Db;
  p->_protocol = ((struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *)Py_None); Py_INCREF(Py_None);
  p->_encoding = ((PyObject*)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_8asynctnt_6iproto_8protocol_2Db_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_8asynctnt_6iproto_8protocol_Db(PyObject *o) {
  struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *p = (struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_protocol);
  Py_CLEAR(p->_encoding);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_8asynctnt_6iproto_8protocol_Db(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *p = (struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *)o;
  if (p->_protocol) {
    e = (*v)(((PyObject*)p->_protocol), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_8asynctnt_6iproto_8protocol_Db(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *p = (struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *)o;
  tmp = ((PyObject*)p->_protocol);
  p->_protocol = ((struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_8asynctnt_6iproto_8protocol_Db[] = {
  {"execute", (PyCFunction)__pyx_pw_8asynctnt_6iproto_8protocol_2Db_3execute, METH_VARARGS|METH_KEYWORDS, 0},
  {"ping", (PyCFunction)__pyx_pw_8asynctnt_6iproto_8protocol_2Db_6ping, METH_VARARGS|METH_KEYWORDS, 0},
  {"call16", (PyCFunction)__pyx_pw_8asynctnt_6iproto_8protocol_2Db_8call16, METH_VARARGS|METH_KEYWORDS, 0},
  {"call", (PyCFunction)__pyx_pw_8asynctnt_6iproto_8protocol_2Db_10call, METH_VARARGS|METH_KEYWORDS, 0},
  {"eval", (PyCFunction)__pyx_pw_8asynctnt_6iproto_8protocol_2Db_12eval, METH_VARARGS|METH_KEYWORDS, 0},
  {"select", (PyCFunction)__pyx_pw_8asynctnt_6iproto_8protocol_2Db_14select, METH_VARARGS|METH_KEYWORDS, 0},
  {"insert", (PyCFunction)__pyx_pw_8asynctnt_6iproto_8protocol_2Db_16insert, METH_VARARGS|METH_KEYWORDS, 0},
  {"replace", (PyCFunction)__pyx_pw_8asynctnt_6iproto_8protocol_2Db_18replace, METH_VARARGS|METH_KEYWORDS, 0},
  {"delete", (PyCFunction)__pyx_pw_8asynctnt_6iproto_8protocol_2Db_20delete, METH_VARARGS|METH_KEYWORDS, 0},
  {"update", (PyCFunction)__pyx_pw_8asynctnt_6iproto_8protocol_2Db_22update, METH_VARARGS|METH_KEYWORDS, 0},
  {"upsert", (PyCFunction)__pyx_pw_8asynctnt_6iproto_8protocol_2Db_24upsert, METH_VARARGS|METH_KEYWORDS, 0},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_8asynctnt_6iproto_8protocol_Db = {
  PyVarObject_HEAD_INIT(0, 0)
  "asynctnt.iproto.protocol.Db", /*tp_name*/
  sizeof(struct __pyx_obj_8asynctnt_6iproto_8protocol_Db), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_8asynctnt_6iproto_8protocol_Db, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_8asynctnt_6iproto_8protocol_Db, /*tp_traverse*/
  __pyx_tp_clear_8asynctnt_6iproto_8protocol_Db, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_8asynctnt_6iproto_8protocol_Db, /*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_8asynctnt_6iproto_8protocol_Db, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_8asynctnt_6iproto_8protocol_CoreProtocol __pyx_vtable_8asynctnt_6iproto_8protocol_CoreProtocol;

static PyObject *__pyx_tp_new_8asynctnt_6iproto_8protocol_CoreProtocol(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_8asynctnt_6iproto_8protocol_CoreProtocol *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_8asynctnt_6iproto_8protocol_CoreProtocol *)o);
  p->__pyx_vtab = __pyx_vtabptr_8asynctnt_6iproto_8protocol_CoreProtocol;
  p->host = Py_None; Py_INCREF(Py_None);
  p->port = Py_None; Py_INCREF(Py_None);
  p->encoding = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->reqs = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->rbuf = ((struct __pyx_obj_8asynctnt_6iproto_8protocol_ReadBuffer *)Py_None); Py_INCREF(Py_None);
  p->version = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->salt = ((PyObject*)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_8asynctnt_6iproto_8protocol_CoreProtocol(PyObject *o) {
  struct __pyx_obj_8asynctnt_6iproto_8protocol_CoreProtocol *p = (struct __pyx_obj_8asynctnt_6iproto_8protocol_CoreProtocol *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->host);
  Py_CLEAR(p->port);
  Py_CLEAR(p->encoding);
  Py_CLEAR(p->reqs);
  Py_CLEAR(p->rbuf);
  Py_CLEAR(p->version);
  Py_CLEAR(p->salt);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_8asynctnt_6iproto_8protocol_CoreProtocol(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_8asynctnt_6iproto_8protocol_CoreProtocol *p = (struct __pyx_obj_8asynctnt_6iproto_8protocol_CoreProtocol *)o;
  if (p->host) {
    e = (*v)(p->host, a); if (e) return e;
  }
  if (p->port) {
    e = (*v)(p->port, a); if (e) return e;
  }
  if (p->reqs) {
    e = (*v)(p->reqs, a); if (e) return e;
  }
  if (p->rbuf) {
    e = (*v)(((PyObject*)p->rbuf), a); if (e) return e;
  }
  if (p->version) {
    e = (*v)(p->version, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_8asynctnt_6iproto_8protocol_CoreProtocol(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_8asynctnt_6iproto_8protocol_CoreProtocol *p = (struct __pyx_obj_8asynctnt_6iproto_8protocol_CoreProtocol *)o;
  tmp = ((PyObject*)p->host);
  p->host = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->port);
  p->port = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->reqs);
  p->reqs = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->rbuf);
  p->rbuf = ((struct __pyx_obj_8asynctnt_6iproto_8protocol_ReadBuffer *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->version);
  p->version = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_8asynctnt_6iproto_8protocol_CoreProtocol[] = {
  {"is_connected", (PyCFunction)__pyx_pw_8asynctnt_6iproto_8protocol_12CoreProtocol_3is_connected, METH_NOARGS, 0},
  {"is_fully_connected", (PyCFunction)__pyx_pw_8asynctnt_6iproto_8protocol_12CoreProtocol_5is_fully_connected, METH_NOARGS, 0},
  {"get_version", (PyCFunction)__pyx_pw_8asynctnt_6iproto_8protocol_12CoreProtocol_7get_version, METH_NOARGS, 0},
  {"_parse_version", (PyCFunction)__pyx_pw_8asynctnt_6iproto_8protocol_12CoreProtocol_9_parse_version, METH_O, 0},
  {"data_received", (PyCFunction)__pyx_pw_8asynctnt_6iproto_8protocol_12CoreProtocol_11data_received, METH_O, 0},
  {"connection_made", (PyCFunction)__pyx_pw_8asynctnt_6iproto_8protocol_12CoreProtocol_13connection_made, METH_O, 0},
  {"connection_lost", (PyCFunction)__pyx_pw_8asynctnt_6iproto_8protocol_12CoreProtocol_15connection_lost, METH_O, 0},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_8asynctnt_6iproto_8protocol_CoreProtocol = {
  PyVarObject_HEAD_INIT(0, 0)
  "asynctnt.iproto.protocol.CoreProtocol", /*tp_name*/
  sizeof(struct __pyx_obj_8asynctnt_6iproto_8protocol_CoreProtocol), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_8asynctnt_6iproto_8protocol_CoreProtocol, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_8asynctnt_6iproto_8protocol_CoreProtocol, /*tp_traverse*/
  __pyx_tp_clear_8asynctnt_6iproto_8protocol_CoreProtocol, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_8asynctnt_6iproto_8protocol_CoreProtocol, /*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*/
  __pyx_pw_8asynctnt_6iproto_8protocol_12CoreProtocol_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_8asynctnt_6iproto_8protocol_CoreProtocol, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_8asynctnt_6iproto_8protocol_BaseProtocol __pyx_vtable_8asynctnt_6iproto_8protocol_BaseProtocol;

static PyObject *__pyx_tp_new_8asynctnt_6iproto_8protocol_BaseProtocol(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *p;
  PyObject *o = __pyx_tp_new_8asynctnt_6iproto_8protocol_CoreProtocol(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_8asynctnt_6iproto_8protocol_CoreProtocol*)__pyx_vtabptr_8asynctnt_6iproto_8protocol_BaseProtocol;
  p->loop = Py_None; Py_INCREF(Py_None);
  p->username = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->password = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->connected_fut = Py_None; Py_INCREF(Py_None);
  p->on_connected_lost_cb = Py_None; Py_INCREF(Py_None);
  p->_on_request_completed_cb = Py_None; Py_INCREF(Py_None);
  p->_on_request_timeout_cb = Py_None; Py_INCREF(Py_None);
  p->_schema = ((struct __pyx_obj_8asynctnt_6iproto_8protocol_Schema *)Py_None); Py_INCREF(Py_None);
  p->_db = ((struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_8asynctnt_6iproto_8protocol_BaseProtocol(PyObject *o) {
  struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *p = (struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->loop);
  Py_CLEAR(p->username);
  Py_CLEAR(p->password);
  Py_CLEAR(p->connected_fut);
  Py_CLEAR(p->on_connected_lost_cb);
  Py_CLEAR(p->_on_request_completed_cb);
  Py_CLEAR(p->_on_request_timeout_cb);
  Py_CLEAR(p->_schema);
  Py_CLEAR(p->_db);
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_8asynctnt_6iproto_8protocol_CoreProtocol(o);
}

static int __pyx_tp_traverse_8asynctnt_6iproto_8protocol_BaseProtocol(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *p = (struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *)o;
  e = __pyx_tp_traverse_8asynctnt_6iproto_8protocol_CoreProtocol(o, v, a); if (e) return e;
  if (p->loop) {
    e = (*v)(p->loop, a); if (e) return e;
  }
  if (p->connected_fut) {
    e = (*v)(p->connected_fut, a); if (e) return e;
  }
  if (p->on_connected_lost_cb) {
    e = (*v)(p->on_connected_lost_cb, a); if (e) return e;
  }
  if (p->_on_request_completed_cb) {
    e = (*v)(p->_on_request_completed_cb, a); if (e) return e;
  }
  if (p->_on_request_timeout_cb) {
    e = (*v)(p->_on_request_timeout_cb, a); if (e) return e;
  }
  if (p->_schema) {
    e = (*v)(((PyObject*)p->_schema), a); if (e) return e;
  }
  if (p->_db) {
    e = (*v)(((PyObject*)p->_db), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_8asynctnt_6iproto_8protocol_BaseProtocol(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *p = (struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *)o;
  __pyx_tp_clear_8asynctnt_6iproto_8protocol_CoreProtocol(o);
  tmp = ((PyObject*)p->loop);
  p->loop = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->connected_fut);
  p->connected_fut = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->on_connected_lost_cb);
  p->on_connected_lost_cb = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_on_request_completed_cb);
  p->_on_request_completed_cb = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_on_request_timeout_cb);
  p->_on_request_timeout_cb = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_schema);
  p->_schema = ((struct __pyx_obj_8asynctnt_6iproto_8protocol_Schema *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_db);
  p->_db = ((struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_8asynctnt_6iproto_8protocol_12BaseProtocol_schema(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8asynctnt_6iproto_8protocol_12BaseProtocol_6schema_1__get__(o);
}

static PyObject *__pyx_getprop_8asynctnt_6iproto_8protocol_12BaseProtocol_schema_id(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8asynctnt_6iproto_8protocol_12BaseProtocol_9schema_id_1__get__(o);
}

static PyMethodDef __pyx_methods_8asynctnt_6iproto_8protocol_BaseProtocol[] = {
  {"_create_future_fallback", (PyCFunction)__pyx_pw_8asynctnt_6iproto_8protocol_12BaseProtocol_3_create_future_fallback, METH_NOARGS, 0},
  {"_on_request_timeout", (PyCFunction)__pyx_pw_8asynctnt_6iproto_8protocol_12BaseProtocol_5_on_request_timeout, METH_O, 0},
  {"_on_request_completed", (PyCFunction)__pyx_pw_8asynctnt_6iproto_8protocol_12BaseProtocol_7_on_request_completed, METH_O, 0},
  {"create_db", (PyCFunction)__pyx_pw_8asynctnt_6iproto_8protocol_12BaseProtocol_9create_db, METH_NOARGS, 0},
  {"get_common_db", (PyCFunction)__pyx_pw_8asynctnt_6iproto_8protocol_12BaseProtocol_11get_common_db, METH_NOARGS, 0},
  {"refetch_schema", (PyCFunction)__pyx_pw_8asynctnt_6iproto_8protocol_12BaseProtocol_13refetch_schema, METH_NOARGS, 0},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_8asynctnt_6iproto_8protocol_BaseProtocol[] = {
  {(char *)"schema", __pyx_getprop_8asynctnt_6iproto_8protocol_12BaseProtocol_schema, 0, (char *)0, 0},
  {(char *)"schema_id", __pyx_getprop_8asynctnt_6iproto_8protocol_12BaseProtocol_schema_id, 0, (char *)0, 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_8asynctnt_6iproto_8protocol_BaseProtocol = {
  PyVarObject_HEAD_INIT(0, 0)
  "asynctnt.iproto.protocol.BaseProtocol", /*tp_name*/
  sizeof(struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_8asynctnt_6iproto_8protocol_BaseProtocol, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_8asynctnt_6iproto_8protocol_BaseProtocol, /*tp_traverse*/
  __pyx_tp_clear_8asynctnt_6iproto_8protocol_BaseProtocol, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_8asynctnt_6iproto_8protocol_BaseProtocol, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_8asynctnt_6iproto_8protocol_BaseProtocol, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_8asynctnt_6iproto_8protocol_12BaseProtocol_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_8asynctnt_6iproto_8protocol_BaseProtocol, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_8asynctnt_6iproto_8protocol___pyx_scope_struct__execute *__pyx_freelist_8asynctnt_6iproto_8protocol___pyx_scope_struct__execute[8];
static int __pyx_freecount_8asynctnt_6iproto_8protocol___pyx_scope_struct__execute = 0;

static PyObject *__pyx_tp_new_8asynctnt_6iproto_8protocol___pyx_scope_struct__execute(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_8asynctnt_6iproto_8protocol___pyx_scope_struct__execute > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_8asynctnt_6iproto_8protocol___pyx_scope_struct__execute)))) {
    o = (PyObject*)__pyx_freelist_8asynctnt_6iproto_8protocol___pyx_scope_struct__execute[--__pyx_freecount_8asynctnt_6iproto_8protocol___pyx_scope_struct__execute];
    memset(o, 0, sizeof(struct __pyx_obj_8asynctnt_6iproto_8protocol___pyx_scope_struct__execute));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_8asynctnt_6iproto_8protocol___pyx_scope_struct__execute(PyObject *o) {
  struct __pyx_obj_8asynctnt_6iproto_8protocol___pyx_scope_struct__execute *p = (struct __pyx_obj_8asynctnt_6iproto_8protocol___pyx_scope_struct__execute *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_e);
  Py_CLEAR(p->__pyx_v_fut);
  Py_CLEAR(p->__pyx_v_req);
  Py_CLEAR(p->__pyx_v_self);
  Py_CLEAR(p->__pyx_t_0);
  Py_CLEAR(p->__pyx_t_1);
  Py_CLEAR(p->__pyx_t_2);
  Py_CLEAR(p->__pyx_t_3);
  Py_CLEAR(p->__pyx_t_4);
  Py_CLEAR(p->__pyx_t_5);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_8asynctnt_6iproto_8protocol___pyx_scope_struct__execute < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_8asynctnt_6iproto_8protocol___pyx_scope_struct__execute)))) {
    __pyx_freelist_8asynctnt_6iproto_8protocol___pyx_scope_struct__execute[__pyx_freecount_8asynctnt_6iproto_8protocol___pyx_scope_struct__execute++] = ((struct __pyx_obj_8asynctnt_6iproto_8protocol___pyx_scope_struct__execute *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_8asynctnt_6iproto_8protocol___pyx_scope_struct__execute(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_8asynctnt_6iproto_8protocol___pyx_scope_struct__execute *p = (struct __pyx_obj_8asynctnt_6iproto_8protocol___pyx_scope_struct__execute *)o;
  if (p->__pyx_v_e) {
    e = (*v)(p->__pyx_v_e, a); if (e) return e;
  }
  if (p->__pyx_v_fut) {
    e = (*v)(p->__pyx_v_fut, a); if (e) return e;
  }
  if (p->__pyx_v_req) {
    e = (*v)(((PyObject*)p->__pyx_v_req), a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e;
  }
  if (p->__pyx_t_0) {
    e = (*v)(p->__pyx_t_0, a); if (e) return e;
  }
  if (p->__pyx_t_1) {
    e = (*v)(p->__pyx_t_1, a); if (e) return e;
  }
  if (p->__pyx_t_2) {
    e = (*v)(p->__pyx_t_2, a); if (e) return e;
  }
  if (p->__pyx_t_3) {
    e = (*v)(p->__pyx_t_3, a); if (e) return e;
  }
  if (p->__pyx_t_4) {
    e = (*v)(p->__pyx_t_4, a); if (e) return e;
  }
  if (p->__pyx_t_5) {
    e = (*v)(p->__pyx_t_5, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_8asynctnt_6iproto_8protocol___pyx_scope_struct__execute(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_8asynctnt_6iproto_8protocol___pyx_scope_struct__execute *p = (struct __pyx_obj_8asynctnt_6iproto_8protocol___pyx_scope_struct__execute *)o;
  tmp = ((PyObject*)p->__pyx_v_e);
  p->__pyx_v_e = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_fut);
  p->__pyx_v_fut = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_req);
  p->__pyx_v_req = ((struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_self);
  p->__pyx_v_self = ((struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_t_0);
  p->__pyx_t_0 = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_t_1);
  p->__pyx_t_1 = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_t_2);
  p->__pyx_t_2 = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_t_3);
  p->__pyx_t_3 = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_t_4);
  p->__pyx_t_4 = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_t_5);
  p->__pyx_t_5 = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_8asynctnt_6iproto_8protocol___pyx_scope_struct__execute = {
  PyVarObject_HEAD_INIT(0, 0)
  "asynctnt.iproto.protocol.__pyx_scope_struct__execute", /*tp_name*/
  sizeof(struct __pyx_obj_8asynctnt_6iproto_8protocol___pyx_scope_struct__execute), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_8asynctnt_6iproto_8protocol___pyx_scope_struct__execute, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_8asynctnt_6iproto_8protocol___pyx_scope_struct__execute, /*tp_traverse*/
  __pyx_tp_clear_8asynctnt_6iproto_8protocol___pyx_scope_struct__execute, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*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_8asynctnt_6iproto_8protocol___pyx_scope_struct__execute, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_8asynctnt_6iproto_8protocol___pyx_scope_struct_1__do_auth *__pyx_freelist_8asynctnt_6iproto_8protocol___pyx_scope_struct_1__do_auth[8];
static int __pyx_freecount_8asynctnt_6iproto_8protocol___pyx_scope_struct_1__do_auth = 0;

static PyObject *__pyx_tp_new_8asynctnt_6iproto_8protocol___pyx_scope_struct_1__do_auth(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_8asynctnt_6iproto_8protocol___pyx_scope_struct_1__do_auth > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_8asynctnt_6iproto_8protocol___pyx_scope_struct_1__do_auth)))) {
    o = (PyObject*)__pyx_freelist_8asynctnt_6iproto_8protocol___pyx_scope_struct_1__do_auth[--__pyx_freecount_8asynctnt_6iproto_8protocol___pyx_scope_struct_1__do_auth];
    memset(o, 0, sizeof(struct __pyx_obj_8asynctnt_6iproto_8protocol___pyx_scope_struct_1__do_auth));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_8asynctnt_6iproto_8protocol___pyx_scope_struct_1__do_auth(PyObject *o) {
  struct __pyx_obj_8asynctnt_6iproto_8protocol___pyx_scope_struct_1__do_auth *p = (struct __pyx_obj_8asynctnt_6iproto_8protocol___pyx_scope_struct_1__do_auth *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_8asynctnt_6iproto_8protocol___pyx_scope_struct_1__do_auth < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_8asynctnt_6iproto_8protocol___pyx_scope_struct_1__do_auth)))) {
    __pyx_freelist_8asynctnt_6iproto_8protocol___pyx_scope_struct_1__do_auth[__pyx_freecount_8asynctnt_6iproto_8protocol___pyx_scope_struct_1__do_auth++] = ((struct __pyx_obj_8asynctnt_6iproto_8protocol___pyx_scope_struct_1__do_auth *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_8asynctnt_6iproto_8protocol___pyx_scope_struct_1__do_auth(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_8asynctnt_6iproto_8protocol___pyx_scope_struct_1__do_auth *p = (struct __pyx_obj_8asynctnt_6iproto_8protocol___pyx_scope_struct_1__do_auth *)o;
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_8asynctnt_6iproto_8protocol___pyx_scope_struct_1__do_auth(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_8asynctnt_6iproto_8protocol___pyx_scope_struct_1__do_auth *p = (struct __pyx_obj_8asynctnt_6iproto_8protocol___pyx_scope_struct_1__do_auth *)o;
  tmp = ((PyObject*)p->__pyx_v_self);
  p->__pyx_v_self = ((struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_8asynctnt_6iproto_8protocol___pyx_scope_struct_1__do_auth = {
  PyVarObject_HEAD_INIT(0, 0)
  "asynctnt.iproto.protocol.__pyx_scope_struct_1__do_auth", /*tp_name*/
  sizeof(struct __pyx_obj_8asynctnt_6iproto_8protocol___pyx_scope_struct_1__do_auth), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_8asynctnt_6iproto_8protocol___pyx_scope_struct_1__do_auth, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_8asynctnt_6iproto_8protocol___pyx_scope_struct_1__do_auth, /*tp_traverse*/
  __pyx_tp_clear_8asynctnt_6iproto_8protocol___pyx_scope_struct_1__do_auth, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*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_8asynctnt_6iproto_8protocol___pyx_scope_struct_1__do_auth, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_8asynctnt_6iproto_8protocol___pyx_scope_struct_2__do_fetch_schema *__pyx_freelist_8asynctnt_6iproto_8protocol___pyx_scope_struct_2__do_fetch_schema[8];
static int __pyx_freecount_8asynctnt_6iproto_8protocol___pyx_scope_struct_2__do_fetch_schema = 0;

static PyObject *__pyx_tp_new_8asynctnt_6iproto_8protocol___pyx_scope_struct_2__do_fetch_schema(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_8asynctnt_6iproto_8protocol___pyx_scope_struct_2__do_fetch_schema > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_8asynctnt_6iproto_8protocol___pyx_scope_struct_2__do_fetch_schema)))) {
    o = (PyObject*)__pyx_freelist_8asynctnt_6iproto_8protocol___pyx_scope_struct_2__do_fetch_schema[--__pyx_freecount_8asynctnt_6iproto_8protocol___pyx_scope_struct_2__do_fetch_schema];
    memset(o, 0, sizeof(struct __pyx_obj_8asynctnt_6iproto_8protocol___pyx_scope_struct_2__do_fetch_schema));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_8asynctnt_6iproto_8protocol___pyx_scope_struct_2__do_fetch_schema(PyObject *o) {
  struct __pyx_obj_8asynctnt_6iproto_8protocol___pyx_scope_struct_2__do_fetch_schema *p = (struct __pyx_obj_8asynctnt_6iproto_8protocol___pyx_scope_struct_2__do_fetch_schema *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_fut);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_8asynctnt_6iproto_8protocol___pyx_scope_struct_2__do_fetch_schema < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_8asynctnt_6iproto_8protocol___pyx_scope_struct_2__do_fetch_schema)))) {
    __pyx_freelist_8asynctnt_6iproto_8protocol___pyx_scope_struct_2__do_fetch_schema[__pyx_freecount_8asynctnt_6iproto_8protocol___pyx_scope_struct_2__do_fetch_schema++] = ((struct __pyx_obj_8asynctnt_6iproto_8protocol___pyx_scope_struct_2__do_fetch_schema *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_8asynctnt_6iproto_8protocol___pyx_scope_struct_2__do_fetch_schema(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_8asynctnt_6iproto_8protocol___pyx_scope_struct_2__do_fetch_schema *p = (struct __pyx_obj_8asynctnt_6iproto_8protocol___pyx_scope_struct_2__do_fetch_schema *)o;
  if (p->__pyx_v_fut) {
    e = (*v)(p->__pyx_v_fut, a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_8asynctnt_6iproto_8protocol___pyx_scope_struct_2__do_fetch_schema(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_8asynctnt_6iproto_8protocol___pyx_scope_struct_2__do_fetch_schema *p = (struct __pyx_obj_8asynctnt_6iproto_8protocol___pyx_scope_struct_2__do_fetch_schema *)o;
  tmp = ((PyObject*)p->__pyx_v_fut);
  p->__pyx_v_fut = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_self);
  p->__pyx_v_self = ((struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_8asynctnt_6iproto_8protocol___pyx_scope_struct_2__do_fetch_schema = {
  PyVarObject_HEAD_INIT(0, 0)
  "asynctnt.iproto.protocol.__pyx_scope_struct_2__do_fetch_schema", /*tp_name*/
  sizeof(struct __pyx_obj_8asynctnt_6iproto_8protocol___pyx_scope_struct_2__do_fetch_schema), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_8asynctnt_6iproto_8protocol___pyx_scope_struct_2__do_fetch_schema, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_8asynctnt_6iproto_8protocol___pyx_scope_struct_2__do_fetch_schema, /*tp_traverse*/
  __pyx_tp_clear_8asynctnt_6iproto_8protocol___pyx_scope_struct_2__do_fetch_schema, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*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_8asynctnt_6iproto_8protocol___pyx_scope_struct_2__do_fetch_schema, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static PyMethodDef __pyx_methods[] = {
  {0, 0, 0, 0}
};

#if PY_MAJOR_VERSION >= 3
static struct PyModuleDef __pyx_moduledef = {
  #if PY_VERSION_HEX < 0x03020000
    { PyObject_HEAD_INIT(NULL) NULL, 0, NULL },
  #else
    PyModuleDef_HEAD_INIT,
  #endif
    "protocol",
    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_n_s_AF_UNIX, __pyx_k_AF_UNIX, sizeof(__pyx_k_AF_UNIX), 0, 0, 1, 1},
  {&__pyx_n_s_ALL, __pyx_k_ALL, sizeof(__pyx_k_ALL), 0, 0, 1, 1},
  {&__pyx_n_s_AttributeError, __pyx_k_AttributeError, sizeof(__pyx_k_AttributeError), 0, 0, 1, 1},
  {&__pyx_n_s_BITS_ALL_NOT_SET, __pyx_k_BITS_ALL_NOT_SET, sizeof(__pyx_k_BITS_ALL_NOT_SET), 0, 0, 1, 1},
  {&__pyx_n_s_BITS_ALL_SET, __pyx_k_BITS_ALL_SET, sizeof(__pyx_k_BITS_ALL_SET), 0, 0, 1, 1},
  {&__pyx_n_s_BITS_ANY_SET, __pyx_k_BITS_ANY_SET, sizeof(__pyx_k_BITS_ANY_SET), 0, 0, 1, 1},
  {&__pyx_n_s_BaseProtocol__do_auth_locals_on, __pyx_k_BaseProtocol__do_auth_locals_on, sizeof(__pyx_k_BaseProtocol__do_auth_locals_on), 0, 0, 1, 1},
  {&__pyx_n_s_BaseProtocol__do_fetch_schema_lo, __pyx_k_BaseProtocol__do_fetch_schema_lo, sizeof(__pyx_k_BaseProtocol__do_fetch_schema_lo), 0, 0, 1, 1},
  {&__pyx_n_s_BufferError, __pyx_k_BufferError, sizeof(__pyx_k_BufferError), 0, 0, 1, 1},
  {&__pyx_n_s_CancelledError, __pyx_k_CancelledError, sizeof(__pyx_k_CancelledError), 0, 0, 1, 1},
  {&__pyx_n_s_Db_execute, __pyx_k_Db_execute, sizeof(__pyx_k_Db_execute), 0, 0, 1, 1},
  {&__pyx_kp_s_Deallocating_buffer_with_attache, __pyx_k_Deallocating_buffer_with_attache, sizeof(__pyx_k_Deallocating_buffer_with_attache), 0, 0, 1, 0},
  {&__pyx_n_s_EQ, __pyx_k_EQ, sizeof(__pyx_k_EQ), 0, 0, 1, 1},
  {&__pyx_n_s_ER_WRONG_SCHEMA_VERSION, __pyx_k_ER_WRONG_SCHEMA_VERSION, sizeof(__pyx_k_ER_WRONG_SCHEMA_VERSION), 0, 0, 1, 1},
  {&__pyx_n_s_ErrorCode, __pyx_k_ErrorCode, sizeof(__pyx_k_ErrorCode), 0, 0, 1, 1},
  {&__pyx_n_s_Future, __pyx_k_Future, sizeof(__pyx_k_Future), 0, 0, 1, 1},
  {&__pyx_n_s_GE, __pyx_k_GE, sizeof(__pyx_k_GE), 0, 0, 1, 1},
  {&__pyx_n_s_GT, __pyx_k_GT, sizeof(__pyx_k_GT), 0, 0, 1, 1},
  {&__pyx_kp_s_Header_key_must_be_a_MP_UINT, __pyx_k_Header_key_must_be_a_MP_UINT, sizeof(__pyx_k_Header_key_must_be_a_MP_UINT), 0, 0, 1, 0},
  {&__pyx_n_s_IPPROTO_TCP, __pyx_k_IPPROTO_TCP, sizeof(__pyx_k_IPPROTO_TCP), 0, 0, 1, 1},
  {&__pyx_n_s_IndexError, __pyx_k_IndexError, sizeof(__pyx_k_IndexError), 0, 0, 1, 1},
  {&__pyx_kp_s_Index_for_space_not_found, __pyx_k_Index_for_space_not_found, sizeof(__pyx_k_Index_for_space_not_found), 0, 0, 1, 0},
  {&__pyx_n_s_IntEnum, __pyx_k_IntEnum, sizeof(__pyx_k_IntEnum), 0, 0, 1, 1},
  {&__pyx_n_s_Iterator, __pyx_k_Iterator, sizeof(__pyx_k_Iterator), 0, 0, 1, 1},
  {&__pyx_kp_s_Iterator_is_of_unsupported_type, __pyx_k_Iterator_is_of_unsupported_type, sizeof(__pyx_k_Iterator_is_of_unsupported_type), 0, 0, 1, 0},
  {&__pyx_n_s_KeyError, __pyx_k_KeyError, sizeof(__pyx_k_KeyError), 0, 0, 1, 1},
  {&__pyx_n_s_LE, __pyx_k_LE, sizeof(__pyx_k_LE), 0, 0, 1, 1},
  {&__pyx_n_s_LT, __pyx_k_LT, sizeof(__pyx_k_LT), 0, 0, 1, 1},
  {&__pyx_kp_s_Lost_connection_to_Tarantool, __pyx_k_Lost_connection_to_Tarantool, sizeof(__pyx_k_Lost_connection_to_Tarantool), 0, 0, 1, 0},
  {&__pyx_n_s_MemoryError, __pyx_k_MemoryError, sizeof(__pyx_k_MemoryError), 0, 0, 1, 1},
  {&__pyx_n_s_NEIGHBOR, __pyx_k_NEIGHBOR, sizeof(__pyx_k_NEIGHBOR), 0, 0, 1, 1},
  {&__pyx_n_s_OVERLAPS, __pyx_k_OVERLAPS, sizeof(__pyx_k_OVERLAPS), 0, 0, 1, 1},
  {&__pyx_kp_s_Offset_incorrect_Got_use_len, __pyx_k_Offset_incorrect_Got_use_len, sizeof(__pyx_k_Offset_incorrect_Got_use_len), 0, 0, 1, 0},
  {&__pyx_kp_s_Operation_field_no_must_be_of_in, __pyx_k_Operation_field_no_must_be_of_in, sizeof(__pyx_k_Operation_field_no_must_be_of_in), 0, 0, 1, 0},
  {&__pyx_kp_s_Operation_length_must_be_at_leas, __pyx_k_Operation_length_must_be_at_leas, sizeof(__pyx_k_Operation_length_must_be_at_leas), 0, 0, 1, 0},
  {&__pyx_kp_s_Operation_type_must_of_a_str_or, __pyx_k_Operation_type_must_of_a_str_or, sizeof(__pyx_k_Operation_type_must_of_a_str_or), 0, 0, 1, 0},
  {&__pyx_n_s_Protocol, __pyx_k_Protocol, sizeof(__pyx_k_Protocol), 0, 0, 1, 1},
  {&__pyx_n_s_REQ, __pyx_k_REQ, sizeof(__pyx_k_REQ), 0, 0, 1, 1},
  {&__pyx_kp_s_Request_op_sync_schema_id_body, __pyx_k_Request_op_sync_schema_id_body, sizeof(__pyx_k_Request_op_sync_schema_id_body), 0, 0, 1, 0},
  {&__pyx_kp_s_Response_body_must_be_a_MP_MAP, __pyx_k_Response_body_must_be_a_MP_MAP, sizeof(__pyx_k_Response_body_must_be_a_MP_MAP), 0, 0, 1, 0},
  {&__pyx_kp_s_Response_code_sync, __pyx_k_Response_code_sync, sizeof(__pyx_k_Response_code_sync), 0, 0, 1, 0},
  {&__pyx_kp_s_Response_header_must_be_a_MP_MAP, __pyx_k_Response_header_must_be_a_MP_MAP, sizeof(__pyx_k_Response_header_must_be_a_MP_MAP), 0, 0, 1, 0},
  {&__pyx_n_s_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 0, 0, 1, 1},
  {&__pyx_kp_s_Schema, __pyx_k_Schema, sizeof(__pyx_k_Schema), 0, 0, 1, 0},
  {&__pyx_kp_s_SchemaIndex_sid_id_name_type_un, __pyx_k_SchemaIndex_sid_id_name_type_un, sizeof(__pyx_k_SchemaIndex_sid_id_name_type_un), 0, 0, 1, 0},
  {&__pyx_kp_s_SchemaSpace_id_name_arity, __pyx_k_SchemaSpace_id_name_arity, sizeof(__pyx_k_SchemaSpace_id_name_arity), 0, 0, 1, 0},
  {&__pyx_kp_s_Schema_fetch_timeout, __pyx_k_Schema_fetch_timeout, sizeof(__pyx_k_Schema_fetch_timeout), 0, 0, 1, 0},
  {&__pyx_kp_s_Schema_not_fetched, __pyx_k_Schema_not_fetched, sizeof(__pyx_k_Schema_not_fetched), 0, 0, 1, 0},
  {&__pyx_kp_s_Single_operation_must_be_a_tuple, __pyx_k_Single_operation_must_be_a_tuple, sizeof(__pyx_k_Single_operation_must_be_a_tuple), 0, 0, 1, 0},
  {&__pyx_kp_s_Space_not_found, __pyx_k_Space_not_found, sizeof(__pyx_k_Space_not_found), 0, 0, 1, 0},
  {&__pyx_kp_s_Splice_offset_must_be_int, __pyx_k_Splice_offset_must_be_int, sizeof(__pyx_k_Splice_offset_must_be_int), 0, 0, 1, 0},
  {&__pyx_kp_s_Splice_operation_must_have_lengt, __pyx_k_Splice_operation_must_have_lengt, sizeof(__pyx_k_Splice_operation_must_have_lengt), 0, 0, 1, 0},
  {&__pyx_kp_s_Splice_position_must_be_int, __pyx_k_Splice_position_must_be_int, sizeof(__pyx_k_Splice_position_must_be_int), 0, 0, 1, 0},
  {&__pyx_n_s_TCP_NODELAY, __pyx_k_TCP_NODELAY, sizeof(__pyx_k_TCP_NODELAY), 0, 0, 1, 1},
  {&__pyx_n_s_TarantoolDatabaseError, __pyx_k_TarantoolDatabaseError, sizeof(__pyx_k_TarantoolDatabaseError), 0, 0, 1, 1},
  {&__pyx_n_s_TarantoolNotConnectedError, __pyx_k_TarantoolNotConnectedError, sizeof(__pyx_k_TarantoolNotConnectedError), 0, 0, 1, 1},
  {&__pyx_n_s_TarantoolSchemaError, __pyx_k_TarantoolSchemaError, sizeof(__pyx_k_TarantoolSchemaError), 0, 0, 1, 1},
  {&__pyx_kp_s_Tarantool_is_not_connected, __pyx_k_Tarantool_is_not_connected, sizeof(__pyx_k_Tarantool_is_not_connected), 0, 0, 1, 0},
  {&__pyx_kp_s_Tarantool_s_s_Authorization_fail, __pyx_k_Tarantool_s_s_Authorization_fail, sizeof(__pyx_k_Tarantool_s_s_Authorization_fail), 0, 0, 1, 0},
  {&__pyx_kp_s_Tarantool_s_s_Authorized_success, __pyx_k_Tarantool_s_s_Authorized_success, sizeof(__pyx_k_Tarantool_s_s_Authorized_success), 0, 0, 1, 0},
  {&__pyx_kp_s_Tarantool_s_s_Schema_fetch_faile, __pyx_k_Tarantool_s_s_Schema_fetch_faile, sizeof(__pyx_k_Tarantool_s_s_Schema_fetch_faile), 0, 0, 1, 0},
  {&__pyx_kp_s_Tarantool_s_s_Schema_fetch_succe, __pyx_k_Tarantool_s_s_Schema_fetch_succe, sizeof(__pyx_k_Tarantool_s_s_Schema_fetch_succe), 0, 0, 1, 0},
  {&__pyx_n_s_TimeoutError, __pyx_k_TimeoutError, sizeof(__pyx_k_TimeoutError), 0, 0, 1, 1},
  {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1},
  {&__pyx_kp_s_Type_is_not_supported_for_encodi, __pyx_k_Type_is_not_supported_for_encodi, sizeof(__pyx_k_Type_is_not_supported_for_encodi), 0, 0, 1, 0},
  {&__pyx_kp_s_Unexpected_key_type_in_map_s, __pyx_k_Unexpected_key_type_in_map_s, sizeof(__pyx_k_Unexpected_key_type_in_map_s), 0, 0, 1, 0},
  {&__pyx_kp_s_Unexpected_obj_type_s, __pyx_k_Unexpected_obj_type_s, sizeof(__pyx_k_Unexpected_obj_type_s), 0, 0, 1, 0},
  {&__pyx_kp_s_Unknown_argument_in_header_Skipp, __pyx_k_Unknown_argument_in_header_Skipp, sizeof(__pyx_k_Unknown_argument_in_header_Skipp), 0, 0, 1, 0},
  {&__pyx_kp_s_Unknown_update_operation_type, __pyx_k_Unknown_update_operation_type, sizeof(__pyx_k_Unknown_update_operation_type), 0, 0, 1, 0},
  {&__pyx_n_s_VERSION_STRING_REGEX, __pyx_k_VERSION_STRING_REGEX, sizeof(__pyx_k_VERSION_STRING_REGEX), 0, 0, 1, 1},
  {&__pyx_kp_s__29, __pyx_k__29, sizeof(__pyx_k__29), 0, 0, 1, 0},
  {&__pyx_n_s_add_done_callback, __pyx_k_add_done_callback, sizeof(__pyx_k_add_done_callback), 0, 0, 1, 1},
  {&__pyx_n_s_allow_unicode, __pyx_k_allow_unicode, sizeof(__pyx_k_allow_unicode), 0, 0, 1, 1},
  {&__pyx_n_s_args, __pyx_k_args, sizeof(__pyx_k_args), 0, 0, 1, 1},
  {&__pyx_n_s_ascii, __pyx_k_ascii, sizeof(__pyx_k_ascii), 0, 0, 1, 1},
  {&__pyx_n_s_asyncio, __pyx_k_asyncio, sizeof(__pyx_k_asyncio), 0, 0, 1, 1},
  {&__pyx_n_s_asyncio_coroutines, __pyx_k_asyncio_coroutines, sizeof(__pyx_k_asyncio_coroutines), 0, 0, 1, 1},
  {&__pyx_n_s_asyncio_tasks, __pyx_k_asyncio_tasks, sizeof(__pyx_k_asyncio_tasks), 0, 0, 1, 1},
  {&__pyx_n_s_asynctnt_exceptions, __pyx_k_asynctnt_exceptions, sizeof(__pyx_k_asynctnt_exceptions), 0, 0, 1, 1},
  {&__pyx_n_s_asynctnt_iproto_protocol, __pyx_k_asynctnt_iproto_protocol, sizeof(__pyx_k_asynctnt_iproto_protocol), 0, 0, 1, 1},
  {&__pyx_n_s_asynctnt_log, __pyx_k_asynctnt_log, sizeof(__pyx_k_asynctnt_log), 0, 0, 1, 1},
  {&__pyx_n_s_auto_refetch_schema, __pyx_k_auto_refetch_schema, sizeof(__pyx_k_auto_refetch_schema), 0, 0, 1, 1},
  {&__pyx_n_s_await, __pyx_k_await, sizeof(__pyx_k_await), 0, 0, 1, 1},
  {&__pyx_n_s_b64decode, __pyx_k_b64decode, sizeof(__pyx_k_b64decode), 0, 0, 1, 1},
  {&__pyx_n_s_base64, __pyx_k_base64, sizeof(__pyx_k_base64), 0, 0, 1, 1},
  {&__pyx_n_s_body, __pyx_k_body, sizeof(__pyx_k_body), 0, 0, 1, 1},
  {&__pyx_kp_s_body_data_type_must_be_a_MP_ARRA, __pyx_k_body_data_type_must_be_a_MP_ARRA, sizeof(__pyx_k_body_data_type_must_be_a_MP_ARRA), 0, 0, 1, 0},
  {&__pyx_n_s_call_later, __pyx_k_call_later, sizeof(__pyx_k_call_later), 0, 0, 1, 1},
  {&__pyx_n_s_cancel, __pyx_k_cancel, sizeof(__pyx_k_cancel), 0, 0, 1, 1},
  {&__pyx_n_s_cancelled, __pyx_k_cancelled, sizeof(__pyx_k_cancelled), 0, 0, 1, 1},
  {&__pyx_n_s_class, __pyx_k_class, sizeof(__pyx_k_class), 0, 0, 1, 1},
  {&__pyx_n_s_close, __pyx_k_close, sizeof(__pyx_k_close), 0, 0, 1, 1},
  {&__pyx_n_s_code, __pyx_k_code, sizeof(__pyx_k_code), 0, 0, 1, 1},
  {&__pyx_kp_s_code_type_must_be_a_MP_UINT, __pyx_k_code_type_must_be_a_MP_UINT, sizeof(__pyx_k_code_type_must_be_a_MP_UINT), 0, 0, 1, 0},
  {&__pyx_n_s_compile, __pyx_k_compile, sizeof(__pyx_k_compile), 0, 0, 1, 1},
  {&__pyx_n_s_connected_fut, __pyx_k_connected_fut, sizeof(__pyx_k_connected_fut), 0, 0, 1, 1},
  {&__pyx_n_s_create_future, __pyx_k_create_future, sizeof(__pyx_k_create_future), 0, 0, 1, 1},
  {&__pyx_n_s_create_future_fallback, __pyx_k_create_future_fallback, sizeof(__pyx_k_create_future_fallback), 0, 0, 1, 1},
  {&__pyx_n_s_debug, __pyx_k_debug, sizeof(__pyx_k_debug), 0, 0, 1, 1},
  {&__pyx_n_s_decode, __pyx_k_decode, sizeof(__pyx_k_decode), 0, 0, 1, 1},
  {&__pyx_n_s_digest, __pyx_k_digest, sizeof(__pyx_k_digest), 0, 0, 1, 1},
  {&__pyx_n_s_doc, __pyx_k_doc, sizeof(__pyx_k_doc), 0, 0, 1, 1},
  {&__pyx_n_s_done, __pyx_k_done, sizeof(__pyx_k_done), 0, 0, 1, 1},
  {&__pyx_n_s_dump, __pyx_k_dump, sizeof(__pyx_k_dump), 0, 0, 1, 1},
  {&__pyx_n_s_e, __pyx_k_e, sizeof(__pyx_k_e), 0, 0, 1, 1},
  {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1},
  {&__pyx_n_s_encoding, __pyx_k_encoding, sizeof(__pyx_k_encoding), 0, 0, 1, 1},
  {&__pyx_kp_s_encoding_must_be_either_str_or_b, __pyx_k_encoding_must_be_either_str_or_b, sizeof(__pyx_k_encoding_must_be_either_str_or_b), 0, 0, 1, 0},
  {&__pyx_n_s_enum, __pyx_k_enum, sizeof(__pyx_k_enum), 0, 0, 1, 1},
  {&__pyx_n_s_error, __pyx_k_error, sizeof(__pyx_k_error), 0, 0, 1, 1},
  {&__pyx_kp_s_errstr_type_must_be_a_MP_STR, __pyx_k_errstr_type_must_be_a_MP_STR, sizeof(__pyx_k_errstr_type_must_be_a_MP_STR), 0, 0, 1, 0},
  {&__pyx_kp_s_exceeded_timeout, __pyx_k_exceeded_timeout, sizeof(__pyx_k_exceeded_timeout), 0, 0, 1, 0},
  {&__pyx_n_s_exception, __pyx_k_exception, sizeof(__pyx_k_exception), 0, 0, 1, 1},
  {&__pyx_n_s_execute, __pyx_k_execute, sizeof(__pyx_k_execute), 0, 0, 1, 1},
  {&__pyx_n_s_expression, __pyx_k_expression, sizeof(__pyx_k_expression), 0, 0, 1, 1},
  {&__pyx_n_s_f, __pyx_k_f, sizeof(__pyx_k_f), 0, 0, 1, 1},
  {&__pyx_n_s_family, __pyx_k_family, sizeof(__pyx_k_family), 0, 0, 1, 1},
  {&__pyx_n_s_fetch_schema, __pyx_k_fetch_schema, sizeof(__pyx_k_fetch_schema), 0, 0, 1, 1},
  {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1},
  {&__pyx_n_s_func_name, __pyx_k_func_name, sizeof(__pyx_k_func_name), 0, 0, 1, 1},
  {&__pyx_n_s_futures, __pyx_k_futures, sizeof(__pyx_k_futures), 0, 0, 1, 1},
  {&__pyx_n_s_gather, __pyx_k_gather, sizeof(__pyx_k_gather), 0, 0, 1, 1},
  {&__pyx_n_s_get_extra_info, __pyx_k_get_extra_info, sizeof(__pyx_k_get_extra_info), 0, 0, 1, 1},
  {&__pyx_n_s_get_id, __pyx_k_get_id, sizeof(__pyx_k_get_id), 0, 0, 1, 1},
  {&__pyx_n_s_get_index, __pyx_k_get_index, sizeof(__pyx_k_get_index), 0, 0, 1, 1},
  {&__pyx_n_s_get_space, __pyx_k_get_space, sizeof(__pyx_k_get_space), 0, 0, 1, 1},
  {&__pyx_n_s_group, __pyx_k_group, sizeof(__pyx_k_group), 0, 0, 1, 1},
  {&__pyx_n_s_hashlib, __pyx_k_hashlib, sizeof(__pyx_k_hashlib), 0, 0, 1, 1},
  {&__pyx_kp_s_home_travis_build_igorcoding_as, __pyx_k_home_travis_build_igorcoding_as, sizeof(__pyx_k_home_travis_build_igorcoding_as), 0, 0, 1, 0},
  {&__pyx_kp_s_home_travis_build_igorcoding_as_2, __pyx_k_home_travis_build_igorcoding_as_2, sizeof(__pyx_k_home_travis_build_igorcoding_as_2), 0, 0, 1, 0},
  {&__pyx_n_s_host, __pyx_k_host, sizeof(__pyx_k_host), 0, 0, 1, 1},
  {&__pyx_n_s_iid, __pyx_k_iid, sizeof(__pyx_k_iid), 0, 0, 1, 1},
  {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
  {&__pyx_n_s_index, __pyx_k_index, sizeof(__pyx_k_index), 0, 0, 1, 1},
  {&__pyx_n_s_index_row, __pyx_k_index_row, sizeof(__pyx_k_index_row), 0, 0, 1, 1},
  {&__pyx_n_s_index_type, __pyx_k_index_type, sizeof(__pyx_k_index_type), 0, 0, 1, 1},
  {&__pyx_n_s_indexes, __pyx_k_indexes, sizeof(__pyx_k_indexes), 0, 0, 1, 1},
  {&__pyx_n_s_init, __pyx_k_init, sizeof(__pyx_k_init), 0, 0, 1, 1},
  {&__pyx_n_s_init___locals___repr, __pyx_k_init___locals___repr, sizeof(__pyx_k_init___locals___repr), 0, 0, 1, 1},
  {&__pyx_n_s_initial_read_buffer_size, __pyx_k_initial_read_buffer_size, sizeof(__pyx_k_initial_read_buffer_size), 0, 0, 1, 1},
  {&__pyx_n_s_insert, __pyx_k_insert, sizeof(__pyx_k_insert), 0, 0, 1, 1},
  {&__pyx_n_s_inspect, __pyx_k_inspect, sizeof(__pyx_k_inspect), 0, 0, 1, 1},
  {&__pyx_kp_s_int_argument_required_for_Arithm, __pyx_k_int_argument_required_for_Arithm, sizeof(__pyx_k_int_argument_required_for_Arithm), 0, 0, 1, 0},
  {&__pyx_n_s_iterator, __pyx_k_iterator, sizeof(__pyx_k_iterator), 0, 0, 1, 1},
  {&__pyx_n_s_key, __pyx_k_key, sizeof(__pyx_k_key), 0, 0, 1, 1},
  {&__pyx_n_s_limit, __pyx_k_limit, sizeof(__pyx_k_limit), 0, 0, 1, 1},
  {&__pyx_n_s_logger, __pyx_k_logger, sizeof(__pyx_k_logger), 0, 0, 1, 1},
  {&__pyx_n_s_loop, __pyx_k_loop, sizeof(__pyx_k_loop), 0, 0, 1, 1},
  {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
  {&__pyx_n_s_map, __pyx_k_map, sizeof(__pyx_k_map), 0, 0, 1, 1},
  {&__pyx_n_s_match, __pyx_k_match, sizeof(__pyx_k_match), 0, 0, 1, 1},
  {&__pyx_n_s_memoryview, __pyx_k_memoryview, sizeof(__pyx_k_memoryview), 0, 0, 1, 1},
  {&__pyx_n_s_metaclass, __pyx_k_metaclass, sizeof(__pyx_k_metaclass), 0, 0, 1, 1},
  {&__pyx_n_s_module, __pyx_k_module, sizeof(__pyx_k_module), 0, 0, 1, 1},
  {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
  {&__pyx_n_s_name_2, __pyx_k_name_2, sizeof(__pyx_k_name_2), 0, 0, 1, 1},
  {&__pyx_n_s_offset, __pyx_k_offset, sizeof(__pyx_k_offset), 0, 0, 1, 1},
  {&__pyx_n_s_on_authorized, __pyx_k_on_authorized, sizeof(__pyx_k_on_authorized), 0, 0, 1, 1},
  {&__pyx_n_s_on_connection_lost, __pyx_k_on_connection_lost, sizeof(__pyx_k_on_connection_lost), 0, 0, 1, 1},
  {&__pyx_n_s_on_connection_lost_cb, __pyx_k_on_connection_lost_cb, sizeof(__pyx_k_on_connection_lost_cb), 0, 0, 1, 1},
  {&__pyx_n_s_on_connection_made, __pyx_k_on_connection_made, sizeof(__pyx_k_on_connection_made), 0, 0, 1, 1},
  {&__pyx_n_s_on_connection_made_cb, __pyx_k_on_connection_made_cb, sizeof(__pyx_k_on_connection_made_cb), 0, 0, 1, 1},
  {&__pyx_kp_s_on_data_received_expected_bytes, __pyx_k_on_data_received_expected_bytes, sizeof(__pyx_k_on_data_received_expected_bytes), 0, 0, 1, 0},
  {&__pyx_n_s_on_fetch, __pyx_k_on_fetch, sizeof(__pyx_k_on_fetch), 0, 0, 1, 1},
  {&__pyx_n_s_on_request_completed, __pyx_k_on_request_completed, sizeof(__pyx_k_on_request_completed), 0, 0, 1, 1},
  {&__pyx_n_s_on_request_timeout, __pyx_k_on_request_timeout, sizeof(__pyx_k_on_request_timeout), 0, 0, 1, 1},
  {&__pyx_n_s_operations, __pyx_k_operations, sizeof(__pyx_k_operations), 0, 0, 1, 1},
  {&__pyx_n_s_parse_version, __pyx_k_parse_version, sizeof(__pyx_k_parse_version), 0, 0, 1, 1},
  {&__pyx_n_s_password, __pyx_k_password, sizeof(__pyx_k_password), 0, 0, 1, 1},
  {&__pyx_n_s_port, __pyx_k_port, sizeof(__pyx_k_port), 0, 0, 1, 1},
  {&__pyx_n_s_prepare, __pyx_k_prepare, sizeof(__pyx_k_prepare), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1},
  {&__pyx_n_s_qualname, __pyx_k_qualname, sizeof(__pyx_k_qualname), 0, 0, 1, 1},
  {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
  {&__pyx_n_s_re, __pyx_k_re, sizeof(__pyx_k_re), 0, 0, 1, 1},
  {&__pyx_n_s_refetch_schema, __pyx_k_refetch_schema, sizeof(__pyx_k_refetch_schema), 0, 0, 1, 1},
  {&__pyx_n_s_replace, __pyx_k_replace, sizeof(__pyx_k_replace), 0, 0, 1, 1},
  {&__pyx_n_s_repr, __pyx_k_repr, sizeof(__pyx_k_repr), 0, 0, 1, 1},
  {&__pyx_n_s_req, __pyx_k_req, sizeof(__pyx_k_req), 0, 0, 1, 1},
  {&__pyx_n_s_req_2, __pyx_k_req_2, sizeof(__pyx_k_req_2), 0, 0, 1, 1},
  {&__pyx_n_s_request_timeout, __pyx_k_request_timeout, sizeof(__pyx_k_request_timeout), 0, 0, 1, 1},
  {&__pyx_n_s_result, __pyx_k_result, sizeof(__pyx_k_result), 0, 0, 1, 1},
  {&__pyx_n_s_return_exceptions, __pyx_k_return_exceptions, sizeof(__pyx_k_return_exceptions), 0, 0, 1, 1},
  {&__pyx_kp_s_s_Tarantool_s_d_s, __pyx_k_s_Tarantool_s_d_s, sizeof(__pyx_k_s_Tarantool_s_d_s), 0, 0, 1, 0},
  {&__pyx_n_s_schema_id, __pyx_k_schema_id, sizeof(__pyx_k_schema_id), 0, 0, 1, 1},
  {&__pyx_kp_s_schema_id_type_must_be_a_MP_UINT, __pyx_k_schema_id_type_must_be_a_MP_UINT, sizeof(__pyx_k_schema_id_type_must_be_a_MP_UINT), 0, 0, 1, 0},
  {&__pyx_n_s_select, __pyx_k_select, sizeof(__pyx_k_select), 0, 0, 1, 1},
  {&__pyx_n_s_self, __pyx_k_self, sizeof(__pyx_k_self), 0, 0, 1, 1},
  {&__pyx_n_s_send, __pyx_k_send, sizeof(__pyx_k_send), 0, 0, 1, 1},
  {&__pyx_n_s_set_exception, __pyx_k_set_exception, sizeof(__pyx_k_set_exception), 0, 0, 1, 1},
  {&__pyx_n_s_set_result, __pyx_k_set_result, sizeof(__pyx_k_set_result), 0, 0, 1, 1},
  {&__pyx_n_s_setsockopt, __pyx_k_setsockopt, sizeof(__pyx_k_setsockopt), 0, 0, 1, 1},
  {&__pyx_n_s_sha1, __pyx_k_sha1, sizeof(__pyx_k_sha1), 0, 0, 1, 1},
  {&__pyx_n_s_sid, __pyx_k_sid, sizeof(__pyx_k_sid), 0, 0, 1, 1},
  {&__pyx_n_s_socket, __pyx_k_socket, sizeof(__pyx_k_socket), 0, 0, 1, 1},
  {&__pyx_n_s_space, __pyx_k_space, sizeof(__pyx_k_space), 0, 0, 1, 1},
  {&__pyx_n_s_space_row, __pyx_k_space_row, sizeof(__pyx_k_space_row), 0, 0, 1, 1},
  {&__pyx_n_s_spaces, __pyx_k_spaces, sizeof(__pyx_k_spaces), 0, 0, 1, 1},
  {&__pyx_n_s_split, __pyx_k_split, sizeof(__pyx_k_split), 0, 0, 1, 1},
  {&__pyx_kp_s_sync_d_not_found, __pyx_k_sync_d_not_found, sizeof(__pyx_k_sync_d_not_found), 0, 0, 1, 0},
  {&__pyx_kp_s_sync_type_must_be_a_MP_UINT, __pyx_k_sync_type_must_be_a_MP_UINT, sizeof(__pyx_k_sync_type_must_be_a_MP_UINT), 0, 0, 1, 0},
  {&__pyx_n_s_t, __pyx_k_t, sizeof(__pyx_k_t), 0, 0, 1, 1},
  {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
  {&__pyx_kp_s_the_buffer_is_in_read_only_mode, __pyx_k_the_buffer_is_in_read_only_mode, sizeof(__pyx_k_the_buffer_is_in_read_only_mode), 0, 0, 1, 0},
  {&__pyx_n_s_throw, __pyx_k_throw, sizeof(__pyx_k_throw), 0, 0, 1, 1},
  {&__pyx_n_s_timeout, __pyx_k_timeout, sizeof(__pyx_k_timeout), 0, 0, 1, 1},
  {&__pyx_n_s_transport, __pyx_k_transport, sizeof(__pyx_k_transport), 0, 0, 1, 1},
  {&__pyx_n_s_unique, __pyx_k_unique, sizeof(__pyx_k_unique), 0, 0, 1, 1},
  {&__pyx_n_s_update, __pyx_k_update, sizeof(__pyx_k_update), 0, 0, 1, 1},
  {&__pyx_n_s_username, __pyx_k_username, sizeof(__pyx_k_username), 0, 0, 1, 1},
  {&__pyx_kp_b_utf_8, __pyx_k_utf_8, sizeof(__pyx_k_utf_8), 0, 0, 0, 0},
  {&__pyx_n_s_value, __pyx_k_value, sizeof(__pyx_k_value), 0, 0, 1, 1},
  {&__pyx_n_s_warning, __pyx_k_warning, sizeof(__pyx_k_warning), 0, 0, 1, 1},
  {&__pyx_n_s_write, __pyx_k_write, sizeof(__pyx_k_write), 0, 0, 1, 1},
  {&__pyx_n_s_yaml, __pyx_k_yaml, sizeof(__pyx_k_yaml), 0, 0, 1, 1},
  {0, 0, 0, 0, 0, 0, 0}
};
static int __Pyx_InitCachedBuiltins(void) {
  __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(0, 38, __pyx_L1_error)
  __pyx_builtin_BufferError = __Pyx_GetBuiltinName(__pyx_n_s_BufferError); if (!__pyx_builtin_BufferError) __PYX_ERR(0, 62, __pyx_L1_error)
  __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(0, 101, __pyx_L1_error)
  __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 235, __pyx_L1_error)
  __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(0, 333, __pyx_L1_error)
  __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s_IndexError); if (!__pyx_builtin_IndexError) __PYX_ERR(0, 395, __pyx_L1_error)
  __pyx_builtin_KeyError = __Pyx_GetBuiltinName(__pyx_n_s_KeyError); if (!__pyx_builtin_KeyError) __PYX_ERR(1, 52, __pyx_L1_error)
  __pyx_builtin_memoryview = __Pyx_GetBuiltinName(__pyx_n_s_memoryview); if (!__pyx_builtin_memoryview) __PYX_ERR(2, 63, __pyx_L1_error)
  __pyx_builtin_map = __Pyx_GetBuiltinName(__pyx_n_s_map); if (!__pyx_builtin_map) __PYX_ERR(2, 168, __pyx_L1_error)
  __pyx_builtin_AttributeError = __Pyx_GetBuiltinName(__pyx_n_s_AttributeError); if (!__pyx_builtin_AttributeError) __PYX_ERR(3, 73, __pyx_L1_error)
  return 0;
  __pyx_L1_error:;
  return -1;
}

static int __Pyx_InitCachedConstants(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);

  /* "asynctnt/iproto/buffer.pyx":38
 * 
 *         if self._view_count:
 *             raise RuntimeError(             # <<<<<<<<<<<<<<
 *                 'Deallocating buffer with attached memoryviews')
 * 
 */
  __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_s_Deallocating_buffer_with_attache); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 38, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple_);
  __Pyx_GIVEREF(__pyx_tuple_);

  /* "asynctnt/iproto/buffer.pyx":62
 *     cdef inline _check_readonly(self):
 *         if self._view_count:
 *             raise BufferError('the buffer is in read-only mode')             # <<<<<<<<<<<<<<
 * 
 *     cdef inline len(self):
 */
  __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_s_the_buffer_is_in_read_only_mode); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 62, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__2);
  __Pyx_GIVEREF(__pyx_tuple__2);

  /* "asynctnt/iproto/buffer.pyx":390
 *         for operation in operations:
 *             if not isinstance(operation, (list, tuple)):
 *                 raise TypeError(             # <<<<<<<<<<<<<<
 *                     'Single operation must be a tuple or list')
 * 
 */
  __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_s_Single_operation_must_be_a_tuple); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 390, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__3);
  __Pyx_GIVEREF(__pyx_tuple__3);

  /* "asynctnt/iproto/buffer.pyx":395
 *             op_len = <uint32_t>cpython.list.PyList_GET_SIZE(operation)
 *             if op_len < 3:
 *                 raise IndexError(             # <<<<<<<<<<<<<<
 *                     'Operation length must be at least 3')
 * 
 */
  __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_s_Operation_length_must_be_at_leas); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 395, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__4);
  __Pyx_GIVEREF(__pyx_tuple__4);

  /* "asynctnt/iproto/buffer.pyx":404
 *                 str_temp = op_type_str
 *             else:
 *                 raise TypeError(             # <<<<<<<<<<<<<<
 *                     'Operation type must of a str or bytes type')
 * 
 */
  __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_s_Operation_type_must_of_a_str_or); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 404, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__5);
  __Pyx_GIVEREF(__pyx_tuple__5);

  /* "asynctnt/iproto/buffer.pyx":412
 *             op_kind = self._op_type_to_kind(op_str_c, op_str_len)
 *             if not isinstance(operation[1], int):
 *                 raise TypeError(             # <<<<<<<<<<<<<<
 *                     'Operation field_no must be of int type')
 *             field_no = <uint64_t>int(operation[1])
 */
  __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_s_Operation_field_no_must_be_of_in); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 412, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__6);
  __Pyx_GIVEREF(__pyx_tuple__6);

  /* "asynctnt/iproto/buffer.pyx":420
 *                 op_argument = operation[2]
 *                 if not isinstance(op_argument, int):
 *                     raise TypeError(             # <<<<<<<<<<<<<<
 *                         'int argument required for '
 *                         'Arithmetic and Delete operations'
 */
  __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_s_int_argument_required_for_Arithm); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 420, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__7);
  __Pyx_GIVEREF(__pyx_tuple__7);

  /* "asynctnt/iproto/buffer.pyx":461
 *                 op_argument = operation[4]
 *                 if not isinstance(splice_position_obj, int):
 *                     raise TypeError('Splice position must be int')             # <<<<<<<<<<<<<<
 *                 if not isinstance(splice_offset_obj, int):
 *                     raise TypeError('Splice offset must be int')
 */
  __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_s_Splice_position_must_be_int); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 461, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__8);
  __Pyx_GIVEREF(__pyx_tuple__8);

  /* "asynctnt/iproto/buffer.pyx":463
 *                     raise TypeError('Splice position must be int')
 *                 if not isinstance(splice_offset_obj, int):
 *                     raise TypeError('Splice offset must be int')             # <<<<<<<<<<<<<<
 * 
 *                 splice_position = <uint32_t>splice_position_obj
 */
  __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_s_Splice_offset_must_be_int); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 463, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__9);
  __Pyx_GIVEREF(__pyx_tuple__9);

  /* "asynctnt/iproto/response.pyx":140
 *     b = <const char*>buf
 *     if mp_typeof(b[0]) != MP_MAP:
 *         raise TypeError('Response header must be a MP_MAP')             # <<<<<<<<<<<<<<
 * 
 *     resp = Response.new(encoding)
 */
  __pyx_tuple__12 = PyTuple_Pack(1, __pyx_kp_s_Response_header_must_be_a_MP_MAP); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(7, 140, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__12);
  __Pyx_GIVEREF(__pyx_tuple__12);

  /* "asynctnt/iproto/response.pyx":148
 *     for _ in range(size):
 *         if mp_typeof(b[0]) != MP_UINT:
 *             raise TypeError('Header key must be a MP_UINT')             # <<<<<<<<<<<<<<
 * 
 *         key = mp_decode_uint(&b)
 */
  __pyx_tuple__13 = PyTuple_Pack(1, __pyx_kp_s_Header_key_must_be_a_MP_UINT); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(7, 148, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__13);
  __Pyx_GIVEREF(__pyx_tuple__13);

  /* "asynctnt/iproto/response.pyx":153
 *         if key == tnt.TP_CODE:
 *             if mp_typeof(b[0]) != MP_UINT:
 *                 raise TypeError('code type must be a MP_UINT')             # <<<<<<<<<<<<<<
 * 
 *             resp.code = <uint32_t>mp_decode_uint(&b)
 */
  __pyx_tuple__14 = PyTuple_Pack(1, __pyx_kp_s_code_type_must_be_a_MP_UINT); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(7, 153, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__14);
  __Pyx_GIVEREF(__pyx_tuple__14);

  /* "asynctnt/iproto/response.pyx":159
 *         elif key == tnt.TP_SYNC:
 *             if mp_typeof(b[0]) != MP_UINT:
 *                 raise TypeError('sync type must be a MP_UINT')             # <<<<<<<<<<<<<<
 * 
 *             resp.sync = mp_decode_uint(&b)
 */
  __pyx_tuple__15 = PyTuple_Pack(1, __pyx_kp_s_sync_type_must_be_a_MP_UINT); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(7, 159, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__15);
  __Pyx_GIVEREF(__pyx_tuple__15);

  /* "asynctnt/iproto/response.pyx":164
 *         elif key == tnt.TP_SCHEMA_ID:
 *             if mp_typeof(b[0]) != MP_UINT:
 *                 raise TypeError('schema_id type must be a MP_UINT')             # <<<<<<<<<<<<<<
 * 
 *             resp.schema_id = mp_decode_uint(&b)
 */
  __pyx_tuple__16 = PyTuple_Pack(1, __pyx_kp_s_schema_id_type_must_be_a_MP_UINT); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(7, 164, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__16);
  __Pyx_GIVEREF(__pyx_tuple__16);

  /* "asynctnt/iproto/response.pyx":168
 *             resp.schema_id = mp_decode_uint(&b)
 *         else:
 *             logger.warning('Unknown argument in header. Skipping.')             # <<<<<<<<<<<<<<
 *             mp_next(&b)
 * 
 */
  __pyx_tuple__17 = PyTuple_Pack(1, __pyx_kp_s_Unknown_argument_in_header_Skipp); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(7, 168, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__17);
  __Pyx_GIVEREF(__pyx_tuple__17);

  /* "asynctnt/iproto/response.pyx":177
 * 
 *     if mp_typeof(b[0]) != MP_MAP:
 *         raise TypeError('Response body must be a MP_MAP')             # <<<<<<<<<<<<<<
 * 
 *     size = mp_decode_map(&b)
 */
  __pyx_tuple__18 = PyTuple_Pack(1, __pyx_kp_s_Response_body_must_be_a_MP_MAP); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(7, 177, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__18);
  __Pyx_GIVEREF(__pyx_tuple__18);

  /* "asynctnt/iproto/response.pyx":182
 *     for _ in range(size):
 *         if mp_typeof(b[0]) != MP_UINT:
 *             raise TypeError('Header key must be a MP_UINT')             # <<<<<<<<<<<<<<
 * 
 *         key = mp_decode_uint(&b)
 */
  __pyx_tuple__19 = PyTuple_Pack(1, __pyx_kp_s_Header_key_must_be_a_MP_UINT); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(7, 182, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__19);
  __Pyx_GIVEREF(__pyx_tuple__19);

  /* "asynctnt/iproto/response.pyx":187
 *         if key == tnt.TP_ERROR:
 *             if mp_typeof(b[0]) != MP_STR:
 *                 raise TypeError('errstr type must be a MP_STR')             # <<<<<<<<<<<<<<
 * 
 *             s = NULL
 */
  __pyx_tuple__20 = PyTuple_Pack(1, __pyx_kp_s_errstr_type_must_be_a_MP_STR); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(7, 187, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__20);
  __Pyx_GIVEREF(__pyx_tuple__20);

  /* "asynctnt/iproto/response.pyx":195
 *         elif key == tnt.TP_DATA:
 *             if mp_typeof(b[0]) != MP_ARRAY:
 *                 raise TypeError('body data type must be a MP_ARRAY')             # <<<<<<<<<<<<<<
 *             resp.body = _response_parse_body_data(b, encoding)
 * 
 */
  __pyx_tuple__21 = PyTuple_Pack(1, __pyx_kp_s_body_data_type_must_be_a_MP_ARRA); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(7, 195, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__21);
  __Pyx_GIVEREF(__pyx_tuple__21);

  /* "asynctnt/iproto/schema.pyx":18
 *                     (index_row[5 + 1 + i * 2], index_row[5 + 2 + i * 2]))
 * 
 *         def __repr__(self):             # <<<<<<<<<<<<<<
 *             return \
 *                 '<SchemaIndex sid={}, id={}, name={}, ' \
 */
  __pyx_tuple__22 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(1, 18, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__22);
  __Pyx_GIVEREF(__pyx_tuple__22);
  __pyx_codeobj__23 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__22, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_travis_build_igorcoding_as, __pyx_n_s_repr, 18, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__23)) __PYX_ERR(1, 18, __pyx_L1_error)

  /* "asynctnt/iproto/coreproto.pyx":33
 *             self.encoding = encoding
 *         else:
 *             raise TypeError('encoding must be either str or bytes')             # <<<<<<<<<<<<<<
 * 
 *         initial_read_buffer_size = initial_read_buffer_size or 0x20000
 */
  __pyx_tuple__24 = PyTuple_Pack(1, __pyx_kp_s_encoding_must_be_either_str_or_b); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(2, 33, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__24);
  __Pyx_GIVEREF(__pyx_tuple__24);

  /* "asynctnt/iproto/coreproto.pyx":82
 * 
 *         if not cpython.PyBytes_CheckExact(data):
 *             raise BufferError('_on_data_received: expected bytes object')             # <<<<<<<<<<<<<<
 * 
 *         data_str = NULL
 */
  __pyx_tuple__25 = PyTuple_Pack(1, __pyx_kp_s_on_data_received_expected_bytes); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(2, 82, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__25);
  __Pyx_GIVEREF(__pyx_tuple__25);

  /* "asynctnt/iproto/coreproto.pyx":160
 *             self.rbuf.get_slice(ver_length,
 *                                 ver_length + SALT_LENGTH)
 *         )[:SCRAMBLE_SIZE]             # <<<<<<<<<<<<<<
 *         self.state = PROTOCOL_NORMAL
 *         self._on_greeting_received()
 */
  __pyx_slice__26 = PySlice_New(Py_None, __pyx_int_20, Py_None); if (unlikely(!__pyx_slice__26)) __PYX_ERR(2, 160, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__26);
  __Pyx_GIVEREF(__pyx_slice__26);

  /* "asynctnt/iproto/coreproto.pyx":165
 * 
 *     def _parse_version(self, version):
 *         m = VERSION_STRING_REGEX.match(version.decode('ascii'))             # <<<<<<<<<<<<<<
 *         if m is not None:
 *             ver = m.group(1)
 */
  __pyx_tuple__27 = PyTuple_Pack(1, __pyx_n_s_ascii); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(2, 165, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__27);
  __Pyx_GIVEREF(__pyx_tuple__27);

  /* "asynctnt/iproto/coreproto.pyx":167
 *         m = VERSION_STRING_REGEX.match(version.decode('ascii'))
 *         if m is not None:
 *             ver = m.group(1)             # <<<<<<<<<<<<<<
 *             return tuple(map(int, ver.split('.')))
 * 
 */
  __pyx_tuple__28 = PyTuple_Pack(1, __pyx_int_1); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(2, 167, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__28);
  __Pyx_GIVEREF(__pyx_tuple__28);

  /* "asynctnt/iproto/coreproto.pyx":168
 *         if m is not None:
 *             ver = m.group(1)
 *             return tuple(map(int, ver.split('.')))             # <<<<<<<<<<<<<<
 * 
 *     cdef void _on_connection_made(self):
 */
  __pyx_tuple__30 = PyTuple_Pack(1, __pyx_kp_s__29); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(2, 168, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__30);
  __Pyx_GIVEREF(__pyx_tuple__30);

  /* "asynctnt/iproto/coreproto.pyx":190
 *                 if exc is None:
 *                     waiter.set_exception(
 *                         TarantoolNotConnectedError(             # <<<<<<<<<<<<<<
 *                             'Lost connection to Tarantool')
 *                     )
 */
  __pyx_tuple__31 = PyTuple_Pack(1, __pyx_kp_s_Lost_connection_to_Tarantool); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(2, 190, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__31);
  __Pyx_GIVEREF(__pyx_tuple__31);

  /* "asynctnt/iproto/coreproto.pyx":208
 *         self.con_state = CONNECTION_CONNECTED
 * 
 *         sock = transport.get_extra_info('socket')             # <<<<<<<<<<<<<<
 *         if sock is not None and \
 *                 (not hasattr(socket, 'AF_UNIX') or
 */
  __pyx_tuple__32 = PyTuple_Pack(1, __pyx_n_s_socket); if (unlikely(!__pyx_tuple__32)) __PYX_ERR(2, 208, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__32);
  __Pyx_GIVEREF(__pyx_tuple__32);

  /* "asynctnt/iproto/protocol.pyx":89
 *     cdef void _set_connection_ready(self):
 *         if not self.connected_fut.done():
 *             self.connected_fut.set_result(True)             # <<<<<<<<<<<<<<
 *             self.con_state = CONNECTION_FULL
 * 
 */
  __pyx_tuple__33 = PyTuple_Pack(1, Py_True); if (unlikely(!__pyx_tuple__33)) __PYX_ERR(3, 89, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__33);
  __Pyx_GIVEREF(__pyx_tuple__33);

  /* "asynctnt/iproto/protocol.pyx":112
 *         )
 * 
 *         def on_authorized(f):             # <<<<<<<<<<<<<<
 *             if f.cancelled():
 *                 self._set_connection_error(asyncio.futures.CancelledError())
 */
  __pyx_tuple__34 = PyTuple_Pack(2, __pyx_n_s_f, __pyx_n_s_e); if (unlikely(!__pyx_tuple__34)) __PYX_ERR(3, 112, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__34);
  __Pyx_GIVEREF(__pyx_tuple__34);
  __pyx_codeobj__35 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__34, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_travis_build_igorcoding_as_2, __pyx_n_s_on_authorized, 112, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__35)) __PYX_ERR(3, 112, __pyx_L1_error)

  /* "asynctnt/iproto/protocol.pyx":160
 *                              self.host, self.port, str(e))
 *                 if isinstance(e, asyncio.TimeoutError):
 *                     e = asyncio.TimeoutError('Schema fetch timeout')             # <<<<<<<<<<<<<<
 *                 self._set_connection_error(e)
 *                 fut.set_exception(e)
 */
  __pyx_tuple__36 = PyTuple_Pack(1, __pyx_kp_s_Schema_fetch_timeout); if (unlikely(!__pyx_tuple__36)) __PYX_ERR(3, 160, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__36);
  __Pyx_GIVEREF(__pyx_tuple__36);

  /* "asynctnt/iproto/protocol.pyx":135
 *         fut = self.create_future()
 * 
 *         def on_fetch(f):             # <<<<<<<<<<<<<<
 *             if f.cancelled():
 *                 self._set_connection_error(asyncio.futures.CancelledError())
 */
  __pyx_tuple__37 = PyTuple_Pack(4, __pyx_n_s_f, __pyx_n_s_e, __pyx_n_s_spaces, __pyx_n_s_indexes); if (unlikely(!__pyx_tuple__37)) __PYX_ERR(3, 135, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__37);
  __Pyx_GIVEREF(__pyx_tuple__37);
  __pyx_codeobj__38 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__37, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_travis_build_igorcoding_as_2, __pyx_n_s_on_fetch, 135, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__38)) __PYX_ERR(3, 135, __pyx_L1_error)

  /* "asynctnt/iproto/protocol.pyx":165
 * 
 *         self._schema_id = -1
 *         fut_vspace = self._db.select(SPACE_VSPACE, timeout=0)             # <<<<<<<<<<<<<<
 *         fut_vindex = self._db.select(SPACE_VINDEX, timeout=0)
 *         gather_fut = asyncio.gather(fut_vspace, fut_vindex,
 */
  __pyx_tuple__39 = PyTuple_Pack(1, __pyx_int_281); if (unlikely(!__pyx_tuple__39)) __PYX_ERR(3, 165, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__39);
  __Pyx_GIVEREF(__pyx_tuple__39);

  /* "asynctnt/iproto/protocol.pyx":166
 *         self._schema_id = -1
 *         fut_vspace = self._db.select(SPACE_VSPACE, timeout=0)
 *         fut_vindex = self._db.select(SPACE_VINDEX, timeout=0)             # <<<<<<<<<<<<<<
 *         gather_fut = asyncio.gather(fut_vspace, fut_vindex,
 *                                     return_exceptions=False,
 */
  __pyx_tuple__40 = PyTuple_Pack(1, __pyx_int_289); if (unlikely(!__pyx_tuple__40)) __PYX_ERR(3, 166, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__40);
  __Pyx_GIVEREF(__pyx_tuple__40);

  /* "asynctnt/iproto/protocol.pyx":236
 *     cdef object execute(self, Request req, float timeout):
 *         if self.con_state == CONNECTION_BAD:
 *             raise TarantoolNotConnectedError('Tarantool is not connected')             # <<<<<<<<<<<<<<
 * 
 *         cpython.dict.PyDict_SetItem(self.reqs, req.sync, req)
 */
  __pyx_tuple__41 = PyTuple_Pack(1, __pyx_kp_s_Tarantool_is_not_connected); if (unlikely(!__pyx_tuple__41)) __PYX_ERR(3, 236, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__41);
  __Pyx_GIVEREF(__pyx_tuple__41);

  /* "asynctnt/iproto/protocol.pyx":251
 *             return Iterator[iterator]
 *         else:
 *             raise TypeError('Iterator is of unsupported type '             # <<<<<<<<<<<<<<
 *                             '(asynctnt.Iterator, int, str)')
 * 
 */
  __pyx_tuple__42 = PyTuple_Pack(1, __pyx_kp_s_Iterator_is_of_unsupported_type); if (unlikely(!__pyx_tuple__42)) __PYX_ERR(3, 251, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__42);
  __Pyx_GIVEREF(__pyx_tuple__42);

  /* "asynctnt/iproto/protocol.pyx":257
 *         if isinstance(space, str):
 *             if self._schema is None:
 *                 raise TarantoolSchemaError('Schema not fetched')             # <<<<<<<<<<<<<<
 * 
 *             sp = self._schema.get_space(space)
 */
  __pyx_tuple__43 = PyTuple_Pack(1, __pyx_kp_s_Schema_not_fetched); if (unlikely(!__pyx_tuple__43)) __PYX_ERR(3, 257, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__43);
  __Pyx_GIVEREF(__pyx_tuple__43);

  /* "asynctnt/iproto/protocol.pyx":268
 *         if isinstance(index, str):
 *             if self._schema is None:
 *                 raise TarantoolSchemaError('Schema not fetched')             # <<<<<<<<<<<<<<
 * 
 *             idx = self._schema.get_index(space, index)
 */
  __pyx_tuple__44 = PyTuple_Pack(1, __pyx_kp_s_Schema_not_fetched); if (unlikely(!__pyx_tuple__44)) __PYX_ERR(3, 268, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__44);
  __Pyx_GIVEREF(__pyx_tuple__44);

  /* "asynctnt/iproto/coreproto.pyx":16
 * from asynctnt.log import logger
 * 
 * VERSION_STRING_REGEX = re.compile(r'\s*Tarantool\s+([\d.]+)\s+.*')             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_tuple__45 = PyTuple_Pack(1, __pyx_kp_s_s_Tarantool_s_d_s); if (unlikely(!__pyx_tuple__45)) __PYX_ERR(2, 16, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__45);
  __Pyx_GIVEREF(__pyx_tuple__45);
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_InitGlobals(void) {
  if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(3, 1, __pyx_L1_error);
  __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(3, 1, __pyx_L1_error)
  __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(3, 1, __pyx_L1_error)
  __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) __PYX_ERR(3, 1, __pyx_L1_error)
  __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) __PYX_ERR(3, 1, __pyx_L1_error)
  __pyx_int_4 = PyInt_FromLong(4); if (unlikely(!__pyx_int_4)) __PYX_ERR(3, 1, __pyx_L1_error)
  __pyx_int_5 = PyInt_FromLong(5); if (unlikely(!__pyx_int_5)) __PYX_ERR(3, 1, __pyx_L1_error)
  __pyx_int_6 = PyInt_FromLong(6); if (unlikely(!__pyx_int_6)) __PYX_ERR(3, 1, __pyx_L1_error)
  __pyx_int_7 = PyInt_FromLong(7); if (unlikely(!__pyx_int_7)) __PYX_ERR(3, 1, __pyx_L1_error)
  __pyx_int_8 = PyInt_FromLong(8); if (unlikely(!__pyx_int_8)) __PYX_ERR(3, 1, __pyx_L1_error)
  __pyx_int_9 = PyInt_FromLong(9); if (unlikely(!__pyx_int_9)) __PYX_ERR(3, 1, __pyx_L1_error)
  __pyx_int_10 = PyInt_FromLong(10); if (unlikely(!__pyx_int_10)) __PYX_ERR(3, 1, __pyx_L1_error)
  __pyx_int_11 = PyInt_FromLong(11); if (unlikely(!__pyx_int_11)) __PYX_ERR(3, 1, __pyx_L1_error)
  __pyx_int_20 = PyInt_FromLong(20); if (unlikely(!__pyx_int_20)) __PYX_ERR(3, 1, __pyx_L1_error)
  __pyx_int_281 = PyInt_FromLong(281); if (unlikely(!__pyx_int_281)) __PYX_ERR(3, 1, __pyx_L1_error)
  __pyx_int_289 = PyInt_FromLong(289); if (unlikely(!__pyx_int_289)) __PYX_ERR(3, 1, __pyx_L1_error)
  __pyx_int_4294967295 = PyInt_FromString((char *)"4294967295", 0, 0); if (unlikely(!__pyx_int_4294967295)) __PYX_ERR(3, 1, __pyx_L1_error)
  __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(3, 1, __pyx_L1_error)
  return 0;
  __pyx_L1_error:;
  return -1;
}

#if PY_MAJOR_VERSION < 3
PyMODINIT_FUNC initprotocol(void); /*proto*/
PyMODINIT_FUNC initprotocol(void)
#else
PyMODINIT_FUNC PyInit_protocol(void); /*proto*/
PyMODINIT_FUNC PyInit_protocol(void)
#endif
{
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannyDeclarations
  #if CYTHON_REFNANNY
  __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
  if (!__Pyx_RefNanny) {
      PyErr_Clear();
      __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
      if (!__Pyx_RefNanny)
          Py_FatalError("failed to import 'refnanny' module");
  }
  #endif
  __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_protocol(void)", 0);
  if (__Pyx_check_binary_version() < 0) __PYX_ERR(3, 1, __pyx_L1_error)
  __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(3, 1, __pyx_L1_error)
  __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(3, 1, __pyx_L1_error)
  __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(3, 1, __pyx_L1_error)
  #ifdef __Pyx_CyFunction_USED
  if (__pyx_CyFunction_init() < 0) __PYX_ERR(3, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_FusedFunction_USED
  if (__pyx_FusedFunction_init() < 0) __PYX_ERR(3, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_Coroutine_USED
  if (__pyx_Coroutine_init() < 0) __PYX_ERR(3, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_Generator_USED
  if (__pyx_Generator_init() < 0) __PYX_ERR(3, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_StopAsyncIteration_USED
  if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(3, 1, __pyx_L1_error)
  #endif
  /*--- Library function declarations ---*/
  /*--- Threads initialization code ---*/
  #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
  #ifdef WITH_THREAD /* Python build with threading support? */
  PyEval_InitThreads();
  #endif
  #endif
  /*--- Module creation code ---*/
  #if PY_MAJOR_VERSION < 3
  __pyx_m = Py_InitModule4("protocol", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
  #else
  __pyx_m = PyModule_Create(&__pyx_moduledef);
  #endif
  if (unlikely(!__pyx_m)) __PYX_ERR(3, 1, __pyx_L1_error)
  __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(3, 1, __pyx_L1_error)
  Py_INCREF(__pyx_d);
  __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(3, 1, __pyx_L1_error)
  #if CYTHON_COMPILING_IN_PYPY
  Py_INCREF(__pyx_b);
  #endif
  if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(3, 1, __pyx_L1_error);
  /*--- Initialize various global constants etc. ---*/
  if (__Pyx_InitGlobals() < 0) __PYX_ERR(3, 1, __pyx_L1_error)
  #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
  if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(3, 1, __pyx_L1_error)
  #endif
  if (__pyx_module_is_main_asynctnt__iproto__protocol) {
    if (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) __PYX_ERR(3, 1, __pyx_L1_error)
  }
  #if PY_MAJOR_VERSION >= 3
  {
    PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(3, 1, __pyx_L1_error)
    if (!PyDict_GetItemString(modules, "asynctnt.iproto.protocol")) {
      if (unlikely(PyDict_SetItemString(modules, "asynctnt.iproto.protocol", __pyx_m) < 0)) __PYX_ERR(3, 1, __pyx_L1_error)
    }
  }
  #endif
  /*--- Builtin init code ---*/
  if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(3, 1, __pyx_L1_error)
  /*--- Constants init code ---*/
  if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(3, 1, __pyx_L1_error)
  /*--- Global init code ---*/
  /*--- Variable export code ---*/
  /*--- Function export code ---*/
  if (__Pyx_ExportFunction("encode_unicode_string", (void (*)(void))__pyx_f_8asynctnt_6iproto_8protocol_encode_unicode_string, "PyObject *(PyObject *, struct __pyx_opt_args_8asynctnt_6iproto_8protocol_encode_unicode_string *__pyx_optional_args)") < 0) __PYX_ERR(3, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("size_t_max", (void (*)(void))__pyx_f_8asynctnt_6iproto_8protocol_size_t_max, "size_t (size_t, size_t)") < 0) __PYX_ERR(3, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("nearest_power_of_2", (void (*)(void))__pyx_f_8asynctnt_6iproto_8protocol_nearest_power_of_2, "uint32_t (uint32_t)") < 0) __PYX_ERR(3, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("response_parse", (void (*)(void))__pyx_f_8asynctnt_6iproto_8protocol_response_parse, "struct __pyx_obj_8asynctnt_6iproto_8protocol_Response *(char const *, uint32_t, PyObject *)") < 0) __PYX_ERR(3, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("parse_schema", (void (*)(void))__pyx_f_8asynctnt_6iproto_8protocol_parse_schema, "struct __pyx_obj_8asynctnt_6iproto_8protocol_Schema *(int64_t, PyObject *, PyObject *)") < 0) __PYX_ERR(3, 1, __pyx_L1_error)
  /*--- Type init code ---*/
  __pyx_vtabptr_8asynctnt_6iproto_8protocol_WriteBuffer = &__pyx_vtable_8asynctnt_6iproto_8protocol_WriteBuffer;
  __pyx_vtable_8asynctnt_6iproto_8protocol_WriteBuffer.new = (struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *(*)(struct __pyx_opt_args_8asynctnt_6iproto_8protocol_11WriteBuffer_new *__pyx_optional_args))__pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer_new;
  __pyx_vtable_8asynctnt_6iproto_8protocol_WriteBuffer._check_readonly = (PyObject *(*)(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *))__pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__check_readonly;
  __pyx_vtable_8asynctnt_6iproto_8protocol_WriteBuffer.len = (PyObject *(*)(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *))__pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer_len;
  __pyx_vtable_8asynctnt_6iproto_8protocol_WriteBuffer.ensure_allocated = (void (*)(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *, Py_ssize_t))__pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer_ensure_allocated;
  __pyx_vtable_8asynctnt_6iproto_8protocol_WriteBuffer._ensure_allocated = (char *(*)(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *, char *, Py_ssize_t))__pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__ensure_allocated;
  __pyx_vtable_8asynctnt_6iproto_8protocol_WriteBuffer._reallocate = (void (*)(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *, Py_ssize_t))__pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__reallocate;
  __pyx_vtable_8asynctnt_6iproto_8protocol_WriteBuffer.write_buffer = (void (*)(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *, struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *))__pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer_write_buffer;
  __pyx_vtable_8asynctnt_6iproto_8protocol_WriteBuffer.write_header = (void (*)(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *, uint64_t, enum __pyx_t_8asynctnt_6iproto_3tnt_tp_request_type, struct __pyx_opt_args_8asynctnt_6iproto_8protocol_11WriteBuffer_write_header *__pyx_optional_args))__pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer_write_header;
  __pyx_vtable_8asynctnt_6iproto_8protocol_WriteBuffer.write_length = (void (*)(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *))__pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer_write_length;
  __pyx_vtable_8asynctnt_6iproto_8protocol_WriteBuffer._encode_nil = (char *(*)(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *, char *))__pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__encode_nil;
  __pyx_vtable_8asynctnt_6iproto_8protocol_WriteBuffer._encode_bool = (char *(*)(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *, char *, int))__pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__encode_bool;
  __pyx_vtable_8asynctnt_6iproto_8protocol_WriteBuffer._encode_double = (char *(*)(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *, char *, double))__pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__encode_double;
  __pyx_vtable_8asynctnt_6iproto_8protocol_WriteBuffer._encode_uint = (char *(*)(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *, char *, uint64_t))__pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__encode_uint;
  __pyx_vtable_8asynctnt_6iproto_8protocol_WriteBuffer._encode_int = (char *(*)(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *, char *, int64_t))__pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__encode_int;
  __pyx_vtable_8asynctnt_6iproto_8protocol_WriteBuffer._encode_str = (char *(*)(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *, char *, char const *, uint32_t))__pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__encode_str;
  __pyx_vtable_8asynctnt_6iproto_8protocol_WriteBuffer._encode_bin = (char *(*)(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *, char *, char const *, uint32_t))__pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__encode_bin;
  __pyx_vtable_8asynctnt_6iproto_8protocol_WriteBuffer._encode_array = (char *(*)(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *, char *, uint32_t))__pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__encode_array;
  __pyx_vtable_8asynctnt_6iproto_8protocol_WriteBuffer._encode_map = (char *(*)(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *, char *, uint32_t))__pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__encode_map;
  __pyx_vtable_8asynctnt_6iproto_8protocol_WriteBuffer._encode_list = (char *(*)(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *, char *, PyObject *))__pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__encode_list;
  __pyx_vtable_8asynctnt_6iproto_8protocol_WriteBuffer._encode_tuple = (char *(*)(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *, char *, PyObject *))__pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__encode_tuple;
  __pyx_vtable_8asynctnt_6iproto_8protocol_WriteBuffer._encode_dict = (char *(*)(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *, char *, PyObject *))__pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__encode_dict;
  __pyx_vtable_8asynctnt_6iproto_8protocol_WriteBuffer._encode_obj = (char *(*)(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *, char *, PyObject *))__pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__encode_obj;
  __pyx_vtable_8asynctnt_6iproto_8protocol_WriteBuffer._op_type_to_kind = (enum __pyx_t_8asynctnt_6iproto_3tnt_tnt_update_op_kind (*)(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *, char *, Py_ssize_t))__pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__op_type_to_kind;
  __pyx_vtable_8asynctnt_6iproto_8protocol_WriteBuffer._encode_update_ops = (char *(*)(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *, char *, PyObject *))__pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer__encode_update_ops;
  __pyx_vtable_8asynctnt_6iproto_8protocol_WriteBuffer.encode_request_call = (void (*)(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *, PyObject *, PyObject *))__pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer_encode_request_call;
  __pyx_vtable_8asynctnt_6iproto_8protocol_WriteBuffer.encode_request_eval = (void (*)(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *, PyObject *, PyObject *))__pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer_encode_request_eval;
  __pyx_vtable_8asynctnt_6iproto_8protocol_WriteBuffer.encode_request_select = (void (*)(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *, uint32_t, uint32_t, PyObject *, uint64_t, uint64_t, uint32_t))__pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer_encode_request_select;
  __pyx_vtable_8asynctnt_6iproto_8protocol_WriteBuffer.encode_request_insert = (void (*)(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *, uint32_t, PyObject *))__pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer_encode_request_insert;
  __pyx_vtable_8asynctnt_6iproto_8protocol_WriteBuffer.encode_request_delete = (void (*)(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *, uint32_t, uint32_t, PyObject *))__pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer_encode_request_delete;
  __pyx_vtable_8asynctnt_6iproto_8protocol_WriteBuffer.encode_request_update = (void (*)(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *, uint32_t, uint32_t, PyObject *, PyObject *, struct __pyx_opt_args_8asynctnt_6iproto_8protocol_11WriteBuffer_encode_request_update *__pyx_optional_args))__pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer_encode_request_update;
  __pyx_vtable_8asynctnt_6iproto_8protocol_WriteBuffer.encode_request_upsert = (void (*)(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *, uint32_t, PyObject *, PyObject *))__pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer_encode_request_upsert;
  __pyx_vtable_8asynctnt_6iproto_8protocol_WriteBuffer.encode_request_auth = (void (*)(struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *, PyObject *, PyObject *))__pyx_f_8asynctnt_6iproto_8protocol_11WriteBuffer_encode_request_auth;
  if (PyType_Ready(&__pyx_type_8asynctnt_6iproto_8protocol_WriteBuffer) < 0) __PYX_ERR(0, 23, __pyx_L1_error)
  __pyx_type_8asynctnt_6iproto_8protocol_WriteBuffer.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_8asynctnt_6iproto_8protocol_WriteBuffer.tp_dict, __pyx_vtabptr_8asynctnt_6iproto_8protocol_WriteBuffer) < 0) __PYX_ERR(0, 23, __pyx_L1_error)
  if (PyObject_SetAttrString(__pyx_m, "WriteBuffer", (PyObject *)&__pyx_type_8asynctnt_6iproto_8protocol_WriteBuffer) < 0) __PYX_ERR(0, 23, __pyx_L1_error)
  __pyx_ptype_8asynctnt_6iproto_8protocol_WriteBuffer = &__pyx_type_8asynctnt_6iproto_8protocol_WriteBuffer;
  __pyx_vtabptr_8asynctnt_6iproto_8protocol_ReadBuffer = &__pyx_vtable_8asynctnt_6iproto_8protocol_ReadBuffer;
  __pyx_vtable_8asynctnt_6iproto_8protocol_ReadBuffer.new = (struct __pyx_obj_8asynctnt_6iproto_8protocol_ReadBuffer *(*)(PyObject *, struct __pyx_opt_args_8asynctnt_6iproto_8protocol_10ReadBuffer_new *__pyx_optional_args))__pyx_f_8asynctnt_6iproto_8protocol_10ReadBuffer_new;
  __pyx_vtable_8asynctnt_6iproto_8protocol_ReadBuffer._reallocate = (void (*)(struct __pyx_obj_8asynctnt_6iproto_8protocol_ReadBuffer *, size_t))__pyx_f_8asynctnt_6iproto_8protocol_10ReadBuffer__reallocate;
  __pyx_vtable_8asynctnt_6iproto_8protocol_ReadBuffer.extend = (int (*)(struct __pyx_obj_8asynctnt_6iproto_8protocol_ReadBuffer *, char const *, size_t))__pyx_f_8asynctnt_6iproto_8protocol_10ReadBuffer_extend;
  __pyx_vtable_8asynctnt_6iproto_8protocol_ReadBuffer.move = (void (*)(struct __pyx_obj_8asynctnt_6iproto_8protocol_ReadBuffer *, size_t))__pyx_f_8asynctnt_6iproto_8protocol_10ReadBuffer_move;
  __pyx_vtable_8asynctnt_6iproto_8protocol_ReadBuffer.move_offset = (void (*)(struct __pyx_obj_8asynctnt_6iproto_8protocol_ReadBuffer *, Py_ssize_t, size_t))__pyx_f_8asynctnt_6iproto_8protocol_10ReadBuffer_move_offset;
  __pyx_vtable_8asynctnt_6iproto_8protocol_ReadBuffer.get_slice = (PyObject *(*)(struct __pyx_obj_8asynctnt_6iproto_8protocol_ReadBuffer *, size_t, size_t))__pyx_f_8asynctnt_6iproto_8protocol_10ReadBuffer_get_slice;
  __pyx_vtable_8asynctnt_6iproto_8protocol_ReadBuffer.get_slice_begin = (PyObject *(*)(struct __pyx_obj_8asynctnt_6iproto_8protocol_ReadBuffer *, size_t))__pyx_f_8asynctnt_6iproto_8protocol_10ReadBuffer_get_slice_begin;
  __pyx_vtable_8asynctnt_6iproto_8protocol_ReadBuffer.get_slice_end = (PyObject *(*)(struct __pyx_obj_8asynctnt_6iproto_8protocol_ReadBuffer *, size_t))__pyx_f_8asynctnt_6iproto_8protocol_10ReadBuffer_get_slice_end;
  if (PyType_Ready(&__pyx_type_8asynctnt_6iproto_8protocol_ReadBuffer) < 0) __PYX_ERR(5, 38, __pyx_L1_error)
  __pyx_type_8asynctnt_6iproto_8protocol_ReadBuffer.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_8asynctnt_6iproto_8protocol_ReadBuffer.tp_dict, __pyx_vtabptr_8asynctnt_6iproto_8protocol_ReadBuffer) < 0) __PYX_ERR(5, 38, __pyx_L1_error)
  if (PyObject_SetAttrString(__pyx_m, "ReadBuffer", (PyObject *)&__pyx_type_8asynctnt_6iproto_8protocol_ReadBuffer) < 0) __PYX_ERR(5, 38, __pyx_L1_error)
  __pyx_ptype_8asynctnt_6iproto_8protocol_ReadBuffer = &__pyx_type_8asynctnt_6iproto_8protocol_ReadBuffer;
  __pyx_vtabptr_8asynctnt_6iproto_8protocol_Request = &__pyx_vtable_8asynctnt_6iproto_8protocol_Request;
  __pyx_vtable_8asynctnt_6iproto_8protocol_Request.new = (struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *(*)(enum __pyx_t_8asynctnt_6iproto_3tnt_tp_request_type, uint64_t, int64_t, struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *))__pyx_f_8asynctnt_6iproto_8protocol_7Request_new;
  __pyx_vtable_8asynctnt_6iproto_8protocol_Request.build = (struct __pyx_obj_8asynctnt_6iproto_8protocol_WriteBuffer *(*)(struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *))__pyx_f_8asynctnt_6iproto_8protocol_7Request_build;
  if (PyType_Ready(&__pyx_type_8asynctnt_6iproto_8protocol_Request) < 0) __PYX_ERR(6, 9, __pyx_L1_error)
  __pyx_type_8asynctnt_6iproto_8protocol_Request.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_8asynctnt_6iproto_8protocol_Request.tp_dict, __pyx_vtabptr_8asynctnt_6iproto_8protocol_Request) < 0) __PYX_ERR(6, 9, __pyx_L1_error)
  if (PyObject_SetAttrString(__pyx_m, "Request", (PyObject *)&__pyx_type_8asynctnt_6iproto_8protocol_Request) < 0) __PYX_ERR(6, 9, __pyx_L1_error)
  __pyx_ptype_8asynctnt_6iproto_8protocol_Request = &__pyx_type_8asynctnt_6iproto_8protocol_Request;
  __pyx_vtabptr_8asynctnt_6iproto_8protocol_Response = &__pyx_vtable_8asynctnt_6iproto_8protocol_Response;
  __pyx_vtable_8asynctnt_6iproto_8protocol_Response.new = (struct __pyx_obj_8asynctnt_6iproto_8protocol_Response *(*)(PyObject *))__pyx_f_8asynctnt_6iproto_8protocol_8Response_new;
  __pyx_vtable_8asynctnt_6iproto_8protocol_Response.has_schema_id = (PyObject *(*)(struct __pyx_obj_8asynctnt_6iproto_8protocol_Response *))__pyx_f_8asynctnt_6iproto_8protocol_8Response_has_schema_id;
  __pyx_vtable_8asynctnt_6iproto_8protocol_Response.is_error = (PyObject *(*)(struct __pyx_obj_8asynctnt_6iproto_8protocol_Response *))__pyx_f_8asynctnt_6iproto_8protocol_8Response_is_error;
  if (PyType_Ready(&__pyx_type_8asynctnt_6iproto_8protocol_Response) < 0) __PYX_ERR(7, 11, __pyx_L1_error)
  __pyx_type_8asynctnt_6iproto_8protocol_Response.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_8asynctnt_6iproto_8protocol_Response.tp_dict, __pyx_vtabptr_8asynctnt_6iproto_8protocol_Response) < 0) __PYX_ERR(7, 11, __pyx_L1_error)
  if (PyObject_SetAttrString(__pyx_m, "Response", (PyObject *)&__pyx_type_8asynctnt_6iproto_8protocol_Response) < 0) __PYX_ERR(7, 11, __pyx_L1_error)
  __pyx_ptype_8asynctnt_6iproto_8protocol_Response = &__pyx_type_8asynctnt_6iproto_8protocol_Response;
  if (PyType_Ready(&__pyx_type_8asynctnt_6iproto_8protocol_SchemaIndex) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_type_8asynctnt_6iproto_8protocol_SchemaIndex.tp_print = 0;
  if (PyObject_SetAttrString(__pyx_m, "SchemaIndex", (PyObject *)&__pyx_type_8asynctnt_6iproto_8protocol_SchemaIndex) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_ptype_8asynctnt_6iproto_8protocol_SchemaIndex = &__pyx_type_8asynctnt_6iproto_8protocol_SchemaIndex;
  __pyx_vtabptr_8asynctnt_6iproto_8protocol_SchemaSpace = &__pyx_vtable_8asynctnt_6iproto_8protocol_SchemaSpace;
  __pyx_vtable_8asynctnt_6iproto_8protocol_SchemaSpace.add_index = (PyObject *(*)(struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaSpace *, struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaIndex *))__pyx_f_8asynctnt_6iproto_8protocol_11SchemaSpace_add_index;
  if (PyType_Ready(&__pyx_type_8asynctnt_6iproto_8protocol_SchemaSpace) < 0) __PYX_ERR(1, 26, __pyx_L1_error)
  __pyx_type_8asynctnt_6iproto_8protocol_SchemaSpace.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_8asynctnt_6iproto_8protocol_SchemaSpace.tp_dict, __pyx_vtabptr_8asynctnt_6iproto_8protocol_SchemaSpace) < 0) __PYX_ERR(1, 26, __pyx_L1_error)
  if (PyObject_SetAttrString(__pyx_m, "SchemaSpace", (PyObject *)&__pyx_type_8asynctnt_6iproto_8protocol_SchemaSpace) < 0) __PYX_ERR(1, 26, __pyx_L1_error)
  __pyx_ptype_8asynctnt_6iproto_8protocol_SchemaSpace = &__pyx_type_8asynctnt_6iproto_8protocol_SchemaSpace;
  __pyx_vtabptr_8asynctnt_6iproto_8protocol_Schema = &__pyx_vtable_8asynctnt_6iproto_8protocol_Schema;
  __pyx_vtable_8asynctnt_6iproto_8protocol_Schema.get_id = (PyObject *(*)(struct __pyx_obj_8asynctnt_6iproto_8protocol_Schema *, int __pyx_skip_dispatch))__pyx_f_8asynctnt_6iproto_8protocol_6Schema_get_id;
  __pyx_vtable_8asynctnt_6iproto_8protocol_Schema.get_space = (struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaSpace *(*)(struct __pyx_obj_8asynctnt_6iproto_8protocol_Schema *, PyObject *, int __pyx_skip_dispatch))__pyx_f_8asynctnt_6iproto_8protocol_6Schema_get_space;
  __pyx_vtable_8asynctnt_6iproto_8protocol_Schema.get_index = (struct __pyx_obj_8asynctnt_6iproto_8protocol_SchemaIndex *(*)(struct __pyx_obj_8asynctnt_6iproto_8protocol_Schema *, PyObject *, PyObject *, int __pyx_skip_dispatch))__pyx_f_8asynctnt_6iproto_8protocol_6Schema_get_index;
  __pyx_vtable_8asynctnt_6iproto_8protocol_Schema.clear = (PyObject *(*)(struct __pyx_obj_8asynctnt_6iproto_8protocol_Schema *))__pyx_f_8asynctnt_6iproto_8protocol_6Schema_clear;
  if (PyType_Ready(&__pyx_type_8asynctnt_6iproto_8protocol_Schema) < 0) __PYX_ERR(1, 44, __pyx_L1_error)
  __pyx_type_8asynctnt_6iproto_8protocol_Schema.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_8asynctnt_6iproto_8protocol_Schema.tp_dict, __pyx_vtabptr_8asynctnt_6iproto_8protocol_Schema) < 0) __PYX_ERR(1, 44, __pyx_L1_error)
  if (PyObject_SetAttrString(__pyx_m, "Schema", (PyObject *)&__pyx_type_8asynctnt_6iproto_8protocol_Schema) < 0) __PYX_ERR(1, 44, __pyx_L1_error)
  __pyx_ptype_8asynctnt_6iproto_8protocol_Schema = &__pyx_type_8asynctnt_6iproto_8protocol_Schema;
  __pyx_vtabptr_8asynctnt_6iproto_8protocol_Db = &__pyx_vtable_8asynctnt_6iproto_8protocol_Db;
  __pyx_vtable_8asynctnt_6iproto_8protocol_Db.new = (struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *(*)(struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *))__pyx_f_8asynctnt_6iproto_8protocol_2Db_new;
  __pyx_vtable_8asynctnt_6iproto_8protocol_Db.next_sync = (uint64_t (*)(struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *))__pyx_f_8asynctnt_6iproto_8protocol_2Db_next_sync;
  __pyx_vtable_8asynctnt_6iproto_8protocol_Db._ping = (struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *(*)(struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *))__pyx_f_8asynctnt_6iproto_8protocol_2Db__ping;
  __pyx_vtable_8asynctnt_6iproto_8protocol_Db._call16 = (struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *(*)(struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *, PyObject *, PyObject *))__pyx_f_8asynctnt_6iproto_8protocol_2Db__call16;
  __pyx_vtable_8asynctnt_6iproto_8protocol_Db._call = (struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *(*)(struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *, PyObject *, PyObject *))__pyx_f_8asynctnt_6iproto_8protocol_2Db__call;
  __pyx_vtable_8asynctnt_6iproto_8protocol_Db._eval = (struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *(*)(struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *, PyObject *, PyObject *))__pyx_f_8asynctnt_6iproto_8protocol_2Db__eval;
  __pyx_vtable_8asynctnt_6iproto_8protocol_Db._select = (struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *(*)(struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *, uint32_t, uint32_t, PyObject *, uint64_t, uint64_t, uint32_t))__pyx_f_8asynctnt_6iproto_8protocol_2Db__select;
  __pyx_vtable_8asynctnt_6iproto_8protocol_Db._insert = (struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *(*)(struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *, uint32_t, PyObject *, int))__pyx_f_8asynctnt_6iproto_8protocol_2Db__insert;
  __pyx_vtable_8asynctnt_6iproto_8protocol_Db._delete = (struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *(*)(struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *, uint32_t, uint32_t, PyObject *))__pyx_f_8asynctnt_6iproto_8protocol_2Db__delete;
  __pyx_vtable_8asynctnt_6iproto_8protocol_Db._update = (struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *(*)(struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *, uint32_t, uint32_t, PyObject *, PyObject *))__pyx_f_8asynctnt_6iproto_8protocol_2Db__update;
  __pyx_vtable_8asynctnt_6iproto_8protocol_Db._upsert = (struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *(*)(struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *, uint32_t, PyObject *, PyObject *))__pyx_f_8asynctnt_6iproto_8protocol_2Db__upsert;
  __pyx_vtable_8asynctnt_6iproto_8protocol_Db._auth = (struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *(*)(struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *, PyObject *, PyObject *, PyObject *))__pyx_f_8asynctnt_6iproto_8protocol_2Db__auth;
  __pyx_vtable_8asynctnt_6iproto_8protocol_Db._sha1 = (PyObject *(*)(PyObject *))__pyx_f_8asynctnt_6iproto_8protocol_2Db__sha1;
  __pyx_vtable_8asynctnt_6iproto_8protocol_Db._strxor = (PyObject *(*)(PyObject *, PyObject *))__pyx_f_8asynctnt_6iproto_8protocol_2Db__strxor;
  if (PyType_Ready(&__pyx_type_8asynctnt_6iproto_8protocol_Db) < 0) __PYX_ERR(10, 8, __pyx_L1_error)
  __pyx_type_8asynctnt_6iproto_8protocol_Db.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_8asynctnt_6iproto_8protocol_Db.tp_dict, __pyx_vtabptr_8asynctnt_6iproto_8protocol_Db) < 0) __PYX_ERR(10, 8, __pyx_L1_error)
  if (PyObject_SetAttrString(__pyx_m, "Db", (PyObject *)&__pyx_type_8asynctnt_6iproto_8protocol_Db) < 0) __PYX_ERR(10, 8, __pyx_L1_error)
  __pyx_ptype_8asynctnt_6iproto_8protocol_Db = &__pyx_type_8asynctnt_6iproto_8protocol_Db;
  __pyx_vtabptr_8asynctnt_6iproto_8protocol_CoreProtocol = &__pyx_vtable_8asynctnt_6iproto_8protocol_CoreProtocol;
  __pyx_vtable_8asynctnt_6iproto_8protocol_CoreProtocol._is_connected = (int (*)(struct __pyx_obj_8asynctnt_6iproto_8protocol_CoreProtocol *))__pyx_f_8asynctnt_6iproto_8protocol_12CoreProtocol__is_connected;
  __pyx_vtable_8asynctnt_6iproto_8protocol_CoreProtocol._is_fully_connected = (int (*)(struct __pyx_obj_8asynctnt_6iproto_8protocol_CoreProtocol *))__pyx_f_8asynctnt_6iproto_8protocol_12CoreProtocol__is_fully_connected;
  __pyx_vtable_8asynctnt_6iproto_8protocol_CoreProtocol._write = (void (*)(struct __pyx_obj_8asynctnt_6iproto_8protocol_CoreProtocol *, PyObject *))__pyx_f_8asynctnt_6iproto_8protocol_12CoreProtocol__write;
  __pyx_vtable_8asynctnt_6iproto_8protocol_CoreProtocol._on_data_received = (void (*)(struct __pyx_obj_8asynctnt_6iproto_8protocol_CoreProtocol *, PyObject *))__pyx_f_8asynctnt_6iproto_8protocol_12CoreProtocol__on_data_received;
  __pyx_vtable_8asynctnt_6iproto_8protocol_CoreProtocol._process__greeting = (void (*)(struct __pyx_obj_8asynctnt_6iproto_8protocol_CoreProtocol *))__pyx_f_8asynctnt_6iproto_8protocol_12CoreProtocol__process__greeting;
  __pyx_vtable_8asynctnt_6iproto_8protocol_CoreProtocol._on_greeting_received = (void (*)(struct __pyx_obj_8asynctnt_6iproto_8protocol_CoreProtocol *))__pyx_f_8asynctnt_6iproto_8protocol_12CoreProtocol__on_greeting_received;
  __pyx_vtable_8asynctnt_6iproto_8protocol_CoreProtocol._on_connection_made = (void (*)(struct __pyx_obj_8asynctnt_6iproto_8protocol_CoreProtocol *))__pyx_f_8asynctnt_6iproto_8protocol_12CoreProtocol__on_connection_made;
  __pyx_vtable_8asynctnt_6iproto_8protocol_CoreProtocol._on_connection_lost = (void (*)(struct __pyx_obj_8asynctnt_6iproto_8protocol_CoreProtocol *, PyObject *))__pyx_f_8asynctnt_6iproto_8protocol_12CoreProtocol__on_connection_lost;
  if (PyType_Ready(&__pyx_type_8asynctnt_6iproto_8protocol_CoreProtocol) < 0) __PYX_ERR(2, 19, __pyx_L1_error)
  __pyx_type_8asynctnt_6iproto_8protocol_CoreProtocol.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_8asynctnt_6iproto_8protocol_CoreProtocol.tp_dict, __pyx_vtabptr_8asynctnt_6iproto_8protocol_CoreProtocol) < 0) __PYX_ERR(2, 19, __pyx_L1_error)
  if (PyObject_SetAttrString(__pyx_m, "CoreProtocol", (PyObject *)&__pyx_type_8asynctnt_6iproto_8protocol_CoreProtocol) < 0) __PYX_ERR(2, 19, __pyx_L1_error)
  __pyx_ptype_8asynctnt_6iproto_8protocol_CoreProtocol = &__pyx_type_8asynctnt_6iproto_8protocol_CoreProtocol;
  __pyx_vtabptr_8asynctnt_6iproto_8protocol_BaseProtocol = &__pyx_vtable_8asynctnt_6iproto_8protocol_BaseProtocol;
  __pyx_vtable_8asynctnt_6iproto_8protocol_BaseProtocol.__pyx_base = *__pyx_vtabptr_8asynctnt_6iproto_8protocol_CoreProtocol;
  __pyx_vtable_8asynctnt_6iproto_8protocol_BaseProtocol.__pyx_base._on_greeting_received = (void (*)(struct __pyx_obj_8asynctnt_6iproto_8protocol_CoreProtocol *))__pyx_f_8asynctnt_6iproto_8protocol_12BaseProtocol__on_greeting_received;
  __pyx_vtable_8asynctnt_6iproto_8protocol_BaseProtocol.__pyx_base._on_connection_made = (void (*)(struct __pyx_obj_8asynctnt_6iproto_8protocol_CoreProtocol *))__pyx_f_8asynctnt_6iproto_8protocol_12BaseProtocol__on_connection_made;
  __pyx_vtable_8asynctnt_6iproto_8protocol_BaseProtocol.__pyx_base._on_connection_lost = (void (*)(struct __pyx_obj_8asynctnt_6iproto_8protocol_CoreProtocol *, PyObject *))__pyx_f_8asynctnt_6iproto_8protocol_12BaseProtocol__on_connection_lost;
  __pyx_vtable_8asynctnt_6iproto_8protocol_BaseProtocol._set_connection_ready = (void (*)(struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *))__pyx_f_8asynctnt_6iproto_8protocol_12BaseProtocol__set_connection_ready;
  __pyx_vtable_8asynctnt_6iproto_8protocol_BaseProtocol._set_connection_error = (void (*)(struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *, PyObject *))__pyx_f_8asynctnt_6iproto_8protocol_12BaseProtocol__set_connection_error;
  __pyx_vtable_8asynctnt_6iproto_8protocol_BaseProtocol._do_auth = (void (*)(struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *, PyObject *, PyObject *))__pyx_f_8asynctnt_6iproto_8protocol_12BaseProtocol__do_auth;
  __pyx_vtable_8asynctnt_6iproto_8protocol_BaseProtocol._do_fetch_schema = (PyObject *(*)(struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *))__pyx_f_8asynctnt_6iproto_8protocol_12BaseProtocol__do_fetch_schema;
  __pyx_vtable_8asynctnt_6iproto_8protocol_BaseProtocol.next_sync = (uint64_t (*)(struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *))__pyx_f_8asynctnt_6iproto_8protocol_12BaseProtocol_next_sync;
  __pyx_vtable_8asynctnt_6iproto_8protocol_BaseProtocol.transform_iterator = (uint32_t (*)(struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *, PyObject *))__pyx_f_8asynctnt_6iproto_8protocol_12BaseProtocol_transform_iterator;
  __pyx_vtable_8asynctnt_6iproto_8protocol_BaseProtocol.transform_space = (uint32_t (*)(struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *, PyObject *))__pyx_f_8asynctnt_6iproto_8protocol_12BaseProtocol_transform_space;
  __pyx_vtable_8asynctnt_6iproto_8protocol_BaseProtocol.transform_index = (uint32_t (*)(struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *, PyObject *, PyObject *))__pyx_f_8asynctnt_6iproto_8protocol_12BaseProtocol_transform_index;
  __pyx_vtable_8asynctnt_6iproto_8protocol_BaseProtocol._new_waiter_for_request = (PyObject *(*)(struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *, struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *, float))__pyx_f_8asynctnt_6iproto_8protocol_12BaseProtocol__new_waiter_for_request;
  __pyx_vtable_8asynctnt_6iproto_8protocol_BaseProtocol._create_db = (struct __pyx_obj_8asynctnt_6iproto_8protocol_Db *(*)(struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *))__pyx_f_8asynctnt_6iproto_8protocol_12BaseProtocol__create_db;
  __pyx_vtable_8asynctnt_6iproto_8protocol_BaseProtocol.execute = (PyObject *(*)(struct __pyx_obj_8asynctnt_6iproto_8protocol_BaseProtocol *, struct __pyx_obj_8asynctnt_6iproto_8protocol_Request *, float))__pyx_f_8asynctnt_6iproto_8protocol_12BaseProtocol_execute;
  __pyx_type_8asynctnt_6iproto_8protocol_BaseProtocol.tp_base = __pyx_ptype_8asynctnt_6iproto_8protocol_CoreProtocol;
  if (PyType_Ready(&__pyx_type_8asynctnt_6iproto_8protocol_BaseProtocol) < 0) __PYX_ERR(3, 38, __pyx_L1_error)
  __pyx_type_8asynctnt_6iproto_8protocol_BaseProtocol.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_8asynctnt_6iproto_8protocol_BaseProtocol.tp_dict, __pyx_vtabptr_8asynctnt_6iproto_8protocol_BaseProtocol) < 0) __PYX_ERR(3, 38, __pyx_L1_error)
  if (PyObject_SetAttrString(__pyx_m, "BaseProtocol", (PyObject *)&__pyx_type_8asynctnt_6iproto_8protocol_BaseProtocol) < 0) __PYX_ERR(3, 38, __pyx_L1_error)
  __pyx_ptype_8asynctnt_6iproto_8protocol_BaseProtocol = &__pyx_type_8asynctnt_6iproto_8protocol_BaseProtocol;
  if (PyType_Ready(&__pyx_type_8asynctnt_6iproto_8protocol___pyx_scope_struct__execute) < 0) __PYX_ERR(10, 23, __pyx_L1_error)
  __pyx_type_8asynctnt_6iproto_8protocol___pyx_scope_struct__execute.tp_print = 0;
  __pyx_ptype_8asynctnt_6iproto_8protocol___pyx_scope_struct__execute = &__pyx_type_8asynctnt_6iproto_8protocol___pyx_scope_struct__execute;
  if (PyType_Ready(&__pyx_type_8asynctnt_6iproto_8protocol___pyx_scope_struct_1__do_auth) < 0) __PYX_ERR(3, 105, __pyx_L1_error)
  __pyx_type_8asynctnt_6iproto_8protocol___pyx_scope_struct_1__do_auth.tp_print = 0;
  __pyx_ptype_8asynctnt_6iproto_8protocol___pyx_scope_struct_1__do_auth = &__pyx_type_8asynctnt_6iproto_8protocol___pyx_scope_struct_1__do_auth;
  if (PyType_Ready(&__pyx_type_8asynctnt_6iproto_8protocol___pyx_scope_struct_2__do_fetch_schema) < 0) __PYX_ERR(3, 132, __pyx_L1_error)
  __pyx_type_8asynctnt_6iproto_8protocol___pyx_scope_struct_2__do_fetch_schema.tp_print = 0;
  __pyx_ptype_8asynctnt_6iproto_8protocol___pyx_scope_struct_2__do_fetch_schema = &__pyx_type_8asynctnt_6iproto_8protocol___pyx_scope_struct_2__do_fetch_schema;
  /*--- Type import code ---*/
  __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type", 
  #if CYTHON_COMPILING_IN_PYPY
  sizeof(PyTypeObject),
  #else
  sizeof(PyHeapTypeObject),
  #endif
  0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) __PYX_ERR(11, 9, __pyx_L1_error)
  __pyx_ptype_7cpython_4bool_bool = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "bool", sizeof(PyBoolObject), 0); if (unlikely(!__pyx_ptype_7cpython_4bool_bool)) __PYX_ERR(12, 8, __pyx_L1_error)
  __pyx_ptype_7cpython_7complex_complex = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "complex", sizeof(PyComplexObject), 0); if (unlikely(!__pyx_ptype_7cpython_7complex_complex)) __PYX_ERR(13, 15, __pyx_L1_error)
  /*--- Variable import code ---*/
  /*--- Function import code ---*/
  /*--- Execution code ---*/
  #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
  if (__Pyx_patch_abc() < 0) __PYX_ERR(3, 1, __pyx_L1_error)
  #endif

  /* "asynctnt/iproto/protocol.pyx":4
 * cimport cpython.dict
 * 
 * import asyncio             # <<<<<<<<<<<<<<
 * import enum
 * 
 */
  __pyx_t_1 = __Pyx_patch_asyncio(__Pyx_Import(__pyx_n_s_asyncio, 0, -1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_asyncio, __pyx_t_1) < 0) __PYX_ERR(3, 4, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asynctnt/iproto/protocol.pyx":5
 * 
 * import asyncio
 * import enum             # <<<<<<<<<<<<<<
 * 
 * from asynctnt.exceptions import \
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_enum, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_enum, __pyx_t_1) < 0) __PYX_ERR(3, 5, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asynctnt/iproto/protocol.pyx":8
 * 
 * from asynctnt.exceptions import \
 *     TarantoolSchemaError, TarantoolNotConnectedError             # <<<<<<<<<<<<<<
 * 
 * include "const.pxi"
 */
  __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 8, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_TarantoolSchemaError);
  __Pyx_GIVEREF(__pyx_n_s_TarantoolSchemaError);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_TarantoolSchemaError);
  __Pyx_INCREF(__pyx_n_s_TarantoolNotConnectedError);
  __Pyx_GIVEREF(__pyx_n_s_TarantoolNotConnectedError);
  PyList_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_TarantoolNotConnectedError);

  /* "asynctnt/iproto/protocol.pyx":7
 * import enum
 * 
 * from asynctnt.exceptions import \             # <<<<<<<<<<<<<<
 *     TarantoolSchemaError, TarantoolNotConnectedError
 * 
 */
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_asynctnt_exceptions, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_TarantoolSchemaError); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_TarantoolSchemaError, __pyx_t_1) < 0) __PYX_ERR(3, 8, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_TarantoolNotConnectedError); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_TarantoolNotConnectedError, __pyx_t_1) < 0) __PYX_ERR(3, 8, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asynctnt/iproto/buffer.pyx":15
 * from libc.stdint cimport uint32_t, uint64_t, int64_t
 * 
 * from asynctnt.log import logger             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 15, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_s_logger);
  __Pyx_GIVEREF(__pyx_n_s_logger);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_logger);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_asynctnt_log, __pyx_t_2, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 15, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_logger); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 15, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_logger, __pyx_t_2) < 0) __PYX_ERR(0, 15, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asynctnt/iproto/buffer.pyx":696
 *     cdef void encode_request_update(self, uint32_t space, uint32_t index,
 *                                     list key_tuple, list operations,
 *                                     uint32_t key_of_tuple=tnt.TP_KEY,             # <<<<<<<<<<<<<<
 *                                     uint32_t key_of_operations=tnt.TP_TUPLE
 *                                     ) except *:
 */
  __pyx_k__10 = __pyx_e_8asynctnt_6iproto_3tnt_TP_KEY;

  /* "asynctnt/iproto/buffer.pyx":697
 *                                     list key_tuple, list operations,
 *                                     uint32_t key_of_tuple=tnt.TP_KEY,
 *                                     uint32_t key_of_operations=tnt.TP_TUPLE             # <<<<<<<<<<<<<<
 *                                     ) except *:
 *         cdef:
 */
  __pyx_k__11 = __pyx_e_8asynctnt_6iproto_3tnt_TP_TUPLE;

  /* "asynctnt/iproto/rbuffer.pyx":16
 * from libc.math cimport fmax
 * 
 * from asynctnt.log import logger             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 16, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_logger);
  __Pyx_GIVEREF(__pyx_n_s_logger);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_logger);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_asynctnt_log, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 16, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_logger); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 16, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_logger, __pyx_t_1) < 0) __PYX_ERR(5, 16, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asynctnt/iproto/response.pyx":7
 * cimport tnt
 * 
 * from asynctnt.log import logger             # <<<<<<<<<<<<<<
 * import yaml
 * 
 */
  __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_s_logger);
  __Pyx_GIVEREF(__pyx_n_s_logger);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_logger);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_asynctnt_log, __pyx_t_2, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_logger); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_logger, __pyx_t_2) < 0) __PYX_ERR(7, 7, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asynctnt/iproto/response.pyx":8
 * 
 * from asynctnt.log import logger
 * import yaml             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_yaml, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 8, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_yaml, __pyx_t_1) < 0) __PYX_ERR(7, 8, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asynctnt/iproto/db.pyx":4
 * cimport tnt
 * 
 * import hashlib             # <<<<<<<<<<<<<<
 * from asynctnt.exceptions import TarantoolDatabaseError, ErrorCode
 * 
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_hashlib, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_hashlib, __pyx_t_1) < 0) __PYX_ERR(10, 4, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asynctnt/iproto/db.pyx":5
 * 
 * import hashlib
 * from asynctnt.exceptions import TarantoolDatabaseError, ErrorCode             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_TarantoolDatabaseError);
  __Pyx_GIVEREF(__pyx_n_s_TarantoolDatabaseError);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_TarantoolDatabaseError);
  __Pyx_INCREF(__pyx_n_s_ErrorCode);
  __Pyx_GIVEREF(__pyx_n_s_ErrorCode);
  PyList_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_ErrorCode);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_asynctnt_exceptions, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_TarantoolDatabaseError); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_TarantoolDatabaseError, __pyx_t_1) < 0) __PYX_ERR(10, 5, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_ErrorCode); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_ErrorCode, __pyx_t_1) < 0) __PYX_ERR(10, 5, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asynctnt/iproto/coreproto.pyx":8
 * from libc.stdint cimport uint32_t, uint64_t
 * 
 * import base64             # <<<<<<<<<<<<<<
 * import socket
 * 
 */
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_base64, 0, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 8, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_base64, __pyx_t_2) < 0) __PYX_ERR(2, 8, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asynctnt/iproto/coreproto.pyx":9
 * 
 * import base64
 * import socket             # <<<<<<<<<<<<<<
 * 
 * import re
 */
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_socket, 0, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 9, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_socket, __pyx_t_2) < 0) __PYX_ERR(2, 9, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asynctnt/iproto/coreproto.pyx":11
 * import socket
 * 
 * import re             # <<<<<<<<<<<<<<
 * 
 * from asynctnt.exceptions import TarantoolDatabaseError
 */
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_re, 0, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 11, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_re, __pyx_t_2) < 0) __PYX_ERR(2, 11, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asynctnt/iproto/coreproto.pyx":13
 * import re
 * 
 * from asynctnt.exceptions import TarantoolDatabaseError             # <<<<<<<<<<<<<<
 * from asynctnt.log import logger
 * 
 */
  __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 13, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_s_TarantoolDatabaseError);
  __Pyx_GIVEREF(__pyx_n_s_TarantoolDatabaseError);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_TarantoolDatabaseError);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_asynctnt_exceptions, __pyx_t_2, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 13, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_TarantoolDatabaseError); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 13, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_TarantoolDatabaseError, __pyx_t_2) < 0) __PYX_ERR(2, 13, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "asynctnt/iproto/coreproto.pyx":14
 * 
 * from asynctnt.exceptions import TarantoolDatabaseError
 * from asynctnt.log import logger             # <<<<<<<<<<<<<<
 * 
 * VERSION_STRING_REGEX = re.compile(r'\s*Tarantool\s+([\d.]+)\s+.*')
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 14, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_logger);
  __Pyx_GIVEREF(__pyx_n_s_logger);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_logger);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_asynctnt_log, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 14, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_logger); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 14, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_logger, __pyx_t_1) < 0) __PYX_ERR(2, 14, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asynctnt/iproto/coreproto.pyx":16
 * from asynctnt.log import logger
 * 
 * VERSION_STRING_REGEX = re.compile(r'\s*Tarantool\s+([\d.]+)\s+.*')             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_re); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 16, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_compile); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 16, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__45, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 16, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_VERSION_STRING_REGEX, __pyx_t_2) < 0) __PYX_ERR(2, 16, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asynctnt/iproto/protocol.pyx":23
 * 
 * 
 * class Iterator(enum.IntEnum):             # <<<<<<<<<<<<<<
 *     EQ = 0
 *     REQ = 1
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_enum); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 23, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_IntEnum); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 23, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 23, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 23, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_2, __pyx_n_s_Iterator, __pyx_n_s_Iterator, (PyObject *) NULL, __pyx_n_s_asynctnt_iproto_protocol, (PyObject *) NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 23, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "asynctnt/iproto/protocol.pyx":24
 * 
 * class Iterator(enum.IntEnum):
 *     EQ = 0             # <<<<<<<<<<<<<<
 *     REQ = 1
 *     ALL = 2
 */
  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_EQ, __pyx_int_0) < 0) __PYX_ERR(3, 24, __pyx_L1_error)

  /* "asynctnt/iproto/protocol.pyx":25
 * class Iterator(enum.IntEnum):
 *     EQ = 0
 *     REQ = 1             # <<<<<<<<<<<<<<
 *     ALL = 2
 *     LT = 3
 */
  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_REQ, __pyx_int_1) < 0) __PYX_ERR(3, 25, __pyx_L1_error)

  /* "asynctnt/iproto/protocol.pyx":26
 *     EQ = 0
 *     REQ = 1
 *     ALL = 2             # <<<<<<<<<<<<<<
 *     LT = 3
 *     LE = 4
 */
  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_ALL, __pyx_int_2) < 0) __PYX_ERR(3, 26, __pyx_L1_error)

  /* "asynctnt/iproto/protocol.pyx":27
 *     REQ = 1
 *     ALL = 2
 *     LT = 3             # <<<<<<<<<<<<<<
 *     LE = 4
 *     GE = 5
 */
  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_LT, __pyx_int_3) < 0) __PYX_ERR(3, 27, __pyx_L1_error)

  /* "asynctnt/iproto/protocol.pyx":28
 *     ALL = 2
 *     LT = 3
 *     LE = 4             # <<<<<<<<<<<<<<
 *     GE = 5
 *     GT = 6
 */
  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_LE, __pyx_int_4) < 0) __PYX_ERR(3, 28, __pyx_L1_error)

  /* "asynctnt/iproto/protocol.pyx":29
 *     LT = 3
 *     LE = 4
 *     GE = 5             # <<<<<<<<<<<<<<
 *     GT = 6
 *     BITS_ALL_SET = 7
 */
  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_GE, __pyx_int_5) < 0) __PYX_ERR(3, 29, __pyx_L1_error)

  /* "asynctnt/iproto/protocol.pyx":30
 *     LE = 4
 *     GE = 5
 *     GT = 6             # <<<<<<<<<<<<<<
 *     BITS_ALL_SET = 7
 *     BITS_ANY_SET = 8
 */
  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_GT, __pyx_int_6) < 0) __PYX_ERR(3, 30, __pyx_L1_error)

  /* "asynctnt/iproto/protocol.pyx":31
 *     GE = 5
 *     GT = 6
 *     BITS_ALL_SET = 7             # <<<<<<<<<<<<<<
 *     BITS_ANY_SET = 8
 *     BITS_ALL_NOT_SET = 9
 */
  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_BITS_ALL_SET, __pyx_int_7) < 0) __PYX_ERR(3, 31, __pyx_L1_error)

  /* "asynctnt/iproto/protocol.pyx":32
 *     GT = 6
 *     BITS_ALL_SET = 7
 *     BITS_ANY_SET = 8             # <<<<<<<<<<<<<<
 *     BITS_ALL_NOT_SET = 9
 *     OVERLAPS = 10
 */
  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_BITS_ANY_SET, __pyx_int_8) < 0) __PYX_ERR(3, 32, __pyx_L1_error)

  /* "asynctnt/iproto/protocol.pyx":33
 *     BITS_ALL_SET = 7
 *     BITS_ANY_SET = 8
 *     BITS_ALL_NOT_SET = 9             # <<<<<<<<<<<<<<
 *     OVERLAPS = 10
 *     NEIGHBOR = 11
 */
  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_BITS_ALL_NOT_SET, __pyx_int_9) < 0) __PYX_ERR(3, 33, __pyx_L1_error)

  /* "asynctnt/iproto/protocol.pyx":34
 *     BITS_ANY_SET = 8
 *     BITS_ALL_NOT_SET = 9
 *     OVERLAPS = 10             # <<<<<<<<<<<<<<
 *     NEIGHBOR = 11
 * 
 */
  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_OVERLAPS, __pyx_int_10) < 0) __PYX_ERR(3, 34, __pyx_L1_error)

  /* "asynctnt/iproto/protocol.pyx":35
 *     BITS_ALL_NOT_SET = 9
 *     OVERLAPS = 10
 *     NEIGHBOR = 11             # <<<<<<<<<<<<<<
 * 
 * 
 */
  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_NEIGHBOR, __pyx_int_11) < 0) __PYX_ERR(3, 35, __pyx_L1_error)

  /* "asynctnt/iproto/protocol.pyx":23
 * 
 * 
 * class Iterator(enum.IntEnum):             # <<<<<<<<<<<<<<
 *     EQ = 0
 *     REQ = 1
 */
  __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_Iterator, __pyx_t_2, __pyx_t_3, NULL, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 23, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Iterator, __pyx_t_4) < 0) __PYX_ERR(3, 23, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asynctnt/iproto/protocol.pyx":281
 * 
 * 
 * class Protocol(BaseProtocol, asyncio.Protocol):             # <<<<<<<<<<<<<<
 *     pass
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_asyncio); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 281, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_Protocol); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 281, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 281, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_ptype_8asynctnt_6iproto_8protocol_BaseProtocol));
  __Pyx_GIVEREF(((PyObject *)__pyx_ptype_8asynctnt_6iproto_8protocol_BaseProtocol));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_ptype_8asynctnt_6iproto_8protocol_BaseProtocol));
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 281, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_2, __pyx_n_s_Protocol, __pyx_n_s_Protocol, (PyObject *) NULL, __pyx_n_s_asynctnt_iproto_protocol, (PyObject *) NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 281, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_Protocol, __pyx_t_2, __pyx_t_3, NULL, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 281, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Protocol, __pyx_t_4) < 0) __PYX_ERR(3, 281, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "asynctnt/iproto/protocol.pyx":1
 * cimport cython             # <<<<<<<<<<<<<<
 * cimport cpython.dict
 * 
 */
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_2) < 0) __PYX_ERR(3, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /*--- Wrapped vars code ---*/

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  if (__pyx_m) {
    if (__pyx_d) {
      __Pyx_AddTraceback("init asynctnt.iproto.protocol", __pyx_clineno, __pyx_lineno, __pyx_filename);
    }
    Py_DECREF(__pyx_m); __pyx_m = 0;
  } else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_ImportError, "init asynctnt.iproto.protocol");
  }
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  #if PY_MAJOR_VERSION < 3
  return;
  #else
  return __pyx_m;
  #endif
}

/* --- Runtime support code --- */
/* Refnanny */
#if CYTHON_REFNANNY
static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
    PyObject *m = NULL, *p = NULL;
    void *r = NULL;
    m = PyImport_ImportModule((char *)modname);
    if (!m) goto end;
    p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
    if (!p) goto end;
    r = PyLong_AsVoidPtr(p);
end:
    Py_XDECREF(p);
    Py_XDECREF(m);
    return (__Pyx_RefNannyAPIStruct *)r;
}
#endif

/* GetBuiltinName */
static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
    PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
    if (unlikely(!result)) {
        PyErr_Format(PyExc_NameError,
#if PY_MAJOR_VERSION >= 3
            "name '%U' is not defined", name);
#else
            "name '%.200s' is not defined", PyString_AS_STRING(name));
#endif
    }
    return result;
}

/* RaiseArgTupleInvalid */
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 *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";
    }
    PyErr_Format(PyExc_TypeError,
                 "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
                 func_name, more_or_less, num_expected,
                 (num_expected == 1) ? "" : "s", num_found);
}

/* KeywordStringCheck */
static CYTHON_INLINE int __Pyx_CheckKeywordStrings(
    PyObject *kwdict,
    const char* function_name,
    int kw_allowed)
{
    PyObject* key = 0;
    Py_ssize_t pos = 0;
#if CYTHON_COMPILING_IN_PYPY
    if (!kw_allowed && PyDict_Next(kwdict, &pos, &key, 0))
        goto invalid_keyword;
    return 1;
#else
    while (PyDict_Next(kwdict, &pos, &key, 0)) {
        #if PY_MAJOR_VERSION < 3
        if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key)))
        #endif
            if (unlikely(!PyUnicode_Check(key)))
                goto invalid_keyword_type;
    }
    if ((!kw_allowed) && unlikely(key))
        goto invalid_keyword;
    return 1;
invalid_keyword_type:
    PyErr_Format(PyExc_TypeError,
        "%.200s() keywords must be strings", function_name);
    return 0;
#endif
invalid_keyword:
    PyErr_Format(PyExc_TypeError,
    #if PY_MAJOR_VERSION < 3
        "%.200s() got an unexpected keyword argument '%.200s'",
        function_name, PyString_AsString(key));
    #else
        "%s() got an unexpected keyword argument '%U'",
        function_name, key);
    #endif
    return 0;
}

/* PyObjectCall */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
    PyObject *result;
    ternaryfunc call = func->ob_type->tp_call;
    if (unlikely(!call))
        return PyObject_Call(func, arg, kw);
    if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
        return NULL;
    result = (*call)(func, arg, kw);
    Py_LeaveRecursiveCall();
    if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
        PyErr_SetString(
            PyExc_SystemError,
            "NULL result without error in PyObject_Call");
    }
    return result;
}
#endif

/* PyErrFetchRestore */
#if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    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 CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
    *type = tstate->curexc_type;
    *value = tstate->curexc_value;
    *tb = tstate->curexc_traceback;
    tstate->curexc_type = 0;
    tstate->curexc_value = 0;
    tstate->curexc_traceback = 0;
}
#endif

/* RaiseException */
#if PY_MAJOR_VERSION < 3
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
                        CYTHON_UNUSED PyObject *cause) {
    __Pyx_PyThreadState_declare
    Py_XINCREF(type);
    if (!value || value == Py_None)
        value = NULL;
    else
        Py_INCREF(value);
    if (!tb || tb == Py_None)
        tb = NULL;
    else {
        Py_INCREF(tb);
        if (!PyTraceBack_Check(tb)) {
            PyErr_SetString(PyExc_TypeError,
                "raise: arg 3 must be a traceback or None");
            goto raise_error;
        }
    }
    if (PyType_Check(type)) {
#if CYTHON_COMPILING_IN_PYPY
        if (!value) {
            Py_INCREF(Py_None);
            value = Py_None;
        }
#endif
        PyErr_NormalizeException(&type, &value, &tb);
    } else {
        if (value) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto raise_error;
        }
        value = type;
        type = (PyObject*) Py_TYPE(type);
        Py_INCREF(type);
        if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
            PyErr_SetString(PyExc_TypeError,
                "raise: exception class must be a subclass of BaseException");
            goto raise_error;
        }
    }
    __Pyx_PyThreadState_assign
    __Pyx_ErrRestore(type, value, tb);
    return;
raise_error:
    Py_XDECREF(value);
    Py_XDECREF(type);
    Py_XDECREF(tb);
    return;
}
#else
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
    PyObject* owned_instance = NULL;
    if (tb == Py_None) {
        tb = 0;
    } else if (tb && !PyTraceBack_Check(tb)) {
        PyErr_SetString(PyExc_TypeError,
            "raise: arg 3 must be a traceback or None");
        goto bad;
    }
    if (value == Py_None)
        value = 0;
    if (PyExceptionInstance_Check(type)) {
        if (value) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto bad;
        }
        value = type;
        type = (PyObject*) Py_TYPE(value);
    } else if (PyExceptionClass_Check(type)) {
        PyObject *instance_class = NULL;
        if (value && PyExceptionInstance_Check(value)) {
            instance_class = (PyObject*) Py_TYPE(value);
            if (instance_class != type) {
                int is_subclass = PyObject_IsSubclass(instance_class, type);
                if (!is_subclass) {
                    instance_class = NULL;
                } else if (unlikely(is_subclass == -1)) {
                    goto bad;
                } else {
                    type = instance_class;
                }
            }
        }
        if (!instance_class) {
            PyObject *args;
            if (!value)
                args = PyTuple_New(0);
            else if (PyTuple_Check(value)) {
                Py_INCREF(value);
                args = value;
            } else
                args = PyTuple_Pack(1, value);
            if (!args)
                goto bad;
            owned_instance = PyObject_Call(type, args, NULL);
            Py_DECREF(args);
            if (!owned_instance)
                goto bad;
            value = owned_instance;
            if (!PyExceptionInstance_Check(value)) {
                PyErr_Format(PyExc_TypeError,
                             "calling %R should have returned an instance of "
                             "BaseException, not %R",
                             type, Py_TYPE(value));
                goto bad;
            }
        }
    } else {
        PyErr_SetString(PyExc_TypeError,
            "raise: exception class must be a subclass of BaseException");
        goto bad;
    }
#if PY_VERSION_HEX >= 0x03030000
    if (cause) {
#else
    if (cause && cause != Py_None) {
#endif
        PyObject *fixed_cause;
        if (cause == Py_None) {
            fixed_cause = NULL;
        } else if (PyExceptionClass_Check(cause)) {
            fixed_cause = PyObject_CallObject(cause, NULL);
            if (fixed_cause == NULL)
                goto bad;
        } else if (PyExceptionInstance_Check(cause)) {
            fixed_cause = cause;
            Py_INCREF(fixed_cause);
        } else {
            PyErr_SetString(PyExc_TypeError,
                            "exception causes must derive from "
                            "BaseException");
            goto bad;
        }
        PyException_SetCause(value, fixed_cause);
    }
    PyErr_SetObject(type, value);
    if (tb) {
#if CYTHON_COMPILING_IN_PYPY
        PyObject *tmp_type, *tmp_value, *tmp_tb;
        PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
        Py_INCREF(tb);
        PyErr_Restore(tmp_type, tmp_value, tb);
        Py_XDECREF(tmp_tb);
#else
        PyThreadState *tstate = PyThreadState_GET();
        PyObject* tmp_tb = tstate->curexc_traceback;
        if (tb != tmp_tb) {
            Py_INCREF(tb);
            tstate->curexc_traceback = tb;
            Py_XDECREF(tmp_tb);
        }
#endif
    }
bad:
    Py_XDECREF(owned_instance);
    return;
}
#endif

/* WriteUnraisableException */
  static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno,
                                  CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename,
                                  int full_traceback, CYTHON_UNUSED int nogil) {
    PyObject *old_exc, *old_val, *old_tb;
    PyObject *ctx;
    __Pyx_PyThreadState_declare
#ifdef WITH_THREAD
    PyGILState_STATE state;
    if (nogil)
        state = PyGILState_Ensure();
#ifdef _MSC_VER
    else state = (PyGILState_STATE)-1;
#endif
#endif
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
    if (full_traceback) {
        Py_XINCREF(old_exc);
        Py_XINCREF(old_val);
        Py_XINCREF(old_tb);
        __Pyx_ErrRestore(old_exc, old_val, old_tb);
        PyErr_PrintEx(1);
    }
    #if PY_MAJOR_VERSION < 3
    ctx = PyString_FromString(name);
    #else
    ctx = PyUnicode_FromString(name);
    #endif
    __Pyx_ErrRestore(old_exc, old_val, old_tb);
    if (!ctx) {
        PyErr_WriteUnraisable(Py_None);
    } else {
        PyErr_WriteUnraisable(ctx);
        Py_DECREF(ctx);
    }
#ifdef WITH_THREAD
    if (nogil)
        PyGILState_Release(state);
#endif
}

/* ExtTypeTest */
  static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
    if (unlikely(!type)) {
        PyErr_SetString(PyExc_SystemError, "Missing type object");
        return 0;
    }
    if (likely(PyObject_TypeCheck(obj, type)))
        return 1;
    PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
                 Py_TYPE(obj)->tp_name, type->tp_name);
    return 0;
}

/* PyCFunctionFastCall */
  #if CYTHON_FAST_PYCCALL
static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
    PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
    PyCFunction meth = PyCFunction_GET_FUNCTION(func);
    PyObject *self = PyCFunction_GET_SELF(func);
    assert(PyCFunction_Check(func));
    assert(METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST)));
    assert(nargs >= 0);
    assert(nargs == 0 || args != NULL);
    /* _PyCFunction_FastCallDict() must not be called with an exception set,
       because it may clear it (directly or indirectly) and so the
       caller loses its exception */
    assert(!PyErr_Occurred());
    return (*((__Pyx_PyCFunctionFast)meth)) (self, args, nargs, NULL);
}
#endif  // CYTHON_FAST_PYCCALL

/* PyFunctionFastCall */
  #if CYTHON_FAST_PYCALL
#include "frameobject.h"
static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
                                               PyObject *globals) {
    PyFrameObject *f;
    PyThreadState *tstate = PyThreadState_GET();
    PyObject **fastlocals;
    Py_ssize_t i;
    PyObject *result;
    assert(globals != NULL);
    /* XXX Perhaps we should create a specialized
       PyFrame_New() that doesn't take locals, but does
       take builtins without sanity checking them.
       */
    assert(tstate != NULL);
    f = PyFrame_New(tstate, co, globals, NULL);
    if (f == NULL) {
        return NULL;
    }
    fastlocals = f->f_localsplus;
    for (i = 0; i < na; i++) {
        Py_INCREF(*args);
        fastlocals[i] = *args++;
    }
    result = PyEval_EvalFrameEx(f,0);
    ++tstate->recursion_depth;
    Py_DECREF(f);
    --tstate->recursion_depth;
    return result;
}
#if 1 || PY_VERSION_HEX < 0x030600B1
static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs) {
    PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
    PyObject *globals = PyFunction_GET_GLOBALS(func);
    PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
    PyObject *closure;
#if PY_MAJOR_VERSION >= 3
    PyObject *kwdefs;
#endif
    PyObject *kwtuple, **k;
    PyObject **d;
    Py_ssize_t nd;
    Py_ssize_t nk;
    PyObject *result;
    assert(kwargs == NULL || PyDict_Check(kwargs));
    nk = kwargs ? PyDict_Size(kwargs) : 0;
    if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
        return NULL;
    }
    if (
#if PY_MAJOR_VERSION >= 3
            co->co_kwonlyargcount == 0 &&
#endif
            likely(kwargs == NULL || nk == 0) &&
            co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
        if (argdefs == NULL && co->co_argcount == nargs) {
            result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
            goto done;
        }
        else if (nargs == 0 && argdefs != NULL
                 && co->co_argcount == Py_SIZE(argdefs)) {
            /* function called with no arguments, but all parameters have
               a default value: use default values as arguments .*/
            args = &PyTuple_GET_ITEM(argdefs, 0);
            result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
            goto done;
        }
    }
    if (kwargs != NULL) {
        Py_ssize_t pos, i;
        kwtuple = PyTuple_New(2 * nk);
        if (kwtuple == NULL) {
            result = NULL;
            goto done;
        }
        k = &PyTuple_GET_ITEM(kwtuple, 0);
        pos = i = 0;
        while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
            Py_INCREF(k[i]);
            Py_INCREF(k[i+1]);
            i += 2;
        }
        nk = i / 2;
    }
    else {
        kwtuple = NULL;
        k = NULL;
    }
    closure = PyFunction_GET_CLOSURE(func);
#if PY_MAJOR_VERSION >= 3
    kwdefs = PyFunction_GET_KW_DEFAULTS(func);
#endif
    if (argdefs != NULL) {
        d = &PyTuple_GET_ITEM(argdefs, 0);
        nd = Py_SIZE(argdefs);
    }
    else {
        d = NULL;
        nd = 0;
    }
#if PY_MAJOR_VERSION >= 3
    result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
                               args, nargs,
                               k, (int)nk,
                               d, (int)nd, kwdefs, closure);
#else
    result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
                               args, nargs,
                               k, (int)nk,
                               d, (int)nd, closure);
#endif
    Py_XDECREF(kwtuple);
done:
    Py_LeaveRecursiveCall();
    return result;
}
#endif  // CPython < 3.6
#endif  // CYTHON_FAST_PYCALL

/* PyObjectCallMethO */
  #if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
    PyObject *self, *result;
    PyCFunction cfunc;
    cfunc = PyCFunction_GET_FUNCTION(func);
    self = PyCFunction_GET_SELF(func);
    if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
        return NULL;
    result = cfunc(self, arg);
    Py_LeaveRecursiveCall();
    if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
        PyErr_SetString(
            PyExc_SystemError,
            "NULL result without error in PyObject_Call");
    }
    return result;
}
#endif

/* PyObjectCallOneArg */
  #if CYTHON_COMPILING_IN_CPYTHON
static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
    PyObject *result;
    PyObject *args = PyTuple_New(1);
    if (unlikely(!args)) return NULL;
    Py_INCREF(arg);
    PyTuple_SET_ITEM(args, 0, arg);
    result = __Pyx_PyObject_Call(func, args, NULL);
    Py_DECREF(args);
    return result;
}
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
#if CYTHON_FAST_PYCALL
    if (PyFunction_Check(func)) {
        return __Pyx_PyFunction_FastCall(func, &arg, 1);
    }
#endif
#ifdef __Pyx_CyFunction_USED
    if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) {
#else
    if (likely(PyCFunction_Check(func))) {
#endif
        if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
            return __Pyx_PyObject_CallMethO(func, arg);
#if CYTHON_FAST_PYCCALL
        } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) {
            return __Pyx_PyCFunction_FastCall(func, &arg, 1);
#endif
        }
    }
    return __Pyx__PyObject_CallOneArg(func, arg);
}
#else
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
    PyObject *result;
    PyObject *args = PyTuple_Pack(1, arg);
    if (unlikely(!args)) return NULL;
    result = __Pyx_PyObject_Call(func, args, NULL);
    Py_DECREF(args);
    return result;
}
#endif

/* GetItemInt */
    static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
    PyObject *r;
    if (!j) return NULL;
    r = PyObject_GetItem(o, j);
    Py_DECREF(j);
    return r;
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
                                                              CYTHON_NCP_UNUSED int wraparound,
                                                              CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (wraparound & unlikely(i < 0)) i += PyList_GET_SIZE(o);
    if ((!boundscheck) || likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
        PyObject *r = PyList_GET_ITEM(o, i);
        Py_INCREF(r);
        return r;
    }
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
#else
    return PySequence_GetItem(o, i);
#endif
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
                                                              CYTHON_NCP_UNUSED int wraparound,
                                                              CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (wraparound & unlikely(i < 0)) i += PyTuple_GET_SIZE(o);
    if ((!boundscheck) || likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
        PyObject *r = PyTuple_GET_ITEM(o, i);
        Py_INCREF(r);
        return r;
    }
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
#else
    return PySequence_GetItem(o, i);
#endif
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
                                                     CYTHON_NCP_UNUSED int wraparound,
                                                     CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
    if (is_list || PyList_CheckExact(o)) {
        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
        if ((!boundscheck) || (likely((n >= 0) & (n < PyList_GET_SIZE(o))))) {
            PyObject *r = PyList_GET_ITEM(o, n);
            Py_INCREF(r);
            return r;
        }
    }
    else if (PyTuple_CheckExact(o)) {
        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
        if ((!boundscheck) || likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) {
            PyObject *r = PyTuple_GET_ITEM(o, n);
            Py_INCREF(r);
            return r;
        }
    } else {
        PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
        if (likely(m && m->sq_item)) {
            if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
                Py_ssize_t l = m->sq_length(o);
                if (likely(l >= 0)) {
                    i += l;
                } else {
                    if (!PyErr_ExceptionMatches(PyExc_OverflowError))
                        return NULL;
                    PyErr_Clear();
                }
            }
            return m->sq_item(o, i);
        }
    }
#else
    if (is_list || PySequence_Check(o)) {
        return PySequence_GetItem(o, i);
    }
#endif
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
}

/* GetModuleGlobalName */
    static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) {
    PyObject *result;
#if !CYTHON_AVOID_BORROWED_REFS
    result = PyDict_GetItem(__pyx_d, name);
    if (likely(result)) {
        Py_INCREF(result);
    } else {
#else
    result = PyObject_GetItem(__pyx_d, name);
    if (!result) {
        PyErr_Clear();
#endif
        result = __Pyx_GetBuiltinName(name);
    }
    return result;
}

/* decode_c_string */
      static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
         const char* cstring, Py_ssize_t start, Py_ssize_t stop,
         const char* encoding, const char* errors,
         PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) {
    Py_ssize_t length;
    if (unlikely((start < 0) | (stop < 0))) {
        size_t slen = strlen(cstring);
        if (unlikely(slen > (size_t) PY_SSIZE_T_MAX)) {
            PyErr_SetString(PyExc_OverflowError,
                            "c-string too long to convert to Python");
            return NULL;
        }
        length = (Py_ssize_t) slen;
        if (start < 0) {
            start += length;
            if (start < 0)
                start = 0;
        }
        if (stop < 0)
            stop += length;
    }
    length = stop - start;
    if (unlikely(length <= 0))
        return PyUnicode_FromUnicode(NULL, 0);
    cstring += start;
    if (decode_func) {
        return decode_func(cstring, length, errors);
    } else {
        return PyUnicode_Decode(cstring, length, encoding, errors);
    }
}

/* None */
      static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) {
    PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname);
}

/* RaiseDoubleKeywords */
      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_AsString(kw_name));
        #endif
}

/* ParseKeywords */
      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)) {
        name = first_kw_arg;
        while (*name && (**name != key)) name++;
        if (*name) {
            values[name-argnames] = value;
            continue;
        }
        name = first_kw_arg;
        #if PY_MAJOR_VERSION < 3
        if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) {
            while (*name) {
                if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
                        && _PyString_Eq(**name, key)) {
                    values[name-argnames] = value;
                    break;
                }
                name++;
            }
            if (*name) continue;
            else {
                PyObject*** argname = argnames;
                while (argname != first_kw_arg) {
                    if ((**argname == key) || (
                            (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
                             && _PyString_Eq(**argname, key))) {
                        goto arg_passed_twice;
                    }
                    argname++;
                }
            }
        } else
        #endif
        if (likely(PyUnicode_Check(key))) {
            while (*name) {
                int cmp = (**name == key) ? 0 :
                #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
                    (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
                #endif
                    PyUnicode_Compare(**name, key);
                if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
                if (cmp == 0) {
                    values[name-argnames] = value;
                    break;
                }
                name++;
            }
            if (*name) continue;
            else {
                PyObject*** argname = argnames;
                while (argname != first_kw_arg) {
                    int cmp = (**argname == key) ? 0 :
                    #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
                        (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
                    #endif
                        PyUnicode_Compare(**argname, key);
                    if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
                    if (cmp == 0) goto arg_passed_twice;
                    argname++;
                }
            }
        } else
            goto invalid_keyword_type;
        if (kwds2) {
            if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
        } else {
            goto invalid_keyword;
        }
    }
    return 0;
arg_passed_twice:
    __Pyx_RaiseDoubleKeywordsError(function_name, key);
    goto bad;
invalid_keyword_type:
    PyErr_Format(PyExc_TypeError,
        "%.200s() keywords must be strings", function_name);
    goto bad;
invalid_keyword:
    PyErr_Format(PyExc_TypeError,
    #if PY_MAJOR_VERSION < 3
        "%.200s() got an unexpected keyword argument '%.200s'",
        function_name, PyString_AsString(key));
    #else
        "%s() got an unexpected keyword argument '%U'",
        function_name, key);
    #endif
bad:
    return -1;
}

/* ArgTypeTest */
      static void __Pyx_RaiseArgumentTypeInvalid(const char* name, PyObject *obj, PyTypeObject *type) {
    PyErr_Format(PyExc_TypeError,
        "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
        name, type->tp_name, Py_TYPE(obj)->tp_name);
}
static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
    const char *name, int exact)
{
    if (unlikely(!type)) {
        PyErr_SetString(PyExc_SystemError, "Missing type object");
        return 0;
    }
    if (none_allowed && obj == Py_None) return 1;
    else if (exact) {
        if (likely(Py_TYPE(obj) == type)) return 1;
        #if PY_MAJOR_VERSION == 2
        else if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
        #endif
    }
    else {
        if (likely(PyObject_TypeCheck(obj, type))) return 1;
    }
    __Pyx_RaiseArgumentTypeInvalid(name, obj, type);
    return 0;
}

/* RaiseTooManyValuesToUnpack */
      static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
    PyErr_Format(PyExc_ValueError,
                 "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
}

/* RaiseNeedMoreValuesToUnpack */
      static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
    PyErr_Format(PyExc_ValueError,
                 "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
                 index, (index == 1) ? "" : "s");
}

/* IterFinish */
      static CYTHON_INLINE int __Pyx_IterFinish(void) {
#if CYTHON_FAST_THREAD_STATE
    PyThreadState *tstate = PyThreadState_GET();
    PyObject* exc_type = tstate->curexc_type;
    if (unlikely(exc_type)) {
        if (likely(exc_type == PyExc_StopIteration) || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)) {
            PyObject *exc_value, *exc_tb;
            exc_value = tstate->curexc_value;
            exc_tb = tstate->curexc_traceback;
            tstate->curexc_type = 0;
            tstate->curexc_value = 0;
            tstate->curexc_traceback = 0;
            Py_DECREF(exc_type);
            Py_XDECREF(exc_value);
            Py_XDECREF(exc_tb);
            return 0;
        } else {
            return -1;
        }
    }
    return 0;
#else
    if (unlikely(PyErr_Occurred())) {
        if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
            PyErr_Clear();
            return 0;
        } else {
            return -1;
        }
    }
    return 0;
#endif
}

/* UnpackItemEndCheck */
      static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
    if (unlikely(retval)) {
        Py_DECREF(retval);
        __Pyx_RaiseTooManyValuesError(expected);
        return -1;
    } else {
        return __Pyx_IterFinish();
    }
    return 0;
}

/* PyIntBinop */
      #if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_AddCObj(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED int inplace) {
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op2))) {
        const long a = intval;
        long x;
        long b = PyInt_AS_LONG(op2);
            x = (long)((unsigned long)a + b);
            if (likely((x^a) >= 0 || (x^b) >= 0))
                return PyInt_FromLong(x);
            return PyLong_Type.tp_as_number->nb_add(op1, op2);
    }
    #endif
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op2))) {
        const long a = intval;
        long b, x;
#ifdef HAVE_LONG_LONG
        const PY_LONG_LONG lla = intval;
        PY_LONG_LONG llb, llx;
#endif
        const digit* digits = ((PyLongObject*)op2)->ob_digit;
        const Py_ssize_t size = Py_SIZE(op2);
        if (likely(__Pyx_sst_abs(size) <= 1)) {
            b = likely(size) ? digits[0] : 0;
            if (size == -1) b = -b;
        } else {
            switch (size) {
                case -2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        b = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        llb = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                case 2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        b = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        llb = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                case -3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        b = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        llb = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                case 3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        b = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        llb = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                case -4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        b = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        llb = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                case 4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        b = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        llb = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                default: return PyLong_Type.tp_as_number->nb_add(op1, op2);
            }
        }
                x = a + b;
            return PyLong_FromLong(x);
#ifdef HAVE_LONG_LONG
        long_long:
                llx = lla + llb;
            return PyLong_FromLongLong(llx);
#endif
        
        
    }
    #endif
    if (PyFloat_CheckExact(op2)) {
        const long a = intval;
        double b = PyFloat_AS_DOUBLE(op2);
            double result;
            PyFPE_START_PROTECT("add", return NULL)
            result = ((double)a) + (double)b;
            PyFPE_END_PROTECT(result)
            return PyFloat_FromDouble(result);
    }
    return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
}
#endif

/* FetchCommonType */
      static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) {
    PyObject* fake_module;
    PyTypeObject* cached_type = NULL;
    fake_module = PyImport_AddModule((char*) "_cython_" CYTHON_ABI);
    if (!fake_module) return NULL;
    Py_INCREF(fake_module);
    cached_type = (PyTypeObject*) PyObject_GetAttrString(fake_module, type->tp_name);
    if (cached_type) {
        if (!PyType_Check((PyObject*)cached_type)) {
            PyErr_Format(PyExc_TypeError,
                "Shared Cython type %.200s is not a type object",
                type->tp_name);
            goto bad;
        }
        if (cached_type->tp_basicsize != type->tp_basicsize) {
            PyErr_Format(PyExc_TypeError,
                "Shared Cython type %.200s has the wrong size, try recompiling",
                type->tp_name);
            goto bad;
        }
    } else {
        if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad;
        PyErr_Clear();
        if (PyType_Ready(type) < 0) goto bad;
        if (PyObject_SetAttrString(fake_module, type->tp_name, (PyObject*) type) < 0)
            goto bad;
        Py_INCREF(type);
        cached_type = type;
    }
done:
    Py_DECREF(fake_module);
    return cached_type;
bad:
    Py_XDECREF(cached_type);
    cached_type = NULL;
    goto done;
}

/* CythonFunction */
      static PyObject *
__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure)
{
    if (unlikely(op->func_doc == NULL)) {
        if (op->func.m_ml->ml_doc) {
#if PY_MAJOR_VERSION >= 3
            op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc);
#else
            op->func_doc = PyString_FromString(op->func.m_ml->ml_doc);
#endif
            if (unlikely(op->func_doc == NULL))
                return NULL;
        } else {
            Py_INCREF(Py_None);
            return Py_None;
        }
    }
    Py_INCREF(op->func_doc);
    return op->func_doc;
}
static int
__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value)
{
    PyObject *tmp = op->func_doc;
    if (value == NULL) {
        value = Py_None;
    }
    Py_INCREF(value);
    op->func_doc = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op)
{
    if (unlikely(op->func_name == NULL)) {
#if PY_MAJOR_VERSION >= 3
        op->func_name = PyUnicode_InternFromString(op->func.m_ml->ml_name);
#else
        op->func_name = PyString_InternFromString(op->func.m_ml->ml_name);
#endif
        if (unlikely(op->func_name == NULL))
            return NULL;
    }
    Py_INCREF(op->func_name);
    return op->func_name;
}
static int
__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value)
{
    PyObject *tmp;
#if PY_MAJOR_VERSION >= 3
    if (unlikely(value == NULL || !PyUnicode_Check(value))) {
#else
    if (unlikely(value == NULL || !PyString_Check(value))) {
#endif
        PyErr_SetString(PyExc_TypeError,
                        "__name__ must be set to a string object");
        return -1;
    }
    tmp = op->func_name;
    Py_INCREF(value);
    op->func_name = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op)
{
    Py_INCREF(op->func_qualname);
    return op->func_qualname;
}
static int
__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value)
{
    PyObject *tmp;
#if PY_MAJOR_VERSION >= 3
    if (unlikely(value == NULL || !PyUnicode_Check(value))) {
#else
    if (unlikely(value == NULL || !PyString_Check(value))) {
#endif
        PyErr_SetString(PyExc_TypeError,
                        "__qualname__ must be set to a string object");
        return -1;
    }
    tmp = op->func_qualname;
    Py_INCREF(value);
    op->func_qualname = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED void *closure)
{
    PyObject *self;
    self = m->func_closure;
    if (self == NULL)
        self = Py_None;
    Py_INCREF(self);
    return self;
}
static PyObject *
__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op)
{
    if (unlikely(op->func_dict == NULL)) {
        op->func_dict = PyDict_New();
        if (unlikely(op->func_dict == NULL))
            return NULL;
    }
    Py_INCREF(op->func_dict);
    return op->func_dict;
}
static int
__Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value)
{
    PyObject *tmp;
    if (unlikely(value == NULL)) {
        PyErr_SetString(PyExc_TypeError,
               "function's dictionary may not be deleted");
        return -1;
    }
    if (unlikely(!PyDict_Check(value))) {
        PyErr_SetString(PyExc_TypeError,
               "setting function's dictionary to a non-dict");
        return -1;
    }
    tmp = op->func_dict;
    Py_INCREF(value);
    op->func_dict = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op)
{
    Py_INCREF(op->func_globals);
    return op->func_globals;
}
static PyObject *
__Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op)
{
    Py_INCREF(Py_None);
    return Py_None;
}
static PyObject *
__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op)
{
    PyObject* result = (op->func_code) ? op->func_code : Py_None;
    Py_INCREF(result);
    return result;
}
static int
__Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) {
    int result = 0;
    PyObject *res = op->defaults_getter((PyObject *) op);
    if (unlikely(!res))
        return -1;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    op->defaults_tuple = PyTuple_GET_ITEM(res, 0);
    Py_INCREF(op->defaults_tuple);
    op->defaults_kwdict = PyTuple_GET_ITEM(res, 1);
    Py_INCREF(op->defaults_kwdict);
    #else
    op->defaults_tuple = PySequence_ITEM(res, 0);
    if (unlikely(!op->defaults_tuple)) result = -1;
    else {
        op->defaults_kwdict = PySequence_ITEM(res, 1);
        if (unlikely(!op->defaults_kwdict)) result = -1;
    }
    #endif
    Py_DECREF(res);
    return result;
}
static int
__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value) {
    PyObject* tmp;
    if (!value) {
        value = Py_None;
    } else if (value != Py_None && !PyTuple_Check(value)) {
        PyErr_SetString(PyExc_TypeError,
                        "__defaults__ must be set to a tuple object");
        return -1;
    }
    Py_INCREF(value);
    tmp = op->defaults_tuple;
    op->defaults_tuple = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op) {
    PyObject* result = op->defaults_tuple;
    if (unlikely(!result)) {
        if (op->defaults_getter) {
            if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
            result = op->defaults_tuple;
        } else {
            result = Py_None;
        }
    }
    Py_INCREF(result);
    return result;
}
static int
__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value) {
    PyObject* tmp;
    if (!value) {
        value = Py_None;
    } else if (value != Py_None && !PyDict_Check(value)) {
        PyErr_SetString(PyExc_TypeError,
                        "__kwdefaults__ must be set to a dict object");
        return -1;
    }
    Py_INCREF(value);
    tmp = op->defaults_kwdict;
    op->defaults_kwdict = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op) {
    PyObject* result = op->defaults_kwdict;
    if (unlikely(!result)) {
        if (op->defaults_getter) {
            if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
            result = op->defaults_kwdict;
        } else {
            result = Py_None;
        }
    }
    Py_INCREF(result);
    return result;
}
static int
__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value) {
    PyObject* tmp;
    if (!value || value == Py_None) {
        value = NULL;
    } else if (!PyDict_Check(value)) {
        PyErr_SetString(PyExc_TypeError,
                        "__annotations__ must be set to a dict object");
        return -1;
    }
    Py_XINCREF(value);
    tmp = op->func_annotations;
    op->func_annotations = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op) {
    PyObject* result = op->func_annotations;
    if (unlikely(!result)) {
        result = PyDict_New();
        if (unlikely(!result)) return NULL;
        op->func_annotations = result;
    }
    Py_INCREF(result);
    return result;
}
static PyGetSetDef __pyx_CyFunction_getsets[] = {
    {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
    {(char *) "__doc__",  (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
    {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
    {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
    {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0},
    {(char *) "__self__", (getter)__Pyx_CyFunction_get_self, 0, 0, 0},
    {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
    {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
    {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
    {(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
    {(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
    {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
    {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
    {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
    {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
    {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
    {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0},
    {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0},
    {0, 0, 0, 0, 0}
};
static PyMemberDef __pyx_CyFunction_members[] = {
    {(char *) "__module__", T_OBJECT, offsetof(__pyx_CyFunctionObject, func.m_module), PY_WRITE_RESTRICTED, 0},
    {0, 0, 0,  0, 0}
};
static PyObject *
__Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args)
{
#if PY_MAJOR_VERSION >= 3
    return PyUnicode_FromString(m->func.m_ml->ml_name);
#else
    return PyString_FromString(m->func.m_ml->ml_name);
#endif
}
static PyMethodDef __pyx_CyFunction_methods[] = {
    {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
    {0, 0, 0, 0}
};
#if PY_VERSION_HEX < 0x030500A0
#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist)
#else
#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func.m_weakreflist)
#endif
static PyObject *__Pyx_CyFunction_New(PyTypeObject *type, PyMethodDef *ml, int flags, PyObject* qualname,
                                      PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
    __pyx_CyFunctionObject *op = PyObject_GC_New(__pyx_CyFunctionObject, type);
    if (op == NULL)
        return NULL;
    op->flags = flags;
    __Pyx_CyFunction_weakreflist(op) = NULL;
    op->func.m_ml = ml;
    op->func.m_self = (PyObject *) op;
    Py_XINCREF(closure);
    op->func_closure = closure;
    Py_XINCREF(module);
    op->func.m_module = module;
    op->func_dict = NULL;
    op->func_name = NULL;
    Py_INCREF(qualname);
    op->func_qualname = qualname;
    op->func_doc = NULL;
    op->func_classobj = NULL;
    op->func_globals = globals;
    Py_INCREF(op->func_globals);
    Py_XINCREF(code);
    op->func_code = code;
    op->defaults_pyobjects = 0;
    op->defaults = NULL;
    op->defaults_tuple = NULL;
    op->defaults_kwdict = NULL;
    op->defaults_getter = NULL;
    op->func_annotations = NULL;
    PyObject_GC_Track(op);
    return (PyObject *) op;
}
static int
__Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
{
    Py_CLEAR(m->func_closure);
    Py_CLEAR(m->func.m_module);
    Py_CLEAR(m->func_dict);
    Py_CLEAR(m->func_name);
    Py_CLEAR(m->func_qualname);
    Py_CLEAR(m->func_doc);
    Py_CLEAR(m->func_globals);
    Py_CLEAR(m->func_code);
    Py_CLEAR(m->func_classobj);
    Py_CLEAR(m->defaults_tuple);
    Py_CLEAR(m->defaults_kwdict);
    Py_CLEAR(m->func_annotations);
    if (m->defaults) {
        PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
        int i;
        for (i = 0; i < m->defaults_pyobjects; i++)
            Py_XDECREF(pydefaults[i]);
        PyObject_Free(m->defaults);
        m->defaults = NULL;
    }
    return 0;
}
static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m)
{
    PyObject_GC_UnTrack(m);
    if (__Pyx_CyFunction_weakreflist(m) != NULL)
        PyObject_ClearWeakRefs((PyObject *) m);
    __Pyx_CyFunction_clear(m);
    PyObject_GC_Del(m);
}
static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg)
{
    Py_VISIT(m->func_closure);
    Py_VISIT(m->func.m_module);
    Py_VISIT(m->func_dict);
    Py_VISIT(m->func_name);
    Py_VISIT(m->func_qualname);
    Py_VISIT(m->func_doc);
    Py_VISIT(m->func_globals);
    Py_VISIT(m->func_code);
    Py_VISIT(m->func_classobj);
    Py_VISIT(m->defaults_tuple);
    Py_VISIT(m->defaults_kwdict);
    if (m->defaults) {
        PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
        int i;
        for (i = 0; i < m->defaults_pyobjects; i++)
            Py_VISIT(pydefaults[i]);
    }
    return 0;
}
static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type)
{
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) {
        Py_INCREF(func);
        return func;
    }
    if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) {
        if (type == NULL)
            type = (PyObject *)(Py_TYPE(obj));
        return __Pyx_PyMethod_New(func, type, (PyObject *)(Py_TYPE(type)));
    }
    if (obj == Py_None)
        obj = NULL;
    return __Pyx_PyMethod_New(func, obj, type);
}
static PyObject*
__Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
{
#if PY_MAJOR_VERSION >= 3
    return PyUnicode_FromFormat("<cyfunction %U at %p>",
                                op->func_qualname, (void *)op);
#else
    return PyString_FromFormat("<cyfunction %s at %p>",
                               PyString_AsString(op->func_qualname), (void *)op);
#endif
}
static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) {
    PyCFunctionObject* f = (PyCFunctionObject*)func;
    PyCFunction meth = f->m_ml->ml_meth;
    Py_ssize_t size;
    switch (f->m_ml->ml_flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) {
    case METH_VARARGS:
        if (likely(kw == NULL || PyDict_Size(kw) == 0))
            return (*meth)(self, arg);
        break;
    case METH_VARARGS | METH_KEYWORDS:
        return (*(PyCFunctionWithKeywords)meth)(self, arg, kw);
    case METH_NOARGS:
        if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
            size = PyTuple_GET_SIZE(arg);
            if (likely(size == 0))
                return (*meth)(self, NULL);
            PyErr_Format(PyExc_TypeError,
                "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)",
                f->m_ml->ml_name, size);
            return NULL;
        }
        break;
    case METH_O:
        if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
            size = PyTuple_GET_SIZE(arg);
            if (likely(size == 1)) {
                PyObject *result, *arg0 = PySequence_ITEM(arg, 0);
                if (unlikely(!arg0)) return NULL;
                result = (*meth)(self, arg0);
                Py_DECREF(arg0);
                return result;
            }
            PyErr_Format(PyExc_TypeError,
                "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)",
                f->m_ml->ml_name, size);
            return NULL;
        }
        break;
    default:
        PyErr_SetString(PyExc_SystemError, "Bad call flags in "
                        "__Pyx_CyFunction_Call. METH_OLDARGS is no "
                        "longer supported!");
        return NULL;
    }
    PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments",
                 f->m_ml->ml_name);
    return NULL;
}
static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
    return __Pyx_CyFunction_CallMethod(func, ((PyCFunctionObject*)func)->m_self, arg, kw);
}
static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) {
    PyObject *result;
    __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func;
    if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) {
        Py_ssize_t argc;
        PyObject *new_args;
        PyObject *self;
        argc = PyTuple_GET_SIZE(args);
        new_args = PyTuple_GetSlice(args, 1, argc);
        if (unlikely(!new_args))
            return NULL;
        self = PyTuple_GetItem(args, 0);
        if (unlikely(!self)) {
            Py_DECREF(new_args);
            return NULL;
        }
        result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw);
        Py_DECREF(new_args);
    } else {
        result = __Pyx_CyFunction_Call(func, args, kw);
    }
    return result;
}
static PyTypeObject __pyx_CyFunctionType_type = {
    PyVarObject_HEAD_INIT(0, 0)
    "cython_function_or_method",
    sizeof(__pyx_CyFunctionObject),
    0,
    (destructor) __Pyx_CyFunction_dealloc,
    0,
    0,
    0,
#if PY_MAJOR_VERSION < 3
    0,
#else
    0,
#endif
    (reprfunc) __Pyx_CyFunction_repr,
    0,
    0,
    0,
    0,
    __Pyx_CyFunction_CallAsMethod,
    0,
    0,
    0,
    0,
    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
    0,
    (traverseproc) __Pyx_CyFunction_traverse,
    (inquiry) __Pyx_CyFunction_clear,
    0,
#if PY_VERSION_HEX < 0x030500A0
    offsetof(__pyx_CyFunctionObject, func_weakreflist),
#else
    offsetof(PyCFunctionObject, m_weakreflist),
#endif
    0,
    0,
    __pyx_CyFunction_methods,
    __pyx_CyFunction_members,
    __pyx_CyFunction_getsets,
    0,
    0,
    __Pyx_CyFunction_descr_get,
    0,
    offsetof(__pyx_CyFunctionObject, func_dict),
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
#if PY_VERSION_HEX >= 0x030400a1
    0,
#endif
};
static int __pyx_CyFunction_init(void) {
    __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type);
    if (__pyx_CyFunctionType == NULL) {
        return -1;
    }
    return 0;
}
static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->defaults = PyObject_Malloc(size);
    if (!m->defaults)
        return PyErr_NoMemory();
    memset(m->defaults, 0, size);
    m->defaults_pyobjects = pyobjects;
    return m->defaults;
}
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->defaults_tuple = tuple;
    Py_INCREF(tuple);
}
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->defaults_kwdict = dict;
    Py_INCREF(dict);
}
static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->func_annotations = dict;
    Py_INCREF(dict);
}

/* SaveResetException */
          #if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
    *type = tstate->exc_type;
    *value = tstate->exc_value;
    *tb = tstate->exc_traceback;
    Py_XINCREF(*type);
    Py_XINCREF(*value);
    Py_XINCREF(*tb);
}
static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = type;
    tstate->exc_value = value;
    tstate->exc_traceback = tb;
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
}
#endif

/* PyErrExceptionMatches */
          #if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
    PyObject *exc_type = tstate->curexc_type;
    if (exc_type == err) return 1;
    if (unlikely(!exc_type)) return 0;
    return PyErr_GivenExceptionMatches(exc_type, err);
}
#endif

/* GetException */
          #if CYTHON_FAST_THREAD_STATE
static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
#else
static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) {
#endif
    PyObject *local_type, *local_value, *local_tb;
#if CYTHON_FAST_THREAD_STATE
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    local_type = tstate->curexc_type;
    local_value = tstate->curexc_value;
    local_tb = tstate->curexc_traceback;
    tstate->curexc_type = 0;
    tstate->curexc_value = 0;
    tstate->curexc_traceback = 0;
#else
    PyErr_Fetch(&local_type, &local_value, &local_tb);
#endif
    PyErr_NormalizeException(&local_type, &local_value, &local_tb);
#if CYTHON_FAST_THREAD_STATE
    if (unlikely(tstate->curexc_type))
#else
    if (unlikely(PyErr_Occurred()))
#endif
        goto bad;
    #if PY_MAJOR_VERSION >= 3
    if (local_tb) {
        if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
            goto bad;
    }
    #endif
    Py_XINCREF(local_tb);
    Py_XINCREF(local_type);
    Py_XINCREF(local_value);
    *type = local_type;
    *value = local_value;
    *tb = local_tb;
#if CYTHON_FAST_THREAD_STATE
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = local_type;
    tstate->exc_value = local_value;
    tstate->exc_traceback = local_tb;
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
#else
    PyErr_SetExcInfo(local_type, local_value, local_tb);
#endif
    return 0;
bad:
    *type = 0;
    *value = 0;
    *tb = 0;
    Py_XDECREF(local_type);
    Py_XDECREF(local_value);
    Py_XDECREF(local_tb);
    return -1;
}

/* PyObjectCallNoArg */
            #if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
#if CYTHON_FAST_PYCALL
    if (PyFunction_Check(func)) {
        return __Pyx_PyFunction_FastCall(func, NULL, 0);
    }
#endif
#ifdef __Pyx_CyFunction_USED
    if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) {
#else
    if (likely(PyCFunction_Check(func))) {
#endif
        if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
            return __Pyx_PyObject_CallMethO(func, NULL);
        }
    }
    return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
}
#endif

/* SwapException */
              #if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = *type;
    tstate->exc_value = *value;
    tstate->exc_traceback = *tb;
    *type = tmp_type;
    *value = tmp_value;
    *tb = tmp_tb;
}
#else
static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb);
    PyErr_SetExcInfo(*type, *value, *tb);
    *type = tmp_type;
    *value = tmp_value;
    *tb = tmp_tb;
}
#endif

/* PyObjectCallMethod1 */
              static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) {
    PyObject *method, *result = NULL;
    method = __Pyx_PyObject_GetAttrStr(obj, method_name);
    if (unlikely(!method)) goto done;
#if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(method))) {
        PyObject *self = PyMethod_GET_SELF(method);
        if (likely(self)) {
            PyObject *args;
            PyObject *function = PyMethod_GET_FUNCTION(method);
            #if CYTHON_FAST_PYCALL
            if (PyFunction_Check(function)) {
                PyObject *args[2] = {self, arg};
                result = __Pyx_PyFunction_FastCall(function, args, 2);
                goto done;
            }
            #endif
            #if CYTHON_FAST_PYCCALL
            if (__Pyx_PyFastCFunction_Check(function)) {
                PyObject *args[2] = {self, arg};
                result = __Pyx_PyCFunction_FastCall(function, args, 2);
                goto done;
            }
            #endif
            args = PyTuple_New(2);
            if (unlikely(!args)) goto done;
            Py_INCREF(self);
            PyTuple_SET_ITEM(args, 0, self);
            Py_INCREF(arg);
            PyTuple_SET_ITEM(args, 1, arg);
            Py_INCREF(function);
            Py_DECREF(method); method = NULL;
            result = __Pyx_PyObject_Call(function, args, NULL);
            Py_DECREF(args);
            Py_DECREF(function);
            return result;
        }
    }
#endif
    result = __Pyx_PyObject_CallOneArg(method, arg);
done:
    Py_XDECREF(method);
    return result;
}

/* CoroutineBase */
              #include <structmember.h>
#include <frameobject.h>
static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value);
static PyObject *__Pyx_Coroutine_Close(PyObject *self);
static PyObject *__Pyx_Coroutine_Throw(PyObject *gen, PyObject *args);
#define __Pyx_Coroutine_Undelegate(gen) Py_CLEAR((gen)->yieldfrom)
#if 1 || PY_VERSION_HEX < 0x030300B0
static int __Pyx_PyGen_FetchStopIterationValue(PyObject **pvalue) {
    PyObject *et, *ev, *tb;
    PyObject *value = NULL;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&et, &ev, &tb);
    if (!et) {
        Py_XDECREF(tb);
        Py_XDECREF(ev);
        Py_INCREF(Py_None);
        *pvalue = Py_None;
        return 0;
    }
    if (likely(et == PyExc_StopIteration)) {
        if (!ev) {
            Py_INCREF(Py_None);
            value = Py_None;
        }
#if PY_VERSION_HEX >= 0x030300A0
        else if (Py_TYPE(ev) == (PyTypeObject*)PyExc_StopIteration) {
            value = ((PyStopIterationObject *)ev)->value;
            Py_INCREF(value);
            Py_DECREF(ev);
        }
#endif
        else if (unlikely(PyTuple_Check(ev))) {
            if (PyTuple_GET_SIZE(ev) >= 1) {
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
                value = PyTuple_GET_ITEM(ev, 0);
                Py_INCREF(value);
#else
                value = PySequence_ITEM(ev, 0);
#endif
            } else {
                Py_INCREF(Py_None);
                value = Py_None;
            }
            Py_DECREF(ev);
        }
        else if (!PyObject_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration)) {
            value = ev;
        }
        if (likely(value)) {
            Py_XDECREF(tb);
            Py_DECREF(et);
            *pvalue = value;
            return 0;
        }
    } else if (!PyErr_GivenExceptionMatches(et, PyExc_StopIteration)) {
        __Pyx_ErrRestore(et, ev, tb);
        return -1;
    }
    PyErr_NormalizeException(&et, &ev, &tb);
    if (unlikely(!PyObject_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration))) {
        __Pyx_ErrRestore(et, ev, tb);
        return -1;
    }
    Py_XDECREF(tb);
    Py_DECREF(et);
#if PY_VERSION_HEX >= 0x030300A0
    value = ((PyStopIterationObject *)ev)->value;
    Py_INCREF(value);
    Py_DECREF(ev);
#else
    {
        PyObject* args = __Pyx_PyObject_GetAttrStr(ev, __pyx_n_s_args);
        Py_DECREF(ev);
        if (likely(args)) {
            value = PySequence_GetItem(args, 0);
            Py_DECREF(args);
        }
        if (unlikely(!value)) {
            __Pyx_ErrRestore(NULL, NULL, NULL);
            Py_INCREF(Py_None);
            value = Py_None;
        }
    }
#endif
    *pvalue = value;
    return 0;
}
#endif
static CYTHON_INLINE
void __Pyx_Coroutine_ExceptionClear(__pyx_CoroutineObject *self) {
    PyObject *exc_type = self->exc_type;
    PyObject *exc_value = self->exc_value;
    PyObject *exc_traceback = self->exc_traceback;
    self->exc_type = NULL;
    self->exc_value = NULL;
    self->exc_traceback = NULL;
    Py_XDECREF(exc_type);
    Py_XDECREF(exc_value);
    Py_XDECREF(exc_traceback);
}
static CYTHON_INLINE
int __Pyx_Coroutine_CheckRunning(__pyx_CoroutineObject *gen) {
    if (unlikely(gen->is_running)) {
        PyErr_SetString(PyExc_ValueError,
                        "generator already executing");
        return 1;
    }
    return 0;
}
static CYTHON_INLINE
PyObject *__Pyx_Coroutine_SendEx(__pyx_CoroutineObject *self, PyObject *value) {
    PyObject *retval;
    __Pyx_PyThreadState_declare
    assert(!self->is_running);
    if (unlikely(self->resume_label == 0)) {
        if (unlikely(value && value != Py_None)) {
            PyErr_SetString(PyExc_TypeError,
                            "can't send non-None value to a "
                            "just-started generator");
            return NULL;
        }
    }
    if (unlikely(self->resume_label == -1)) {
        PyErr_SetNone(PyExc_StopIteration);
        return NULL;
    }
    __Pyx_PyThreadState_assign
    if (value) {
#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_PYSTON
#else
        if (self->exc_traceback) {
            PyTracebackObject *tb = (PyTracebackObject *) self->exc_traceback;
            PyFrameObject *f = tb->tb_frame;
            Py_XINCREF(__pyx_tstate->frame);
            assert(f->f_back == NULL);
            f->f_back = __pyx_tstate->frame;
        }
#endif
        __Pyx_ExceptionSwap(&self->exc_type, &self->exc_value,
                            &self->exc_traceback);
    } else {
        __Pyx_Coroutine_ExceptionClear(self);
    }
    self->is_running = 1;
    retval = self->body((PyObject *) self, value);
    self->is_running = 0;
    if (retval) {
        __Pyx_ExceptionSwap(&self->exc_type, &self->exc_value,
                            &self->exc_traceback);
#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_PYSTON
#else
        if (self->exc_traceback) {
            PyTracebackObject *tb = (PyTracebackObject *) self->exc_traceback;
            PyFrameObject *f = tb->tb_frame;
            Py_CLEAR(f->f_back);
        }
#endif
    } else {
        __Pyx_Coroutine_ExceptionClear(self);
    }
    return retval;
}
static CYTHON_INLINE
PyObject *__Pyx_Coroutine_MethodReturn(PyObject *retval) {
    if (unlikely(!retval && !PyErr_Occurred())) {
        PyErr_SetNone(PyExc_StopIteration);
    }
    return retval;
}
static CYTHON_INLINE
PyObject *__Pyx_Coroutine_FinishDelegation(__pyx_CoroutineObject *gen) {
    PyObject *ret;
    PyObject *val = NULL;
    __Pyx_Coroutine_Undelegate(gen);
    __Pyx_PyGen_FetchStopIterationValue(&val);
    ret = __Pyx_Coroutine_SendEx(gen, val);
    Py_XDECREF(val);
    return ret;
}
static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value) {
    PyObject *retval;
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self;
    PyObject *yf = gen->yieldfrom;
    if (unlikely(__Pyx_Coroutine_CheckRunning(gen)))
        return NULL;
    if (yf) {
        PyObject *ret;
        gen->is_running = 1;
        #ifdef __Pyx_Generator_USED
        if (__Pyx_Generator_CheckExact(yf)) {
            ret = __Pyx_Coroutine_Send(yf, value);
        } else
        #endif
        #ifdef __Pyx_Coroutine_USED
        if (__Pyx_Coroutine_CheckExact(yf)) {
            ret = __Pyx_Coroutine_Send(yf, value);
        } else
        #endif
        {
            if (value == Py_None)
                ret = Py_TYPE(yf)->tp_iternext(yf);
            else
                ret = __Pyx_PyObject_CallMethod1(yf, __pyx_n_s_send, value);
        }
        gen->is_running = 0;
        if (likely(ret)) {
            return ret;
        }
        retval = __Pyx_Coroutine_FinishDelegation(gen);
    } else {
        retval = __Pyx_Coroutine_SendEx(gen, value);
    }
    return __Pyx_Coroutine_MethodReturn(retval);
}
static int __Pyx_Coroutine_CloseIter(__pyx_CoroutineObject *gen, PyObject *yf) {
    PyObject *retval = NULL;
    int err = 0;
    #ifdef __Pyx_Generator_USED
    if (__Pyx_Generator_CheckExact(yf)) {
        retval = __Pyx_Coroutine_Close(yf);
        if (!retval)
            return -1;
    } else
    #endif
    #ifdef __Pyx_Coroutine_USED
    if (__Pyx_Coroutine_CheckExact(yf)) {
        retval = __Pyx_Coroutine_Close(yf);
        if (!retval)
            return -1;
    } else
    #endif
    {
        PyObject *meth;
        gen->is_running = 1;
        meth = __Pyx_PyObject_GetAttrStr(yf, __pyx_n_s_close);
        if (unlikely(!meth)) {
            if (!PyErr_ExceptionMatches(PyExc_AttributeError)) {
                PyErr_WriteUnraisable(yf);
            }
            PyErr_Clear();
        } else {
            retval = PyObject_CallFunction(meth, NULL);
            Py_DECREF(meth);
            if (!retval)
                err = -1;
        }
        gen->is_running = 0;
    }
    Py_XDECREF(retval);
    return err;
}
static PyObject *__Pyx_Generator_Next(PyObject *self) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self;
    PyObject *yf = gen->yieldfrom;
    if (unlikely(__Pyx_Coroutine_CheckRunning(gen)))
        return NULL;
    if (yf) {
        PyObject *ret;
        gen->is_running = 1;
        #ifdef __Pyx_Generator_USED
        if (__Pyx_Generator_CheckExact(yf)) {
            ret = __Pyx_Generator_Next(yf);
        } else
        #endif
            ret = Py_TYPE(yf)->tp_iternext(yf);
        gen->is_running = 0;
        if (likely(ret)) {
            return ret;
        }
        return __Pyx_Coroutine_FinishDelegation(gen);
    }
    return __Pyx_Coroutine_SendEx(gen, Py_None);
}
static PyObject *__Pyx_Coroutine_Close(PyObject *self) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    PyObject *retval, *raised_exception;
    PyObject *yf = gen->yieldfrom;
    int err = 0;
    if (unlikely(__Pyx_Coroutine_CheckRunning(gen)))
        return NULL;
    if (yf) {
        Py_INCREF(yf);
        err = __Pyx_Coroutine_CloseIter(gen, yf);
        __Pyx_Coroutine_Undelegate(gen);
        Py_DECREF(yf);
    }
    if (err == 0)
        PyErr_SetNone(PyExc_GeneratorExit);
    retval = __Pyx_Coroutine_SendEx(gen, NULL);
    if (retval) {
        Py_DECREF(retval);
        PyErr_SetString(PyExc_RuntimeError,
                        "generator ignored GeneratorExit");
        return NULL;
    }
    raised_exception = PyErr_Occurred();
    if (!raised_exception
        || raised_exception == PyExc_StopIteration
        || raised_exception == PyExc_GeneratorExit
        || PyErr_GivenExceptionMatches(raised_exception, PyExc_GeneratorExit)
        || PyErr_GivenExceptionMatches(raised_exception, PyExc_StopIteration))
    {
        if (raised_exception) PyErr_Clear();
        Py_INCREF(Py_None);
        return Py_None;
    }
    return NULL;
}
static PyObject *__Pyx_Coroutine_Throw(PyObject *self, PyObject *args) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    PyObject *typ;
    PyObject *tb = NULL;
    PyObject *val = NULL;
    PyObject *yf = gen->yieldfrom;
    if (!PyArg_UnpackTuple(args, (char *)"throw", 1, 3, &typ, &val, &tb))
        return NULL;
    if (unlikely(__Pyx_Coroutine_CheckRunning(gen)))
        return NULL;
    if (yf) {
        PyObject *ret;
        Py_INCREF(yf);
        if (PyErr_GivenExceptionMatches(typ, PyExc_GeneratorExit)) {
            int err = __Pyx_Coroutine_CloseIter(gen, yf);
            Py_DECREF(yf);
            __Pyx_Coroutine_Undelegate(gen);
            if (err < 0)
                return __Pyx_Coroutine_MethodReturn(__Pyx_Coroutine_SendEx(gen, NULL));
            goto throw_here;
        }
        gen->is_running = 1;
        #ifdef __Pyx_Generator_USED
        if (__Pyx_Generator_CheckExact(yf)) {
            ret = __Pyx_Coroutine_Throw(yf, args);
        } else
        #endif
        #ifdef __Pyx_Coroutine_USED
        if (__Pyx_Coroutine_CheckExact(yf)) {
            ret = __Pyx_Coroutine_Throw(yf, args);
        } else
        #endif
        {
            PyObject *meth = __Pyx_PyObject_GetAttrStr(yf, __pyx_n_s_throw);
            if (unlikely(!meth)) {
                Py_DECREF(yf);
                if (!PyErr_ExceptionMatches(PyExc_AttributeError)) {
                    gen->is_running = 0;
                    return NULL;
                }
                PyErr_Clear();
                __Pyx_Coroutine_Undelegate(gen);
                gen->is_running = 0;
                goto throw_here;
            }
            ret = PyObject_CallObject(meth, args);
            Py_DECREF(meth);
        }
        gen->is_running = 0;
        Py_DECREF(yf);
        if (!ret) {
            ret = __Pyx_Coroutine_FinishDelegation(gen);
        }
        return __Pyx_Coroutine_MethodReturn(ret);
    }
throw_here:
    __Pyx_Raise(typ, val, tb, NULL);
    return __Pyx_Coroutine_MethodReturn(__Pyx_Coroutine_SendEx(gen, NULL));
}
static int __Pyx_Coroutine_traverse(PyObject *self, visitproc visit, void *arg) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    Py_VISIT(gen->closure);
    Py_VISIT(gen->classobj);
    Py_VISIT(gen->yieldfrom);
    Py_VISIT(gen->exc_type);
    Py_VISIT(gen->exc_value);
    Py_VISIT(gen->exc_traceback);
    return 0;
}
static int __Pyx_Coroutine_clear(PyObject *self) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    Py_CLEAR(gen->closure);
    Py_CLEAR(gen->classobj);
    Py_CLEAR(gen->yieldfrom);
    Py_CLEAR(gen->exc_type);
    Py_CLEAR(gen->exc_value);
    Py_CLEAR(gen->exc_traceback);
    Py_CLEAR(gen->gi_name);
    Py_CLEAR(gen->gi_qualname);
    return 0;
}
static void __Pyx_Coroutine_dealloc(PyObject *self) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    PyObject_GC_UnTrack(gen);
    if (gen->gi_weakreflist != NULL)
        PyObject_ClearWeakRefs(self);
    if (gen->resume_label > 0) {
        PyObject_GC_Track(self);
#if PY_VERSION_HEX >= 0x030400a1
        if (PyObject_CallFinalizerFromDealloc(self))
#else
        Py_TYPE(gen)->tp_del(self);
        if (self->ob_refcnt > 0)
#endif
        {
            return;
        }
        PyObject_GC_UnTrack(self);
    }
    __Pyx_Coroutine_clear(self);
    PyObject_GC_Del(gen);
}
static void __Pyx_Coroutine_del(PyObject *self) {
    PyObject *res;
    PyObject *error_type, *error_value, *error_traceback;
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    __Pyx_PyThreadState_declare
    if (gen->resume_label <= 0)
        return ;
#if PY_VERSION_HEX < 0x030400a1
    assert(self->ob_refcnt == 0);
    self->ob_refcnt = 1;
#endif
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&error_type, &error_value, &error_traceback);
    res = __Pyx_Coroutine_Close(self);
    if (res == NULL)
        PyErr_WriteUnraisable(self);
    else
        Py_DECREF(res);
    __Pyx_ErrRestore(error_type, error_value, error_traceback);
#if PY_VERSION_HEX < 0x030400a1
    assert(self->ob_refcnt > 0);
    if (--self->ob_refcnt == 0) {
        return;
    }
    {
        Py_ssize_t refcnt = self->ob_refcnt;
        _Py_NewReference(self);
        self->ob_refcnt = refcnt;
    }
#if CYTHON_COMPILING_IN_CPYTHON
    assert(PyType_IS_GC(self->ob_type) &&
           _Py_AS_GC(self)->gc.gc_refs != _PyGC_REFS_UNTRACKED);
    _Py_DEC_REFTOTAL;
#endif
#ifdef COUNT_ALLOCS
    --Py_TYPE(self)->tp_frees;
    --Py_TYPE(self)->tp_allocs;
#endif
#endif
}
static PyObject *
__Pyx_Coroutine_get_name(__pyx_CoroutineObject *self)
{
    PyObject *name = self->gi_name;
    if (unlikely(!name)) name = Py_None;
    Py_INCREF(name);
    return name;
}
static int
__Pyx_Coroutine_set_name(__pyx_CoroutineObject *self, PyObject *value)
{
    PyObject *tmp;
#if PY_MAJOR_VERSION >= 3
    if (unlikely(value == NULL || !PyUnicode_Check(value))) {
#else
    if (unlikely(value == NULL || !PyString_Check(value))) {
#endif
        PyErr_SetString(PyExc_TypeError,
                        "__name__ must be set to a string object");
        return -1;
    }
    tmp = self->gi_name;
    Py_INCREF(value);
    self->gi_name = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_Coroutine_get_qualname(__pyx_CoroutineObject *self)
{
    PyObject *name = self->gi_qualname;
    if (unlikely(!name)) name = Py_None;
    Py_INCREF(name);
    return name;
}
static int
__Pyx_Coroutine_set_qualname(__pyx_CoroutineObject *self, PyObject *value)
{
    PyObject *tmp;
#if PY_MAJOR_VERSION >= 3
    if (unlikely(value == NULL || !PyUnicode_Check(value))) {
#else
    if (unlikely(value == NULL || !PyString_Check(value))) {
#endif
        PyErr_SetString(PyExc_TypeError,
                        "__qualname__ must be set to a string object");
        return -1;
    }
    tmp = self->gi_qualname;
    Py_INCREF(value);
    self->gi_qualname = value;
    Py_XDECREF(tmp);
    return 0;
}
static __pyx_CoroutineObject *__Pyx__Coroutine_New(
            PyTypeObject* type, __pyx_coroutine_body_t body, PyObject *closure,
            PyObject *name, PyObject *qualname, PyObject *module_name) {
    __pyx_CoroutineObject *gen = PyObject_GC_New(__pyx_CoroutineObject, type);
    if (gen == NULL)
        return NULL;
    gen->body = body;
    gen->closure = closure;
    Py_XINCREF(closure);
    gen->is_running = 0;
    gen->resume_label = 0;
    gen->classobj = NULL;
    gen->yieldfrom = NULL;
    gen->exc_type = NULL;
    gen->exc_value = NULL;
    gen->exc_traceback = NULL;
    gen->gi_weakreflist = NULL;
    Py_XINCREF(qualname);
    gen->gi_qualname = qualname;
    Py_XINCREF(name);
    gen->gi_name = name;
    Py_XINCREF(module_name);
    gen->gi_modulename = module_name;
    PyObject_GC_Track(gen);
    return gen;
}

/* PatchModuleWithCoroutine */
                  static PyObject* __Pyx_Coroutine_patch_module(PyObject* module, const char* py_code) {
#if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
    int result;
    PyObject *globals, *result_obj;
    globals = PyDict_New();  if (unlikely(!globals)) goto ignore;
    result = PyDict_SetItemString(globals, "_cython_coroutine_type",
    #ifdef __Pyx_Coroutine_USED
        (PyObject*)__pyx_CoroutineType);
    #else
        Py_None);
    #endif
    if (unlikely(result < 0)) goto ignore;
    result = PyDict_SetItemString(globals, "_cython_generator_type",
    #ifdef __Pyx_Generator_USED
        (PyObject*)__pyx_GeneratorType);
    #else
        Py_None);
    #endif
    if (unlikely(result < 0)) goto ignore;
    if (unlikely(PyDict_SetItemString(globals, "_module", module) < 0)) goto ignore;
    if (unlikely(PyDict_SetItemString(globals, "__builtins__", __pyx_b) < 0)) goto ignore;
    result_obj = PyRun_String(py_code, Py_file_input, globals, globals);
    if (unlikely(!result_obj)) goto ignore;
    Py_DECREF(result_obj);
    Py_DECREF(globals);
    return module;
ignore:
    Py_XDECREF(globals);
    PyErr_WriteUnraisable(module);
    if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning, "Cython module failed to patch module with custom type", 1) < 0)) {
        Py_DECREF(module);
        module = NULL;
    }
#else
    py_code++;
#endif
    return module;
}

/* PatchGeneratorABC */
                  #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
static PyObject* __Pyx_patch_abc_module(PyObject *module);
static PyObject* __Pyx_patch_abc_module(PyObject *module) {
    module = __Pyx_Coroutine_patch_module(
        module, ""
"if _cython_generator_type is not None:\n"
"    try: Generator = _module.Generator\n"
"    except AttributeError: pass\n"
"    else: Generator.register(_cython_generator_type)\n"
"if _cython_coroutine_type is not None:\n"
"    try: Coroutine = _module.Coroutine\n"
"    except AttributeError: pass\n"
"    else: Coroutine.register(_cython_coroutine_type)\n"
    );
    return module;
}
#endif
static int __Pyx_patch_abc(void) {
#if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
    static int abc_patched = 0;
    if (!abc_patched) {
        PyObject *module;
        module = PyImport_ImportModule((PY_VERSION_HEX >= 0x03030000) ? "collections.abc" : "collections");
        if (!module) {
            PyErr_WriteUnraisable(NULL);
            if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning,
                    ((PY_VERSION_HEX >= 0x03030000) ?
                        "Cython module failed to register with collections.abc module" :
                        "Cython module failed to register with collections module"), 1) < 0)) {
                return -1;
            }
        } else {
            module = __Pyx_patch_abc_module(module);
            abc_patched = 1;
            if (unlikely(!module))
                return -1;
            Py_DECREF(module);
        }
        module = PyImport_ImportModule("backports_abc");
        if (module) {
            module = __Pyx_patch_abc_module(module);
            Py_XDECREF(module);
        }
        if (!module) {
            PyErr_Clear();
        }
    }
#else
    if (0) __Pyx_Coroutine_patch_module(NULL, NULL);
#endif
    return 0;
}

/* Coroutine */
                  typedef struct {
    PyObject_HEAD
    PyObject *coroutine;
} __pyx_CoroutineAwaitObject;
static void __Pyx_CoroutineAwait_dealloc(PyObject *self) {
    PyObject_GC_UnTrack(self);
    Py_CLEAR(((__pyx_CoroutineAwaitObject*)self)->coroutine);
    PyObject_GC_Del(self);
}
static int __Pyx_CoroutineAwait_traverse(__pyx_CoroutineAwaitObject *self, visitproc visit, void *arg) {
    Py_VISIT(self->coroutine);
    return 0;
}
static int __Pyx_CoroutineAwait_clear(__pyx_CoroutineAwaitObject *self) {
    Py_CLEAR(self->coroutine);
    return 0;
}
static PyObject *__Pyx_CoroutineAwait_Next(__pyx_CoroutineAwaitObject *self) {
    return __Pyx_Generator_Next(self->coroutine);
}
static PyObject *__Pyx_CoroutineAwait_Send(__pyx_CoroutineAwaitObject *self, PyObject *value) {
    return __Pyx_Coroutine_Send(self->coroutine, value);
}
static PyObject *__Pyx_CoroutineAwait_Throw(__pyx_CoroutineAwaitObject *self, PyObject *args) {
    return __Pyx_Coroutine_Throw(self->coroutine, args);
}
static PyObject *__Pyx_CoroutineAwait_Close(__pyx_CoroutineAwaitObject *self) {
    return __Pyx_Coroutine_Close(self->coroutine);
}
static PyObject *__Pyx_CoroutineAwait_self(PyObject *self) {
    Py_INCREF(self);
    return self;
}
#if !CYTHON_COMPILING_IN_PYPY
static PyObject *__Pyx_CoroutineAwait_no_new(CYTHON_UNUSED PyTypeObject *type, CYTHON_UNUSED PyObject *args, CYTHON_UNUSED PyObject *kwargs) {
    PyErr_SetString(PyExc_TypeError, "cannot instantiate type, use 'await coroutine' instead");
    return NULL;
}
#endif
static PyMethodDef __pyx_CoroutineAwait_methods[] = {
    {"send", (PyCFunction) __Pyx_CoroutineAwait_Send, METH_O,
     (char*) PyDoc_STR("send(arg) -> send 'arg' into coroutine,\nreturn next yielded value or raise StopIteration.")},
    {"throw", (PyCFunction) __Pyx_CoroutineAwait_Throw, METH_VARARGS,
     (char*) PyDoc_STR("throw(typ[,val[,tb]]) -> raise exception in coroutine,\nreturn next yielded value or raise StopIteration.")},
    {"close", (PyCFunction) __Pyx_CoroutineAwait_Close, METH_NOARGS,
     (char*) PyDoc_STR("close() -> raise GeneratorExit inside coroutine.")},
    {0, 0, 0, 0}
};
static PyTypeObject __pyx_CoroutineAwaitType_type = {
    PyVarObject_HEAD_INIT(0, 0)
    "coroutine_wrapper",
    sizeof(__pyx_CoroutineAwaitObject),
    0,
    (destructor) __Pyx_CoroutineAwait_dealloc,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
    PyDoc_STR("A wrapper object implementing __await__ for coroutines."),
    (traverseproc) __Pyx_CoroutineAwait_traverse,
    (inquiry) __Pyx_CoroutineAwait_clear,
    0,
    0,
    __Pyx_CoroutineAwait_self,
    (iternextfunc) __Pyx_CoroutineAwait_Next,
    __pyx_CoroutineAwait_methods,
    0                         ,
    0                      ,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
#if !CYTHON_COMPILING_IN_PYPY
    __Pyx_CoroutineAwait_no_new,
#else
    0,
#endif
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
#if PY_VERSION_HEX >= 0x030400a1
    0,
#endif
};
static CYTHON_INLINE PyObject *__Pyx__Coroutine_await(PyObject *coroutine) {
#if CYTHON_COMPILING_IN_CPYTHON
    __pyx_CoroutineAwaitObject *await = PyObject_GC_New(__pyx_CoroutineAwaitObject, __pyx_CoroutineAwaitType);
#else
    __pyx_CoroutineAwaitObject *await = (__pyx_CoroutineAwaitObject*)
        __pyx_CoroutineAwaitType->tp_new(__pyx_CoroutineAwaitType, __pyx_empty_tuple, NULL);
#endif
    if (unlikely(!await)) return NULL;
    Py_INCREF(coroutine);
    await->coroutine = coroutine;
#if CYTHON_COMPILING_IN_CPYTHON
    PyObject_GC_Track(await);
#endif
    return (PyObject*)await;
}
static PyObject *__Pyx_Coroutine_await(PyObject *coroutine) {
    if (unlikely(!coroutine || !__Pyx_Coroutine_CheckExact(coroutine))) {
        PyErr_SetString(PyExc_TypeError, "invalid input, expected coroutine");
        return NULL;
    }
    return __Pyx__Coroutine_await(coroutine);
}
static void __Pyx_Coroutine_check_and_dealloc(PyObject *self) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    if (gen->resume_label == 0 && !PyErr_Occurred()) {
        PyObject_GC_UnTrack(self);
#if PY_VERSION_HEX >= 0x03030000 || defined(PyErr_WarnFormat)
        PyErr_WarnFormat(PyExc_RuntimeWarning, 1, "coroutine '%.50S' was never awaited", gen->gi_qualname);
        PyErr_Clear();
#else
        {PyObject *msg;
        char *cmsg;
        #if CYTHON_COMPILING_IN_PYPY
        msg = NULL;
        cmsg = (char*) "coroutine was never awaited";
        #else
        char *cname;
        PyObject *qualname;
        #if PY_MAJOR_VERSION >= 3
        qualname = PyUnicode_AsUTF8String(gen->gi_qualname);
        if (likely(qualname)) {
            cname = PyBytes_AS_STRING(qualname);
        } else {
            PyErr_Clear();
            cname = (char*) "?";
        }
        msg = PyBytes_FromFormat(
        #else
        qualname = gen->gi_qualname;
        cname = PyString_AS_STRING(qualname);
        msg = PyString_FromFormat(
        #endif
            "coroutine '%.50s' was never awaited", cname);
        #if PY_MAJOR_VERSION >= 3
        Py_XDECREF(qualname);
        #endif
        if (unlikely(!msg)) {
            PyErr_Clear();
            cmsg = (char*) "coroutine was never awaited";
        } else {
            #if PY_MAJOR_VERSION >= 3
            cmsg = PyBytes_AS_STRING(msg);
            #else
            cmsg = PyString_AS_STRING(msg);
            #endif
        }
        #endif
        if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning, cmsg, 1) < 0))
            PyErr_WriteUnraisable(self);
        Py_XDECREF(msg);}
#endif
        PyObject_GC_Track(self);
    }
    __Pyx_Coroutine_dealloc(self);
}
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 && PY_VERSION_HEX < 0x030500B1
static PyObject *__Pyx_Coroutine_compare(PyObject *obj, PyObject *other, int op) {
    PyObject* result;
    switch (op) {
        case Py_EQ: result = (other == obj) ? Py_True : Py_False; break;
        case Py_NE: result = (other != obj) ? Py_True : Py_False; break;
        default:
            result = Py_NotImplemented;
    }
    Py_INCREF(result);
    return result;
}
#endif
static PyMethodDef __pyx_Coroutine_methods[] = {
    {"send", (PyCFunction) __Pyx_Coroutine_Send, METH_O,
     (char*) PyDoc_STR("send(arg) -> send 'arg' into coroutine,\nreturn next iterated value or raise StopIteration.")},
    {"throw", (PyCFunction) __Pyx_Coroutine_Throw, METH_VARARGS,
     (char*) PyDoc_STR("throw(typ[,val[,tb]]) -> raise exception in coroutine,\nreturn next iterated value or raise StopIteration.")},
    {"close", (PyCFunction) __Pyx_Coroutine_Close, METH_NOARGS,
     (char*) PyDoc_STR("close() -> raise GeneratorExit inside coroutine.")},
#if PY_VERSION_HEX < 0x030500B1
    {"__await__", (PyCFunction) __Pyx_Coroutine_await, METH_NOARGS,
     (char*) PyDoc_STR("__await__() -> return an iterator to be used in await expression.")},
#endif
    {0, 0, 0, 0}
};
static PyMemberDef __pyx_Coroutine_memberlist[] = {
    {(char *) "cr_running", T_BOOL, offsetof(__pyx_CoroutineObject, is_running), READONLY, NULL},
    {(char*) "cr_await", T_OBJECT, offsetof(__pyx_CoroutineObject, yieldfrom), READONLY,
     (char*) PyDoc_STR("object being awaited, or None")},
    {(char *) "__module__", T_OBJECT, offsetof(__pyx_CoroutineObject, gi_modulename), PY_WRITE_RESTRICTED, 0},
    {0, 0, 0, 0, 0}
};
static PyGetSetDef __pyx_Coroutine_getsets[] = {
    {(char *) "__name__", (getter)__Pyx_Coroutine_get_name, (setter)__Pyx_Coroutine_set_name,
     (char*) PyDoc_STR("name of the coroutine"), 0},
    {(char *) "__qualname__", (getter)__Pyx_Coroutine_get_qualname, (setter)__Pyx_Coroutine_set_qualname,
     (char*) PyDoc_STR("qualified name of the coroutine"), 0},
    {0, 0, 0, 0, 0}
};
#if CYTHON_USE_ASYNC_SLOTS
static __Pyx_PyAsyncMethodsStruct __pyx_Coroutine_as_async = {
    __Pyx_Coroutine_await,
    0,
    0,
};
#endif
static PyTypeObject __pyx_CoroutineType_type = {
    PyVarObject_HEAD_INIT(0, 0)
    "coroutine",
    sizeof(__pyx_CoroutineObject),
    0,
    (destructor) __Pyx_Coroutine_check_and_dealloc,
    0,
    0,
    0,
#if CYTHON_USE_ASYNC_SLOTS
    &__pyx_Coroutine_as_async,
#else
    0,
#endif
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_HAVE_FINALIZE,
    0,
    (traverseproc) __Pyx_Coroutine_traverse,
    0,
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 && PY_VERSION_HEX < 0x030500B1
    __Pyx_Coroutine_compare,
#else
    0,
#endif
            offsetof(__pyx_CoroutineObject, gi_weakreflist),
            __Pyx_Coroutine_await, /* tp_iter */
            (iternextfunc) __Pyx_Generator_Next, /* tp_iternext */
            __pyx_Coroutine_methods,
            __pyx_Coroutine_memberlist,
            __pyx_Coroutine_getsets,
            
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
#if PY_VERSION_HEX >= 0x030400a1
    0,
#else
    __Pyx_Coroutine_del,
#endif
    0,
#if PY_VERSION_HEX >= 0x030400a1
    __Pyx_Coroutine_del,
#endif
};
static int __pyx_Coroutine_init(void) {
    __pyx_CoroutineType_type.tp_getattro = PyObject_GenericGetAttr;
    __pyx_CoroutineType = __Pyx_FetchCommonType(&__pyx_CoroutineType_type);
    if (unlikely(!__pyx_CoroutineType))
        return -1;
    __pyx_CoroutineAwaitType = __Pyx_FetchCommonType(&__pyx_CoroutineAwaitType_type);
    if (unlikely(!__pyx_CoroutineAwaitType))
        return -1;
    return 0;
}

/* GetAwaitIter */
                  static CYTHON_INLINE PyObject *__Pyx_Coroutine_GetAwaitableIter(PyObject *o) {
#ifdef __Pyx_Coroutine_USED
    if (__Pyx_Coroutine_CheckExact(o)) {
        Py_INCREF(o);
        return o;
    }
#endif
    return __Pyx__Coroutine_GetAwaitableIter(o);
}
static PyObject *__Pyx__Coroutine_GetAwaitableIter(PyObject *obj) {
    PyObject *res;
#if CYTHON_USE_ASYNC_SLOTS
    __Pyx_PyAsyncMethodsStruct* am = __Pyx_PyType_AsAsync(obj);
    if (likely(am && am->am_await)) {
        res = (*am->am_await)(obj);
    } else
#endif
#if PY_VERSION_HEX >= 0x030500B2 || defined(PyCoro_CheckExact)
    if (PyCoro_CheckExact(obj)) {
        Py_INCREF(obj);
        return obj;
    } else
#endif
#if CYTHON_COMPILING_IN_CPYTHON && defined(CO_ITERABLE_COROUTINE)
    if (PyGen_CheckExact(obj) && ((PyGenObject*)obj)->gi_code && ((PyCodeObject *)((PyGenObject*)obj)->gi_code)->co_flags & CO_ITERABLE_COROUTINE) {
        Py_INCREF(obj);
        return obj;
    } else
#endif
    {
        PyObject *method = __Pyx_PyObject_GetAttrStr(obj, __pyx_n_s_await);
        if (unlikely(!method)) goto slot_error;
        #if CYTHON_UNPACK_METHODS
        if (likely(PyMethod_Check(method))) {
            PyObject *self = PyMethod_GET_SELF(method);
            if (likely(self)) {
                PyObject *function = PyMethod_GET_FUNCTION(method);
                res = __Pyx_PyObject_CallOneArg(function, self);
            } else
                res = __Pyx_PyObject_CallNoArg(method);
        } else
        #endif
            res = __Pyx_PyObject_CallNoArg(method);
        Py_DECREF(method);
    }
    if (unlikely(!res)) goto bad;
    if (!PyIter_Check(res)) {
        PyErr_Format(PyExc_TypeError,
                     "__await__() returned non-iterator of type '%.100s'",
                     Py_TYPE(res)->tp_name);
        Py_CLEAR(res);
    } else {
        int is_coroutine = 0;
        #ifdef __Pyx_Coroutine_USED
        is_coroutine |= __Pyx_Coroutine_CheckExact(res);
        #endif
        #if PY_VERSION_HEX >= 0x030500B2 || defined(PyCoro_CheckExact)
        is_coroutine |= PyCoro_CheckExact(res);
        #endif
        if (unlikely(is_coroutine)) {
            /* __await__ must return an *iterator*, not
               a coroutine or another awaitable (see PEP 492) */
            PyErr_SetString(PyExc_TypeError,
                            "__await__() returned a coroutine");
            Py_CLEAR(res);
        }
    }
    return res;
slot_error:
    PyErr_Format(PyExc_TypeError,
                 "object %.100s can't be used in 'await' expression",
                 Py_TYPE(obj)->tp_name);
bad:
    return NULL;
}

/* CoroutineYieldFrom */
                  static int __Pyx_WarnAIterDeprecation(PyObject *aiter) {
    int result;
#if PY_MAJOR_VERSION >= 3
    result = PyErr_WarnFormat(
        PyExc_PendingDeprecationWarning, 1,
        "'%.100s' implements legacy __aiter__ protocol; "
        "__aiter__ should return an asynchronous "
        "iterator, not awaitable",
        Py_TYPE(aiter)->tp_name);
#else
    result = PyErr_WarnEx(
        PyExc_PendingDeprecationWarning,
        "object implements legacy __aiter__ protocol; "
        "__aiter__ should return an asynchronous "
        "iterator, not awaitable",
        1);
#endif
    return result != 0;
}
static CYTHON_INLINE PyObject* __Pyx__Coroutine_Yield_From(__pyx_CoroutineObject *gen, PyObject *source, int warn) {
    PyObject *retval;
    if (__Pyx_Coroutine_CheckExact(source)) {
        if (warn && unlikely(__Pyx_WarnAIterDeprecation(source))) {
            return NULL;
        }
        retval = __Pyx_Generator_Next(source);
        if (retval) {
            Py_INCREF(source);
            gen->yieldfrom = source;
            return retval;
        }
    } else {
        PyObject *source_gen = __Pyx__Coroutine_GetAwaitableIter(source);
        if (unlikely(!source_gen))
            return NULL;
        if (warn && unlikely(__Pyx_WarnAIterDeprecation(source))) {
            Py_DECREF(source_gen);
            return NULL;
        }
        if (__Pyx_Coroutine_CheckExact(source_gen)) {
            retval = __Pyx_Generator_Next(source_gen);
        } else {
            retval = Py_TYPE(source_gen)->tp_iternext(source_gen);
        }
        if (retval) {
            gen->yieldfrom = source_gen;
            return retval;
        }
        Py_DECREF(source_gen);
    }
    return NULL;
}

/* ReturnWithStopIteration */
                  static void __Pyx__ReturnWithStopIteration(PyObject* value) {
    PyObject *exc, *args;
#if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_PYSTON
    __Pyx_PyThreadState_declare
    if ((PY_VERSION_HEX >= 0x03030000 && PY_VERSION_HEX < 0x030500B1) || unlikely(PyTuple_Check(value))) {
        args = PyTuple_New(1);
        if (unlikely(!args)) return;
        Py_INCREF(value);
        PyTuple_SET_ITEM(args, 0, value);
        exc = PyType_Type.tp_call(PyExc_StopIteration, args, NULL);
        Py_DECREF(args);
        if (!exc) return;
    } else {
        Py_INCREF(value);
        exc = value;
    }
    __Pyx_PyThreadState_assign
    if (!__pyx_tstate->exc_type) {
        Py_INCREF(PyExc_StopIteration);
        __Pyx_ErrRestore(PyExc_StopIteration, exc, NULL);
        return;
    }
#else
    args = PyTuple_Pack(1, value);
    if (unlikely(!args)) return;
    exc = PyObject_Call(PyExc_StopIteration, args, NULL);
    Py_DECREF(args);
    if (unlikely(!exc)) return;
#endif
    PyErr_SetObject(PyExc_StopIteration, exc);
    Py_DECREF(exc);
}

/* SliceObject */
                  static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(PyObject* obj,
        Py_ssize_t cstart, Py_ssize_t cstop,
        PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice,
        int has_cstart, int has_cstop, CYTHON_UNUSED int wraparound) {
#if CYTHON_USE_TYPE_SLOTS
    PyMappingMethods* mp;
#if PY_MAJOR_VERSION < 3
    PySequenceMethods* ms = Py_TYPE(obj)->tp_as_sequence;
    if (likely(ms && ms->sq_slice)) {
        if (!has_cstart) {
            if (_py_start && (*_py_start != Py_None)) {
                cstart = __Pyx_PyIndex_AsSsize_t(*_py_start);
                if ((cstart == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
            } else
                cstart = 0;
        }
        if (!has_cstop) {
            if (_py_stop && (*_py_stop != Py_None)) {
                cstop = __Pyx_PyIndex_AsSsize_t(*_py_stop);
                if ((cstop == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
            } else
                cstop = PY_SSIZE_T_MAX;
        }
        if (wraparound && unlikely((cstart < 0) | (cstop < 0)) && likely(ms->sq_length)) {
            Py_ssize_t l = ms->sq_length(obj);
            if (likely(l >= 0)) {
                if (cstop < 0) {
                    cstop += l;
                    if (cstop < 0) cstop = 0;
                }
                if (cstart < 0) {
                    cstart += l;
                    if (cstart < 0) cstart = 0;
                }
            } else {
                if (!PyErr_ExceptionMatches(PyExc_OverflowError))
                    goto bad;
                PyErr_Clear();
            }
        }
        return ms->sq_slice(obj, cstart, cstop);
    }
#endif
    mp = Py_TYPE(obj)->tp_as_mapping;
    if (likely(mp && mp->mp_subscript))
#endif
    {
        PyObject* result;
        PyObject *py_slice, *py_start, *py_stop;
        if (_py_slice) {
            py_slice = *_py_slice;
        } else {
            PyObject* owned_start = NULL;
            PyObject* owned_stop = NULL;
            if (_py_start) {
                py_start = *_py_start;
            } else {
                if (has_cstart) {
                    owned_start = py_start = PyInt_FromSsize_t(cstart);
                    if (unlikely(!py_start)) goto bad;
                } else
                    py_start = Py_None;
            }
            if (_py_stop) {
                py_stop = *_py_stop;
            } else {
                if (has_cstop) {
                    owned_stop = py_stop = PyInt_FromSsize_t(cstop);
                    if (unlikely(!py_stop)) {
                        Py_XDECREF(owned_start);
                        goto bad;
                    }
                } else
                    py_stop = Py_None;
            }
            py_slice = PySlice_New(py_start, py_stop, Py_None);
            Py_XDECREF(owned_start);
            Py_XDECREF(owned_stop);
            if (unlikely(!py_slice)) goto bad;
        }
#if CYTHON_USE_TYPE_SLOTS
        result = mp->mp_subscript(obj, py_slice);
#else
        result = PyObject_GetItem(obj, py_slice);
#endif
        if (!_py_slice) {
            Py_DECREF(py_slice);
        }
        return result;
    }
    PyErr_Format(PyExc_TypeError,
        "'%.200s' object is unsliceable", Py_TYPE(obj)->tp_name);
bad:
    return NULL;
}

/* None */
                  static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname) {
    PyErr_Format(PyExc_NameError, "free variable '%s' referenced before assignment in enclosing scope", varname);
}

/* SetVTable */
                  static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
#if PY_VERSION_HEX >= 0x02070000
    PyObject *ob = PyCapsule_New(vtable, 0, 0);
#else
    PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
#endif
    if (!ob)
        goto bad;
    if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0)
        goto bad;
    Py_DECREF(ob);
    return 0;
bad:
    Py_XDECREF(ob);
    return -1;
}

/* Import */
                  static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
    PyObject *empty_list = 0;
    PyObject *module = 0;
    PyObject *global_dict = 0;
    PyObject *empty_dict = 0;
    PyObject *list;
    #if PY_VERSION_HEX < 0x03030000
    PyObject *py_import;
    py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
    if (!py_import)
        goto bad;
    #endif
    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;
    {
        #if PY_MAJOR_VERSION >= 3
        if (level == -1) {
            if (strchr(__Pyx_MODULE_NAME, '.')) {
                #if PY_VERSION_HEX < 0x03030000
                PyObject *py_level = PyInt_FromLong(1);
                if (!py_level)
                    goto bad;
                module = PyObject_CallFunctionObjArgs(py_import,
                    name, global_dict, empty_dict, list, py_level, NULL);
                Py_DECREF(py_level);
                #else
                module = PyImport_ImportModuleLevelObject(
                    name, global_dict, empty_dict, list, 1);
                #endif
                if (!module) {
                    if (!PyErr_ExceptionMatches(PyExc_ImportError))
                        goto bad;
                    PyErr_Clear();
                }
            }
            level = 0;
        }
        #endif
        if (!module) {
            #if PY_VERSION_HEX < 0x03030000
            PyObject *py_level = PyInt_FromLong(level);
            if (!py_level)
                goto bad;
            module = PyObject_CallFunctionObjArgs(py_import,
                name, global_dict, empty_dict, list, py_level, NULL);
            Py_DECREF(py_level);
            #else
            module = PyImport_ImportModuleLevelObject(
                name, global_dict, empty_dict, list, level);
            #endif
        }
    }
bad:
    #if PY_VERSION_HEX < 0x03030000
    Py_XDECREF(py_import);
    #endif
    Py_XDECREF(empty_list);
    Py_XDECREF(empty_dict);
    return module;
}

/* PatchInspect */
                  static PyObject* __Pyx_patch_inspect(PyObject* module) {
#if defined(__Pyx_Generator_USED) && (!defined(CYTHON_PATCH_INSPECT) || CYTHON_PATCH_INSPECT)
    static int inspect_patched = 0;
    if (unlikely((!inspect_patched) && module)) {
        module = __Pyx_Coroutine_patch_module(
            module, ""
"old_types = getattr(_module.isgenerator, '_cython_generator_types', None)\n"
"if old_types is None or not isinstance(old_types, set):\n"
"    old_types = set()\n"
"    def cy_wrap(orig_func, type=type, cython_generator_types=old_types):\n"
"        def cy_isgenerator(obj): return type(obj) in cython_generator_types or orig_func(obj)\n"
"        cy_isgenerator._cython_generator_types = cython_generator_types\n"
"        return cy_isgenerator\n"
"    _module.isgenerator = cy_wrap(_module.isgenerator)\n"
"old_types.add(_cython_generator_type)\n"
        );
        inspect_patched = 1;
    }
#else
    if (0) return __Pyx_Coroutine_patch_module(module, NULL);
#endif
    return module;
}

/* PatchAsyncIO */
                  static PyObject* __Pyx_patch_asyncio(PyObject* module) {
#if PY_VERSION_HEX < 0x030500B2 &&\
        (defined(__Pyx_Coroutine_USED) || defined(__Pyx_Generator_USED)) &&\
        (!defined(CYTHON_PATCH_ASYNCIO) || CYTHON_PATCH_ASYNCIO)
    PyObject *patch_module = NULL;
    static int asyncio_patched = 0;
    if (unlikely((!asyncio_patched) && module)) {
        PyObject *package;
        package = __Pyx_Import(__pyx_n_s_asyncio_coroutines, NULL, 0);
        if (package) {
            patch_module = __Pyx_Coroutine_patch_module(
                PyObject_GetAttrString(package, "coroutines"), ""
"try:\n"
"    coro_types = _module._COROUTINE_TYPES\n"
"except AttributeError: pass\n"
"else:\n"
"    if _cython_coroutine_type is not None and _cython_coroutine_type not in coro_types:\n"
"        coro_types = tuple(coro_types) + (_cython_coroutine_type,)\n"
"    if _cython_generator_type is not None and _cython_generator_type not in coro_types:\n"
"        coro_types = tuple(coro_types) + (_cython_generator_type,)\n"
"_module._COROUTINE_TYPES = coro_types\n"
            );
        } else {
            PyErr_Clear();
#if PY_VERSION_HEX < 0x03040200
            package = __Pyx_Import(__pyx_n_s_asyncio_tasks, NULL, 0);
            if (unlikely(!package)) goto asyncio_done;
            patch_module = __Pyx_Coroutine_patch_module(
                PyObject_GetAttrString(package, "tasks"), ""
"if hasattr(_module, 'iscoroutine'):\n"
"    old_types = getattr(_module.iscoroutine, '_cython_coroutine_types', None)\n"
"    if old_types is None or not isinstance(old_types, set):\n"
"        old_types = set()\n"
"        def cy_wrap(orig_func, type=type, cython_coroutine_types=old_types):\n"
"            def cy_iscoroutine(obj): return type(obj) in cython_coroutine_types or orig_func(obj)\n"
"            cy_iscoroutine._cython_coroutine_types = cython_coroutine_types\n"
"            return cy_iscoroutine\n"
"        _module.iscoroutine = cy_wrap(_module.iscoroutine)\n"
"    if _cython_coroutine_type is not None:\n"
"        old_types.add(_cython_coroutine_type)\n"
"    if _cython_generator_type is not None:\n"
"        old_types.add(_cython_generator_type)\n"
            );
#endif
        }
        Py_DECREF(package);
        if (unlikely(!patch_module)) goto ignore;
#if PY_VERSION_HEX < 0x03040200
asyncio_done:
        PyErr_Clear();
#endif
        asyncio_patched = 1;
#ifdef __Pyx_Generator_USED
        {
            PyObject *inspect_module;
            if (patch_module) {
                inspect_module = PyObject_GetAttr(patch_module, __pyx_n_s_inspect);
                Py_DECREF(patch_module);
            } else {
                inspect_module = __Pyx_Import(__pyx_n_s_inspect, NULL, 0);
            }
            if (unlikely(!inspect_module)) goto ignore;
            inspect_module = __Pyx_patch_inspect(inspect_module);
            if (unlikely(!inspect_module)) {
                Py_DECREF(module);
                module = NULL;
            }
            Py_XDECREF(inspect_module);
        }
#else
        if (0) return __Pyx_patch_inspect(module);
#endif
    }
    return module;
ignore:
    PyErr_WriteUnraisable(module);
    if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning, "Cython module failed to patch asyncio package with custom generator type", 1) < 0)) {
        Py_DECREF(module);
        module = NULL;
    }
#else
    if (0) return __Pyx_patch_inspect(__Pyx_Coroutine_patch_module(module, NULL));
#endif
    return module;
}

/* ImportFrom */
                  static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
    PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
    if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
        PyErr_Format(PyExc_ImportError,
        #if PY_MAJOR_VERSION < 3
            "cannot import name %.230s", PyString_AS_STRING(name));
        #else
            "cannot import name %S", name);
        #endif
    }
    return value;
}

/* CalculateMetaclass */
                  static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases) {
    Py_ssize_t i, nbases = PyTuple_GET_SIZE(bases);
    for (i=0; i < nbases; i++) {
        PyTypeObject *tmptype;
        PyObject *tmp = PyTuple_GET_ITEM(bases, i);
        tmptype = Py_TYPE(tmp);
#if PY_MAJOR_VERSION < 3
        if (tmptype == &PyClass_Type)
            continue;
#endif
        if (!metaclass) {
            metaclass = tmptype;
            continue;
        }
        if (PyType_IsSubtype(metaclass, tmptype))
            continue;
        if (PyType_IsSubtype(tmptype, metaclass)) {
            metaclass = tmptype;
            continue;
        }
        PyErr_SetString(PyExc_TypeError,
                        "metaclass conflict: "
                        "the metaclass of a derived class "
                        "must be a (non-strict) subclass "
                        "of the metaclasses of all its bases");
        return NULL;
    }
    if (!metaclass) {
#if PY_MAJOR_VERSION < 3
        metaclass = &PyClass_Type;
#else
        metaclass = &PyType_Type;
#endif
    }
    Py_INCREF((PyObject*) metaclass);
    return (PyObject*) metaclass;
}

/* Py3ClassCreate */
                  static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name,
                                           PyObject *qualname, PyObject *mkw, PyObject *modname, PyObject *doc) {
    PyObject *ns;
    if (metaclass) {
        PyObject *prep = __Pyx_PyObject_GetAttrStr(metaclass, __pyx_n_s_prepare);
        if (prep) {
            PyObject *pargs = PyTuple_Pack(2, name, bases);
            if (unlikely(!pargs)) {
                Py_DECREF(prep);
                return NULL;
            }
            ns = PyObject_Call(prep, pargs, mkw);
            Py_DECREF(prep);
            Py_DECREF(pargs);
        } else {
            if (unlikely(!PyErr_ExceptionMatches(PyExc_AttributeError)))
                return NULL;
            PyErr_Clear();
            ns = PyDict_New();
        }
    } else {
        ns = PyDict_New();
    }
    if (unlikely(!ns))
        return NULL;
    if (unlikely(PyObject_SetItem(ns, __pyx_n_s_module, modname) < 0)) goto bad;
    if (unlikely(PyObject_SetItem(ns, __pyx_n_s_qualname, qualname) < 0)) goto bad;
    if (unlikely(doc && PyObject_SetItem(ns, __pyx_n_s_doc, doc) < 0)) goto bad;
    return ns;
bad:
    Py_DECREF(ns);
    return NULL;
}
static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases,
                                      PyObject *dict, PyObject *mkw,
                                      int calculate_metaclass, int allow_py2_metaclass) {
    PyObject *result, *margs;
    PyObject *owned_metaclass = NULL;
    if (allow_py2_metaclass) {
        owned_metaclass = PyObject_GetItem(dict, __pyx_n_s_metaclass);
        if (owned_metaclass) {
            metaclass = owned_metaclass;
        } else if (likely(PyErr_ExceptionMatches(PyExc_KeyError))) {
            PyErr_Clear();
        } else {
            return NULL;
        }
    }
    if (calculate_metaclass && (!metaclass || PyType_Check(metaclass))) {
        metaclass = __Pyx_CalculateMetaclass((PyTypeObject*) metaclass, bases);
        Py_XDECREF(owned_metaclass);
        if (unlikely(!metaclass))
            return NULL;
        owned_metaclass = metaclass;
    }
    margs = PyTuple_Pack(3, name, bases, dict);
    if (unlikely(!margs)) {
        result = NULL;
    } else {
        result = PyObject_Call(metaclass, margs, mkw);
        Py_DECREF(margs);
    }
    Py_XDECREF(owned_metaclass);
    return result;
}

/* CodeObjectCache */
                  static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
    int start = 0, mid = 0, end = count - 1;
    if (end >= 0 && code_line > entries[end].code_line) {
        return count;
    }
    while (start < end) {
        mid = start + (end - start) / 2;
        if (code_line < entries[mid].code_line) {
            end = mid;
        } else if (code_line > entries[mid].code_line) {
             start = mid + 1;
        } else {
            return mid;
        }
    }
    if (code_line <= entries[mid].code_line) {
        return mid;
    } else {
        return mid + 1;
    }
}
static PyCodeObject *__pyx_find_code_object(int code_line) {
    PyCodeObject* code_object;
    int pos;
    if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
        return NULL;
    }
    pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
    if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
        return NULL;
    }
    code_object = __pyx_code_cache.entries[pos].code_object;
    Py_INCREF(code_object);
    return code_object;
}
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
    int pos, i;
    __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
    if (unlikely(!code_line)) {
        return;
    }
    if (unlikely(!entries)) {
        entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
        if (likely(entries)) {
            __pyx_code_cache.entries = entries;
            __pyx_code_cache.max_count = 64;
            __pyx_code_cache.count = 1;
            entries[0].code_line = code_line;
            entries[0].code_object = code_object;
            Py_INCREF(code_object);
        }
        return;
    }
    pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
    if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
        PyCodeObject* tmp = entries[pos].code_object;
        entries[pos].code_object = code_object;
        Py_DECREF(tmp);
        return;
    }
    if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
        int new_max = __pyx_code_cache.max_count + 64;
        entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
            __pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry));
        if (unlikely(!entries)) {
            return;
        }
        __pyx_code_cache.entries = entries;
        __pyx_code_cache.max_count = new_max;
    }
    for (i=__pyx_code_cache.count; i>pos; i--) {
        entries[i] = entries[i-1];
    }
    entries[pos].code_line = code_line;
    entries[pos].code_object = code_object;
    __pyx_code_cache.count++;
    Py_INCREF(code_object);
}

/* AddTraceback */
                  #include "compile.h"
#include "frameobject.h"
#include "traceback.h"
static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
            const char *funcname, int c_line,
            int py_line, const char *filename) {
    PyCodeObject *py_code = 0;
    PyObject *py_srcfile = 0;
    PyObject *py_funcname = 0;
    #if PY_MAJOR_VERSION < 3
    py_srcfile = PyString_FromString(filename);
    #else
    py_srcfile = PyUnicode_FromString(filename);
    #endif
    if (!py_srcfile) goto bad;
    if (c_line) {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
        #else
        py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
        #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_code = __Pyx_PyCode_New(
        0,
        0,
        0,
        0,
        0,
        __pyx_empty_bytes, /*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,*/
        py_line,
        __pyx_empty_bytes  /*PyObject *lnotab*/
    );
    Py_DECREF(py_srcfile);
    Py_DECREF(py_funcname);
    return py_code;
bad:
    Py_XDECREF(py_srcfile);
    Py_XDECREF(py_funcname);
    return NULL;
}
static void __Pyx_AddTraceback(const char *funcname, int c_line,
                               int py_line, const char *filename) {
    PyCodeObject *py_code = 0;
    PyFrameObject *py_frame = 0;
    py_code = __pyx_find_code_object(c_line ? c_line : py_line);
    if (!py_code) {
        py_code = __Pyx_CreateCodeObjectForTraceback(
            funcname, c_line, py_line, filename);
        if (!py_code) goto bad;
        __pyx_insert_code_object(c_line ? c_line : py_line, py_code);
    }
    py_frame = PyFrame_New(
        PyThreadState_GET(), /*PyThreadState *tstate,*/
        py_code,             /*PyCodeObject *code,*/
        __pyx_d,      /*PyObject *globals,*/
        0                    /*PyObject *locals*/
    );
    if (!py_frame) goto bad;
    __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
    PyTraceBack_Here(py_frame);
bad:
    Py_XDECREF(py_code);
    Py_XDECREF(py_frame);
}

/* CIntFromPyVerify */
                  #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
    __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
    __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
    {\
        func_type value = func_value;\
        if (sizeof(target_type) < sizeof(func_type)) {\
            if (unlikely(value != (func_type) (target_type) value)) {\
                func_type zero = 0;\
                if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
                    return (target_type) -1;\
                if (is_unsigned && unlikely(value < zero))\
                    goto raise_neg_overflow;\
                else\
                    goto raise_overflow;\
            }\
        }\
        return (target_type) value;\
    }

/* CIntToPy */
                  static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint32_t(uint32_t value) {
    const uint32_t neg_one = (uint32_t) -1, const_zero = (uint32_t) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(uint32_t) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(uint32_t) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(uint32_t) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(uint32_t) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(uint32_t) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(uint32_t),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
                  static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
    const long neg_one = (long) -1, const_zero = (long) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(long) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(long) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(long) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(long),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
                  static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum____pyx_t_8asynctnt_6iproto_3tnt_tp_request_type(enum __pyx_t_8asynctnt_6iproto_3tnt_tp_request_type value) {
    const enum __pyx_t_8asynctnt_6iproto_3tnt_tp_request_type neg_one = (enum __pyx_t_8asynctnt_6iproto_3tnt_tp_request_type) -1, const_zero = (enum __pyx_t_8asynctnt_6iproto_3tnt_tp_request_type) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(enum __pyx_t_8asynctnt_6iproto_3tnt_tp_request_type) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(enum __pyx_t_8asynctnt_6iproto_3tnt_tp_request_type) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(enum __pyx_t_8asynctnt_6iproto_3tnt_tp_request_type) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(enum __pyx_t_8asynctnt_6iproto_3tnt_tp_request_type) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(enum __pyx_t_8asynctnt_6iproto_3tnt_tp_request_type) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(enum __pyx_t_8asynctnt_6iproto_3tnt_tp_request_type),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
                  static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint64_t(uint64_t value) {
    const uint64_t neg_one = (uint64_t) -1, const_zero = (uint64_t) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(uint64_t) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(uint64_t) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(uint64_t) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(uint64_t) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(uint64_t) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(uint64_t),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
                  static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int64_t(int64_t value) {
    const int64_t neg_one = (int64_t) -1, const_zero = (int64_t) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(int64_t) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(int64_t) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(int64_t) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(int64_t) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(int64_t) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(int64_t),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
                  static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__mp_type(enum mp_type value) {
    const enum mp_type neg_one = (enum mp_type) -1, const_zero = (enum mp_type) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(enum mp_type) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(enum mp_type) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(enum mp_type) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(enum mp_type) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(enum mp_type) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(enum mp_type),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
                  static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
    const int neg_one = (int) -1, const_zero = (int) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(int) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(int) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(int) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(int),
                                     little, !is_unsigned);
    }
}

/* CIntFromPy */
                  static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
    const int neg_one = (int) -1, const_zero = (int) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(int) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (int) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (int) 0;
                case  1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
                case 2:
                    if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
                            return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
                            return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
                            return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
                        }
                    }
                    break;
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (int) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(int) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (int) 0;
                case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(int,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
                            return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
                            return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
                            return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
                            return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
                            return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
                            return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(int) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            int val;
            PyObject *v = __Pyx_PyNumber_IntOrLong(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (int) -1;
        }
    } else {
        int val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (int) -1;
        val = __Pyx_PyInt_As_int(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to int");
    return (int) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to int");
    return (int) -1;
}

/* CIntFromPy */
                  static CYTHON_INLINE int64_t __Pyx_PyInt_As_int64_t(PyObject *x) {
    const int64_t neg_one = (int64_t) -1, const_zero = (int64_t) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(int64_t) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(int64_t, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (int64_t) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (int64_t) 0;
                case  1: __PYX_VERIFY_RETURN_INT(int64_t, digit, digits[0])
                case 2:
                    if (8 * sizeof(int64_t) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int64_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int64_t) >= 2 * PyLong_SHIFT) {
                            return (int64_t) (((((int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(int64_t) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int64_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int64_t) >= 3 * PyLong_SHIFT) {
                            return (int64_t) (((((((int64_t)digits[2]) << PyLong_SHIFT) | (int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(int64_t) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int64_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int64_t) >= 4 * PyLong_SHIFT) {
                            return (int64_t) (((((((((int64_t)digits[3]) << PyLong_SHIFT) | (int64_t)digits[2]) << PyLong_SHIFT) | (int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0]));
                        }
                    }
                    break;
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (int64_t) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(int64_t) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(int64_t, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(int64_t) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(int64_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (int64_t) 0;
                case -1: __PYX_VERIFY_RETURN_INT(int64_t, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(int64_t,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(int64_t) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int64_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int64_t) - 1 > 2 * PyLong_SHIFT) {
                            return (int64_t) (((int64_t)-1)*(((((int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(int64_t) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int64_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int64_t) - 1 > 2 * PyLong_SHIFT) {
                            return (int64_t) ((((((int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(int64_t) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int64_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int64_t) - 1 > 3 * PyLong_SHIFT) {
                            return (int64_t) (((int64_t)-1)*(((((((int64_t)digits[2]) << PyLong_SHIFT) | (int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(int64_t) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int64_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int64_t) - 1 > 3 * PyLong_SHIFT) {
                            return (int64_t) ((((((((int64_t)digits[2]) << PyLong_SHIFT) | (int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(int64_t) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int64_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int64_t) - 1 > 4 * PyLong_SHIFT) {
                            return (int64_t) (((int64_t)-1)*(((((((((int64_t)digits[3]) << PyLong_SHIFT) | (int64_t)digits[2]) << PyLong_SHIFT) | (int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(int64_t) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int64_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int64_t) - 1 > 4 * PyLong_SHIFT) {
                            return (int64_t) ((((((((((int64_t)digits[3]) << PyLong_SHIFT) | (int64_t)digits[2]) << PyLong_SHIFT) | (int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(int64_t) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(int64_t, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(int64_t) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(int64_t, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            int64_t val;
            PyObject *v = __Pyx_PyNumber_IntOrLong(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (int64_t) -1;
        }
    } else {
        int64_t val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (int64_t) -1;
        val = __Pyx_PyInt_As_int64_t(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to int64_t");
    return (int64_t) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to int64_t");
    return (int64_t) -1;
}

/* CIntFromPy */
                  static CYTHON_INLINE uint32_t __Pyx_PyInt_As_uint32_t(PyObject *x) {
    const uint32_t neg_one = (uint32_t) -1, const_zero = (uint32_t) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(uint32_t) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(uint32_t, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (uint32_t) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (uint32_t) 0;
                case  1: __PYX_VERIFY_RETURN_INT(uint32_t, digit, digits[0])
                case 2:
                    if (8 * sizeof(uint32_t) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(uint32_t) >= 2 * PyLong_SHIFT) {
                            return (uint32_t) (((((uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(uint32_t) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(uint32_t) >= 3 * PyLong_SHIFT) {
                            return (uint32_t) (((((((uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(uint32_t) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(uint32_t) >= 4 * PyLong_SHIFT) {
                            return (uint32_t) (((((((((uint32_t)digits[3]) << PyLong_SHIFT) | (uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]));
                        }
                    }
                    break;
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (uint32_t) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(uint32_t) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(uint32_t, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(uint32_t) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(uint32_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (uint32_t) 0;
                case -1: __PYX_VERIFY_RETURN_INT(uint32_t, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(uint32_t,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(uint32_t) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(uint32_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(uint32_t) - 1 > 2 * PyLong_SHIFT) {
                            return (uint32_t) (((uint32_t)-1)*(((((uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(uint32_t) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(uint32_t) - 1 > 2 * PyLong_SHIFT) {
                            return (uint32_t) ((((((uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(uint32_t) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(uint32_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(uint32_t) - 1 > 3 * PyLong_SHIFT) {
                            return (uint32_t) (((uint32_t)-1)*(((((((uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(uint32_t) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(uint32_t) - 1 > 3 * PyLong_SHIFT) {
                            return (uint32_t) ((((((((uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(uint32_t) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(uint32_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(uint32_t) - 1 > 4 * PyLong_SHIFT) {
                            return (uint32_t) (((uint32_t)-1)*(((((((((uint32_t)digits[3]) << PyLong_SHIFT) | (uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(uint32_t) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(uint32_t) - 1 > 4 * PyLong_SHIFT) {
                            return (uint32_t) ((((((((((uint32_t)digits[3]) << PyLong_SHIFT) | (uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(uint32_t) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(uint32_t, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(uint32_t) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(uint32_t, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            uint32_t val;
            PyObject *v = __Pyx_PyNumber_IntOrLong(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (uint32_t) -1;
        }
    } else {
        uint32_t val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (uint32_t) -1;
        val = __Pyx_PyInt_As_uint32_t(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to uint32_t");
    return (uint32_t) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to uint32_t");
    return (uint32_t) -1;
}

/* CIntFromPy */
                  static CYTHON_INLINE uint64_t __Pyx_PyInt_As_uint64_t(PyObject *x) {
    const uint64_t neg_one = (uint64_t) -1, const_zero = (uint64_t) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(uint64_t) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(uint64_t, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (uint64_t) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (uint64_t) 0;
                case  1: __PYX_VERIFY_RETURN_INT(uint64_t, digit, digits[0])
                case 2:
                    if (8 * sizeof(uint64_t) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(uint64_t) >= 2 * PyLong_SHIFT) {
                            return (uint64_t) (((((uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(uint64_t) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(uint64_t) >= 3 * PyLong_SHIFT) {
                            return (uint64_t) (((((((uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(uint64_t) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(uint64_t) >= 4 * PyLong_SHIFT) {
                            return (uint64_t) (((((((((uint64_t)digits[3]) << PyLong_SHIFT) | (uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]));
                        }
                    }
                    break;
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (uint64_t) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(uint64_t) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(uint64_t, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(uint64_t) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(uint64_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (uint64_t) 0;
                case -1: __PYX_VERIFY_RETURN_INT(uint64_t, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(uint64_t,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(uint64_t) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(uint64_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(uint64_t) - 1 > 2 * PyLong_SHIFT) {
                            return (uint64_t) (((uint64_t)-1)*(((((uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(uint64_t) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(uint64_t) - 1 > 2 * PyLong_SHIFT) {
                            return (uint64_t) ((((((uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(uint64_t) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(uint64_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(uint64_t) - 1 > 3 * PyLong_SHIFT) {
                            return (uint64_t) (((uint64_t)-1)*(((((((uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(uint64_t) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(uint64_t) - 1 > 3 * PyLong_SHIFT) {
                            return (uint64_t) ((((((((uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(uint64_t) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(uint64_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(uint64_t) - 1 > 4 * PyLong_SHIFT) {
                            return (uint64_t) (((uint64_t)-1)*(((((((((uint64_t)digits[3]) << PyLong_SHIFT) | (uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(uint64_t) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(uint64_t) - 1 > 4 * PyLong_SHIFT) {
                            return (uint64_t) ((((((((((uint64_t)digits[3]) << PyLong_SHIFT) | (uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(uint64_t) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(uint64_t, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(uint64_t) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(uint64_t, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            uint64_t val;
            PyObject *v = __Pyx_PyNumber_IntOrLong(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (uint64_t) -1;
        }
    } else {
        uint64_t val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (uint64_t) -1;
        val = __Pyx_PyInt_As_uint64_t(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to uint64_t");
    return (uint64_t) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to uint64_t");
    return (uint64_t) -1;
}

/* CIntFromPy */
                  static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *x) {
    const size_t neg_one = (size_t) -1, const_zero = (size_t) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(size_t) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(size_t, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (size_t) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (size_t) 0;
                case  1: __PYX_VERIFY_RETURN_INT(size_t, digit, digits[0])
                case 2:
                    if (8 * sizeof(size_t) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) >= 2 * PyLong_SHIFT) {
                            return (size_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(size_t) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) >= 3 * PyLong_SHIFT) {
                            return (size_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(size_t) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) >= 4 * PyLong_SHIFT) {
                            return (size_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
                        }
                    }
                    break;
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (size_t) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(size_t) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(size_t) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (size_t) 0;
                case -1: __PYX_VERIFY_RETURN_INT(size_t, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(size_t,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(size_t) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) {
                            return (size_t) (((size_t)-1)*(((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(size_t) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) {
                            return (size_t) ((((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) {
                            return (size_t) (((size_t)-1)*(((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(size_t) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) {
                            return (size_t) ((((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT) {
                            return (size_t) (((size_t)-1)*(((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(size_t) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT) {
                            return (size_t) ((((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(size_t) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(size_t, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(size_t) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(size_t, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            size_t val;
            PyObject *v = __Pyx_PyNumber_IntOrLong(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (size_t) -1;
        }
    } else {
        size_t val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (size_t) -1;
        val = __Pyx_PyInt_As_size_t(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to size_t");
    return (size_t) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to size_t");
    return (size_t) -1;
}

/* CIntFromPy */
                  static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
    const long neg_one = (long) -1, const_zero = (long) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(long) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (long) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (long) 0;
                case  1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
                case 2:
                    if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
                            return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
                            return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
                            return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
                        }
                    }
                    break;
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (long) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(long) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (long) 0;
                case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(long,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                            return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                            return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                            return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                            return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                            return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                            return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(long) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            long val;
            PyObject *v = __Pyx_PyNumber_IntOrLong(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (long) -1;
        }
    } else {
        long val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (long) -1;
        val = __Pyx_PyInt_As_long(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to long");
    return (long) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to long");
    return (long) -1;
}

/* CheckBinaryVersion */
                  static int __Pyx_check_binary_version(void) {
    char ctversion[4], rtversion[4];
    PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
    PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
    if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
        char message[200];
        PyOS_snprintf(message, sizeof(message),
                      "compiletime version %s of module '%.100s' "
                      "does not match runtime version %s",
                      ctversion, __Pyx_MODULE_NAME, rtversion);
        return PyErr_WarnEx(NULL, message, 1);
    }
    return 0;
}

/* FunctionExport */
                  static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig) {
    PyObject *d = 0;
    PyObject *cobj = 0;
    union {
        void (*fp)(void);
        void *p;
    } tmp;
    d = PyObject_GetAttrString(__pyx_m, (char *)"__pyx_capi__");
    if (!d) {
        PyErr_Clear();
        d = PyDict_New();
        if (!d)
            goto bad;
        Py_INCREF(d);
        if (PyModule_AddObject(__pyx_m, (char *)"__pyx_capi__", d) < 0)
            goto bad;
    }
    tmp.fp = f;
#if PY_VERSION_HEX >= 0x02070000
    cobj = PyCapsule_New(tmp.p, sig, 0);
#else
    cobj = PyCObject_FromVoidPtrAndDesc(tmp.p, (void *)sig, 0);
#endif
    if (!cobj)
        goto bad;
    if (PyDict_SetItemString(d, name, cobj) < 0)
        goto bad;
    Py_DECREF(cobj);
    Py_DECREF(d);
    return 0;
bad:
    Py_XDECREF(cobj);
    Py_XDECREF(d);
    return -1;
}

/* ModuleImport */
                  #ifndef __PYX_HAVE_RT_ImportModule
#define __PYX_HAVE_RT_ImportModule
static PyObject *__Pyx_ImportModule(const char *name) {
    PyObject *py_name = 0;
    PyObject *py_module = 0;
    py_name = __Pyx_PyIdentifier_FromString(name);
    if (!py_name)
        goto bad;
    py_module = PyImport_Import(py_name);
    Py_DECREF(py_name);
    return py_module;
bad:
    Py_XDECREF(py_name);
    return 0;
}
#endif

/* TypeImport */
                  #ifndef __PYX_HAVE_RT_ImportType
#define __PYX_HAVE_RT_ImportType
static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name,
    size_t size, int strict)
{
    PyObject *py_module = 0;
    PyObject *result = 0;
    PyObject *py_name = 0;
    char warning[200];
    Py_ssize_t basicsize;
#ifdef Py_LIMITED_API
    PyObject *py_basicsize;
#endif
    py_module = __Pyx_ImportModule(module_name);
    if (!py_module)
        goto bad;
    py_name = __Pyx_PyIdentifier_FromString(class_name);
    if (!py_name)
        goto bad;
    result = PyObject_GetAttr(py_module, py_name);
    Py_DECREF(py_name);
    py_name = 0;
    Py_DECREF(py_module);
    py_module = 0;
    if (!result)
        goto bad;
    if (!PyType_Check(result)) {
        PyErr_Format(PyExc_TypeError,
            "%.200s.%.200s is not a type object",
            module_name, class_name);
        goto bad;
    }
#ifndef Py_LIMITED_API
    basicsize = ((PyTypeObject *)result)->tp_basicsize;
#else
    py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
    if (!py_basicsize)
        goto bad;
    basicsize = PyLong_AsSsize_t(py_basicsize);
    Py_DECREF(py_basicsize);
    py_basicsize = 0;
    if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
        goto bad;
#endif
    if (!strict && (size_t)basicsize > size) {
        PyOS_snprintf(warning, sizeof(warning),
            "%s.%s size changed, may indicate binary incompatibility. Expected %zd, got %zd",
            module_name, class_name, basicsize, size);
        if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
    }
    else if ((size_t)basicsize != size) {
        PyErr_Format(PyExc_ValueError,
            "%.200s.%.200s has the wrong size, try recompiling. Expected %zd, got %zd",
            module_name, class_name, basicsize, size);
        goto bad;
    }
    return (PyTypeObject *)result;
bad:
    Py_XDECREF(py_module);
    Py_XDECREF(result);
    return NULL;
}
#endif

/* InitStrings */
                  static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
    while (t->p) {
        #if PY_MAJOR_VERSION < 3
        if (t->is_unicode) {
            *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
        if (t->is_unicode | t->is_str) {
            if (t->intern) {
                *t->p = PyUnicode_InternFromString(t->s);
            } else if (t->encoding) {
                *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
            } else {
                *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;
}

static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
    return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
}
static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) {
    Py_ssize_t ignore;
    return __Pyx_PyObject_AsStringAndSize(o, &ignore);
}
static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
#if CYTHON_COMPILING_IN_CPYTHON && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
    if (
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
            __Pyx_sys_getdefaultencoding_not_ascii &&
#endif
            PyUnicode_Check(o)) {
#if PY_VERSION_HEX < 0x03030000
        char* defenc_c;
        PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
        if (!defenc) return NULL;
        defenc_c = PyBytes_AS_STRING(defenc);
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
        {
            char* end = defenc_c + PyBytes_GET_SIZE(defenc);
            char* c;
            for (c = defenc_c; c < end; c++) {
                if ((unsigned char) (*c) >= 128) {
                    PyUnicode_AsASCIIString(o);
                    return NULL;
                }
            }
        }
#endif
        *length = PyBytes_GET_SIZE(defenc);
        return defenc_c;
#else
        if (__Pyx_PyUnicode_READY(o) == -1) return NULL;
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
        if (PyUnicode_IS_ASCII(o)) {
            *length = PyUnicode_GET_LENGTH(o);
            return PyUnicode_AsUTF8(o);
        } else {
            PyUnicode_AsASCIIString(o);
            return NULL;
        }
#else
        return PyUnicode_AsUTF8AndSize(o, length);
#endif
#endif
    } else
#endif
#if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
    if (PyByteArray_Check(o)) {
        *length = PyByteArray_GET_SIZE(o);
        return PyByteArray_AS_STRING(o);
    } else
#endif
    {
        char* result;
        int r = PyBytes_AsStringAndSize(o, &result, length);
        if (unlikely(r < 0)) {
            return NULL;
        } else {
            return result;
        }
    }
}
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
   int is_true = x == Py_True;
   if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
   else return PyObject_IsTrue(x);
}
static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
#if CYTHON_USE_TYPE_SLOTS
  PyNumberMethods *m;
#endif
  const char *name = NULL;
  PyObject *res = NULL;
#if PY_MAJOR_VERSION < 3
  if (PyInt_Check(x) || PyLong_Check(x))
#else
  if (PyLong_Check(x))
#endif
    return __Pyx_NewRef(x);
#if CYTHON_USE_TYPE_SLOTS
  m = Py_TYPE(x)->tp_as_number;
  #if PY_MAJOR_VERSION < 3
  if (m && m->nb_int) {
    name = "int";
    res = PyNumber_Int(x);
  }
  else if (m && m->nb_long) {
    name = "long";
    res = PyNumber_Long(x);
  }
  #else
  if (m && m->nb_int) {
    name = "int";
    res = PyNumber_Long(x);
  }
  #endif
#else
  res = PyNumber_Int(x);
#endif
  if (res) {
#if PY_MAJOR_VERSION < 3
    if (!PyInt_Check(res) && !PyLong_Check(res)) {
#else
    if (!PyLong_Check(res)) {
#endif
      PyErr_Format(PyExc_TypeError,
                   "__%.4s__ returned non-%.4s (type %.200s)",
                   name, name, Py_TYPE(res)->tp_name);
      Py_DECREF(res);
      return NULL;
    }
  }
  else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_TypeError,
                    "an integer is required");
  }
  return res;
}
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
  Py_ssize_t ival;
  PyObject *x;
#if PY_MAJOR_VERSION < 3
  if (likely(PyInt_CheckExact(b))) {
    if (sizeof(Py_ssize_t) >= sizeof(long))
        return PyInt_AS_LONG(b);
    else
        return PyInt_AsSsize_t(x);
  }
#endif
  if (likely(PyLong_CheckExact(b))) {
    #if CYTHON_USE_PYLONG_INTERNALS
    const digit* digits = ((PyLongObject*)b)->ob_digit;
    const Py_ssize_t size = Py_SIZE(b);
    if (likely(__Pyx_sst_abs(size) <= 1)) {
        ival = likely(size) ? digits[0] : 0;
        if (size == -1) ival = -ival;
        return ival;
    } else {
      switch (size) {
         case 2:
           if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
             return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case -2:
           if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
             return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case 3:
           if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
             return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case -3:
           if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
             return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case 4:
           if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
             return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case -4:
           if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
             return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
      }
    }
    #endif
    return PyLong_AsSsize_t(b);
  }
  x = PyNumber_Index(b);
  if (!x) return -1;
  ival = PyInt_AsSsize_t(x);
  Py_DECREF(x);
  return ival;
}
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
    return PyInt_FromSize_t(ival);
}


#endif /* Py_PYTHON_H */
