/* Generated by Cython 0.29.25 */

#ifndef PY_SSIZE_T_CLEAN
#define PY_SSIZE_T_CLEAN
#endif /* 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 < 0x03030000)
    #error Cython requires Python 2.6+ or Python 3.3+.
#else
#define CYTHON_ABI "0_29_25"
#define CYTHON_HEX_VERSION 0x001D19F0
#define CYTHON_FUTURE_DIVISION 0
#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
#define __PYX_COMMA ,
#ifndef HAVE_LONG_LONG
  #if 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_PYTYPE_LOOKUP
  #define CYTHON_USE_PYTYPE_LOOKUP 0
  #if PY_VERSION_HEX < 0x03050000
    #undef CYTHON_USE_ASYNC_SLOTS
    #define CYTHON_USE_ASYNC_SLOTS 0
  #elif !defined(CYTHON_USE_ASYNC_SLOTS)
    #define CYTHON_USE_ASYNC_SLOTS 1
  #endif
  #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
  #undef CYTHON_PEP489_MULTI_PHASE_INIT
  #define CYTHON_PEP489_MULTI_PHASE_INIT 0
  #undef CYTHON_USE_TP_FINALIZE
  #define CYTHON_USE_TP_FINALIZE 0
  #undef CYTHON_USE_DICT_VERSIONS
  #define CYTHON_USE_DICT_VERSIONS 0
  #undef CYTHON_USE_EXC_INFO_STACK
  #define CYTHON_USE_EXC_INFO_STACK 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_PYTYPE_LOOKUP
  #define CYTHON_USE_PYTYPE_LOOKUP 0
  #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
  #undef CYTHON_PEP489_MULTI_PHASE_INIT
  #define CYTHON_PEP489_MULTI_PHASE_INIT 0
  #undef CYTHON_USE_TP_FINALIZE
  #define CYTHON_USE_TP_FINALIZE 0
  #undef CYTHON_USE_DICT_VERSIONS
  #define CYTHON_USE_DICT_VERSIONS 0
  #undef CYTHON_USE_EXC_INFO_STACK
  #define CYTHON_USE_EXC_INFO_STACK 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_VERSION_HEX < 0x02070000
    #undef CYTHON_USE_PYTYPE_LOOKUP
    #define CYTHON_USE_PYTYPE_LOOKUP 0
  #elif !defined(CYTHON_USE_PYTYPE_LOOKUP)
    #define CYTHON_USE_PYTYPE_LOOKUP 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 || PY_VERSION_HEX >= 0x030B00A2
    #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 (PY_VERSION_HEX < 0x030B00A1)
  #endif
  #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
    #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000)
  #endif
  #ifndef CYTHON_USE_TP_FINALIZE
    #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
  #endif
  #ifndef CYTHON_USE_DICT_VERSIONS
    #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1)
  #endif
  #ifndef CYTHON_USE_EXC_INFO_STACK
    #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3)
  #endif
#endif
#if !defined(CYTHON_FAST_PYCCALL)
#define CYTHON_FAST_PYCCALL  (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
#endif
#if CYTHON_USE_PYLONG_INTERNALS
  #if PY_MAJOR_VERSION < 3
    #include "longintrepr.h"
  #endif
  #undef SHIFT
  #undef BASE
  #undef MASK
  #ifdef SIZEOF_VOID_P
    enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
  #endif
#endif
#ifndef __has_attribute
  #define __has_attribute(x) 0
#endif
#ifndef __has_cpp_attribute
  #define __has_cpp_attribute(x) 0
#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)
#ifdef _MSC_VER
    #ifndef _MSC_STDINT_H_
        #if _MSC_VER < 1300
           typedef unsigned char     uint8_t;
           typedef unsigned int      uint32_t;
        #else
           typedef unsigned __int8   uint8_t;
           typedef unsigned __int32  uint32_t;
        #endif
    #endif
#else
   #include <stdint.h>
#endif
#ifndef CYTHON_FALLTHROUGH
  #if defined(__cplusplus) && __cplusplus >= 201103L
    #if __has_cpp_attribute(fallthrough)
      #define CYTHON_FALLTHROUGH [[fallthrough]]
    #elif __has_cpp_attribute(clang::fallthrough)
      #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
    #elif __has_cpp_attribute(gnu::fallthrough)
      #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
    #endif
  #endif
  #ifndef CYTHON_FALLTHROUGH
    #if __has_attribute(fallthrough)
      #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
    #else
      #define CYTHON_FALLTHROUGH
    #endif
  #endif
  #if defined(__clang__ ) && defined(__apple_build_version__)
    #if __apple_build_version__ < 7000000
      #undef  CYTHON_FALLTHROUGH
      #define CYTHON_FALLTHROUGH
    #endif
  #endif
#endif

#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 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_DefaultClassType PyType_Type
#if PY_VERSION_HEX >= 0x030B00A1
    static CYTHON_INLINE PyCodeObject* __Pyx_PyCode_New(int a, int k, int l, int s, int f,
                                                    PyObject *code, PyObject *c, PyObject* n, PyObject *v,
                                                    PyObject *fv, PyObject *cell, PyObject* fn,
                                                    PyObject *name, int fline, PyObject *lnos) {
        PyObject *kwds=NULL, *argcount=NULL, *posonlyargcount=NULL, *kwonlyargcount=NULL;
        PyObject *nlocals=NULL, *stacksize=NULL, *flags=NULL, *replace=NULL, *call_result=NULL, *empty=NULL;
        const char *fn_cstr=NULL;
        const char *name_cstr=NULL;
        PyCodeObject* co=NULL;
        PyObject *type, *value, *traceback;
        PyErr_Fetch(&type, &value, &traceback);
        if (!(kwds=PyDict_New())) goto end;
        if (!(argcount=PyLong_FromLong(a))) goto end;
        if (PyDict_SetItemString(kwds, "co_argcount", argcount) != 0) goto end;
        if (!(posonlyargcount=PyLong_FromLong(0))) goto end;
        if (PyDict_SetItemString(kwds, "co_posonlyargcount", posonlyargcount) != 0) goto end;
        if (!(kwonlyargcount=PyLong_FromLong(k))) goto end;
        if (PyDict_SetItemString(kwds, "co_kwonlyargcount", kwonlyargcount) != 0) goto end;
        if (!(nlocals=PyLong_FromLong(l))) goto end;
        if (PyDict_SetItemString(kwds, "co_nlocals", nlocals) != 0) goto end;
        if (!(stacksize=PyLong_FromLong(s))) goto end;
        if (PyDict_SetItemString(kwds, "co_stacksize", stacksize) != 0) goto end;
        if (!(flags=PyLong_FromLong(f))) goto end;
        if (PyDict_SetItemString(kwds, "co_flags", flags) != 0) goto end;
        if (PyDict_SetItemString(kwds, "co_code", code) != 0) goto end;
        if (PyDict_SetItemString(kwds, "co_consts", c) != 0) goto end;
        if (PyDict_SetItemString(kwds, "co_names", n) != 0) goto end;
        if (PyDict_SetItemString(kwds, "co_varnames", v) != 0) goto end;
        if (PyDict_SetItemString(kwds, "co_freevars", fv) != 0) goto end;
        if (PyDict_SetItemString(kwds, "co_cellvars", cell) != 0) goto end;
        if (PyDict_SetItemString(kwds, "co_linetable", lnos) != 0) goto end;
        if (!(fn_cstr=PyUnicode_AsUTF8AndSize(fn, NULL))) goto end;
        if (!(name_cstr=PyUnicode_AsUTF8AndSize(name, NULL))) goto end;
        if (!(co = PyCode_NewEmpty(fn_cstr, name_cstr, fline))) goto end;
        if (!(replace = PyObject_GetAttrString((PyObject*)co, "replace"))) goto cleanup_code_too;
        if (!(empty = PyTuple_New(0))) goto cleanup_code_too; // unfortunately __pyx_empty_tuple isn't available here
        if (!(call_result = PyObject_Call(replace, empty, kwds))) goto cleanup_code_too;
        Py_XDECREF((PyObject*)co);
        co = (PyCodeObject*)call_result;
        call_result = NULL;
        if (0) {
            cleanup_code_too:
            Py_XDECREF((PyObject*)co);
            co = NULL;
        }
        end:
        Py_XDECREF(kwds);
        Py_XDECREF(argcount);
        Py_XDECREF(posonlyargcount);
        Py_XDECREF(kwonlyargcount);
        Py_XDECREF(nlocals);
        Py_XDECREF(stacksize);
        Py_XDECREF(replace);
        Py_XDECREF(call_result);
        Py_XDECREF(empty);
        if (type) {
            PyErr_Restore(type, value, traceback);
        }
        return co;
    }
#else
  #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)
#endif
  #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_STACKLESS
  #define METH_STACKLESS 0
#endif
#if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
  #ifndef METH_FASTCALL
     #define METH_FASTCALL 0x80
  #endif
  typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
  typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
                                                          Py_ssize_t nargs, PyObject *kwnames);
#else
  #define __Pyx_PyCFunctionFast _PyCFunctionFast
  #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
#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 | METH_KEYWORDS | METH_STACKLESS)))))
#else
#define __Pyx_PyFastCFunction_Check(func) 0
#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_CPYTHON && PY_VERSION_HEX < 0x030400A1
  #define PyMem_RawMalloc(n)           PyMem_Malloc(n)
  #define PyMem_RawRealloc(p, n)       PyMem_Realloc(p, n)
  #define PyMem_RawFree(p)             PyMem_Free(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
#if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000
  #define __Pyx_PyThreadState_Current PyThreadState_GET()
#elif PY_VERSION_HEX >= 0x03060000
  #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
#elif PY_VERSION_HEX >= 0x03000000
  #define __Pyx_PyThreadState_Current PyThreadState_GET()
#else
  #define __Pyx_PyThreadState_Current _PyThreadState_Current
#endif
#if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
#include "pythread.h"
#define Py_tss_NEEDS_INIT 0
typedef int Py_tss_t;
static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) {
  *key = PyThread_create_key();
  return 0;
}
static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) {
  Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t));
  *key = Py_tss_NEEDS_INIT;
  return key;
}
static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) {
  PyObject_Free(key);
}
static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) {
  return *key != Py_tss_NEEDS_INIT;
}
static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) {
  PyThread_delete_key(*key);
  *key = Py_tss_NEEDS_INIT;
}
static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) {
  return PyThread_set_key_value(*key, value);
}
static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
  return PyThread_get_key_value(*key);
}
#endif
#if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
#define __Pyx_PyDict_NewPresized(n)  ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
#else
#define __Pyx_PyDict_NewPresized(n)  PyDict_New()
#endif
#if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
  #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
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS
#define __Pyx_PyDict_GetItemStr(dict, name)  _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
#else
#define __Pyx_PyDict_GetItemStr(dict, name)  PyDict_GetItem(dict, name)
#endif
#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
  #define CYTHON_PEP393_ENABLED 1
  #if defined(PyUnicode_IS_READY)
  #define __Pyx_PyUnicode_READY(op)       (likely(PyUnicode_IS_READY(op)) ?\
                                              0 : _PyUnicode_Ready((PyObject *)(op)))
  #else
  #define __Pyx_PyUnicode_READY(op)       (0)
  #endif
  #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)
  #if defined(PyUnicode_IS_READY) && defined(PyUnicode_GET_SIZE)
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000
  #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length))
  #else
  #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
  #endif
  #else
  #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != PyUnicode_GET_LENGTH(u))
  #endif
#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
#define __Pyx_PyString_FormatSafe(a, b)   ((unlikely((a) == Py_None || (PyString_Check(b) && !PyString_CheckExact(b)))) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
#define __Pyx_PyUnicode_FormatSafe(a, b)  ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? 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
#ifndef PyObject_Unicode
  #define PyObject_Unicode             PyObject_Str
#endif
#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
#if PY_VERSION_HEX >= 0x030900A4
  #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt)
  #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size)
#else
  #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt)
  #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size)
#endif
#if CYTHON_ASSUME_SAFE_MACROS
  #define __Pyx_PySequence_SIZE(seq)  Py_SIZE(seq)
#else
  #define __Pyx_PySequence_SIZE(seq)  PySequence_Size(seq)
#endif
#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   __Pyx_PyIndex_AsHash_t
#else
  #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
  #define __Pyx_PyInt_AsHash_t   __Pyx_PyIndex_AsSsize_t
#endif
#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyMethod_New(func, self, klass) ((self) ? ((void)(klass), PyMethod_New(func, self)) : __Pyx_NewRef(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
    #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
  #endif
#else
  #define __Pyx_PyType_AsAsync(obj) NULL
#endif
#ifndef __Pyx_PyAsyncMethodsStruct
    typedef struct {
        unaryfunc am_await;
        unaryfunc am_aiter;
        unaryfunc am_anext;
    } __Pyx_PyAsyncMethodsStruct;
#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_MARK_ERR_POS(f_index, lineno) \
    { __pyx_filename = __pyx_f[f_index]; (void)__pyx_filename; __pyx_lineno = lineno; (void)__pyx_lineno; __pyx_clineno = __LINE__; (void)__pyx_clineno; }
#define __PYX_ERR(f_index, lineno, Ln_error) \
    { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; }

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

#define __PYX_HAVE__nghttp2
#define __PYX_HAVE_API__nghttp2
/* Early includes */
#include <stdint.h>
#include "nghttp2/nghttp2.h"
#include <string.h>
#include <stdlib.h>
#ifdef _OPENMP
#include <omp.h>
#endif /* _OPENMP */

#if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_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_UTF8 0
#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)
#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)))  )
static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
    return (size_t) i < (size_t) limit;
}
#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)
    #define __Pyx_sst_abs(value) ((Py_ssize_t)_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 const char* __Pyx_PyObject_AsString(PyObject*);
static CYTHON_INLINE const 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_PyBytes_AsWritableString(s)     ((char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsWritableSString(s)    ((signed char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsWritableUString(s)    ((unsigned char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsString(s)     ((const char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsSString(s)    ((const signed char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsUString(s)    ((const unsigned char*) PyBytes_AS_STRING(s))
#define __Pyx_PyObject_AsWritableString(s)    ((char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsWritableSString(s)    ((signed char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsWritableUString(s)    ((unsigned char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsSString(s)    ((const signed char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsUString(s)    ((const 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)
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);
}
#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)
static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
#define __Pyx_PySequence_Tuple(obj)\
    (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*);
#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) + 1);
    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 CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }

static PyObject *__pyx_m = NULL;
static PyObject *__pyx_d;
static PyObject *__pyx_b;
static PyObject *__pyx_cython_runtime = NULL;
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[] = {
  "nghttp2.pyx",
  "stringsource",
};

/*--- Type declarations ---*/
struct __pyx_obj_7nghttp2_HDDeflater;
struct __pyx_obj_7nghttp2_HDInflater;
struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase;
struct __pyx_obj_7nghttp2__HTTP2SessionCore;
struct __pyx_obj_7nghttp2__HTTP2ClientSessionCore;
struct __pyx_obj_7nghttp2___pyx_scope_struct____init__;
struct __pyx_obj_7nghttp2___pyx_scope_struct_1___init__;

/* "nghttp2.pyx":50
 *     return b[:blen]
 * 
 * cdef class HDDeflater:             # <<<<<<<<<<<<<<
 *     '''Performs header compression. The constructor takes
 *     |hd_table_bufsize_max| parameter, which limits the usage of header
 */
struct __pyx_obj_7nghttp2_HDDeflater {
  PyObject_HEAD
  nghttp2_hd_deflater *_deflater;
};


/* "nghttp2.pyx":159
 *         return res
 * 
 * cdef class HDInflater:             # <<<<<<<<<<<<<<
 *     '''Performs header decompression.
 * 
 */
struct __pyx_obj_7nghttp2_HDInflater {
  PyObject_HEAD
  nghttp2_hd_inflater *_inflater;
};


/* "nghttp2.pyx":662
 *         http2._start_settings_timer()
 * 
 * cdef class _HTTP2SessionCoreBase:             # <<<<<<<<<<<<<<
 *     cdef cnghttp2.nghttp2_session *session
 *     cdef transport
 */
struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase {
  PyObject_HEAD
  nghttp2_session *session;
  PyObject *transport;
  PyObject *handler_class;
  PyObject *handlers;
  PyObject *settings_timer;
  PyObject *inside_callback;
};


/* "nghttp2.pyx":815
 *             return
 * 
 * cdef class _HTTP2SessionCore(_HTTP2SessionCoreBase):             # <<<<<<<<<<<<<<
 *     def __cinit__(self, *args, **kwargs):
 *         cdef cnghttp2.nghttp2_session_callbacks *callbacks
 */
struct __pyx_obj_7nghttp2__HTTP2SessionCore {
  struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase __pyx_base;
};


/* "nghttp2.pyx":931
 *         self.handlers = set()
 * 
 * cdef class _HTTP2ClientSessionCore(_HTTP2SessionCoreBase):             # <<<<<<<<<<<<<<
 *     def __cinit__(self, *args, **kwargs):
 *         cdef cnghttp2.nghttp2_session_callbacks *callbacks
 */
struct __pyx_obj_7nghttp2__HTTP2ClientSessionCore {
  struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase __pyx_base;
};


/* "nghttp2.pyx":1355
 * 
 *         '''
 *         def __init__(self, address, RequestHandlerClass, ssl=None):             # <<<<<<<<<<<<<<
 * 
 *             '''address is a tuple of the listening address and port (e.g.,
 */
struct __pyx_obj_7nghttp2___pyx_scope_struct____init__ {
  PyObject_HEAD
  PyObject *__pyx_v_RequestHandlerClass;
};


/* "nghttp2.pyx":1604
 * 
 *         '''
 *         def __init__(self, address, loop=None, ssl=None):             # <<<<<<<<<<<<<<
 * 
 *             '''address is a tuple of the connect address and port (e.g.,
 */
struct __pyx_obj_7nghttp2___pyx_scope_struct_1___init__ {
  PyObject_HEAD
  PyObject *__pyx_v_self;
};


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

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

/* 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);
#else
#define __Pyx_PyObject_DelAttrStr(o,n)   PyObject_DelAttr(o,n)
#define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v)
#endif

/* PyDictVersioning.proto */
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
#define __PYX_DICT_VERSION_INIT  ((PY_UINT64_T) -1)
#define __PYX_GET_DICT_VERSION(dict)  (((PyDictObject*)(dict))->ma_version_tag)
#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
    (version_var) = __PYX_GET_DICT_VERSION(dict);\
    (cache_var) = (value);
#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
    static PY_UINT64_T __pyx_dict_version = 0;\
    static PyObject *__pyx_dict_cached_value = NULL;\
    if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
        (VAR) = __pyx_dict_cached_value;\
    } else {\
        (VAR) = __pyx_dict_cached_value = (LOOKUP);\
        __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
    }\
}
static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
#else
#define __PYX_GET_DICT_VERSION(dict)  (0)
#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP)  (VAR) = (LOOKUP);
#endif

/* GetModuleGlobalName.proto */
#if CYTHON_USE_DICT_VERSIONS
#define __Pyx_GetModuleGlobalName(var, name)  {\
    static PY_UINT64_T __pyx_dict_version = 0;\
    static PyObject *__pyx_dict_cached_value = NULL;\
    (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\
        (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
        __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
}
#define __Pyx_GetModuleGlobalNameUncached(var, name)  {\
    PY_UINT64_T __pyx_dict_version;\
    PyObject *__pyx_dict_cached_value;\
    (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
}
static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
#else
#define __Pyx_GetModuleGlobalName(var, name)  (var) = __Pyx__GetModuleGlobalName(name)
#define __Pyx_GetModuleGlobalNameUncached(var, name)  (var) = __Pyx__GetModuleGlobalName(name)
static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
#endif

/* 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, Py_ssize_t nargs, PyObject *kwargs);
#else
#define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
#endif
#define __Pyx_BUILD_ASSERT_EXPR(cond)\
    (sizeof(char [1 - 2*!(cond)]) - 1)
#ifndef Py_MEMBER_SIZE
#define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
#endif
#if CYTHON_FAST_PYCALL
  static size_t __pyx_pyframe_localsplus_offset = 0;
  #include "frameobject.h"
  #define __Pxy_PyFrame_Initialize_Offsets()\
    ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
     (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
  #define __Pyx_PyFrame_GetLocalsplus(frame)\
    (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
#endif // CYTHON_FAST_PYCALL
#endif

/* 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

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

/* PyThreadStateGet.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyThreadState_declare  PyThreadState *__pyx_tstate;
#define __Pyx_PyThreadState_assign  __pyx_tstate = __Pyx_PyThreadState_Current;
#define __Pyx_PyErr_Occurred()  __pyx_tstate->curexc_type
#else
#define __Pyx_PyThreadState_declare
#define __Pyx_PyThreadState_assign
#define __Pyx_PyErr_Occurred()  PyErr_Occurred()
#endif

/* PyErrFetchRestore.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
#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);
#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
#else
#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
#endif
#else
#define __Pyx_PyErr_Clear() PyErr_Clear()
#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
#define __Pyx_ErrRestoreWithState(type, value, tb)  PyErr_Restore(type, value, tb)
#define __Pyx_ErrFetchWithState(type, value, tb)  PyErr_Fetch(type, value, tb)
#define __Pyx_ErrRestoreInState(tstate, type, value, tb)  PyErr_Restore(type, value, tb)
#define __Pyx_ErrFetchInState(tstate, 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);

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

/* 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

/* 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

/* GetTopmostException.proto */
#if CYTHON_USE_EXC_INFO_STACK
static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
#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

/* 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);
        __Pyx_SET_SIZE(list, len + 1);
        return 0;
    }
    return PyList_Append(list, x);
}
#else
#define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
#endif

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

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

/* decode_c_string_utf16.proto */
static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16(const char *s, Py_ssize_t size, const char *errors) {
    int byteorder = 0;
    return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
}
static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16LE(const char *s, Py_ssize_t size, const char *errors) {
    int byteorder = -1;
    return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
}
static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16BE(const char *s, Py_ssize_t size, const char *errors) {
    int byteorder = 1;
    return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
}

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

/* PyIntBinop.proto */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
#else
#define __Pyx_PyInt_AddObjC(op1, op2, intval, inplace, zerodivision_check)\
    (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2))
#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

/* PyObjectCall2Args.proto */
static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2);

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

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

/* BytesEquals.proto */
static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals);

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

/* PyObjectGetMethod.proto */
static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method);

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

/* append.proto */
static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x);

/* StringJoin.proto */
#if PY_MAJOR_VERSION < 3
#define __Pyx_PyString_Join __Pyx_PyBytes_Join
#define __Pyx_PyBaseString_Join(s, v) (PyUnicode_CheckExact(s) ? PyUnicode_Join(s, v) : __Pyx_PyBytes_Join(s, v))
#else
#define __Pyx_PyString_Join PyUnicode_Join
#define __Pyx_PyBaseString_Join PyUnicode_Join
#endif
#if CYTHON_COMPILING_IN_CPYTHON
    #if PY_MAJOR_VERSION < 3
    #define __Pyx_PyBytes_Join _PyString_Join
    #else
    #define __Pyx_PyBytes_Join _PyBytes_Join
    #endif
#else
static CYTHON_INLINE PyObject* __Pyx_PyBytes_Join(PyObject* sep, PyObject* values);
#endif

/* PyIntCompare.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, long intval, long inplace);

/* 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

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

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

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

/* CythonFunctionShared.proto */
#define __Pyx_CyFunction_USED 1
#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;
    size_t defaults_size;  // used by FusedFunction for copying defaults
    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_Check(obj)  (__Pyx_TypeCheck(obj, __pyx_CyFunctionType))
static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject* op, 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);

/* CythonFunction.proto */
static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml,
                                      int flags, PyObject* qualname,
                                      PyObject *closure,
                                      PyObject *module, PyObject *globals,
                                      PyObject* code);

/* PyObject_GenericGetAttrNoDict.proto */
#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name);
#else
#define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr
#endif

/* PyObject_GenericGetAttr.proto */
#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name);
#else
#define __Pyx_PyObject_GenericGetAttr PyObject_GenericGetAttr
#endif

/* PyObjectGetAttrStrNoError.proto */
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name);

/* SetupReduce.proto */
static int __Pyx_setup_reduce(PyObject* type_obj);

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

/* SetNameInClass.proto */
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
#define __Pyx_SetNameInClass(ns, name, value)\
    (likely(PyDict_CheckExact(ns)) ? _PyDict_SetItem_KnownHash(ns, name, value, ((PyASCIIObject *) name)->hash) : PyObject_SetItem(ns, name, value))
#elif CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_SetNameInClass(ns, name, value)\
    (likely(PyDict_CheckExact(ns)) ? PyDict_SetItem(ns, name, value) : PyObject_SetItem(ns, name, value))
#else
#define __Pyx_SetNameInClass(ns, name, value)  PyObject_SetItem(ns, name, value)
#endif

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

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

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

/* CLineInTraceback.proto */
#ifdef CYTHON_CLINE_IN_TRACEBACK
#define __Pyx_CLineForTraceback(tstate, c_line)  (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
#else
static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
#endif

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

/* GCCDiagnostics.proto */
#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
#define __Pyx_HAS_GCC_DIAGNOSTIC
#endif

/* Print.proto */
static int __Pyx_Print(PyObject*, PyObject *, int);
#if CYTHON_COMPILING_IN_PYPY || PY_MAJOR_VERSION >= 3
static PyObject* __pyx_print = 0;
static PyObject* __pyx_print_kwargs = 0;
#endif

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_nghttp2_error_code(nghttp2_error_code value);

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

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint16_t(uint16_t value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint8_t(uint8_t value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int32_t(int32_t value);

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

/* PrintOne.proto */
static int __Pyx_PrintOne(PyObject* stream, PyObject *o);

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

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

/* CIntFromPy.proto */
static CYTHON_INLINE int32_t __Pyx_PyInt_As_int32_t(PyObject *);

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

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

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

/* FastTypeChecks.proto */
#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
#else
#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
#define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
#define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
#endif
#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)

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

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


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

/* Module declarations from 'cnghttp2' */

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

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

/* Module declarations from 'nghttp2' */
static PyTypeObject *__pyx_ptype_7nghttp2_HDDeflater = 0;
static PyTypeObject *__pyx_ptype_7nghttp2_HDInflater = 0;
static PyTypeObject *__pyx_ptype_7nghttp2__HTTP2SessionCoreBase = 0;
static PyTypeObject *__pyx_ptype_7nghttp2__HTTP2SessionCore = 0;
static PyTypeObject *__pyx_ptype_7nghttp2__HTTP2ClientSessionCore = 0;
static PyTypeObject *__pyx_ptype_7nghttp2___pyx_scope_struct____init__ = 0;
static PyTypeObject *__pyx_ptype_7nghttp2___pyx_scope_struct_1___init__ = 0;
static PyObject *__pyx_f_7nghttp2__get_pybytes(uint8_t *, uint16_t); /*proto*/
static PyObject *__pyx_f_7nghttp2__strerror(int); /*proto*/
static PyObject *__pyx_f_7nghttp2__get_stream_user_data(nghttp2_session *, int32_t); /*proto*/
static size_t __pyx_f_7nghttp2__make_nva(nghttp2_nv **, PyObject *); /*proto*/
static int __pyx_f_7nghttp2_server_on_header(nghttp2_session *, nghttp2_frame const *, uint8_t const *, size_t, uint8_t const *, size_t, uint8_t, void *); /*proto*/
static int __pyx_f_7nghttp2_client_on_header(nghttp2_session *, nghttp2_frame const *, uint8_t const *, size_t, uint8_t const *, size_t, uint8_t, void *); /*proto*/
static int __pyx_f_7nghttp2_on_header(uint8_t const *, size_t, uint8_t const *, size_t, uint8_t, PyObject *); /*proto*/
static int __pyx_f_7nghttp2_server_on_begin_request_headers(nghttp2_session *, nghttp2_frame const *, void *); /*proto*/
static int __pyx_f_7nghttp2_server_on_begin_headers(nghttp2_session *, nghttp2_frame const *, void *); /*proto*/
static int __pyx_f_7nghttp2_server_on_frame_recv(nghttp2_session *, nghttp2_frame const *, void *); /*proto*/
static int __pyx_f_7nghttp2_on_data_chunk_recv(nghttp2_session *, uint8_t, int32_t, uint8_t const *, size_t, void *); /*proto*/
static int __pyx_f_7nghttp2_server_on_frame_send(nghttp2_session *, nghttp2_frame const *, void *); /*proto*/
static int __pyx_f_7nghttp2_server_on_frame_not_send(nghttp2_session *, nghttp2_frame const *, int, void *); /*proto*/
static int __pyx_f_7nghttp2_on_stream_close(nghttp2_session *, int32_t, uint32_t, void *); /*proto*/
static Py_ssize_t __pyx_f_7nghttp2_data_source_read(nghttp2_session *, int32_t, uint8_t *, size_t, uint32_t *, nghttp2_data_source *, void *); /*proto*/
static int __pyx_f_7nghttp2_client_on_begin_headers(nghttp2_session *, nghttp2_frame const *, void *); /*proto*/
static int __pyx_f_7nghttp2_client_on_frame_recv(nghttp2_session *, nghttp2_frame const *, void *); /*proto*/
static int __pyx_f_7nghttp2_client_on_frame_send(nghttp2_session *, nghttp2_frame const *, void *); /*proto*/
#define __Pyx_MODULE_NAME "nghttp2"
extern int __pyx_module_is_main_nghttp2;
int __pyx_module_is_main_nghttp2 = 0;

/* Implementation of 'nghttp2' */
static PyObject *__pyx_builtin_ImportError;
static PyObject *__pyx_builtin_property;
static PyObject *__pyx_builtin_range;
static PyObject *__pyx_builtin_TypeError;
static PyObject *__pyx_builtin_enumerate;
static PyObject *__pyx_builtin_AttributeError;
static PyObject *__pyx_builtin_super;
static PyObject *__pyx_builtin_OSError;
static const char __pyx_k_P[] = "P";
static const char __pyx_k_b[] = "b";
static const char __pyx_k_e[] = "e";
static const char __pyx_k_k[] = "k";
static const char __pyx_k_n[] = "n";
static const char __pyx_k_s[] = "[{}] (s={}) {}: {}";
static const char __pyx_k_v[] = "v";
static const char __pyx_k__6[] = "\000";
static const char __pyx_k__7[] = "; ";
static const char __pyx_k__9[] = "-";
static const char __pyx_k_io[] = "io";
static const char __pyx_k_GET[] = "GET";
static const char __pyx_k__22[] = "/";
static const char __pyx_k__23[] = ":";
static const char __pyx_k__24[] = ";";
static const char __pyx_k__25[] = "?";
static const char __pyx_k__26[] = "#";
static const char __pyx_k_add[] = "add";
static const char __pyx_k_doc[] = "__doc__";
static const char __pyx_k_end[] = "end";
static const char __pyx_k_err[] = "err";
static const char __pyx_k_exc[] = "exc";
static const char __pyx_k_idx[] = "idx";
static const char __pyx_k_now[] = "now";
static const char __pyx_k_ssl[] = "ssl";
static const char __pyx_k_sys[] = "sys";
static const char __pyx_k_tls[] = "tls";
static const char __pyx_k_url[] = "url";
static const char __pyx_k__120[] = "_";
static const char __pyx_k_body[] = "body";
static const char __pyx_k_coro[] = "coro";
static const char __pyx_k_data[] = "data";
static const char __pyx_k_file[] = "file";
static const char __pyx_k_host[] = "host";
static const char __pyx_k_http[] = "http";
static const char __pyx_k_info[] = "info";
static const char __pyx_k_init[] = "__init__";
static const char __pyx_k_join[] = "join";
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_path[] = ":path";
static const char __pyx_k_port[] = "port";
static const char __pyx_k_push[] = "push";
static const char __pyx_k_self[] = "self";
static const char __pyx_k_sock[] = "sock";
static const char __pyx_k_test[] = "__test__";
static const char __pyx_k_time[] = "time";
static const char __pyx_k_abort[] = "abort";
static const char __pyx_k_close[] = "close";
static const char __pyx_k_debug[] = "debug";
static const char __pyx_k_email[] = "email";
static const char __pyx_k_entry[] = "entry";
static const char __pyx_k_http2[] = "http2";
static const char __pyx_k_https[] = "https";
static const char __pyx_k_print[] = "print";
static const char __pyx_k_query[] = "query";
static const char __pyx_k_range[] = "range";
static const char __pyx_k_read1[] = "read1";
static const char __pyx_k_space[] = "space";
static const char __pyx_k_split[] = "split";
static const char __pyx_k_super[] = "super";
static const char __pyx_k_utf_8[] = "utf-8";
static const char __pyx_k_utils[] = "utils";
static const char __pyx_k_value[] = "value";
static const char __pyx_k_write[] = "write";
static const char __pyx_k_IOBase[] = "IOBase";
static const char __pyx_k_append[] = "append";
static const char __pyx_k_cancel[] = "cancel";
static const char __pyx_k_client[] = "client";
static const char __pyx_k_cookie[] = "cookie";
static const char __pyx_k_decode[] = "decode";
static const char __pyx_k_encode[] = "encode";
static const char __pyx_k_extend[] = "extend";
static const char __pyx_k_format[] = "format";
static const char __pyx_k_import[] = "__import__";
static const char __pyx_k_method[] = ":method";
static const char __pyx_k_mktime[] = "mktime";
static const char __pyx_k_module[] = "__module__";
static const char __pyx_k_name_2[] = "__name__";
static const char __pyx_k_netloc[] = "netloc";
static const char __pyx_k_params[] = "params";
static const char __pyx_k_path_2[] = "path";
static const char __pyx_k_pushed[] = "pushed";
static const char __pyx_k_reduce[] = "__reduce__";
static const char __pyx_k_remove[] = "remove";
static const char __pyx_k_resume[] = "resume";
static const char __pyx_k_scheme[] = ":scheme";
static const char __pyx_k_server[] = "server";
static const char __pyx_k_socket[] = "socket";
static const char __pyx_k_status[] = ":status";
static const char __pyx_k_stderr[] = "stderr";
static const char __pyx_k_usegmt[] = "usegmt";
static const char __pyx_k_BytesIO[] = "BytesIO";
static const char __pyx_k_DATA_OK[] = "DATA_OK";
static const char __pyx_k_OSError[] = "OSError";
static const char __pyx_k_address[] = "address";
static const char __pyx_k_asyncio[] = "asyncio";
static const char __pyx_k_cookies[] = "cookies";
static const char __pyx_k_handler[] = "handler";
static const char __pyx_k_hdtable[] = "hdtable";
static const char __pyx_k_headers[] = "headers";
static const char __pyx_k_inspect[] = "inspect";
static const char __pyx_k_io_loop[] = "io_loop";
static const char __pyx_k_logging[] = "logging";
static const char __pyx_k_namelen[] = "namelen";
static const char __pyx_k_nghttp2[] = "nghttp2";
static const char __pyx_k_on_data[] = "on_data";
static const char __pyx_k_pending[] = "pending";
static const char __pyx_k_prepare[] = "__prepare__";
static const char __pyx_k_session[] = "session";
static const char __pyx_k_ssl_ctx[] = "ssl_ctx";
static const char __pyx_k_ssl_obj[] = "ssl_obj";
static const char __pyx_k_timeval[] = "timeval";
static const char __pyx_k_DATA_EOF[] = "DATA_EOF";
static const char __pyx_k_HAS_ALPN[] = "HAS_ALPN";
static const char __pyx_k_Protocol[] = "Protocol";
static const char __pyx_k_datetime[] = "datetime";
static const char __pyx_k_fragment[] = "fragment";
static const char __pyx_k_generate[] = "generate";
static const char __pyx_k_getstate[] = "__getstate__";
static const char __pyx_k_method_2[] = "method";
static const char __pyx_k_on_close[] = "on_close";
static const char __pyx_k_peername[] = "peername";
static const char __pyx_k_property[] = "property";
static const char __pyx_k_protocol[] = "protocol";
static const char __pyx_k_qualname[] = "__qualname__";
static const char __pyx_k_scheme_2[] = "scheme";
static const char __pyx_k_setstate[] = "__setstate__";
static const char __pyx_k_status_2[] = "status";
static const char __pyx_k_urlparse[] = "urlparse";
static const char __pyx_k_valuelen[] = "valuelen";
static const char __pyx_k_TypeError[] = "TypeError";
static const char __pyx_k_authority[] = ":authority";
static const char __pyx_k_enumerate[] = "enumerate";
static const char __pyx_k_localtime[] = "localtime";
static const char __pyx_k_metaclass[] = "__metaclass__";
static const char __pyx_k_reduce_ex[] = "__reduce_ex__";
static const char __pyx_k_send_data[] = "send_data";
static const char __pyx_k_stream_id[] = "stream_id";
static const char __pyx_k_timetuple[] = "timetuple";
static const char __pyx_k_traceback[] = "traceback";
static const char __pyx_k_transport[] = "transport";
static const char __pyx_k_wrap_body[] = "wrap_body";
static const char __pyx_k_HDDeflater[] = "HDDeflater";
static const char __pyx_k_HDInflater[] = "HDInflater";
static const char __pyx_k_OUTBUF_MAX[] = "OUTBUF_MAX";
static const char __pyx_k_app_protos[] = "app_protos";
static const char __pyx_k_call_later[] = "call_later";
static const char __pyx_k_error_code[] = "error_code";
static const char __pyx_k_format_exc[] = "format_exc";
static const char __pyx_k_formatdate[] = "formatdate";
static const char __pyx_k_on_headers[] = "on_headers";
static const char __pyx_k_rst_stream[] = "_rst_stream";
static const char __pyx_k_setsockopt[] = "setsockopt";
static const char __pyx_k_ssl_object[] = "ssl_object";
static const char __pyx_k_sslcontext[] = "sslcontext";
static const char __pyx_k_HTTP2Client[] = "HTTP2Client";
static const char __pyx_k_HTTP2Server[] = "HTTP2Server";
static const char __pyx_k_IPPROTO_TCP[] = "IPPROTO_TCP";
static const char __pyx_k_ImportError[] = "ImportError";
static const char __pyx_k_TCP_NODELAY[] = "TCP_NODELAY";
static const char __pyx_k_accept_push[] = "accept_push";
static const char __pyx_k_add_handler[] = "_add_handler";
static const char __pyx_k_email_utils[] = "email.utils";
static const char __pyx_k_getpeercert[] = "getpeercert";
static const char __pyx_k_log_request[] = "_log_request";
static const char __pyx_k_reject_push[] = "reject_push";
static const char __pyx_k_run_forever[] = "run_forever";
static const char __pyx_k_HDTableEntry[] = "HDTableEntry";
static const char __pyx_k_HTTP2Session[] = "_HTTP2Session";
static const char __pyx_k_make_handler[] = "_make_handler";
static const char __pyx_k_push_promise[] = "push_promise";
static const char __pyx_k_send_pending[] = "send_pending";
static const char __pyx_k_send_request[] = "send_request";
static const char __pyx_k_urllib_parse[] = "urllib.parse";
static const char __pyx_k_ByteIOWrapper[] = "_ByteIOWrapper";
static const char __pyx_k_DATA_DEFERRED[] = "DATA_DEFERRED";
static const char __pyx_k_asyncio_tasks[] = "asyncio.tasks";
static const char __pyx_k_create_server[] = "create_server";
static const char __pyx_k_data_received[] = "data_received";
static const char __pyx_k_handler_class[] = "handler_class";
static const char __pyx_k_reduce_cython[] = "__reduce_cython__";
static const char __pyx_k_response_body[] = "response_body";
static const char __pyx_k_send_response[] = "send_response";
static const char __pyx_k_serve_forever[] = "serve_forever";
static const char __pyx_k_AttributeError[] = "AttributeError";
static const char __pyx_k_client_address[] = "client_address";
static const char __pyx_k_encode_headers[] = "_encode_headers";
static const char __pyx_k_enter_callback[] = "enter_callback";
static const char __pyx_k_get_event_loop[] = "get_event_loop";
static const char __pyx_k_get_extra_info[] = "get_extra_info";
static const char __pyx_k_leave_callback[] = "leave_callback";
static const char __pyx_k_npn_protocol_s[] = "npn, protocol:%s";
static const char __pyx_k_print_hd_table[] = "print_hd_table";
static const char __pyx_k_remote_address[] = "remote_address";
static const char __pyx_k_remove_handler[] = "_remove_handler";
static const char __pyx_k_resume_writing[] = "resume_writing";
static const char __pyx_k_server_address[] = "server_address";
static const char __pyx_k_alpn_protocol_s[] = "alpn, protocol:%s";
static const char __pyx_k_connection_lost[] = "connection_lost";
static const char __pyx_k_connection_made[] = "connection_made";
static const char __pyx_k_on_push_promise[] = "on_push_promise";
static const char __pyx_k_on_request_done[] = "on_request_done";
static const char __pyx_k_request_headers[] = "request_headers";
static const char __pyx_k_session_factory[] = "session_factory";
static const char __pyx_k_setstate_cython[] = "__setstate_cython__";
static const char __pyx_k_HTTP2SessionCore[] = "_HTTP2SessionCore";
static const char __pyx_k_SETTINGS_TIMEOUT[] = "SETTINGS_TIMEOUT";
static const char __pyx_k_on_response_done[] = "on_response_done";
static const char __pyx_k_promised_handler[] = "promised_handler";
static const char __pyx_k_push_stream_id_s[] = "push, stream_id:%s";
static const char __pyx_k_response_headers[] = "response_headers";
static const char __pyx_k_settings_timeout[] = "_settings_timeout";
static const char __pyx_k_HD_ENTRY_OVERHEAD[] = "HD_ENTRY_OVERHEAD";
static const char __pyx_k_HTTP2Client_close[] = "HTTP2Client.close";
static const char __pyx_k_create_connection[] = "create_connection";
static const char __pyx_k_set_npn_protocols[] = "set_npn_protocols";
static const char __pyx_k_set_response_prop[] = "_set_response_prop";
static const char __pyx_k_BaseRequestHandler[] = "BaseRequestHandler";
static const char __pyx_k_HDTableEntry_space[] = "HDTableEntry.space";
static const char __pyx_k_HTTP2ClientSession[] = "_HTTP2ClientSession";
static const char __pyx_k_HTTP2Client___init[] = "HTTP2Client.__init__";
static const char __pyx_k_HTTP2Server___init[] = "HTTP2Server.__init__";
static const char __pyx_k_asyncio_coroutines[] = "asyncio.coroutines";
static const char __pyx_k_client_certificate[] = "client_certificate";
static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
static const char __pyx_k_get_remote_address[] = "_get_remote_address";
static const char __pyx_k_run_until_complete[] = "run_until_complete";
static const char __pyx_k_s_s_s_s_HTTP_2_s_s[] = "%s - - [%s] \"%s %s HTTP/2\" %s - %s";
static const char __pyx_k_set_alpn_protocols[] = "set_alpn_protocols";
static const char __pyx_k_BaseResponseHandler[] = "BaseResponseHandler";
static const char __pyx_k_HDTableEntry___init[] = "HDTableEntry.__init__";
static const char __pyx_k_HTTP2Client_io_loop[] = "HTTP2Client.io_loop";
static const char __pyx_k_HTTP2Session___init[] = "_HTTP2Session.__init__";
static const char __pyx_k_RequestHandlerClass[] = "RequestHandlerClass";
static const char __pyx_k_negotiated_protocol[] = "negotiated_protocol";
static const char __pyx_k_request_stream_id_s[] = "request, stream_id:%s";
static const char __pyx_k_stop_settings_timer[] = "_stop_settings_timer";
static const char __pyx_k_ByteIOWrapper___init[] = "_ByteIOWrapper.__init__";
static const char __pyx_k_HTTP2SessionCoreBase[] = "_HTTP2SessionCoreBase";
static const char __pyx_k_client_certificate_2[] = "_client_certificate";
static const char __pyx_k_hd_table_bufsize_max[] = "hd_table_bufsize_max";
static const char __pyx_k_start_settings_timer[] = "_start_settings_timer";
static const char __pyx_k_get_write_buffer_size[] = "get_write_buffer_size";
static const char __pyx_k_selected_npn_protocol[] = "selected_npn_protocol";
static const char __pyx_k_ByteIOWrapper_generate[] = "_ByteIOWrapper.generate";
static const char __pyx_k_HTTP2ClientSessionCore[] = "_HTTP2ClientSessionCore";
static const char __pyx_k_get_client_certificate[] = "_get_client_certificate";
static const char __pyx_k_path_must_not_be_empty[] = "path must not be empty";
static const char __pyx_k_selected_alpn_protocol[] = "selected_alpn_protocol";
static const char __pyx_k_BaseRequestHandler_push[] = "BaseRequestHandler.push";
static const char __pyx_k_add_handler_stream_id_s[] = "_add_handler, stream_id:%s";
static const char __pyx_k_listen_address_s_port_s[] = "listen, address:%s, port:%s";
static const char __pyx_k_HTTP2ClientSession_close[] = "_HTTP2ClientSession.close";
static const char __pyx_k_HTTP2Client_send_request[] = "HTTP2Client.send_request";
static const char __pyx_k_connect_address_s_port_s[] = "connect, address:%s, port:%s";
static const char __pyx_k_make_handler_stream_id_s[] = "_make_handler, stream_id:%s";
static const char __pyx_k_method_must_not_be_empty[] = "method must not be empty";
static const char __pyx_k_set_application_protocol[] = "set_application_protocol";
static const char __pyx_k_status_must_not_be_empty[] = "status must not be empty";
static const char __pyx_k_BaseRequestHandler___init[] = "BaseRequestHandler.__init__";
static const char __pyx_k_BaseRequestHandler_resume[] = "BaseRequestHandler.resume";
static const char __pyx_k_DEFAULT_HEADER_TABLE_SIZE[] = "DEFAULT_HEADER_TABLE_SIZE";
static const char __pyx_k_HTTP2ClientSession___init[] = "_HTTP2ClientSession.__init__";
static const char __pyx_k_HTTP2Server_serve_forever[] = "HTTP2Server.serve_forever";
static const char __pyx_k_send_response_stream_id_s[] = "send_response, stream_id:%s";
static const char __pyx_k_BaseRequestHandler_on_data[] = "BaseRequestHandler.on_data";
static const char __pyx_k_BaseResponseHandler___init[] = "BaseResponseHandler.__init__";
static const char __pyx_k_BaseResponseHandler_resume[] = "BaseResponseHandler.resume";
static const char __pyx_k_HTTP2Session_data_received[] = "_HTTP2Session.data_received";
static const char __pyx_k_remove_handler_stream_id_s[] = "_remove_handler, stream_id:%s";
static const char __pyx_k_BaseRequestHandler_on_close[] = "BaseRequestHandler.on_close";
static const char __pyx_k_BaseResponseHandler_on_data[] = "BaseResponseHandler.on_data";
static const char __pyx_k_HTTP2Session_resume_writing[] = "_HTTP2Session.resume_writing";
static const char __pyx_k_failed_to_set_tcp_nodelay_s[] = "failed to set tcp-nodelay: %s";
static const char __pyx_k_on_stream_close_stream_id_s[] = "on_stream_close, stream_id:%s";
static const char __pyx_k_BaseResponseHandler_on_close[] = "BaseResponseHandler.on_close";
static const char __pyx_k_HTTP2Session_connection_lost[] = "_HTTP2Session.connection_lost";
static const char __pyx_k_HTTP2Session_connection_made[] = "_HTTP2Session.connection_made";
static const char __pyx_k_BaseRequestHandler_on_headers[] = "BaseRequestHandler.on_headers";
static const char __pyx_k_DEFLATE_MAX_HEADER_TABLE_SIZE[] = "DEFLATE_MAX_HEADER_TABLE_SIZE";
static const char __pyx_k_nghttp2_submit_request_failed[] = "nghttp2_submit_request failed: {}";
static const char __pyx_k_BaseResponseHandler_on_headers[] = "BaseResponseHandler.on_headers";
static const char __pyx_k_nghttp2_submit_response_failed[] = "nghttp2_submit_response failed: {}";
static const char __pyx_k_nghttp2_submit_settings_failed[] = "nghttp2_submit_settings failed: {}";
static const char __pyx_k_response_has_already_been_sent[] = "response has already been sent";
static const char __pyx_k_BaseResponseHandler_accept_push[] = "BaseResponseHandler.accept_push";
static const char __pyx_k_BaseResponseHandler_on_response[] = "BaseResponseHandler.on_response_done";
static const char __pyx_k_BaseResponseHandler_reject_push[] = "BaseResponseHandler.reject_push";
static const char __pyx_k_HTTP2ClientSession_connection_l[] = "_HTTP2ClientSession.connection_lost";
static const char __pyx_k_HTTP2ClientSession_connection_m[] = "_HTTP2ClientSession.connection_made";
static const char __pyx_k_HTTP2ClientSession_data_receive[] = "_HTTP2ClientSession.data_received";
static const char __pyx_k_HTTP2ClientSession_resume_writi[] = "_HTTP2ClientSession.resume_writing";
static const char __pyx_k_HTTP2ClientSession_send_request[] = "_HTTP2ClientSession.send_request";
static const char __pyx_k_HTTP_2_client_This_class_builds[] = "HTTP/2 client.\n\n        This class builds on top of the asyncio event loop.\n\n        ";
static const char __pyx_k_HTTP_2_server_This_class_builds[] = "HTTP/2 server.\n\n        This class builds on top of the asyncio event loop. On\n        construction, RequestHandlerClass must be given, which must be a\n        subclass of BaseRequestHandler class.\n\n        ";
static const char __pyx_k_home_BWI_src_cygwin_nghttp2_ngh[] = "/home/BWI/src/cygwin/nghttp2/nghttp2-1.50.0-1.i686/src/nghttp2-1.50.0/python/nghttp2.pyx";
static const char __pyx_k_nghttp2_session_mem_recv_failed[] = "nghttp2_session_mem_recv failed: {}";
static const char __pyx_k_nghttp2_session_mem_send_failed[] = "nghttp2_session_mem_send failed: {}";
static const char __pyx_k_server_on_frame_not_send_type_s[] = "server_on_frame_not_send, type:%s, stream_id:%s";
static const char __pyx_k_BaseRequestHandler__set_response[] = "BaseRequestHandler._set_response_prop";
static const char __pyx_k_BaseRequestHandler_client_addres[] = "BaseRequestHandler.client_address";
static const char __pyx_k_BaseRequestHandler_client_certif[] = "BaseRequestHandler.client_certificate";
static const char __pyx_k_BaseRequestHandler_on_request_do[] = "BaseRequestHandler.on_request_done";
static const char __pyx_k_BaseRequestHandler_send_response[] = "BaseRequestHandler.send_response";
static const char __pyx_k_BaseResponseHandler_on_push_prom[] = "BaseResponseHandler.on_push_promise";
static const char __pyx_k_BaseResponseHandler_server_addre[] = "BaseResponseHandler.server_address";
static const char __pyx_k_HTTP2Client___init___locals_sess[] = "HTTP2Client.__init__.<locals>.session_factory";
static const char __pyx_k_HTTP2Server___init___locals_sess[] = "HTTP2Server.__init__.<locals>.session_factory";
static const char __pyx_k_HTTP_2_request_stream_handler_ba[] = "HTTP/2 request (stream) handler base class.\n\n        The class is used to handle the HTTP/2 stream. By default, it does\n        nothing. It must be subclassed to handle each event callback method.\n\n        The first callback method invoked is on_headers(). It is called\n        when HEADERS frame, which includes request header fields, is\n        arrived.\n\n        If request has request body, on_data(data) is invoked for each\n        chunk of received data.\n\n        When whole request is received, on_request_done() is invoked.\n\n        When stream is closed, on_close(error_code) is called.\n\n        The application can send response using send_response() method. It\n        can be used in on_headers(), on_data() or on_request_done().\n\n        The application can push resource using push() method. It must be\n        used before send_response() call.\n\n        The following instance variables are available:\n\n        client_address\n          Contains a tuple of the form (host, port) referring to the client's\n          address.\n\n        client_certificate\n          May contain the client certificate in its non-binary form\n\n        stream_id\n          Stream ID of this stream\n\n        scheme\n          Scheme of the request URI. This is a value of :scheme header field.\n\n        method\n          Method of this stream. This is a value of :method header field.\n\n        host\n          This is a value of :authority or host header field.\n\n        path\n          This is a value of :path header field.\n\n        headers\n          Request header fields\n\n        ";
static const char __pyx_k_HTTP_2_response_stream_handler_b[] = "HTTP/2 response (stream) handler base class.\n\n        The class is used to handle the HTTP/2 stream. By default, it does\n        not nothing. It must be subclassed to handle each event callback\n        method.\n\n        The first callback method invoked is on_headers(). It is called\n        when HEADERS frame, which includes response header fields, is\n        arrived.\n\n        If response has a body, on_data(data) is invoked for each\n        chunk of received data.\n\n        When whole response is received, on_response_done() is invoked.\n\n        When stream is closed or underlying connection is lost,\n        on_close(error_code) is called.\n\n        The application can send follow up requests using HTTP2Client.send_request() method.\n\n        The application can handle push resource using on_push_promise() method.\n\n        The following instance variables are available:\n\n        server_address\n          Contains a tuple of the form (host, port) referring to the server's\n          address.\n\n        stream_id\n          Stream ID of this stream\n\n        scheme\n          Scheme of the request URI. This is a value of :scheme header field.\n\n        method\n          Method of this stream. This is a value of :method header field.\n\n        host\n          This is a value of :authority or host header field.\n\n        path\n          This is a value of :path header field.\n\n        headers\n          Response header fields.  There is a special exception.  If this\n          object is passed to push_promise(), this instance variable contains\n          pushed request header fields.\n\n        ";
static const char __pyx_k_client_on_frame_recv_type_s_stre[] = "client_on_frame_recv, type:%s, stream_id:%s";
static const char __pyx_k_client_on_frame_send_type_s_stre[] = "client_on_frame_send, type:%s, stream_id:%s";
static const char __pyx_k_client_on_header_type_s_stream_i[] = "client_on_header, type:%s, stream_id:%s";
static const char __pyx_k_connection_made_address_s_port_s[] = "connection_made, address:%s, port:%s";
static const char __pyx_k_nghttp2_session_callbacks_new_fa[] = "nghttp2_session_callbacks_new failed: {}";
static const char __pyx_k_nghttp2_session_client_new_faile[] = "nghttp2_session_client_new failed: {}";
static const char __pyx_k_nghttp2_session_server_new_faile[] = "nghttp2_session_server_new failed: {}";
static const char __pyx_k_nghttp2_submit_push_promise_fail[] = "nghttp2_submit_push_promise failed: {}";
static const char __pyx_k_no_default___reduce___due_to_non[] = "no default __reduce__ due to non-trivial __cinit__";
static const char __pyx_k_server_on_frame_recv_type_s_stre[] = "server_on_frame_recv, type:%s, stream_id:%s";
static const char __pyx_k_server_on_frame_send_type_s_stre[] = "server_on_frame_send, type:%s, stream_id:%s";
static const char __pyx_k_server_on_header_type_s_stream_i[] = "server_on_header, type:%s, stream_id:%s";
static PyObject *__pyx_n_s_AttributeError;
static PyObject *__pyx_n_s_BaseRequestHandler;
static PyObject *__pyx_n_s_BaseRequestHandler___init;
static PyObject *__pyx_n_s_BaseRequestHandler__set_response;
static PyObject *__pyx_n_s_BaseRequestHandler_client_addres;
static PyObject *__pyx_n_s_BaseRequestHandler_client_certif;
static PyObject *__pyx_n_s_BaseRequestHandler_on_close;
static PyObject *__pyx_n_s_BaseRequestHandler_on_data;
static PyObject *__pyx_n_s_BaseRequestHandler_on_headers;
static PyObject *__pyx_n_s_BaseRequestHandler_on_request_do;
static PyObject *__pyx_n_s_BaseRequestHandler_push;
static PyObject *__pyx_n_s_BaseRequestHandler_resume;
static PyObject *__pyx_n_s_BaseRequestHandler_send_response;
static PyObject *__pyx_n_s_BaseResponseHandler;
static PyObject *__pyx_n_s_BaseResponseHandler___init;
static PyObject *__pyx_n_s_BaseResponseHandler_accept_push;
static PyObject *__pyx_n_s_BaseResponseHandler_on_close;
static PyObject *__pyx_n_s_BaseResponseHandler_on_data;
static PyObject *__pyx_n_s_BaseResponseHandler_on_headers;
static PyObject *__pyx_n_s_BaseResponseHandler_on_push_prom;
static PyObject *__pyx_n_s_BaseResponseHandler_on_response;
static PyObject *__pyx_n_s_BaseResponseHandler_reject_push;
static PyObject *__pyx_n_s_BaseResponseHandler_resume;
static PyObject *__pyx_n_s_BaseResponseHandler_server_addre;
static PyObject *__pyx_n_s_ByteIOWrapper;
static PyObject *__pyx_n_s_ByteIOWrapper___init;
static PyObject *__pyx_n_s_ByteIOWrapper_generate;
static PyObject *__pyx_n_s_BytesIO;
static PyObject *__pyx_n_s_DATA_DEFERRED;
static PyObject *__pyx_n_s_DATA_EOF;
static PyObject *__pyx_n_s_DATA_OK;
static PyObject *__pyx_n_s_DEFAULT_HEADER_TABLE_SIZE;
static PyObject *__pyx_n_s_DEFLATE_MAX_HEADER_TABLE_SIZE;
static PyObject *__pyx_n_s_GET;
static PyObject *__pyx_n_s_HAS_ALPN;
static PyObject *__pyx_n_s_HDDeflater;
static PyObject *__pyx_n_s_HDInflater;
static PyObject *__pyx_n_s_HDTableEntry;
static PyObject *__pyx_n_s_HDTableEntry___init;
static PyObject *__pyx_n_s_HDTableEntry_space;
static PyObject *__pyx_n_s_HD_ENTRY_OVERHEAD;
static PyObject *__pyx_n_s_HTTP2Client;
static PyObject *__pyx_n_s_HTTP2ClientSession;
static PyObject *__pyx_n_s_HTTP2ClientSessionCore;
static PyObject *__pyx_n_s_HTTP2ClientSession___init;
static PyObject *__pyx_n_s_HTTP2ClientSession_close;
static PyObject *__pyx_n_s_HTTP2ClientSession_connection_l;
static PyObject *__pyx_n_s_HTTP2ClientSession_connection_m;
static PyObject *__pyx_n_s_HTTP2ClientSession_data_receive;
static PyObject *__pyx_n_s_HTTP2ClientSession_resume_writi;
static PyObject *__pyx_n_s_HTTP2ClientSession_send_request;
static PyObject *__pyx_n_s_HTTP2Client___init;
static PyObject *__pyx_n_s_HTTP2Client___init___locals_sess;
static PyObject *__pyx_n_s_HTTP2Client_close;
static PyObject *__pyx_n_s_HTTP2Client_io_loop;
static PyObject *__pyx_n_s_HTTP2Client_send_request;
static PyObject *__pyx_n_s_HTTP2Server;
static PyObject *__pyx_n_s_HTTP2Server___init;
static PyObject *__pyx_n_s_HTTP2Server___init___locals_sess;
static PyObject *__pyx_n_s_HTTP2Server_serve_forever;
static PyObject *__pyx_n_s_HTTP2Session;
static PyObject *__pyx_n_s_HTTP2SessionCore;
static PyObject *__pyx_n_s_HTTP2SessionCoreBase;
static PyObject *__pyx_n_s_HTTP2Session___init;
static PyObject *__pyx_n_s_HTTP2Session_connection_lost;
static PyObject *__pyx_n_s_HTTP2Session_connection_made;
static PyObject *__pyx_n_s_HTTP2Session_data_received;
static PyObject *__pyx_n_s_HTTP2Session_resume_writing;
static PyObject *__pyx_kp_s_HTTP_2_client_This_class_builds;
static PyObject *__pyx_kp_s_HTTP_2_request_stream_handler_ba;
static PyObject *__pyx_kp_s_HTTP_2_response_stream_handler_b;
static PyObject *__pyx_kp_s_HTTP_2_server_This_class_builds;
static PyObject *__pyx_n_s_IOBase;
static PyObject *__pyx_n_s_IPPROTO_TCP;
static PyObject *__pyx_n_s_ImportError;
static PyObject *__pyx_n_s_OSError;
static PyObject *__pyx_n_s_OUTBUF_MAX;
static PyObject *__pyx_n_s_P;
static PyObject *__pyx_n_s_Protocol;
static PyObject *__pyx_n_s_RequestHandlerClass;
static PyObject *__pyx_n_s_SETTINGS_TIMEOUT;
static PyObject *__pyx_n_s_TCP_NODELAY;
static PyObject *__pyx_n_s_TypeError;
static PyObject *__pyx_n_s__120;
static PyObject *__pyx_kp_s__22;
static PyObject *__pyx_kp_s__23;
static PyObject *__pyx_kp_s__24;
static PyObject *__pyx_kp_s__25;
static PyObject *__pyx_kp_s__26;
static PyObject *__pyx_kp_b__6;
static PyObject *__pyx_kp_b__7;
static PyObject *__pyx_kp_s__9;
static PyObject *__pyx_n_s_abort;
static PyObject *__pyx_n_s_accept_push;
static PyObject *__pyx_n_s_add;
static PyObject *__pyx_n_s_add_handler;
static PyObject *__pyx_kp_s_add_handler_stream_id_s;
static PyObject *__pyx_n_s_address;
static PyObject *__pyx_kp_s_alpn_protocol_s;
static PyObject *__pyx_n_s_app_protos;
static PyObject *__pyx_n_s_append;
static PyObject *__pyx_n_s_asyncio;
static PyObject *__pyx_n_s_asyncio_coroutines;
static PyObject *__pyx_n_s_asyncio_tasks;
static PyObject *__pyx_kp_b_authority;
static PyObject *__pyx_n_s_b;
static PyObject *__pyx_n_s_body;
static PyObject *__pyx_n_s_call_later;
static PyObject *__pyx_n_s_cancel;
static PyObject *__pyx_n_s_client;
static PyObject *__pyx_n_s_client_address;
static PyObject *__pyx_n_s_client_certificate;
static PyObject *__pyx_n_s_client_certificate_2;
static PyObject *__pyx_kp_s_client_on_frame_recv_type_s_stre;
static PyObject *__pyx_kp_s_client_on_frame_send_type_s_stre;
static PyObject *__pyx_kp_s_client_on_header_type_s_stream_i;
static PyObject *__pyx_n_s_cline_in_traceback;
static PyObject *__pyx_n_s_close;
static PyObject *__pyx_kp_s_connect_address_s_port_s;
static PyObject *__pyx_n_s_connection_lost;
static PyObject *__pyx_n_s_connection_made;
static PyObject *__pyx_kp_s_connection_made_address_s_port_s;
static PyObject *__pyx_n_b_cookie;
static PyObject *__pyx_n_s_cookies;
static PyObject *__pyx_n_s_coro;
static PyObject *__pyx_n_s_create_connection;
static PyObject *__pyx_n_s_create_server;
static PyObject *__pyx_n_s_data;
static PyObject *__pyx_n_s_data_received;
static PyObject *__pyx_n_s_datetime;
static PyObject *__pyx_n_s_debug;
static PyObject *__pyx_n_s_decode;
static PyObject *__pyx_n_s_doc;
static PyObject *__pyx_n_s_e;
static PyObject *__pyx_n_s_email;
static PyObject *__pyx_n_s_email_utils;
static PyObject *__pyx_n_s_encode;
static PyObject *__pyx_n_s_encode_headers;
static PyObject *__pyx_n_s_end;
static PyObject *__pyx_n_s_enter_callback;
static PyObject *__pyx_n_s_entry;
static PyObject *__pyx_n_s_enumerate;
static PyObject *__pyx_n_s_err;
static PyObject *__pyx_n_s_error_code;
static PyObject *__pyx_n_s_exc;
static PyObject *__pyx_n_s_extend;
static PyObject *__pyx_kp_s_failed_to_set_tcp_nodelay_s;
static PyObject *__pyx_n_s_file;
static PyObject *__pyx_n_s_format;
static PyObject *__pyx_n_s_format_exc;
static PyObject *__pyx_n_s_formatdate;
static PyObject *__pyx_n_s_fragment;
static PyObject *__pyx_n_s_generate;
static PyObject *__pyx_n_s_get_client_certificate;
static PyObject *__pyx_n_s_get_event_loop;
static PyObject *__pyx_n_s_get_extra_info;
static PyObject *__pyx_n_s_get_remote_address;
static PyObject *__pyx_n_s_get_write_buffer_size;
static PyObject *__pyx_n_s_getpeercert;
static PyObject *__pyx_n_s_getstate;
static PyObject *__pyx_n_s_handler;
static PyObject *__pyx_n_s_handler_class;
static PyObject *__pyx_n_s_hd_table_bufsize_max;
static PyObject *__pyx_n_s_hdtable;
static PyObject *__pyx_n_s_headers;
static PyObject *__pyx_kp_s_home_BWI_src_cygwin_nghttp2_ngh;
static PyObject *__pyx_n_b_host;
static PyObject *__pyx_n_s_host;
static PyObject *__pyx_n_s_http;
static PyObject *__pyx_n_s_http2;
static PyObject *__pyx_n_s_https;
static PyObject *__pyx_n_s_idx;
static PyObject *__pyx_n_s_import;
static PyObject *__pyx_n_s_info;
static PyObject *__pyx_n_s_init;
static PyObject *__pyx_n_s_inspect;
static PyObject *__pyx_n_s_io;
static PyObject *__pyx_n_s_io_loop;
static PyObject *__pyx_n_s_join;
static PyObject *__pyx_n_s_k;
static PyObject *__pyx_n_s_leave_callback;
static PyObject *__pyx_kp_s_listen_address_s_port_s;
static PyObject *__pyx_n_s_localtime;
static PyObject *__pyx_n_s_log_request;
static PyObject *__pyx_n_s_logging;
static PyObject *__pyx_n_s_loop;
static PyObject *__pyx_n_s_main;
static PyObject *__pyx_n_s_make_handler;
static PyObject *__pyx_kp_s_make_handler_stream_id_s;
static PyObject *__pyx_n_s_metaclass;
static PyObject *__pyx_kp_b_method;
static PyObject *__pyx_n_s_method_2;
static PyObject *__pyx_kp_s_method_must_not_be_empty;
static PyObject *__pyx_n_s_mktime;
static PyObject *__pyx_n_s_module;
static PyObject *__pyx_n_s_n;
static PyObject *__pyx_n_s_name;
static PyObject *__pyx_n_s_name_2;
static PyObject *__pyx_n_s_namelen;
static PyObject *__pyx_n_s_negotiated_protocol;
static PyObject *__pyx_n_s_netloc;
static PyObject *__pyx_n_s_nghttp2;
static PyObject *__pyx_kp_s_nghttp2_session_callbacks_new_fa;
static PyObject *__pyx_kp_s_nghttp2_session_client_new_faile;
static PyObject *__pyx_kp_s_nghttp2_session_mem_recv_failed;
static PyObject *__pyx_kp_s_nghttp2_session_mem_send_failed;
static PyObject *__pyx_kp_s_nghttp2_session_server_new_faile;
static PyObject *__pyx_kp_s_nghttp2_submit_push_promise_fail;
static PyObject *__pyx_kp_s_nghttp2_submit_request_failed;
static PyObject *__pyx_kp_s_nghttp2_submit_response_failed;
static PyObject *__pyx_kp_s_nghttp2_submit_settings_failed;
static PyObject *__pyx_kp_s_no_default___reduce___due_to_non;
static PyObject *__pyx_n_s_now;
static PyObject *__pyx_kp_s_npn_protocol_s;
static PyObject *__pyx_n_s_on_close;
static PyObject *__pyx_n_s_on_data;
static PyObject *__pyx_n_s_on_headers;
static PyObject *__pyx_n_s_on_push_promise;
static PyObject *__pyx_n_s_on_request_done;
static PyObject *__pyx_n_s_on_response_done;
static PyObject *__pyx_kp_s_on_stream_close_stream_id_s;
static PyObject *__pyx_n_s_params;
static PyObject *__pyx_kp_b_path;
static PyObject *__pyx_n_s_path_2;
static PyObject *__pyx_kp_s_path_must_not_be_empty;
static PyObject *__pyx_n_s_peername;
static PyObject *__pyx_n_s_pending;
static PyObject *__pyx_n_s_port;
static PyObject *__pyx_n_s_prepare;
static PyObject *__pyx_n_s_print;
static PyObject *__pyx_n_s_print_hd_table;
static PyObject *__pyx_n_s_promised_handler;
static PyObject *__pyx_n_s_property;
static PyObject *__pyx_n_s_protocol;
static PyObject *__pyx_n_s_push;
static PyObject *__pyx_n_s_push_promise;
static PyObject *__pyx_kp_s_push_stream_id_s;
static PyObject *__pyx_n_s_pushed;
static PyObject *__pyx_n_s_qualname;
static PyObject *__pyx_n_s_query;
static PyObject *__pyx_n_s_range;
static PyObject *__pyx_n_s_read1;
static PyObject *__pyx_n_s_reduce;
static PyObject *__pyx_n_s_reduce_cython;
static PyObject *__pyx_n_s_reduce_ex;
static PyObject *__pyx_n_s_reject_push;
static PyObject *__pyx_n_s_remote_address;
static PyObject *__pyx_n_s_remove;
static PyObject *__pyx_n_s_remove_handler;
static PyObject *__pyx_kp_s_remove_handler_stream_id_s;
static PyObject *__pyx_n_s_request_headers;
static PyObject *__pyx_kp_s_request_stream_id_s;
static PyObject *__pyx_n_s_response_body;
static PyObject *__pyx_kp_s_response_has_already_been_sent;
static PyObject *__pyx_n_s_response_headers;
static PyObject *__pyx_n_s_resume;
static PyObject *__pyx_n_s_resume_writing;
static PyObject *__pyx_n_s_rst_stream;
static PyObject *__pyx_n_s_run_forever;
static PyObject *__pyx_n_s_run_until_complete;
static PyObject *__pyx_kp_s_s;
static PyObject *__pyx_kp_s_s_s_s_s_HTTP_2_s_s;
static PyObject *__pyx_kp_b_scheme;
static PyObject *__pyx_n_s_scheme_2;
static PyObject *__pyx_n_s_selected_alpn_protocol;
static PyObject *__pyx_n_s_selected_npn_protocol;
static PyObject *__pyx_n_s_self;
static PyObject *__pyx_n_s_send_data;
static PyObject *__pyx_n_s_send_pending;
static PyObject *__pyx_n_s_send_request;
static PyObject *__pyx_n_s_send_response;
static PyObject *__pyx_kp_s_send_response_stream_id_s;
static PyObject *__pyx_n_s_serve_forever;
static PyObject *__pyx_n_s_server;
static PyObject *__pyx_n_s_server_address;
static PyObject *__pyx_kp_s_server_on_frame_not_send_type_s;
static PyObject *__pyx_kp_s_server_on_frame_recv_type_s_stre;
static PyObject *__pyx_kp_s_server_on_frame_send_type_s_stre;
static PyObject *__pyx_kp_s_server_on_header_type_s_stream_i;
static PyObject *__pyx_n_s_session;
static PyObject *__pyx_n_s_session_factory;
static PyObject *__pyx_n_s_set_alpn_protocols;
static PyObject *__pyx_n_s_set_application_protocol;
static PyObject *__pyx_n_s_set_npn_protocols;
static PyObject *__pyx_n_s_set_response_prop;
static PyObject *__pyx_n_s_setsockopt;
static PyObject *__pyx_n_s_setstate;
static PyObject *__pyx_n_s_setstate_cython;
static PyObject *__pyx_n_s_settings_timeout;
static PyObject *__pyx_n_s_sock;
static PyObject *__pyx_n_s_socket;
static PyObject *__pyx_n_s_space;
static PyObject *__pyx_n_s_split;
static PyObject *__pyx_n_s_ssl;
static PyObject *__pyx_n_s_ssl_ctx;
static PyObject *__pyx_n_s_ssl_obj;
static PyObject *__pyx_n_s_ssl_object;
static PyObject *__pyx_n_s_sslcontext;
static PyObject *__pyx_n_s_start_settings_timer;
static PyObject *__pyx_kp_b_status;
static PyObject *__pyx_n_s_status_2;
static PyObject *__pyx_kp_s_status_must_not_be_empty;
static PyObject *__pyx_n_s_stderr;
static PyObject *__pyx_n_s_stop_settings_timer;
static PyObject *__pyx_n_s_stream_id;
static PyObject *__pyx_n_s_super;
static PyObject *__pyx_n_s_sys;
static PyObject *__pyx_n_s_test;
static PyObject *__pyx_n_s_time;
static PyObject *__pyx_n_s_timetuple;
static PyObject *__pyx_n_s_timeval;
static PyObject *__pyx_n_s_tls;
static PyObject *__pyx_n_s_traceback;
static PyObject *__pyx_n_s_transport;
static PyObject *__pyx_n_s_url;
static PyObject *__pyx_n_s_urllib_parse;
static PyObject *__pyx_n_s_urlparse;
static PyObject *__pyx_n_s_usegmt;
static PyObject *__pyx_kp_s_utf_8;
static PyObject *__pyx_n_s_utils;
static PyObject *__pyx_n_s_v;
static PyObject *__pyx_n_s_value;
static PyObject *__pyx_n_s_valuelen;
static PyObject *__pyx_n_s_wrap_body;
static PyObject *__pyx_n_s_write;
static PyObject *__pyx_pf_7nghttp2_12HDTableEntry___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_namelen, PyObject *__pyx_v_value, PyObject *__pyx_v_valuelen); /* proto */
static PyObject *__pyx_pf_7nghttp2_12HDTableEntry_2space(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static int __pyx_pf_7nghttp2_10HDDeflater___cinit__(struct __pyx_obj_7nghttp2_HDDeflater *__pyx_v_self, PyObject *__pyx_v_hd_table_bufsize_max); /* proto */
static void __pyx_pf_7nghttp2_10HDDeflater_2__dealloc__(struct __pyx_obj_7nghttp2_HDDeflater *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7nghttp2_10HDDeflater_4deflate(struct __pyx_obj_7nghttp2_HDDeflater *__pyx_v_self, PyObject *__pyx_v_headers); /* proto */
static PyObject *__pyx_pf_7nghttp2_10HDDeflater_6change_table_size(struct __pyx_obj_7nghttp2_HDDeflater *__pyx_v_self, PyObject *__pyx_v_hd_table_bufsize_max); /* proto */
static PyObject *__pyx_pf_7nghttp2_10HDDeflater_8get_hd_table(struct __pyx_obj_7nghttp2_HDDeflater *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7nghttp2_10HDDeflater_10__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7nghttp2_HDDeflater *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7nghttp2_10HDDeflater_12__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7nghttp2_HDDeflater *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_7nghttp2_10HDInflater___cinit__(struct __pyx_obj_7nghttp2_HDInflater *__pyx_v_self); /* proto */
static void __pyx_pf_7nghttp2_10HDInflater_2__dealloc__(struct __pyx_obj_7nghttp2_HDInflater *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7nghttp2_10HDInflater_4inflate(struct __pyx_obj_7nghttp2_HDInflater *__pyx_v_self, PyObject *__pyx_v_data); /* proto */
static PyObject *__pyx_pf_7nghttp2_10HDInflater_6change_table_size(struct __pyx_obj_7nghttp2_HDInflater *__pyx_v_self, PyObject *__pyx_v_hd_table_bufsize_max); /* proto */
static PyObject *__pyx_pf_7nghttp2_10HDInflater_8get_hd_table(struct __pyx_obj_7nghttp2_HDInflater *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7nghttp2_10HDInflater_10__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7nghttp2_HDInflater *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7nghttp2_10HDInflater_12__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7nghttp2_HDInflater *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_7nghttp2_print_hd_table(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_hdtable); /* proto */
static PyObject *__pyx_pf_7nghttp2_14_ByteIOWrapper___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_b); /* proto */
static PyObject *__pyx_pf_7nghttp2_14_ByteIOWrapper_2generate(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_n); /* proto */
static PyObject *__pyx_pf_7nghttp2_2wrap_body(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_body); /* proto */
static PyObject *__pyx_pf_7nghttp2_4negotiated_protocol(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_ssl_obj); /* proto */
static PyObject *__pyx_pf_7nghttp2_6set_application_protocol(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_ssl_ctx); /* proto */
static int __pyx_pf_7nghttp2_21_HTTP2SessionCoreBase___cinit__(struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *__pyx_v_self, PyObject *__pyx_v_transport, PyObject *__pyx_v_handler_class); /* proto */
static void __pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_2__dealloc__(struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_4data_received(struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *__pyx_v_self, PyObject *__pyx_v_data); /* proto */
static PyObject *__pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_6send_data(struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_8resume(struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *__pyx_v_self, PyObject *__pyx_v_stream_id); /* proto */
static PyObject *__pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_10enter_callback(struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_12leave_callback(struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_14_make_handler(struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *__pyx_v_self, PyObject *__pyx_v_stream_id); /* proto */
static PyObject *__pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_16_remove_handler(struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *__pyx_v_self, PyObject *__pyx_v_handler); /* proto */
static PyObject *__pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_18_add_handler(struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *__pyx_v_self, PyObject *__pyx_v_handler, PyObject *__pyx_v_stream_id); /* proto */
static PyObject *__pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_20_rst_stream(struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *__pyx_v_self, PyObject *__pyx_v_stream_id, PyObject *__pyx_v_error_code); /* proto */
static PyObject *__pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_22_get_remote_address(struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_24_get_client_certificate(struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_26_start_settings_timer(struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_28_stop_settings_timer(struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_30_settings_timeout(struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_32_log_request(CYTHON_UNUSED struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *__pyx_v_self, PyObject *__pyx_v_handler); /* proto */
static PyObject *__pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_34close(struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_36__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_38__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_7nghttp2_17_HTTP2SessionCore___cinit__(struct __pyx_obj_7nghttp2__HTTP2SessionCore *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_7nghttp2_17_HTTP2SessionCore_2send_response(struct __pyx_obj_7nghttp2__HTTP2SessionCore *__pyx_v_self, PyObject *__pyx_v_handler); /* proto */
static PyObject *__pyx_pf_7nghttp2_17_HTTP2SessionCore_4push(struct __pyx_obj_7nghttp2__HTTP2SessionCore *__pyx_v_self, PyObject *__pyx_v_handler, PyObject *__pyx_v_promised_handler); /* proto */
static PyObject *__pyx_pf_7nghttp2_17_HTTP2SessionCore_6connection_lost(struct __pyx_obj_7nghttp2__HTTP2SessionCore *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7nghttp2_17_HTTP2SessionCore_8__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7nghttp2__HTTP2SessionCore *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7nghttp2_17_HTTP2SessionCore_10__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7nghttp2__HTTP2SessionCore *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_7nghttp2_23_HTTP2ClientSessionCore___cinit__(struct __pyx_obj_7nghttp2__HTTP2ClientSessionCore *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_7nghttp2_23_HTTP2ClientSessionCore_2send_request(struct __pyx_obj_7nghttp2__HTTP2ClientSessionCore *__pyx_v_self, PyObject *__pyx_v_method, PyObject *__pyx_v_scheme, PyObject *__pyx_v_host, PyObject *__pyx_v_path, PyObject *__pyx_v_headers, PyObject *__pyx_v_body, PyObject *__pyx_v_handler); /* proto */
static PyObject *__pyx_pf_7nghttp2_23_HTTP2ClientSessionCore_4push(struct __pyx_obj_7nghttp2__HTTP2ClientSessionCore *__pyx_v_self, PyObject *__pyx_v_push_promise, PyObject *__pyx_v_handler); /* proto */
static PyObject *__pyx_pf_7nghttp2_23_HTTP2ClientSessionCore_6__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7nghttp2__HTTP2ClientSessionCore *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7nghttp2_23_HTTP2ClientSessionCore_8__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7nghttp2__HTTP2ClientSessionCore *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_7nghttp2_18BaseRequestHandler___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_http2, PyObject *__pyx_v_stream_id); /* proto */
static PyObject *__pyx_pf_7nghttp2_18BaseRequestHandler_2client_address(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7nghttp2_18BaseRequestHandler_4client_certificate(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7nghttp2_18BaseRequestHandler_6on_headers(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7nghttp2_18BaseRequestHandler_8on_data(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_data); /* proto */
static PyObject *__pyx_pf_7nghttp2_18BaseRequestHandler_10on_request_done(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7nghttp2_18BaseRequestHandler_12on_close(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_error_code); /* proto */
static PyObject *__pyx_pf_7nghttp2_18BaseRequestHandler_14send_response(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_status, PyObject *__pyx_v_headers, PyObject *__pyx_v_body); /* proto */
static PyObject *__pyx_pf_7nghttp2_18BaseRequestHandler_16push(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_path, PyObject *__pyx_v_method, PyObject *__pyx_v_request_headers, PyObject *__pyx_v_status, PyObject *__pyx_v_headers, PyObject *__pyx_v_body); /* proto */
static PyObject *__pyx_pf_7nghttp2_18BaseRequestHandler_18_set_response_prop(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_status, PyObject *__pyx_v_headers, PyObject *__pyx_v_body); /* proto */
static PyObject *__pyx_pf_7nghttp2_18BaseRequestHandler_20resume(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7nghttp2_8_encode_headers(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_headers); /* proto */
static PyObject *__pyx_pf_7nghttp2_13_HTTP2Session___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_RequestHandlerClass); /* proto */
static PyObject *__pyx_pf_7nghttp2_13_HTTP2Session_2connection_made(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_transport); /* proto */
static PyObject *__pyx_pf_7nghttp2_13_HTTP2Session_4connection_lost(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_exc); /* proto */
static PyObject *__pyx_pf_7nghttp2_13_HTTP2Session_6data_received(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_data); /* proto */
static PyObject *__pyx_pf_7nghttp2_13_HTTP2Session_8resume_writing(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7nghttp2_11HTTP2Server_8__init___session_factory(PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_7nghttp2_11HTTP2Server___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_address, PyObject *__pyx_v_RequestHandlerClass, PyObject *__pyx_v_ssl); /* proto */
static PyObject *__pyx_pf_7nghttp2_11HTTP2Server_2serve_forever(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7nghttp2_19BaseResponseHandler___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_http2, PyObject *__pyx_v_stream_id); /* proto */
static PyObject *__pyx_pf_7nghttp2_19BaseResponseHandler_2server_address(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7nghttp2_19BaseResponseHandler_4on_headers(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7nghttp2_19BaseResponseHandler_6on_data(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_data); /* proto */
static PyObject *__pyx_pf_7nghttp2_19BaseResponseHandler_8on_response_done(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7nghttp2_19BaseResponseHandler_10on_close(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_error_code); /* proto */
static PyObject *__pyx_pf_7nghttp2_19BaseResponseHandler_12on_push_promise(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_push_promise); /* proto */
static PyObject *__pyx_pf_7nghttp2_19BaseResponseHandler_14reject_push(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_push_promise); /* proto */
static PyObject *__pyx_pf_7nghttp2_19BaseResponseHandler_16accept_push(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_push_promise, PyObject *__pyx_v_handler); /* proto */
static PyObject *__pyx_pf_7nghttp2_19BaseResponseHandler_18resume(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7nghttp2_19_HTTP2ClientSession___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_client); /* proto */
static PyObject *__pyx_pf_7nghttp2_19_HTTP2ClientSession_2connection_made(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_transport); /* proto */
static PyObject *__pyx_pf_7nghttp2_19_HTTP2ClientSession_4connection_lost(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_exc); /* proto */
static PyObject *__pyx_pf_7nghttp2_19_HTTP2ClientSession_6data_received(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_data); /* proto */
static PyObject *__pyx_pf_7nghttp2_19_HTTP2ClientSession_8resume_writing(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7nghttp2_19_HTTP2ClientSession_10send_request(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_method, PyObject *__pyx_v_scheme, PyObject *__pyx_v_host, PyObject *__pyx_v_path, PyObject *__pyx_v_headers, PyObject *__pyx_v_body, PyObject *__pyx_v_handler); /* proto */
static PyObject *__pyx_pf_7nghttp2_19_HTTP2ClientSession_12close(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7nghttp2_11HTTP2Client_8__init___session_factory(PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_7nghttp2_11HTTP2Client___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_address, PyObject *__pyx_v_loop, PyObject *__pyx_v_ssl); /* proto */
static PyObject *__pyx_pf_7nghttp2_11HTTP2Client_2io_loop(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7nghttp2_11HTTP2Client_4close(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7nghttp2_11HTTP2Client_6send_request(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_method, PyObject *__pyx_v_url, PyObject *__pyx_v_headers, PyObject *__pyx_v_body, PyObject *__pyx_v_handler); /* proto */
static PyObject *__pyx_tp_new_7nghttp2_HDDeflater(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7nghttp2_HDInflater(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7nghttp2__HTTP2SessionCoreBase(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7nghttp2__HTTP2SessionCore(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7nghttp2__HTTP2ClientSessionCore(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7nghttp2___pyx_scope_struct____init__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7nghttp2___pyx_scope_struct_1___init__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_float_5_0;
static PyObject *__pyx_int_0;
static PyObject *__pyx_int_1;
static PyObject *__pyx_int_2;
static PyObject *__pyx_int_32;
static PyObject *__pyx_int_200;
static PyObject *__pyx_int_4096;
static PyObject *__pyx_int_65535;
static PyObject *__pyx_int_neg_1;
static PyObject *__pyx_k_;
static PyObject *__pyx_k__8;
static PyObject *__pyx_tuple__2;
static PyObject *__pyx_tuple__3;
static PyObject *__pyx_tuple__4;
static PyObject *__pyx_tuple__5;
static PyObject *__pyx_tuple__10;
static PyObject *__pyx_tuple__11;
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__27;
static PyObject *__pyx_tuple__29;
static PyObject *__pyx_tuple__31;
static PyObject *__pyx_tuple__33;
static PyObject *__pyx_tuple__35;
static PyObject *__pyx_tuple__37;
static PyObject *__pyx_tuple__39;
static PyObject *__pyx_tuple__41;
static PyObject *__pyx_tuple__43;
static PyObject *__pyx_tuple__45;
static PyObject *__pyx_tuple__47;
static PyObject *__pyx_tuple__49;
static PyObject *__pyx_tuple__51;
static PyObject *__pyx_tuple__53;
static PyObject *__pyx_tuple__55;
static PyObject *__pyx_tuple__57;
static PyObject *__pyx_tuple__59;
static PyObject *__pyx_tuple__60;
static PyObject *__pyx_tuple__62;
static PyObject *__pyx_tuple__63;
static PyObject *__pyx_tuple__65;
static PyObject *__pyx_tuple__67;
static PyObject *__pyx_tuple__69;
static PyObject *__pyx_tuple__71;
static PyObject *__pyx_tuple__73;
static PyObject *__pyx_tuple__75;
static PyObject *__pyx_tuple__77;
static PyObject *__pyx_tuple__79;
static PyObject *__pyx_tuple__81;
static PyObject *__pyx_tuple__82;
static PyObject *__pyx_tuple__84;
static PyObject *__pyx_tuple__86;
static PyObject *__pyx_tuple__87;
static PyObject *__pyx_tuple__89;
static PyObject *__pyx_tuple__91;
static PyObject *__pyx_tuple__93;
static PyObject *__pyx_tuple__95;
static PyObject *__pyx_tuple__97;
static PyObject *__pyx_tuple__99;
static PyObject *__pyx_tuple__101;
static PyObject *__pyx_tuple__103;
static PyObject *__pyx_tuple__104;
static PyObject *__pyx_tuple__106;
static PyObject *__pyx_tuple__108;
static PyObject *__pyx_tuple__110;
static PyObject *__pyx_tuple__112;
static PyObject *__pyx_tuple__114;
static PyObject *__pyx_tuple__116;
static PyObject *__pyx_tuple__118;
static PyObject *__pyx_tuple__121;
static PyObject *__pyx_tuple__123;
static PyObject *__pyx_tuple__124;
static PyObject *__pyx_tuple__126;
static PyObject *__pyx_tuple__128;
static PyObject *__pyx_tuple__130;
static PyObject *__pyx_codeobj__20;
static PyObject *__pyx_codeobj__21;
static PyObject *__pyx_codeobj__28;
static PyObject *__pyx_codeobj__30;
static PyObject *__pyx_codeobj__32;
static PyObject *__pyx_codeobj__34;
static PyObject *__pyx_codeobj__36;
static PyObject *__pyx_codeobj__38;
static PyObject *__pyx_codeobj__40;
static PyObject *__pyx_codeobj__42;
static PyObject *__pyx_codeobj__44;
static PyObject *__pyx_codeobj__46;
static PyObject *__pyx_codeobj__48;
static PyObject *__pyx_codeobj__50;
static PyObject *__pyx_codeobj__52;
static PyObject *__pyx_codeobj__54;
static PyObject *__pyx_codeobj__56;
static PyObject *__pyx_codeobj__58;
static PyObject *__pyx_codeobj__61;
static PyObject *__pyx_codeobj__64;
static PyObject *__pyx_codeobj__66;
static PyObject *__pyx_codeobj__68;
static PyObject *__pyx_codeobj__70;
static PyObject *__pyx_codeobj__72;
static PyObject *__pyx_codeobj__74;
static PyObject *__pyx_codeobj__76;
static PyObject *__pyx_codeobj__78;
static PyObject *__pyx_codeobj__80;
static PyObject *__pyx_codeobj__83;
static PyObject *__pyx_codeobj__85;
static PyObject *__pyx_codeobj__88;
static PyObject *__pyx_codeobj__90;
static PyObject *__pyx_codeobj__92;
static PyObject *__pyx_codeobj__94;
static PyObject *__pyx_codeobj__96;
static PyObject *__pyx_codeobj__98;
static PyObject *__pyx_codeobj__100;
static PyObject *__pyx_codeobj__102;
static PyObject *__pyx_codeobj__105;
static PyObject *__pyx_codeobj__107;
static PyObject *__pyx_codeobj__109;
static PyObject *__pyx_codeobj__111;
static PyObject *__pyx_codeobj__113;
static PyObject *__pyx_codeobj__115;
static PyObject *__pyx_codeobj__117;
static PyObject *__pyx_codeobj__119;
static PyObject *__pyx_codeobj__122;
static PyObject *__pyx_codeobj__125;
static PyObject *__pyx_codeobj__127;
static PyObject *__pyx_codeobj__129;
/* Late includes */

/* "nghttp2.pyx":38
 * class HDTableEntry:
 * 
 *     def __init__(self, name, namelen, value, valuelen):             # <<<<<<<<<<<<<<
 *         self.name = name
 *         self.namelen = namelen
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_12HDTableEntry_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7nghttp2_12HDTableEntry_1__init__ = {"__init__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7nghttp2_12HDTableEntry_1__init__, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7nghttp2_12HDTableEntry_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_name = 0;
  PyObject *__pyx_v_namelen = 0;
  PyObject *__pyx_v_value = 0;
  PyObject *__pyx_v_valuelen = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_name,&__pyx_n_s_namelen,&__pyx_n_s_value,&__pyx_n_s_valuelen,0};
    PyObject* values[5] = {0,0,0,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  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_name)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 1); __PYX_ERR(0, 38, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_namelen)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 2); __PYX_ERR(0, 38, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 3); __PYX_ERR(0, 38, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_valuelen)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 4); __PYX_ERR(0, 38, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 38, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
    }
    __pyx_v_self = values[0];
    __pyx_v_name = values[1];
    __pyx_v_namelen = values[2];
    __pyx_v_value = values[3];
    __pyx_v_valuelen = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 38, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("nghttp2.HDTableEntry.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7nghttp2_12HDTableEntry___init__(__pyx_self, __pyx_v_self, __pyx_v_name, __pyx_v_namelen, __pyx_v_value, __pyx_v_valuelen);

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

static PyObject *__pyx_pf_7nghttp2_12HDTableEntry___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_namelen, PyObject *__pyx_v_value, PyObject *__pyx_v_valuelen) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "nghttp2.pyx":39
 * 
 *     def __init__(self, name, namelen, value, valuelen):
 *         self.name = name             # <<<<<<<<<<<<<<
 *         self.namelen = namelen
 *         self.value = value
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_name, __pyx_v_name) < 0) __PYX_ERR(0, 39, __pyx_L1_error)

  /* "nghttp2.pyx":40
 *     def __init__(self, name, namelen, value, valuelen):
 *         self.name = name
 *         self.namelen = namelen             # <<<<<<<<<<<<<<
 *         self.value = value
 *         self.valuelen = valuelen
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_namelen, __pyx_v_namelen) < 0) __PYX_ERR(0, 40, __pyx_L1_error)

  /* "nghttp2.pyx":41
 *         self.name = name
 *         self.namelen = namelen
 *         self.value = value             # <<<<<<<<<<<<<<
 *         self.valuelen = valuelen
 * 
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_value, __pyx_v_value) < 0) __PYX_ERR(0, 41, __pyx_L1_error)

  /* "nghttp2.pyx":42
 *         self.namelen = namelen
 *         self.value = value
 *         self.valuelen = valuelen             # <<<<<<<<<<<<<<
 * 
 *     def space(self):
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_valuelen, __pyx_v_valuelen) < 0) __PYX_ERR(0, 42, __pyx_L1_error)

  /* "nghttp2.pyx":38
 * class HDTableEntry:
 * 
 *     def __init__(self, name, namelen, value, valuelen):             # <<<<<<<<<<<<<<
 *         self.name = name
 *         self.namelen = namelen
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("nghttp2.HDTableEntry.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":44
 *         self.valuelen = valuelen
 * 
 *     def space(self):             # <<<<<<<<<<<<<<
 *         return self.namelen + self.valuelen + HD_ENTRY_OVERHEAD
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_12HDTableEntry_3space(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7nghttp2_12HDTableEntry_3space = {"space", (PyCFunction)__pyx_pw_7nghttp2_12HDTableEntry_3space, METH_O, 0};
static PyObject *__pyx_pw_7nghttp2_12HDTableEntry_3space(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("space (wrapper)", 0);
  __pyx_r = __pyx_pf_7nghttp2_12HDTableEntry_2space(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_7nghttp2_12HDTableEntry_2space(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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("space", 0);

  /* "nghttp2.pyx":45
 * 
 *     def space(self):
 *         return self.namelen + self.valuelen + HD_ENTRY_OVERHEAD             # <<<<<<<<<<<<<<
 * 
 * cdef _get_pybytes(uint8_t *b, uint16_t blen):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_namelen); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 45, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_valuelen); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 45, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyNumber_Add(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 45, __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_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_HD_ENTRY_OVERHEAD); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 45, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyNumber_Add(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 45, __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_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "nghttp2.pyx":44
 *         self.valuelen = valuelen
 * 
 *     def space(self):             # <<<<<<<<<<<<<<
 *         return self.namelen + self.valuelen + HD_ENTRY_OVERHEAD
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("nghttp2.HDTableEntry.space", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":47
 *         return self.namelen + self.valuelen + HD_ENTRY_OVERHEAD
 * 
 * cdef _get_pybytes(uint8_t *b, uint16_t blen):             # <<<<<<<<<<<<<<
 *     return b[:blen]
 * 
 */

static PyObject *__pyx_f_7nghttp2__get_pybytes(uint8_t *__pyx_v_b, uint16_t __pyx_v_blen) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_get_pybytes", 0);

  /* "nghttp2.pyx":48
 * 
 * cdef _get_pybytes(uint8_t *b, uint16_t blen):
 *     return b[:blen]             # <<<<<<<<<<<<<<
 * 
 * cdef class HDDeflater:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(((const char*)__pyx_v_b) + 0, __pyx_v_blen - 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 48, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "nghttp2.pyx":47
 *         return self.namelen + self.valuelen + HD_ENTRY_OVERHEAD
 * 
 * cdef _get_pybytes(uint8_t *b, uint16_t blen):             # <<<<<<<<<<<<<<
 *     return b[:blen]
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("nghttp2._get_pybytes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":75
 *     cdef cnghttp2.nghttp2_hd_deflater *_deflater
 * 
 *     def __cinit__(self, hd_table_bufsize_max = DEFLATE_MAX_HEADER_TABLE_SIZE):             # <<<<<<<<<<<<<<
 *         rv = cnghttp2.nghttp2_hd_deflate_new(&self._deflater,
 *                                              hd_table_bufsize_max)
 */

/* Python wrapper */
static int __pyx_pw_7nghttp2_10HDDeflater_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_7nghttp2_10HDDeflater_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_hd_table_bufsize_max = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_hd_table_bufsize_max,0};
    PyObject* values[1] = {0};
    values[0] = __pyx_k_;
    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);
        CYTHON_FALLTHROUGH;
        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 = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_hd_table_bufsize_max);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(0, 75, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_hd_table_bufsize_max = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 75, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("nghttp2.HDDeflater.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7nghttp2_10HDDeflater___cinit__(((struct __pyx_obj_7nghttp2_HDDeflater *)__pyx_v_self), __pyx_v_hd_table_bufsize_max);

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

static int __pyx_pf_7nghttp2_10HDDeflater___cinit__(struct __pyx_obj_7nghttp2_HDDeflater *__pyx_v_self, PyObject *__pyx_v_hd_table_bufsize_max) {
  int __pyx_v_rv;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  size_t __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "nghttp2.pyx":77
 *     def __cinit__(self, hd_table_bufsize_max = DEFLATE_MAX_HEADER_TABLE_SIZE):
 *         rv = cnghttp2.nghttp2_hd_deflate_new(&self._deflater,
 *                                              hd_table_bufsize_max)             # <<<<<<<<<<<<<<
 *         if rv != 0:
 *             raise Exception(_strerror(rv))
 */
  __pyx_t_1 = __Pyx_PyInt_As_size_t(__pyx_v_hd_table_bufsize_max); if (unlikely((__pyx_t_1 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 77, __pyx_L1_error)

  /* "nghttp2.pyx":76
 * 
 *     def __cinit__(self, hd_table_bufsize_max = DEFLATE_MAX_HEADER_TABLE_SIZE):
 *         rv = cnghttp2.nghttp2_hd_deflate_new(&self._deflater,             # <<<<<<<<<<<<<<
 *                                              hd_table_bufsize_max)
 *         if rv != 0:
 */
  __pyx_v_rv = nghttp2_hd_deflate_new((&__pyx_v_self->_deflater), __pyx_t_1);

  /* "nghttp2.pyx":78
 *         rv = cnghttp2.nghttp2_hd_deflate_new(&self._deflater,
 *                                              hd_table_bufsize_max)
 *         if rv != 0:             # <<<<<<<<<<<<<<
 *             raise Exception(_strerror(rv))
 * 
 */
  __pyx_t_2 = ((__pyx_v_rv != 0) != 0);
  if (unlikely(__pyx_t_2)) {

    /* "nghttp2.pyx":79
 *                                              hd_table_bufsize_max)
 *         if rv != 0:
 *             raise Exception(_strerror(rv))             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
    __pyx_t_3 = __pyx_f_7nghttp2__strerror(__pyx_v_rv); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 79, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 79, __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(0, 79, __pyx_L1_error)

    /* "nghttp2.pyx":78
 *         rv = cnghttp2.nghttp2_hd_deflate_new(&self._deflater,
 *                                              hd_table_bufsize_max)
 *         if rv != 0:             # <<<<<<<<<<<<<<
 *             raise Exception(_strerror(rv))
 * 
 */
  }

  /* "nghttp2.pyx":75
 *     cdef cnghttp2.nghttp2_hd_deflater *_deflater
 * 
 *     def __cinit__(self, hd_table_bufsize_max = DEFLATE_MAX_HEADER_TABLE_SIZE):             # <<<<<<<<<<<<<<
 *         rv = cnghttp2.nghttp2_hd_deflate_new(&self._deflater,
 *                                              hd_table_bufsize_max)
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("nghttp2.HDDeflater.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":81
 *             raise Exception(_strerror(rv))
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         cnghttp2.nghttp2_hd_deflate_del(self._deflater)
 * 
 */

/* Python wrapper */
static void __pyx_pw_7nghttp2_10HDDeflater_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_7nghttp2_10HDDeflater_3__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_pf_7nghttp2_10HDDeflater_2__dealloc__(((struct __pyx_obj_7nghttp2_HDDeflater *)__pyx_v_self));

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

static void __pyx_pf_7nghttp2_10HDDeflater_2__dealloc__(struct __pyx_obj_7nghttp2_HDDeflater *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "nghttp2.pyx":82
 * 
 *     def __dealloc__(self):
 *         cnghttp2.nghttp2_hd_deflate_del(self._deflater)             # <<<<<<<<<<<<<<
 * 
 *     def deflate(self, headers):
 */
  nghttp2_hd_deflate_del(__pyx_v_self->_deflater);

  /* "nghttp2.pyx":81
 *             raise Exception(_strerror(rv))
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         cnghttp2.nghttp2_hd_deflate_del(self._deflater)
 * 
 */

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

/* "nghttp2.pyx":84
 *         cnghttp2.nghttp2_hd_deflate_del(self._deflater)
 * 
 *     def deflate(self, headers):             # <<<<<<<<<<<<<<
 *         '''Compresses the |headers|. The |headers| must be sequence of tuple
 *         of name/value pair, which are sequence of bytes (not unicode
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_10HDDeflater_5deflate(PyObject *__pyx_v_self, PyObject *__pyx_v_headers); /*proto*/
static char __pyx_doc_7nghttp2_10HDDeflater_4deflate[] = "Compresses the |headers|. The |headers| must be sequence of tuple\n        of name/value pair, which are sequence of bytes (not unicode\n        string).\n\n        This function returns the encoded header block in byte string.\n        An exception will be raised on error.\n\n        ";
static PyObject *__pyx_pw_7nghttp2_10HDDeflater_5deflate(PyObject *__pyx_v_self, PyObject *__pyx_v_headers) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("deflate (wrapper)", 0);
  __pyx_r = __pyx_pf_7nghttp2_10HDDeflater_4deflate(((struct __pyx_obj_7nghttp2_HDDeflater *)__pyx_v_self), ((PyObject *)__pyx_v_headers));

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

static PyObject *__pyx_pf_7nghttp2_10HDDeflater_4deflate(struct __pyx_obj_7nghttp2_HDDeflater *__pyx_v_self, PyObject *__pyx_v_headers) {
  nghttp2_nv *__pyx_v_nva;
  nghttp2_nv *__pyx_v_nvap;
  PyObject *__pyx_v_k = NULL;
  PyObject *__pyx_v_v = NULL;
  CYTHON_UNUSED size_t __pyx_v_outcap;
  Py_ssize_t __pyx_v_rv;
  uint8_t *__pyx_v_out;
  size_t __pyx_v_outlen;
  PyObject *__pyx_v_res = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *(*__pyx_t_8)(PyObject *);
  uint8_t *__pyx_t_9;
  Py_ssize_t __pyx_t_10;
  int __pyx_t_11;
  int __pyx_t_12;
  int __pyx_t_13;
  char const *__pyx_t_14;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  PyObject *__pyx_t_18 = NULL;
  PyObject *__pyx_t_19 = NULL;
  PyObject *__pyx_t_20 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("deflate", 0);

  /* "nghttp2.pyx":95
 *         cdef cnghttp2.nghttp2_nv *nva = <cnghttp2.nghttp2_nv*>\
 *                                         malloc(sizeof(cnghttp2.nghttp2_nv)*\
 *                                         len(headers))             # <<<<<<<<<<<<<<
 *         cdef cnghttp2.nghttp2_nv *nvap = nva
 * 
 */
  __pyx_t_1 = PyObject_Length(__pyx_v_headers); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 95, __pyx_L1_error)

  /* "nghttp2.pyx":93
 * 
 *         '''
 *         cdef cnghttp2.nghttp2_nv *nva = <cnghttp2.nghttp2_nv*>\             # <<<<<<<<<<<<<<
 *                                         malloc(sizeof(cnghttp2.nghttp2_nv)*\
 *                                         len(headers))
 */
  __pyx_v_nva = ((nghttp2_nv *)malloc(((sizeof(nghttp2_nv)) * __pyx_t_1)));

  /* "nghttp2.pyx":96
 *                                         malloc(sizeof(cnghttp2.nghttp2_nv)*\
 *                                         len(headers))
 *         cdef cnghttp2.nghttp2_nv *nvap = nva             # <<<<<<<<<<<<<<
 * 
 *         for k, v in headers:
 */
  __pyx_v_nvap = __pyx_v_nva;

  /* "nghttp2.pyx":98
 *         cdef cnghttp2.nghttp2_nv *nvap = nva
 * 
 *         for k, v in headers:             # <<<<<<<<<<<<<<
 *             nvap[0].name = k
 *             nvap[0].namelen = len(k)
 */
  if (likely(PyList_CheckExact(__pyx_v_headers)) || PyTuple_CheckExact(__pyx_v_headers)) {
    __pyx_t_2 = __pyx_v_headers; __Pyx_INCREF(__pyx_t_2); __pyx_t_1 = 0;
    __pyx_t_3 = NULL;
  } else {
    __pyx_t_1 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_headers); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 98, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 98, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_3)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_4); __pyx_t_1++; if (unlikely(0 < 0)) __PYX_ERR(0, 98, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_2, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 98, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      } else {
        if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_4); __pyx_t_1++; if (unlikely(0 < 0)) __PYX_ERR(0, 98, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_2, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 98, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      }
    } else {
      __pyx_t_4 = __pyx_t_3(__pyx_t_2);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 98, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_4);
    }
    if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
      PyObject* sequence = __pyx_t_4;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 98, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_5 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      #else
      __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 98, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 98, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      #endif
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_7 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 98, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
      index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_6);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) __PYX_ERR(0, 98, __pyx_L1_error)
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L6_unpacking_done;
      __pyx_L5_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 98, __pyx_L1_error)
      __pyx_L6_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_k, __pyx_t_5);
    __pyx_t_5 = 0;
    __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "nghttp2.pyx":99
 * 
 *         for k, v in headers:
 *             nvap[0].name = k             # <<<<<<<<<<<<<<
 *             nvap[0].namelen = len(k)
 *             nvap[0].value = v
 */
    __pyx_t_9 = __Pyx_PyObject_AsWritableUString(__pyx_v_k); if (unlikely((!__pyx_t_9) && PyErr_Occurred())) __PYX_ERR(0, 99, __pyx_L1_error)
    (__pyx_v_nvap[0]).name = __pyx_t_9;

    /* "nghttp2.pyx":100
 *         for k, v in headers:
 *             nvap[0].name = k
 *             nvap[0].namelen = len(k)             # <<<<<<<<<<<<<<
 *             nvap[0].value = v
 *             nvap[0].valuelen = len(v)
 */
    __pyx_t_10 = PyObject_Length(__pyx_v_k); if (unlikely(__pyx_t_10 == ((Py_ssize_t)-1))) __PYX_ERR(0, 100, __pyx_L1_error)
    (__pyx_v_nvap[0]).namelen = __pyx_t_10;

    /* "nghttp2.pyx":101
 *             nvap[0].name = k
 *             nvap[0].namelen = len(k)
 *             nvap[0].value = v             # <<<<<<<<<<<<<<
 *             nvap[0].valuelen = len(v)
 *             nvap[0].flags = cnghttp2.NGHTTP2_NV_FLAG_NONE
 */
    __pyx_t_9 = __Pyx_PyObject_AsWritableUString(__pyx_v_v); if (unlikely((!__pyx_t_9) && PyErr_Occurred())) __PYX_ERR(0, 101, __pyx_L1_error)
    (__pyx_v_nvap[0]).value = __pyx_t_9;

    /* "nghttp2.pyx":102
 *             nvap[0].namelen = len(k)
 *             nvap[0].value = v
 *             nvap[0].valuelen = len(v)             # <<<<<<<<<<<<<<
 *             nvap[0].flags = cnghttp2.NGHTTP2_NV_FLAG_NONE
 *             nvap += 1
 */
    __pyx_t_10 = PyObject_Length(__pyx_v_v); if (unlikely(__pyx_t_10 == ((Py_ssize_t)-1))) __PYX_ERR(0, 102, __pyx_L1_error)
    (__pyx_v_nvap[0]).valuelen = __pyx_t_10;

    /* "nghttp2.pyx":103
 *             nvap[0].value = v
 *             nvap[0].valuelen = len(v)
 *             nvap[0].flags = cnghttp2.NGHTTP2_NV_FLAG_NONE             # <<<<<<<<<<<<<<
 *             nvap += 1
 * 
 */
    (__pyx_v_nvap[0]).flags = NGHTTP2_NV_FLAG_NONE;

    /* "nghttp2.pyx":104
 *             nvap[0].valuelen = len(v)
 *             nvap[0].flags = cnghttp2.NGHTTP2_NV_FLAG_NONE
 *             nvap += 1             # <<<<<<<<<<<<<<
 * 
 *         cdef size_t outcap = 0
 */
    __pyx_v_nvap = (__pyx_v_nvap + 1);

    /* "nghttp2.pyx":98
 *         cdef cnghttp2.nghttp2_nv *nvap = nva
 * 
 *         for k, v in headers:             # <<<<<<<<<<<<<<
 *             nvap[0].name = k
 *             nvap[0].namelen = len(k)
 */
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "nghttp2.pyx":106
 *             nvap += 1
 * 
 *         cdef size_t outcap = 0             # <<<<<<<<<<<<<<
 *         cdef ssize_t rv
 *         cdef uint8_t *out
 */
  __pyx_v_outcap = 0;

  /* "nghttp2.pyx":112
 * 
 *         outlen = cnghttp2.nghttp2_hd_deflate_bound(self._deflater,
 *                                                    nva, len(headers))             # <<<<<<<<<<<<<<
 * 
 *         out = <uint8_t*>malloc(outlen)
 */
  __pyx_t_1 = PyObject_Length(__pyx_v_headers); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 112, __pyx_L1_error)

  /* "nghttp2.pyx":111
 *         cdef size_t outlen
 * 
 *         outlen = cnghttp2.nghttp2_hd_deflate_bound(self._deflater,             # <<<<<<<<<<<<<<
 *                                                    nva, len(headers))
 * 
 */
  __pyx_v_outlen = nghttp2_hd_deflate_bound(__pyx_v_self->_deflater, __pyx_v_nva, __pyx_t_1);

  /* "nghttp2.pyx":114
 *                                                    nva, len(headers))
 * 
 *         out = <uint8_t*>malloc(outlen)             # <<<<<<<<<<<<<<
 * 
 *         rv = cnghttp2.nghttp2_hd_deflate_hd(self._deflater, out, outlen,
 */
  __pyx_v_out = ((uint8_t *)malloc(__pyx_v_outlen));

  /* "nghttp2.pyx":117
 * 
 *         rv = cnghttp2.nghttp2_hd_deflate_hd(self._deflater, out, outlen,
 *                                             nva, len(headers))             # <<<<<<<<<<<<<<
 *         free(nva)
 * 
 */
  __pyx_t_1 = PyObject_Length(__pyx_v_headers); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 117, __pyx_L1_error)

  /* "nghttp2.pyx":116
 *         out = <uint8_t*>malloc(outlen)
 * 
 *         rv = cnghttp2.nghttp2_hd_deflate_hd(self._deflater, out, outlen,             # <<<<<<<<<<<<<<
 *                                             nva, len(headers))
 *         free(nva)
 */
  __pyx_v_rv = nghttp2_hd_deflate_hd(__pyx_v_self->_deflater, __pyx_v_out, __pyx_v_outlen, __pyx_v_nva, __pyx_t_1);

  /* "nghttp2.pyx":118
 *         rv = cnghttp2.nghttp2_hd_deflate_hd(self._deflater, out, outlen,
 *                                             nva, len(headers))
 *         free(nva)             # <<<<<<<<<<<<<<
 * 
 *         if rv < 0:
 */
  free(__pyx_v_nva);

  /* "nghttp2.pyx":120
 *         free(nva)
 * 
 *         if rv < 0:             # <<<<<<<<<<<<<<
 *             free(out)
 * 
 */
  __pyx_t_11 = ((__pyx_v_rv < 0) != 0);
  if (unlikely(__pyx_t_11)) {

    /* "nghttp2.pyx":121
 * 
 *         if rv < 0:
 *             free(out)             # <<<<<<<<<<<<<<
 * 
 *             raise Exception(_strerror(rv))
 */
    free(__pyx_v_out);

    /* "nghttp2.pyx":123
 *             free(out)
 * 
 *             raise Exception(_strerror(rv))             # <<<<<<<<<<<<<<
 * 
 *         cdef bytes res
 */
    __pyx_t_2 = __pyx_f_7nghttp2__strerror(__pyx_v_rv); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 123, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 123, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __PYX_ERR(0, 123, __pyx_L1_error)

    /* "nghttp2.pyx":120
 *         free(nva)
 * 
 *         if rv < 0:             # <<<<<<<<<<<<<<
 *             free(out)
 * 
 */
  }

  /* "nghttp2.pyx":127
 *         cdef bytes res
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             res = out[:rv]
 *         finally:
 */
  /*try:*/ {

    /* "nghttp2.pyx":128
 * 
 *         try:
 *             res = out[:rv]             # <<<<<<<<<<<<<<
 *         finally:
 *             free(out)
 */
    __pyx_t_4 = __Pyx_PyBytes_FromStringAndSize(((const char*)__pyx_v_out) + 0, __pyx_v_rv - 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 128, __pyx_L9_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_v_res = ((PyObject*)__pyx_t_4);
    __pyx_t_4 = 0;
  }

  /* "nghttp2.pyx":130
 *             res = out[:rv]
 *         finally:
 *             free(out)             # <<<<<<<<<<<<<<
 * 
 *         return res
 */
  /*finally:*/ {
    /*normal exit:*/{
      free(__pyx_v_out);
      goto __pyx_L10;
    }
    __pyx_L9_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_18, &__pyx_t_19, &__pyx_t_20);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_15, &__pyx_t_16, &__pyx_t_17) < 0)) __Pyx_ErrFetch(&__pyx_t_15, &__pyx_t_16, &__pyx_t_17);
      __Pyx_XGOTREF(__pyx_t_15);
      __Pyx_XGOTREF(__pyx_t_16);
      __Pyx_XGOTREF(__pyx_t_17);
      __Pyx_XGOTREF(__pyx_t_18);
      __Pyx_XGOTREF(__pyx_t_19);
      __Pyx_XGOTREF(__pyx_t_20);
      __pyx_t_12 = __pyx_lineno; __pyx_t_13 = __pyx_clineno; __pyx_t_14 = __pyx_filename;
      {
        free(__pyx_v_out);
      }
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_18);
        __Pyx_XGIVEREF(__pyx_t_19);
        __Pyx_XGIVEREF(__pyx_t_20);
        __Pyx_ExceptionReset(__pyx_t_18, __pyx_t_19, __pyx_t_20);
      }
      __Pyx_XGIVEREF(__pyx_t_15);
      __Pyx_XGIVEREF(__pyx_t_16);
      __Pyx_XGIVEREF(__pyx_t_17);
      __Pyx_ErrRestore(__pyx_t_15, __pyx_t_16, __pyx_t_17);
      __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0;
      __pyx_lineno = __pyx_t_12; __pyx_clineno = __pyx_t_13; __pyx_filename = __pyx_t_14;
      goto __pyx_L1_error;
    }
    __pyx_L10:;
  }

  /* "nghttp2.pyx":132
 *             free(out)
 * 
 *         return res             # <<<<<<<<<<<<<<
 * 
 *     def change_table_size(self, hd_table_bufsize_max):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_res);
  __pyx_r = __pyx_v_res;
  goto __pyx_L0;

  /* "nghttp2.pyx":84
 *         cnghttp2.nghttp2_hd_deflate_del(self._deflater)
 * 
 *     def deflate(self, headers):             # <<<<<<<<<<<<<<
 *         '''Compresses the |headers|. The |headers| must be sequence of tuple
 *         of name/value pair, which are sequence of bytes (not unicode
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("nghttp2.HDDeflater.deflate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_k);
  __Pyx_XDECREF(__pyx_v_v);
  __Pyx_XDECREF(__pyx_v_res);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":134
 *         return res
 * 
 *     def change_table_size(self, hd_table_bufsize_max):             # <<<<<<<<<<<<<<
 *         '''Changes header table size to |hd_table_bufsize_max| byte.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_10HDDeflater_7change_table_size(PyObject *__pyx_v_self, PyObject *__pyx_v_hd_table_bufsize_max); /*proto*/
static char __pyx_doc_7nghttp2_10HDDeflater_6change_table_size[] = "Changes header table size to |hd_table_bufsize_max| byte.\n\n        An exception will be raised on error.\n\n        ";
static PyObject *__pyx_pw_7nghttp2_10HDDeflater_7change_table_size(PyObject *__pyx_v_self, PyObject *__pyx_v_hd_table_bufsize_max) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("change_table_size (wrapper)", 0);
  __pyx_r = __pyx_pf_7nghttp2_10HDDeflater_6change_table_size(((struct __pyx_obj_7nghttp2_HDDeflater *)__pyx_v_self), ((PyObject *)__pyx_v_hd_table_bufsize_max));

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

static PyObject *__pyx_pf_7nghttp2_10HDDeflater_6change_table_size(struct __pyx_obj_7nghttp2_HDDeflater *__pyx_v_self, PyObject *__pyx_v_hd_table_bufsize_max) {
  int __pyx_v_rv;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  size_t __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("change_table_size", 0);

  /* "nghttp2.pyx":142
 *         cdef int rv
 *         rv = cnghttp2.nghttp2_hd_deflate_change_table_size(self._deflater,
 *                                                            hd_table_bufsize_max)             # <<<<<<<<<<<<<<
 *         if rv != 0:
 *             raise Exception(_strerror(rv))
 */
  __pyx_t_1 = __Pyx_PyInt_As_size_t(__pyx_v_hd_table_bufsize_max); if (unlikely((__pyx_t_1 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 142, __pyx_L1_error)

  /* "nghttp2.pyx":141
 *         '''
 *         cdef int rv
 *         rv = cnghttp2.nghttp2_hd_deflate_change_table_size(self._deflater,             # <<<<<<<<<<<<<<
 *                                                            hd_table_bufsize_max)
 *         if rv != 0:
 */
  __pyx_v_rv = nghttp2_hd_deflate_change_table_size(__pyx_v_self->_deflater, __pyx_t_1);

  /* "nghttp2.pyx":143
 *         rv = cnghttp2.nghttp2_hd_deflate_change_table_size(self._deflater,
 *                                                            hd_table_bufsize_max)
 *         if rv != 0:             # <<<<<<<<<<<<<<
 *             raise Exception(_strerror(rv))
 * 
 */
  __pyx_t_2 = ((__pyx_v_rv != 0) != 0);
  if (unlikely(__pyx_t_2)) {

    /* "nghttp2.pyx":144
 *                                                            hd_table_bufsize_max)
 *         if rv != 0:
 *             raise Exception(_strerror(rv))             # <<<<<<<<<<<<<<
 * 
 *     def get_hd_table(self):
 */
    __pyx_t_3 = __pyx_f_7nghttp2__strerror(__pyx_v_rv); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 144, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 144, __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(0, 144, __pyx_L1_error)

    /* "nghttp2.pyx":143
 *         rv = cnghttp2.nghttp2_hd_deflate_change_table_size(self._deflater,
 *                                                            hd_table_bufsize_max)
 *         if rv != 0:             # <<<<<<<<<<<<<<
 *             raise Exception(_strerror(rv))
 * 
 */
  }

  /* "nghttp2.pyx":134
 *         return res
 * 
 *     def change_table_size(self, hd_table_bufsize_max):             # <<<<<<<<<<<<<<
 *         '''Changes header table size to |hd_table_bufsize_max| byte.
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("nghttp2.HDDeflater.change_table_size", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":146
 *             raise Exception(_strerror(rv))
 * 
 *     def get_hd_table(self):             # <<<<<<<<<<<<<<
 *         '''Returns copy of current dynamic header table.'''
 *         cdef size_t length = cnghttp2.nghttp2_hd_deflate_get_num_table_entries(
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_10HDDeflater_9get_hd_table(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7nghttp2_10HDDeflater_8get_hd_table[] = "Returns copy of current dynamic header table.";
static PyObject *__pyx_pw_7nghttp2_10HDDeflater_9get_hd_table(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_hd_table (wrapper)", 0);
  __pyx_r = __pyx_pf_7nghttp2_10HDDeflater_8get_hd_table(((struct __pyx_obj_7nghttp2_HDDeflater *)__pyx_v_self));

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

static PyObject *__pyx_pf_7nghttp2_10HDDeflater_8get_hd_table(struct __pyx_obj_7nghttp2_HDDeflater *__pyx_v_self) {
  size_t __pyx_v_length;
  nghttp2_nv const *__pyx_v_nv;
  PyObject *__pyx_v_res = NULL;
  size_t __pyx_v_i;
  PyObject *__pyx_v_k = NULL;
  PyObject *__pyx_v_v = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  size_t __pyx_t_2;
  size_t __pyx_t_3;
  size_t __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;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_hd_table", 0);

  /* "nghttp2.pyx":148
 *     def get_hd_table(self):
 *         '''Returns copy of current dynamic header table.'''
 *         cdef size_t length = cnghttp2.nghttp2_hd_deflate_get_num_table_entries(             # <<<<<<<<<<<<<<
 *             self._deflater)
 *         cdef const cnghttp2.nghttp2_nv *nv
 */
  __pyx_v_length = nghttp2_hd_deflate_get_num_table_entries(__pyx_v_self->_deflater);

  /* "nghttp2.pyx":151
 *             self._deflater)
 *         cdef const cnghttp2.nghttp2_nv *nv
 *         res = []             # <<<<<<<<<<<<<<
 *         for i in range(62, length + 1):
 *             nv = cnghttp2.nghttp2_hd_deflate_get_table_entry(self._deflater, i)
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 151, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_res = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "nghttp2.pyx":152
 *         cdef const cnghttp2.nghttp2_nv *nv
 *         res = []
 *         for i in range(62, length + 1):             # <<<<<<<<<<<<<<
 *             nv = cnghttp2.nghttp2_hd_deflate_get_table_entry(self._deflater, i)
 *             k = _get_pybytes(nv.name, nv.namelen)
 */
  __pyx_t_2 = (__pyx_v_length + 1);
  __pyx_t_3 = __pyx_t_2;
  for (__pyx_t_4 = 62; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
    __pyx_v_i = __pyx_t_4;

    /* "nghttp2.pyx":153
 *         res = []
 *         for i in range(62, length + 1):
 *             nv = cnghttp2.nghttp2_hd_deflate_get_table_entry(self._deflater, i)             # <<<<<<<<<<<<<<
 *             k = _get_pybytes(nv.name, nv.namelen)
 *             v = _get_pybytes(nv.value, nv.valuelen)
 */
    __pyx_v_nv = nghttp2_hd_deflate_get_table_entry(__pyx_v_self->_deflater, __pyx_v_i);

    /* "nghttp2.pyx":154
 *         for i in range(62, length + 1):
 *             nv = cnghttp2.nghttp2_hd_deflate_get_table_entry(self._deflater, i)
 *             k = _get_pybytes(nv.name, nv.namelen)             # <<<<<<<<<<<<<<
 *             v = _get_pybytes(nv.value, nv.valuelen)
 *             res.append(HDTableEntry(k, nv.namelen, v, nv.valuelen))
 */
    __pyx_t_1 = __pyx_f_7nghttp2__get_pybytes(__pyx_v_nv->name, __pyx_v_nv->namelen); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 154, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_XDECREF_SET(__pyx_v_k, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "nghttp2.pyx":155
 *             nv = cnghttp2.nghttp2_hd_deflate_get_table_entry(self._deflater, i)
 *             k = _get_pybytes(nv.name, nv.namelen)
 *             v = _get_pybytes(nv.value, nv.valuelen)             # <<<<<<<<<<<<<<
 *             res.append(HDTableEntry(k, nv.namelen, v, nv.valuelen))
 *         return res
 */
    __pyx_t_1 = __pyx_f_7nghttp2__get_pybytes(__pyx_v_nv->value, __pyx_v_nv->valuelen); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 155, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "nghttp2.pyx":156
 *             k = _get_pybytes(nv.name, nv.namelen)
 *             v = _get_pybytes(nv.value, nv.valuelen)
 *             res.append(HDTableEntry(k, nv.namelen, v, nv.valuelen))             # <<<<<<<<<<<<<<
 *         return res
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_HDTableEntry); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 156, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyInt_From_uint16_t(__pyx_v_nv->namelen); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 156, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = __Pyx_PyInt_From_uint16_t(__pyx_v_nv->valuelen); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 156, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = NULL;
    __pyx_t_9 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
        __pyx_t_9 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[5] = {__pyx_t_8, __pyx_v_k, __pyx_t_6, __pyx_v_v, __pyx_t_7};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_9, 4+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 156, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __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_5)) {
      PyObject *__pyx_temp[5] = {__pyx_t_8, __pyx_v_k, __pyx_t_6, __pyx_v_v, __pyx_t_7};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_9, 4+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 156, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __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(4+__pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 156, __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_INCREF(__pyx_v_k);
      __Pyx_GIVEREF(__pyx_v_k);
      PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_9, __pyx_v_k);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_9, __pyx_t_6);
      __Pyx_INCREF(__pyx_v_v);
      __Pyx_GIVEREF(__pyx_v_v);
      PyTuple_SET_ITEM(__pyx_t_10, 2+__pyx_t_9, __pyx_v_v);
      __Pyx_GIVEREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_10, 3+__pyx_t_9, __pyx_t_7);
      __pyx_t_6 = 0;
      __pyx_t_7 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 156, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_res, __pyx_t_1); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 156, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "nghttp2.pyx":157
 *             v = _get_pybytes(nv.value, nv.valuelen)
 *             res.append(HDTableEntry(k, nv.namelen, v, nv.valuelen))
 *         return res             # <<<<<<<<<<<<<<
 * 
 * cdef class HDInflater:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_res);
  __pyx_r = __pyx_v_res;
  goto __pyx_L0;

  /* "nghttp2.pyx":146
 *             raise Exception(_strerror(rv))
 * 
 *     def get_hd_table(self):             # <<<<<<<<<<<<<<
 *         '''Returns copy of current dynamic header table.'''
 *         cdef size_t length = cnghttp2.nghttp2_hd_deflate_get_num_table_entries(
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __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("nghttp2.HDDeflater.get_hd_table", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_res);
  __Pyx_XDECREF(__pyx_v_k);
  __Pyx_XDECREF(__pyx_v_v);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_10HDDeflater_11__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_7nghttp2_10HDDeflater_11__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7nghttp2_10HDDeflater_10__reduce_cython__(((struct __pyx_obj_7nghttp2_HDDeflater *)__pyx_v_self));

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

static PyObject *__pyx_pf_7nghttp2_10HDDeflater_10__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7nghttp2_HDDeflater *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __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(1, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("nghttp2.HDDeflater.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_10HDDeflater_13__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static PyObject *__pyx_pw_7nghttp2_10HDDeflater_13__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7nghttp2_10HDDeflater_12__setstate_cython__(((struct __pyx_obj_7nghttp2_HDDeflater *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_7nghttp2_10HDDeflater_12__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7nghttp2_HDDeflater *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __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(1, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("nghttp2.HDDeflater.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":173
 *     cdef cnghttp2.nghttp2_hd_inflater *_inflater
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         rv = cnghttp2.nghttp2_hd_inflate_new(&self._inflater)
 *         if rv != 0:
 */

/* Python wrapper */
static int __pyx_pw_7nghttp2_10HDInflater_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_7nghttp2_10HDInflater_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_7nghttp2_10HDInflater___cinit__(((struct __pyx_obj_7nghttp2_HDInflater *)__pyx_v_self));

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

static int __pyx_pf_7nghttp2_10HDInflater___cinit__(struct __pyx_obj_7nghttp2_HDInflater *__pyx_v_self) {
  int __pyx_v_rv;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "nghttp2.pyx":174
 * 
 *     def __cinit__(self):
 *         rv = cnghttp2.nghttp2_hd_inflate_new(&self._inflater)             # <<<<<<<<<<<<<<
 *         if rv != 0:
 *             raise Exception(_strerror(rv))
 */
  __pyx_v_rv = nghttp2_hd_inflate_new((&__pyx_v_self->_inflater));

  /* "nghttp2.pyx":175
 *     def __cinit__(self):
 *         rv = cnghttp2.nghttp2_hd_inflate_new(&self._inflater)
 *         if rv != 0:             # <<<<<<<<<<<<<<
 *             raise Exception(_strerror(rv))
 * 
 */
  __pyx_t_1 = ((__pyx_v_rv != 0) != 0);
  if (unlikely(__pyx_t_1)) {

    /* "nghttp2.pyx":176
 *         rv = cnghttp2.nghttp2_hd_inflate_new(&self._inflater)
 *         if rv != 0:
 *             raise Exception(_strerror(rv))             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
    __pyx_t_2 = __pyx_f_7nghttp2__strerror(__pyx_v_rv); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 176, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 176, __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(0, 176, __pyx_L1_error)

    /* "nghttp2.pyx":175
 *     def __cinit__(self):
 *         rv = cnghttp2.nghttp2_hd_inflate_new(&self._inflater)
 *         if rv != 0:             # <<<<<<<<<<<<<<
 *             raise Exception(_strerror(rv))
 * 
 */
  }

  /* "nghttp2.pyx":173
 *     cdef cnghttp2.nghttp2_hd_inflater *_inflater
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         rv = cnghttp2.nghttp2_hd_inflate_new(&self._inflater)
 *         if rv != 0:
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("nghttp2.HDInflater.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":178
 *             raise Exception(_strerror(rv))
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         cnghttp2.nghttp2_hd_inflate_del(self._inflater)
 * 
 */

/* Python wrapper */
static void __pyx_pw_7nghttp2_10HDInflater_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_7nghttp2_10HDInflater_3__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_pf_7nghttp2_10HDInflater_2__dealloc__(((struct __pyx_obj_7nghttp2_HDInflater *)__pyx_v_self));

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

static void __pyx_pf_7nghttp2_10HDInflater_2__dealloc__(struct __pyx_obj_7nghttp2_HDInflater *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "nghttp2.pyx":179
 * 
 *     def __dealloc__(self):
 *         cnghttp2.nghttp2_hd_inflate_del(self._inflater)             # <<<<<<<<<<<<<<
 * 
 *     def inflate(self, data):
 */
  nghttp2_hd_inflate_del(__pyx_v_self->_inflater);

  /* "nghttp2.pyx":178
 *             raise Exception(_strerror(rv))
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         cnghttp2.nghttp2_hd_inflate_del(self._inflater)
 * 
 */

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

/* "nghttp2.pyx":181
 *         cnghttp2.nghttp2_hd_inflate_del(self._inflater)
 * 
 *     def inflate(self, data):             # <<<<<<<<<<<<<<
 *         '''Decompresses the compressed header block |data|. The |data| must be
 *         byte string (not unicode string).
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_10HDInflater_5inflate(PyObject *__pyx_v_self, PyObject *__pyx_v_data); /*proto*/
static char __pyx_doc_7nghttp2_10HDInflater_4inflate[] = "Decompresses the compressed header block |data|. The |data| must be\n        byte string (not unicode string).\n\n        ";
static PyObject *__pyx_pw_7nghttp2_10HDInflater_5inflate(PyObject *__pyx_v_self, PyObject *__pyx_v_data) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("inflate (wrapper)", 0);
  __pyx_r = __pyx_pf_7nghttp2_10HDInflater_4inflate(((struct __pyx_obj_7nghttp2_HDInflater *)__pyx_v_self), ((PyObject *)__pyx_v_data));

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

static PyObject *__pyx_pf_7nghttp2_10HDInflater_4inflate(struct __pyx_obj_7nghttp2_HDInflater *__pyx_v_self, PyObject *__pyx_v_data) {
  nghttp2_nv __pyx_v_nv;
  int __pyx_v_inflate_flags;
  Py_ssize_t __pyx_v_rv;
  uint8_t *__pyx_v_buf;
  size_t __pyx_v_buflen;
  PyObject *__pyx_v_res = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  uint8_t *__pyx_t_1;
  Py_ssize_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("inflate", 0);

  /* "nghttp2.pyx":189
 *         cdef int inflate_flags
 *         cdef ssize_t rv
 *         cdef uint8_t *buf = data             # <<<<<<<<<<<<<<
 *         cdef size_t buflen = len(data)
 *         res = []
 */
  __pyx_t_1 = __Pyx_PyObject_AsWritableUString(__pyx_v_data); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) __PYX_ERR(0, 189, __pyx_L1_error)
  __pyx_v_buf = __pyx_t_1;

  /* "nghttp2.pyx":190
 *         cdef ssize_t rv
 *         cdef uint8_t *buf = data
 *         cdef size_t buflen = len(data)             # <<<<<<<<<<<<<<
 *         res = []
 *         while True:
 */
  __pyx_t_2 = PyObject_Length(__pyx_v_data); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 190, __pyx_L1_error)
  __pyx_v_buflen = __pyx_t_2;

  /* "nghttp2.pyx":191
 *         cdef uint8_t *buf = data
 *         cdef size_t buflen = len(data)
 *         res = []             # <<<<<<<<<<<<<<
 *         while True:
 *             inflate_flags = 0
 */
  __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 191, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_res = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "nghttp2.pyx":192
 *         cdef size_t buflen = len(data)
 *         res = []
 *         while True:             # <<<<<<<<<<<<<<
 *             inflate_flags = 0
 *             rv = cnghttp2.nghttp2_hd_inflate_hd2(self._inflater, &nv,
 */
  while (1) {

    /* "nghttp2.pyx":193
 *         res = []
 *         while True:
 *             inflate_flags = 0             # <<<<<<<<<<<<<<
 *             rv = cnghttp2.nghttp2_hd_inflate_hd2(self._inflater, &nv,
 *                                                  &inflate_flags,
 */
    __pyx_v_inflate_flags = 0;

    /* "nghttp2.pyx":194
 *         while True:
 *             inflate_flags = 0
 *             rv = cnghttp2.nghttp2_hd_inflate_hd2(self._inflater, &nv,             # <<<<<<<<<<<<<<
 *                                                  &inflate_flags,
 *                                                  buf, buflen, 1)
 */
    __pyx_v_rv = nghttp2_hd_inflate_hd2(__pyx_v_self->_inflater, (&__pyx_v_nv), (&__pyx_v_inflate_flags), __pyx_v_buf, __pyx_v_buflen, 1);

    /* "nghttp2.pyx":197
 *                                                  &inflate_flags,
 *                                                  buf, buflen, 1)
 *             if rv < 0:             # <<<<<<<<<<<<<<
 *                 raise Exception(_strerror(rv))
 *             buf += rv
 */
    __pyx_t_4 = ((__pyx_v_rv < 0) != 0);
    if (unlikely(__pyx_t_4)) {

      /* "nghttp2.pyx":198
 *                                                  buf, buflen, 1)
 *             if rv < 0:
 *                 raise Exception(_strerror(rv))             # <<<<<<<<<<<<<<
 *             buf += rv
 *             buflen -= rv
 */
      __pyx_t_3 = __pyx_f_7nghttp2__strerror(__pyx_v_rv); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 198, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = __Pyx_PyObject_CallOneArg(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 198, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_Raise(__pyx_t_5, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __PYX_ERR(0, 198, __pyx_L1_error)

      /* "nghttp2.pyx":197
 *                                                  &inflate_flags,
 *                                                  buf, buflen, 1)
 *             if rv < 0:             # <<<<<<<<<<<<<<
 *                 raise Exception(_strerror(rv))
 *             buf += rv
 */
    }

    /* "nghttp2.pyx":199
 *             if rv < 0:
 *                 raise Exception(_strerror(rv))
 *             buf += rv             # <<<<<<<<<<<<<<
 *             buflen -= rv
 *             if inflate_flags & cnghttp2.NGHTTP2_HD_INFLATE_EMIT:
 */
    __pyx_v_buf = (__pyx_v_buf + __pyx_v_rv);

    /* "nghttp2.pyx":200
 *                 raise Exception(_strerror(rv))
 *             buf += rv
 *             buflen -= rv             # <<<<<<<<<<<<<<
 *             if inflate_flags & cnghttp2.NGHTTP2_HD_INFLATE_EMIT:
 *                 # may throw
 */
    __pyx_v_buflen = (__pyx_v_buflen - __pyx_v_rv);

    /* "nghttp2.pyx":201
 *             buf += rv
 *             buflen -= rv
 *             if inflate_flags & cnghttp2.NGHTTP2_HD_INFLATE_EMIT:             # <<<<<<<<<<<<<<
 *                 # may throw
 *                 res.append((nv.name[:nv.namelen], nv.value[:nv.valuelen]))
 */
    __pyx_t_4 = ((__pyx_v_inflate_flags & NGHTTP2_HD_INFLATE_EMIT) != 0);
    if (__pyx_t_4) {

      /* "nghttp2.pyx":203
 *             if inflate_flags & cnghttp2.NGHTTP2_HD_INFLATE_EMIT:
 *                 # may throw
 *                 res.append((nv.name[:nv.namelen], nv.value[:nv.valuelen]))             # <<<<<<<<<<<<<<
 *             if inflate_flags & cnghttp2.NGHTTP2_HD_INFLATE_FINAL:
 *                 break
 */
      __pyx_t_5 = __Pyx_PyBytes_FromStringAndSize(((const char*)__pyx_v_nv.name) + 0, __pyx_v_nv.namelen - 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 203, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __Pyx_PyBytes_FromStringAndSize(((const char*)__pyx_v_nv.value) + 0, __pyx_v_nv.valuelen - 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 203, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 203, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_3);
      __pyx_t_5 = 0;
      __pyx_t_3 = 0;
      __pyx_t_7 = __Pyx_PyList_Append(__pyx_v_res, __pyx_t_6); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 203, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

      /* "nghttp2.pyx":201
 *             buf += rv
 *             buflen -= rv
 *             if inflate_flags & cnghttp2.NGHTTP2_HD_INFLATE_EMIT:             # <<<<<<<<<<<<<<
 *                 # may throw
 *                 res.append((nv.name[:nv.namelen], nv.value[:nv.valuelen]))
 */
    }

    /* "nghttp2.pyx":204
 *                 # may throw
 *                 res.append((nv.name[:nv.namelen], nv.value[:nv.valuelen]))
 *             if inflate_flags & cnghttp2.NGHTTP2_HD_INFLATE_FINAL:             # <<<<<<<<<<<<<<
 *                 break
 * 
 */
    __pyx_t_4 = ((__pyx_v_inflate_flags & NGHTTP2_HD_INFLATE_FINAL) != 0);
    if (__pyx_t_4) {

      /* "nghttp2.pyx":205
 *                 res.append((nv.name[:nv.namelen], nv.value[:nv.valuelen]))
 *             if inflate_flags & cnghttp2.NGHTTP2_HD_INFLATE_FINAL:
 *                 break             # <<<<<<<<<<<<<<
 * 
 *         cnghttp2.nghttp2_hd_inflate_end_headers(self._inflater)
 */
      goto __pyx_L4_break;

      /* "nghttp2.pyx":204
 *                 # may throw
 *                 res.append((nv.name[:nv.namelen], nv.value[:nv.valuelen]))
 *             if inflate_flags & cnghttp2.NGHTTP2_HD_INFLATE_FINAL:             # <<<<<<<<<<<<<<
 *                 break
 * 
 */
    }
  }
  __pyx_L4_break:;

  /* "nghttp2.pyx":207
 *                 break
 * 
 *         cnghttp2.nghttp2_hd_inflate_end_headers(self._inflater)             # <<<<<<<<<<<<<<
 *         return res
 * 
 */
  (void)(nghttp2_hd_inflate_end_headers(__pyx_v_self->_inflater));

  /* "nghttp2.pyx":208
 * 
 *         cnghttp2.nghttp2_hd_inflate_end_headers(self._inflater)
 *         return res             # <<<<<<<<<<<<<<
 * 
 *     def change_table_size(self, hd_table_bufsize_max):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_res);
  __pyx_r = __pyx_v_res;
  goto __pyx_L0;

  /* "nghttp2.pyx":181
 *         cnghttp2.nghttp2_hd_inflate_del(self._inflater)
 * 
 *     def inflate(self, data):             # <<<<<<<<<<<<<<
 *         '''Decompresses the compressed header block |data|. The |data| must be
 *         byte string (not unicode string).
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("nghttp2.HDInflater.inflate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_res);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":210
 *         return res
 * 
 *     def change_table_size(self, hd_table_bufsize_max):             # <<<<<<<<<<<<<<
 *         '''Changes header table size to |hd_table_bufsize_max| byte.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_10HDInflater_7change_table_size(PyObject *__pyx_v_self, PyObject *__pyx_v_hd_table_bufsize_max); /*proto*/
static char __pyx_doc_7nghttp2_10HDInflater_6change_table_size[] = "Changes header table size to |hd_table_bufsize_max| byte.\n\n        An exception will be raised on error.\n\n        ";
static PyObject *__pyx_pw_7nghttp2_10HDInflater_7change_table_size(PyObject *__pyx_v_self, PyObject *__pyx_v_hd_table_bufsize_max) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("change_table_size (wrapper)", 0);
  __pyx_r = __pyx_pf_7nghttp2_10HDInflater_6change_table_size(((struct __pyx_obj_7nghttp2_HDInflater *)__pyx_v_self), ((PyObject *)__pyx_v_hd_table_bufsize_max));

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

static PyObject *__pyx_pf_7nghttp2_10HDInflater_6change_table_size(struct __pyx_obj_7nghttp2_HDInflater *__pyx_v_self, PyObject *__pyx_v_hd_table_bufsize_max) {
  int __pyx_v_rv;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  size_t __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("change_table_size", 0);

  /* "nghttp2.pyx":218
 *         cdef int rv
 *         rv = cnghttp2.nghttp2_hd_inflate_change_table_size(self._inflater,
 *                                                            hd_table_bufsize_max)             # <<<<<<<<<<<<<<
 *         if rv != 0:
 *             raise Exception(_strerror(rv))
 */
  __pyx_t_1 = __Pyx_PyInt_As_size_t(__pyx_v_hd_table_bufsize_max); if (unlikely((__pyx_t_1 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 218, __pyx_L1_error)

  /* "nghttp2.pyx":217
 *         '''
 *         cdef int rv
 *         rv = cnghttp2.nghttp2_hd_inflate_change_table_size(self._inflater,             # <<<<<<<<<<<<<<
 *                                                            hd_table_bufsize_max)
 *         if rv != 0:
 */
  __pyx_v_rv = nghttp2_hd_inflate_change_table_size(__pyx_v_self->_inflater, __pyx_t_1);

  /* "nghttp2.pyx":219
 *         rv = cnghttp2.nghttp2_hd_inflate_change_table_size(self._inflater,
 *                                                            hd_table_bufsize_max)
 *         if rv != 0:             # <<<<<<<<<<<<<<
 *             raise Exception(_strerror(rv))
 * 
 */
  __pyx_t_2 = ((__pyx_v_rv != 0) != 0);
  if (unlikely(__pyx_t_2)) {

    /* "nghttp2.pyx":220
 *                                                            hd_table_bufsize_max)
 *         if rv != 0:
 *             raise Exception(_strerror(rv))             # <<<<<<<<<<<<<<
 * 
 *     def get_hd_table(self):
 */
    __pyx_t_3 = __pyx_f_7nghttp2__strerror(__pyx_v_rv); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 220, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 220, __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(0, 220, __pyx_L1_error)

    /* "nghttp2.pyx":219
 *         rv = cnghttp2.nghttp2_hd_inflate_change_table_size(self._inflater,
 *                                                            hd_table_bufsize_max)
 *         if rv != 0:             # <<<<<<<<<<<<<<
 *             raise Exception(_strerror(rv))
 * 
 */
  }

  /* "nghttp2.pyx":210
 *         return res
 * 
 *     def change_table_size(self, hd_table_bufsize_max):             # <<<<<<<<<<<<<<
 *         '''Changes header table size to |hd_table_bufsize_max| byte.
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("nghttp2.HDInflater.change_table_size", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":222
 *             raise Exception(_strerror(rv))
 * 
 *     def get_hd_table(self):             # <<<<<<<<<<<<<<
 *         '''Returns copy of current dynamic header table.'''
 *         cdef size_t length = cnghttp2.nghttp2_hd_inflate_get_num_table_entries(
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_10HDInflater_9get_hd_table(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7nghttp2_10HDInflater_8get_hd_table[] = "Returns copy of current dynamic header table.";
static PyObject *__pyx_pw_7nghttp2_10HDInflater_9get_hd_table(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_hd_table (wrapper)", 0);
  __pyx_r = __pyx_pf_7nghttp2_10HDInflater_8get_hd_table(((struct __pyx_obj_7nghttp2_HDInflater *)__pyx_v_self));

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

static PyObject *__pyx_pf_7nghttp2_10HDInflater_8get_hd_table(struct __pyx_obj_7nghttp2_HDInflater *__pyx_v_self) {
  size_t __pyx_v_length;
  nghttp2_nv const *__pyx_v_nv;
  PyObject *__pyx_v_res = NULL;
  size_t __pyx_v_i;
  PyObject *__pyx_v_k = NULL;
  PyObject *__pyx_v_v = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  size_t __pyx_t_2;
  size_t __pyx_t_3;
  size_t __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;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_hd_table", 0);

  /* "nghttp2.pyx":224
 *     def get_hd_table(self):
 *         '''Returns copy of current dynamic header table.'''
 *         cdef size_t length = cnghttp2.nghttp2_hd_inflate_get_num_table_entries(             # <<<<<<<<<<<<<<
 *             self._inflater)
 *         cdef const cnghttp2.nghttp2_nv *nv
 */
  __pyx_v_length = nghttp2_hd_inflate_get_num_table_entries(__pyx_v_self->_inflater);

  /* "nghttp2.pyx":227
 *             self._inflater)
 *         cdef const cnghttp2.nghttp2_nv *nv
 *         res = []             # <<<<<<<<<<<<<<
 *         for i in range(62, length + 1):
 *             nv = cnghttp2.nghttp2_hd_inflate_get_table_entry(self._inflater, i)
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 227, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_res = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "nghttp2.pyx":228
 *         cdef const cnghttp2.nghttp2_nv *nv
 *         res = []
 *         for i in range(62, length + 1):             # <<<<<<<<<<<<<<
 *             nv = cnghttp2.nghttp2_hd_inflate_get_table_entry(self._inflater, i)
 *             k = _get_pybytes(nv.name, nv.namelen)
 */
  __pyx_t_2 = (__pyx_v_length + 1);
  __pyx_t_3 = __pyx_t_2;
  for (__pyx_t_4 = 62; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
    __pyx_v_i = __pyx_t_4;

    /* "nghttp2.pyx":229
 *         res = []
 *         for i in range(62, length + 1):
 *             nv = cnghttp2.nghttp2_hd_inflate_get_table_entry(self._inflater, i)             # <<<<<<<<<<<<<<
 *             k = _get_pybytes(nv.name, nv.namelen)
 *             v = _get_pybytes(nv.value, nv.valuelen)
 */
    __pyx_v_nv = nghttp2_hd_inflate_get_table_entry(__pyx_v_self->_inflater, __pyx_v_i);

    /* "nghttp2.pyx":230
 *         for i in range(62, length + 1):
 *             nv = cnghttp2.nghttp2_hd_inflate_get_table_entry(self._inflater, i)
 *             k = _get_pybytes(nv.name, nv.namelen)             # <<<<<<<<<<<<<<
 *             v = _get_pybytes(nv.value, nv.valuelen)
 *             res.append(HDTableEntry(k, nv.namelen, v, nv.valuelen))
 */
    __pyx_t_1 = __pyx_f_7nghttp2__get_pybytes(__pyx_v_nv->name, __pyx_v_nv->namelen); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 230, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_XDECREF_SET(__pyx_v_k, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "nghttp2.pyx":231
 *             nv = cnghttp2.nghttp2_hd_inflate_get_table_entry(self._inflater, i)
 *             k = _get_pybytes(nv.name, nv.namelen)
 *             v = _get_pybytes(nv.value, nv.valuelen)             # <<<<<<<<<<<<<<
 *             res.append(HDTableEntry(k, nv.namelen, v, nv.valuelen))
 *         return res
 */
    __pyx_t_1 = __pyx_f_7nghttp2__get_pybytes(__pyx_v_nv->value, __pyx_v_nv->valuelen); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 231, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "nghttp2.pyx":232
 *             k = _get_pybytes(nv.name, nv.namelen)
 *             v = _get_pybytes(nv.value, nv.valuelen)
 *             res.append(HDTableEntry(k, nv.namelen, v, nv.valuelen))             # <<<<<<<<<<<<<<
 *         return res
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_HDTableEntry); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 232, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyInt_From_uint16_t(__pyx_v_nv->namelen); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 232, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = __Pyx_PyInt_From_uint16_t(__pyx_v_nv->valuelen); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 232, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = NULL;
    __pyx_t_9 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
        __pyx_t_9 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[5] = {__pyx_t_8, __pyx_v_k, __pyx_t_6, __pyx_v_v, __pyx_t_7};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_9, 4+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 232, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __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_5)) {
      PyObject *__pyx_temp[5] = {__pyx_t_8, __pyx_v_k, __pyx_t_6, __pyx_v_v, __pyx_t_7};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_9, 4+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 232, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __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(4+__pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 232, __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_INCREF(__pyx_v_k);
      __Pyx_GIVEREF(__pyx_v_k);
      PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_9, __pyx_v_k);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_9, __pyx_t_6);
      __Pyx_INCREF(__pyx_v_v);
      __Pyx_GIVEREF(__pyx_v_v);
      PyTuple_SET_ITEM(__pyx_t_10, 2+__pyx_t_9, __pyx_v_v);
      __Pyx_GIVEREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_10, 3+__pyx_t_9, __pyx_t_7);
      __pyx_t_6 = 0;
      __pyx_t_7 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 232, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_res, __pyx_t_1); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 232, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "nghttp2.pyx":233
 *             v = _get_pybytes(nv.value, nv.valuelen)
 *             res.append(HDTableEntry(k, nv.namelen, v, nv.valuelen))
 *         return res             # <<<<<<<<<<<<<<
 * 
 * cdef _strerror(int liberror_code):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_res);
  __pyx_r = __pyx_v_res;
  goto __pyx_L0;

  /* "nghttp2.pyx":222
 *             raise Exception(_strerror(rv))
 * 
 *     def get_hd_table(self):             # <<<<<<<<<<<<<<
 *         '''Returns copy of current dynamic header table.'''
 *         cdef size_t length = cnghttp2.nghttp2_hd_inflate_get_num_table_entries(
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __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("nghttp2.HDInflater.get_hd_table", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_res);
  __Pyx_XDECREF(__pyx_v_k);
  __Pyx_XDECREF(__pyx_v_v);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_10HDInflater_11__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_7nghttp2_10HDInflater_11__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7nghttp2_10HDInflater_10__reduce_cython__(((struct __pyx_obj_7nghttp2_HDInflater *)__pyx_v_self));

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

static PyObject *__pyx_pf_7nghttp2_10HDInflater_10__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7nghttp2_HDInflater *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __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(1, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("nghttp2.HDInflater.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_10HDInflater_13__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static PyObject *__pyx_pw_7nghttp2_10HDInflater_13__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7nghttp2_10HDInflater_12__setstate_cython__(((struct __pyx_obj_7nghttp2_HDInflater *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_7nghttp2_10HDInflater_12__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7nghttp2_HDInflater *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __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(1, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("nghttp2.HDInflater.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":235
 *         return res
 * 
 * cdef _strerror(int liberror_code):             # <<<<<<<<<<<<<<
 *     return cnghttp2.nghttp2_strerror(liberror_code).decode('utf-8')
 * 
 */

static PyObject *__pyx_f_7nghttp2__strerror(int __pyx_v_liberror_code) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  char const *__pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_strerror", 0);

  /* "nghttp2.pyx":236
 * 
 * cdef _strerror(int liberror_code):
 *     return cnghttp2.nghttp2_strerror(liberror_code).decode('utf-8')             # <<<<<<<<<<<<<<
 * 
 * def print_hd_table(hdtable):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = nghttp2_strerror(__pyx_v_liberror_code);
  __pyx_t_2 = __Pyx_decode_c_string(__pyx_t_1, 0, strlen(__pyx_t_1), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 236, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "nghttp2.pyx":235
 *         return res
 * 
 * cdef _strerror(int liberror_code):             # <<<<<<<<<<<<<<
 *     return cnghttp2.nghttp2_strerror(liberror_code).decode('utf-8')
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("nghttp2._strerror", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":238
 *     return cnghttp2.nghttp2_strerror(liberror_code).decode('utf-8')
 * 
 * def print_hd_table(hdtable):             # <<<<<<<<<<<<<<
 *     '''Convenient function to print |hdtable| to the standard output. This
 *     function does not work if header name/value cannot be decoded using
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_1print_hd_table(PyObject *__pyx_self, PyObject *__pyx_v_hdtable); /*proto*/
static char __pyx_doc_7nghttp2_print_hd_table[] = "Convenient function to print |hdtable| to the standard output. This\n    function does not work if header name/value cannot be decoded using\n    UTF-8 encoding.\n\n    s=N means the entry occupies N bytes in header table.\n\n    ";
static PyMethodDef __pyx_mdef_7nghttp2_1print_hd_table = {"print_hd_table", (PyCFunction)__pyx_pw_7nghttp2_1print_hd_table, METH_O, __pyx_doc_7nghttp2_print_hd_table};
static PyObject *__pyx_pw_7nghttp2_1print_hd_table(PyObject *__pyx_self, PyObject *__pyx_v_hdtable) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("print_hd_table (wrapper)", 0);
  __pyx_r = __pyx_pf_7nghttp2_print_hd_table(__pyx_self, ((PyObject *)__pyx_v_hdtable));

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

static PyObject *__pyx_pf_7nghttp2_print_hd_table(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_hdtable) {
  PyObject *__pyx_v_idx = NULL;
  PyObject *__pyx_v_entry = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  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;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("print_hd_table", 0);

  /* "nghttp2.pyx":246
 * 
 *     '''
 *     idx = 0             # <<<<<<<<<<<<<<
 *     for entry in hdtable:
 *         idx += 1
 */
  __Pyx_INCREF(__pyx_int_0);
  __pyx_v_idx = __pyx_int_0;

  /* "nghttp2.pyx":247
 *     '''
 *     idx = 0
 *     for entry in hdtable:             # <<<<<<<<<<<<<<
 *         idx += 1
 *         print('[{}] (s={}) {}: {}'\
 */
  if (likely(PyList_CheckExact(__pyx_v_hdtable)) || PyTuple_CheckExact(__pyx_v_hdtable)) {
    __pyx_t_1 = __pyx_v_hdtable; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
    __pyx_t_3 = NULL;
  } else {
    __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_hdtable); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 247, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 247, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_3)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 247, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 247, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      } else {
        if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 247, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 247, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      }
    } else {
      __pyx_t_4 = __pyx_t_3(__pyx_t_1);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 247, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_XDECREF_SET(__pyx_v_entry, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "nghttp2.pyx":248
 *     idx = 0
 *     for entry in hdtable:
 *         idx += 1             # <<<<<<<<<<<<<<
 *         print('[{}] (s={}) {}: {}'\
 *               .format(idx, entry.space(),
 */
    __pyx_t_4 = __Pyx_PyInt_AddObjC(__pyx_v_idx, __pyx_int_1, 1, 1, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 248, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF_SET(__pyx_v_idx, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "nghttp2.pyx":250
 *         idx += 1
 *         print('[{}] (s={}) {}: {}'\
 *               .format(idx, entry.space(),             # <<<<<<<<<<<<<<
 *                       entry.name.decode('utf-8'),
 *                       entry.value.decode('utf-8')))
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_s, __pyx_n_s_format); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 250, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_entry, __pyx_n_s_space); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 250, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __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);
      }
    }
    __pyx_t_6 = (__pyx_t_8) ? __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_8) : __Pyx_PyObject_CallNoArg(__pyx_t_7);
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 250, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "nghttp2.pyx":251
 *         print('[{}] (s={}) {}: {}'\
 *               .format(idx, entry.space(),
 *                       entry.name.decode('utf-8'),             # <<<<<<<<<<<<<<
 *                       entry.value.decode('utf-8')))
 * 
 */
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_entry, __pyx_n_s_name); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 251, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_decode); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 251, __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_9))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_9);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_9, function);
      }
    }
    __pyx_t_7 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_8, __pyx_kp_s_utf_8) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_kp_s_utf_8);
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 251, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "nghttp2.pyx":252
 *               .format(idx, entry.space(),
 *                       entry.name.decode('utf-8'),
 *                       entry.value.decode('utf-8')))             # <<<<<<<<<<<<<<
 * 
 * try:
 */
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_entry, __pyx_n_s_value); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 252, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_decode); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 252, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __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);
      }
    }
    __pyx_t_9 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_10, __pyx_t_8, __pyx_kp_s_utf_8) : __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_kp_s_utf_8);
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 252, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_10 = NULL;
    __pyx_t_11 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_10)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_10);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
        __pyx_t_11 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[5] = {__pyx_t_10, __pyx_v_idx, __pyx_t_6, __pyx_t_7, __pyx_t_9};
      __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_11, 4+__pyx_t_11); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 250, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[5] = {__pyx_t_10, __pyx_v_idx, __pyx_t_6, __pyx_t_7, __pyx_t_9};
      __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_11, 4+__pyx_t_11); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 250, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    } else
    #endif
    {
      __pyx_t_8 = PyTuple_New(4+__pyx_t_11); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 250, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      if (__pyx_t_10) {
        __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_10); __pyx_t_10 = NULL;
      }
      __Pyx_INCREF(__pyx_v_idx);
      __Pyx_GIVEREF(__pyx_v_idx);
      PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_11, __pyx_v_idx);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_11, __pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_11, __pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_9);
      PyTuple_SET_ITEM(__pyx_t_8, 3+__pyx_t_11, __pyx_t_9);
      __pyx_t_6 = 0;
      __pyx_t_7 = 0;
      __pyx_t_9 = 0;
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 250, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (__Pyx_PrintOne(0, __pyx_t_4) < 0) __PYX_ERR(0, 249, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "nghttp2.pyx":247
 *     '''
 *     idx = 0
 *     for entry in hdtable:             # <<<<<<<<<<<<<<
 *         idx += 1
 *         print('[{}] (s={}) {}: {}'\
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "nghttp2.pyx":238
 *     return cnghttp2.nghttp2_strerror(liberror_code).decode('utf-8')
 * 
 * def print_hd_table(hdtable):             # <<<<<<<<<<<<<<
 *     '''Convenient function to print |hdtable| to the standard output. This
 *     function does not work if header name/value cannot be decoded using
 */

  /* 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_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("nghttp2.print_hd_table", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_idx);
  __Pyx_XDECREF(__pyx_v_entry);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":275
 * class _ByteIOWrapper:
 * 
 *     def __init__(self, b):             # <<<<<<<<<<<<<<
 *         self.b = b
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_14_ByteIOWrapper_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7nghttp2_14_ByteIOWrapper_1__init__ = {"__init__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7nghttp2_14_ByteIOWrapper_1__init__, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7nghttp2_14_ByteIOWrapper_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_b = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_b,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);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_b)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); __PYX_ERR(0, 275, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 275, __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_self = values[0];
    __pyx_v_b = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 275, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("nghttp2._ByteIOWrapper.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7nghttp2_14_ByteIOWrapper___init__(__pyx_self, __pyx_v_self, __pyx_v_b);

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

static PyObject *__pyx_pf_7nghttp2_14_ByteIOWrapper___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_b) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "nghttp2.pyx":276
 * 
 *     def __init__(self, b):
 *         self.b = b             # <<<<<<<<<<<<<<
 * 
 *     def generate(self, n):
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_b, __pyx_v_b) < 0) __PYX_ERR(0, 276, __pyx_L1_error)

  /* "nghttp2.pyx":275
 * class _ByteIOWrapper:
 * 
 *     def __init__(self, b):             # <<<<<<<<<<<<<<
 *         self.b = b
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("nghttp2._ByteIOWrapper.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":278
 *         self.b = b
 * 
 *     def generate(self, n):             # <<<<<<<<<<<<<<
 *         data = self.b.read1(n)
 *         if not data:
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_14_ByteIOWrapper_3generate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7nghttp2_14_ByteIOWrapper_3generate = {"generate", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7nghttp2_14_ByteIOWrapper_3generate, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7nghttp2_14_ByteIOWrapper_3generate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_n = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("generate (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_n,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);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("generate", 1, 2, 2, 1); __PYX_ERR(0, 278, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "generate") < 0)) __PYX_ERR(0, 278, __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_self = values[0];
    __pyx_v_n = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("generate", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 278, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("nghttp2._ByteIOWrapper.generate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7nghttp2_14_ByteIOWrapper_2generate(__pyx_self, __pyx_v_self, __pyx_v_n);

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

static PyObject *__pyx_pf_7nghttp2_14_ByteIOWrapper_2generate(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_n) {
  PyObject *__pyx_v_data = 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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("generate", 0);

  /* "nghttp2.pyx":279
 * 
 *     def generate(self, n):
 *         data = self.b.read1(n)             # <<<<<<<<<<<<<<
 *         if not data:
 *             return None, DATA_EOF
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_b); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 279, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_read1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 279, __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 && 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);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_v_n) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_n);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 279, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_data = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "nghttp2.pyx":280
 *     def generate(self, n):
 *         data = self.b.read1(n)
 *         if not data:             # <<<<<<<<<<<<<<
 *             return None, DATA_EOF
 *         return data, DATA_OK
 */
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_data); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 280, __pyx_L1_error)
  __pyx_t_5 = ((!__pyx_t_4) != 0);
  if (__pyx_t_5) {

    /* "nghttp2.pyx":281
 *         data = self.b.read1(n)
 *         if not data:
 *             return None, DATA_EOF             # <<<<<<<<<<<<<<
 *         return data, DATA_OK
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_DATA_EOF); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 281, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 281, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_3, 0, Py_None);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "nghttp2.pyx":280
 *     def generate(self, n):
 *         data = self.b.read1(n)
 *         if not data:             # <<<<<<<<<<<<<<
 *             return None, DATA_EOF
 *         return data, DATA_OK
 */
  }

  /* "nghttp2.pyx":282
 *         if not data:
 *             return None, DATA_EOF
 *         return data, DATA_OK             # <<<<<<<<<<<<<<
 * 
 * def wrap_body(body):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_DATA_OK); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 282, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 282, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_data);
  __Pyx_GIVEREF(__pyx_v_data);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_data);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "nghttp2.pyx":278
 *         self.b = b
 * 
 *     def generate(self, n):             # <<<<<<<<<<<<<<
 *         data = self.b.read1(n)
 *         if not data:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("nghttp2._ByteIOWrapper.generate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_data);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":284
 *         return data, DATA_OK
 * 
 * def wrap_body(body):             # <<<<<<<<<<<<<<
 *     if body is None:
 *         return body
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_3wrap_body(PyObject *__pyx_self, PyObject *__pyx_v_body); /*proto*/
static PyMethodDef __pyx_mdef_7nghttp2_3wrap_body = {"wrap_body", (PyCFunction)__pyx_pw_7nghttp2_3wrap_body, METH_O, 0};
static PyObject *__pyx_pw_7nghttp2_3wrap_body(PyObject *__pyx_self, PyObject *__pyx_v_body) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("wrap_body (wrapper)", 0);
  __pyx_r = __pyx_pf_7nghttp2_2wrap_body(__pyx_self, ((PyObject *)__pyx_v_body));

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

static PyObject *__pyx_pf_7nghttp2_2wrap_body(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_body) {
  PyObject *__pyx_r = NULL;
  __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;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("wrap_body", 0);

  /* "nghttp2.pyx":285
 * 
 * def wrap_body(body):
 *     if body is None:             # <<<<<<<<<<<<<<
 *         return body
 *     elif isinstance(body, str):
 */
  __pyx_t_1 = (__pyx_v_body == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "nghttp2.pyx":286
 * def wrap_body(body):
 *     if body is None:
 *         return body             # <<<<<<<<<<<<<<
 *     elif isinstance(body, str):
 *         return _ByteIOWrapper(io.BytesIO(body.encode('utf-8'))).generate
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_body);
    __pyx_r = __pyx_v_body;
    goto __pyx_L0;

    /* "nghttp2.pyx":285
 * 
 * def wrap_body(body):
 *     if body is None:             # <<<<<<<<<<<<<<
 *         return body
 *     elif isinstance(body, str):
 */
  }

  /* "nghttp2.pyx":287
 *     if body is None:
 *         return body
 *     elif isinstance(body, str):             # <<<<<<<<<<<<<<
 *         return _ByteIOWrapper(io.BytesIO(body.encode('utf-8'))).generate
 *     elif isinstance(body, bytes):
 */
  __pyx_t_2 = PyString_Check(__pyx_v_body); 
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "nghttp2.pyx":288
 *         return body
 *     elif isinstance(body, str):
 *         return _ByteIOWrapper(io.BytesIO(body.encode('utf-8'))).generate             # <<<<<<<<<<<<<<
 *     elif isinstance(body, bytes):
 *         return _ByteIOWrapper(io.BytesIO(body)).generate
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_ByteIOWrapper); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 288, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_io); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 288, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_BytesIO); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 288, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_body, __pyx_n_s_encode); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 288, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_9 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(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_6 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_9, __pyx_kp_s_utf_8) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_kp_s_utf_8);
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 288, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(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);
      }
    }
    __pyx_t_5 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6);
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 288, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    __pyx_t_3 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_7, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5);
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 288, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_generate); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 288, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;

    /* "nghttp2.pyx":287
 *     if body is None:
 *         return body
 *     elif isinstance(body, str):             # <<<<<<<<<<<<<<
 *         return _ByteIOWrapper(io.BytesIO(body.encode('utf-8'))).generate
 *     elif isinstance(body, bytes):
 */
  }

  /* "nghttp2.pyx":289
 *     elif isinstance(body, str):
 *         return _ByteIOWrapper(io.BytesIO(body.encode('utf-8'))).generate
 *     elif isinstance(body, bytes):             # <<<<<<<<<<<<<<
 *         return _ByteIOWrapper(io.BytesIO(body)).generate
 *     elif isinstance(body, io.IOBase):
 */
  __pyx_t_1 = PyBytes_Check(__pyx_v_body); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "nghttp2.pyx":290
 *         return _ByteIOWrapper(io.BytesIO(body.encode('utf-8'))).generate
 *     elif isinstance(body, bytes):
 *         return _ByteIOWrapper(io.BytesIO(body)).generate             # <<<<<<<<<<<<<<
 *     elif isinstance(body, io.IOBase):
 *         return _ByteIOWrapper(body).generate
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_ByteIOWrapper); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 290, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_io); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 290, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_BytesIO); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 290, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __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);
      }
    }
    __pyx_t_5 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_v_body) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_body);
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 290, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __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);
      }
    }
    __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_6, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_5);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 290, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_generate); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 290, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "nghttp2.pyx":289
 *     elif isinstance(body, str):
 *         return _ByteIOWrapper(io.BytesIO(body.encode('utf-8'))).generate
 *     elif isinstance(body, bytes):             # <<<<<<<<<<<<<<
 *         return _ByteIOWrapper(io.BytesIO(body)).generate
 *     elif isinstance(body, io.IOBase):
 */
  }

  /* "nghttp2.pyx":291
 *     elif isinstance(body, bytes):
 *         return _ByteIOWrapper(io.BytesIO(body)).generate
 *     elif isinstance(body, io.IOBase):             # <<<<<<<<<<<<<<
 *         return _ByteIOWrapper(body).generate
 *     else:
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_io); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 291, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_IOBase); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 291, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_2 = PyObject_IsInstance(__pyx_v_body, __pyx_t_4); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 291, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "nghttp2.pyx":292
 *         return _ByteIOWrapper(io.BytesIO(body)).generate
 *     elif isinstance(body, io.IOBase):
 *         return _ByteIOWrapper(body).generate             # <<<<<<<<<<<<<<
 *     else:
 *         # assume that callable in the form f(n) returning tuple byte
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_ByteIOWrapper); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 292, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(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_4 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_v_body) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_body);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 292, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_generate); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 292, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "nghttp2.pyx":291
 *     elif isinstance(body, bytes):
 *         return _ByteIOWrapper(io.BytesIO(body)).generate
 *     elif isinstance(body, io.IOBase):             # <<<<<<<<<<<<<<
 *         return _ByteIOWrapper(body).generate
 *     else:
 */
  }

  /* "nghttp2.pyx":296
 *         # assume that callable in the form f(n) returning tuple byte
 *         # string and flag.
 *         return body             # <<<<<<<<<<<<<<
 * 
 * def negotiated_protocol(ssl_obj):
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_body);
    __pyx_r = __pyx_v_body;
    goto __pyx_L0;
  }

  /* "nghttp2.pyx":284
 *         return data, DATA_OK
 * 
 * def wrap_body(body):             # <<<<<<<<<<<<<<
 *     if body is None:
 *         return body
 */

  /* 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_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("nghttp2.wrap_body", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":298
 *         return body
 * 
 * def negotiated_protocol(ssl_obj):             # <<<<<<<<<<<<<<
 *     protocol = ssl_obj.selected_alpn_protocol()
 *     if protocol:
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_5negotiated_protocol(PyObject *__pyx_self, PyObject *__pyx_v_ssl_obj); /*proto*/
static PyMethodDef __pyx_mdef_7nghttp2_5negotiated_protocol = {"negotiated_protocol", (PyCFunction)__pyx_pw_7nghttp2_5negotiated_protocol, METH_O, 0};
static PyObject *__pyx_pw_7nghttp2_5negotiated_protocol(PyObject *__pyx_self, PyObject *__pyx_v_ssl_obj) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("negotiated_protocol (wrapper)", 0);
  __pyx_r = __pyx_pf_7nghttp2_4negotiated_protocol(__pyx_self, ((PyObject *)__pyx_v_ssl_obj));

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

static PyObject *__pyx_pf_7nghttp2_4negotiated_protocol(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_ssl_obj) {
  PyObject *__pyx_v_protocol = 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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("negotiated_protocol", 0);

  /* "nghttp2.pyx":299
 * 
 * def negotiated_protocol(ssl_obj):
 *     protocol = ssl_obj.selected_alpn_protocol()             # <<<<<<<<<<<<<<
 *     if protocol:
 *         logging.info('alpn, protocol:%s', protocol)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_ssl_obj, __pyx_n_s_selected_alpn_protocol); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 299, __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);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 299, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_protocol = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "nghttp2.pyx":300
 * def negotiated_protocol(ssl_obj):
 *     protocol = ssl_obj.selected_alpn_protocol()
 *     if protocol:             # <<<<<<<<<<<<<<
 *         logging.info('alpn, protocol:%s', protocol)
 *         return protocol
 */
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_protocol); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 300, __pyx_L1_error)
  if (__pyx_t_4) {

    /* "nghttp2.pyx":301
 *     protocol = ssl_obj.selected_alpn_protocol()
 *     if protocol:
 *         logging.info('alpn, protocol:%s', protocol)             # <<<<<<<<<<<<<<
 *         return protocol
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_logging); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 301, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_info); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 301, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = NULL;
    __pyx_t_5 = 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_5 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_kp_s_alpn_protocol_s, __pyx_v_protocol};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 301, __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[3] = {__pyx_t_2, __pyx_kp_s_alpn_protocol_s, __pyx_v_protocol};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 301, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    {
      __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 301, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      if (__pyx_t_2) {
        __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2); __pyx_t_2 = NULL;
      }
      __Pyx_INCREF(__pyx_kp_s_alpn_protocol_s);
      __Pyx_GIVEREF(__pyx_kp_s_alpn_protocol_s);
      PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_kp_s_alpn_protocol_s);
      __Pyx_INCREF(__pyx_v_protocol);
      __Pyx_GIVEREF(__pyx_v_protocol);
      PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_protocol);
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 301, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "nghttp2.pyx":302
 *     if protocol:
 *         logging.info('alpn, protocol:%s', protocol)
 *         return protocol             # <<<<<<<<<<<<<<
 * 
 *     protocol = ssl_obj.selected_npn_protocol()
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_protocol);
    __pyx_r = __pyx_v_protocol;
    goto __pyx_L0;

    /* "nghttp2.pyx":300
 * def negotiated_protocol(ssl_obj):
 *     protocol = ssl_obj.selected_alpn_protocol()
 *     if protocol:             # <<<<<<<<<<<<<<
 *         logging.info('alpn, protocol:%s', protocol)
 *         return protocol
 */
  }

  /* "nghttp2.pyx":304
 *         return protocol
 * 
 *     protocol = ssl_obj.selected_npn_protocol()             # <<<<<<<<<<<<<<
 *     if protocol:
 *         logging.info('npn, protocol:%s', protocol)
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_ssl_obj, __pyx_n_s_selected_npn_protocol); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 304, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_6 = NULL;
  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_1 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 304, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF_SET(__pyx_v_protocol, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "nghttp2.pyx":305
 * 
 *     protocol = ssl_obj.selected_npn_protocol()
 *     if protocol:             # <<<<<<<<<<<<<<
 *         logging.info('npn, protocol:%s', protocol)
 *         return protocol
 */
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_protocol); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 305, __pyx_L1_error)
  if (__pyx_t_4) {

    /* "nghttp2.pyx":306
 *     protocol = ssl_obj.selected_npn_protocol()
 *     if protocol:
 *         logging.info('npn, protocol:%s', protocol)             # <<<<<<<<<<<<<<
 *         return protocol
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_logging); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 306, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_info); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 306, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = NULL;
    __pyx_t_5 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
        __pyx_t_5 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_6)) {
      PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_kp_s_npn_protocol_s, __pyx_v_protocol};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 306, __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_6)) {
      PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_kp_s_npn_protocol_s, __pyx_v_protocol};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 306, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    {
      __pyx_t_2 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 306, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (__pyx_t_3) {
        __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); __pyx_t_3 = NULL;
      }
      __Pyx_INCREF(__pyx_kp_s_npn_protocol_s);
      __Pyx_GIVEREF(__pyx_kp_s_npn_protocol_s);
      PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_5, __pyx_kp_s_npn_protocol_s);
      __Pyx_INCREF(__pyx_v_protocol);
      __Pyx_GIVEREF(__pyx_v_protocol);
      PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_5, __pyx_v_protocol);
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 306, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "nghttp2.pyx":307
 *     if protocol:
 *         logging.info('npn, protocol:%s', protocol)
 *         return protocol             # <<<<<<<<<<<<<<
 * 
 *     return None
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_protocol);
    __pyx_r = __pyx_v_protocol;
    goto __pyx_L0;

    /* "nghttp2.pyx":305
 * 
 *     protocol = ssl_obj.selected_npn_protocol()
 *     if protocol:             # <<<<<<<<<<<<<<
 *         logging.info('npn, protocol:%s', protocol)
 *         return protocol
 */
  }

  /* "nghttp2.pyx":309
 *         return protocol
 * 
 *     return None             # <<<<<<<<<<<<<<
 * 
 * def set_application_protocol(ssl_ctx):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;

  /* "nghttp2.pyx":298
 *         return body
 * 
 * def negotiated_protocol(ssl_obj):             # <<<<<<<<<<<<<<
 *     protocol = ssl_obj.selected_alpn_protocol()
 *     if protocol:
 */

  /* 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_6);
  __Pyx_AddTraceback("nghttp2.negotiated_protocol", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_protocol);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":311
 *     return None
 * 
 * def set_application_protocol(ssl_ctx):             # <<<<<<<<<<<<<<
 *     app_protos = [cnghttp2.NGHTTP2_PROTO_VERSION_ID.decode('utf-8')]
 *     ssl_ctx.set_npn_protocols(app_protos)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_7set_application_protocol(PyObject *__pyx_self, PyObject *__pyx_v_ssl_ctx); /*proto*/
static PyMethodDef __pyx_mdef_7nghttp2_7set_application_protocol = {"set_application_protocol", (PyCFunction)__pyx_pw_7nghttp2_7set_application_protocol, METH_O, 0};
static PyObject *__pyx_pw_7nghttp2_7set_application_protocol(PyObject *__pyx_self, PyObject *__pyx_v_ssl_ctx) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_application_protocol (wrapper)", 0);
  __pyx_r = __pyx_pf_7nghttp2_6set_application_protocol(__pyx_self, ((PyObject *)__pyx_v_ssl_ctx));

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

static PyObject *__pyx_pf_7nghttp2_6set_application_protocol(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_ssl_ctx) {
  PyObject *__pyx_v_app_protos = 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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("set_application_protocol", 0);

  /* "nghttp2.pyx":312
 * 
 * def set_application_protocol(ssl_ctx):
 *     app_protos = [cnghttp2.NGHTTP2_PROTO_VERSION_ID.decode('utf-8')]             # <<<<<<<<<<<<<<
 *     ssl_ctx.set_npn_protocols(app_protos)
 *     if tls.HAS_ALPN:
 */
  __pyx_t_1 = __Pyx_decode_c_string(NGHTTP2_PROTO_VERSION_ID, 0, strlen(NGHTTP2_PROTO_VERSION_ID), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 312, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 312, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_1);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_v_app_protos = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "nghttp2.pyx":313
 * def set_application_protocol(ssl_ctx):
 *     app_protos = [cnghttp2.NGHTTP2_PROTO_VERSION_ID.decode('utf-8')]
 *     ssl_ctx.set_npn_protocols(app_protos)             # <<<<<<<<<<<<<<
 *     if tls.HAS_ALPN:
 *         ssl_ctx.set_alpn_protocols(app_protos)
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_ssl_ctx, __pyx_n_s_set_npn_protocols); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 313, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_3, __pyx_v_app_protos) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_app_protos);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 313, __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;

  /* "nghttp2.pyx":314
 *     app_protos = [cnghttp2.NGHTTP2_PROTO_VERSION_ID.decode('utf-8')]
 *     ssl_ctx.set_npn_protocols(app_protos)
 *     if tls.HAS_ALPN:             # <<<<<<<<<<<<<<
 *         ssl_ctx.set_alpn_protocols(app_protos)
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_tls); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 314, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_HAS_ALPN); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 314, __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(0, 314, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_4) {

    /* "nghttp2.pyx":315
 *     ssl_ctx.set_npn_protocols(app_protos)
 *     if tls.HAS_ALPN:
 *         ssl_ctx.set_alpn_protocols(app_protos)             # <<<<<<<<<<<<<<
 * 
 * cdef _get_stream_user_data(cnghttp2.nghttp2_session *session,
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_ssl_ctx, __pyx_n_s_set_alpn_protocols); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 315, __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);
      }
    }
    __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_app_protos) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_app_protos);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 315, __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;

    /* "nghttp2.pyx":314
 *     app_protos = [cnghttp2.NGHTTP2_PROTO_VERSION_ID.decode('utf-8')]
 *     ssl_ctx.set_npn_protocols(app_protos)
 *     if tls.HAS_ALPN:             # <<<<<<<<<<<<<<
 *         ssl_ctx.set_alpn_protocols(app_protos)
 * 
 */
  }

  /* "nghttp2.pyx":311
 *     return None
 * 
 * def set_application_protocol(ssl_ctx):             # <<<<<<<<<<<<<<
 *     app_protos = [cnghttp2.NGHTTP2_PROTO_VERSION_ID.decode('utf-8')]
 *     ssl_ctx.set_npn_protocols(app_protos)
 */

  /* 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_AddTraceback("nghttp2.set_application_protocol", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_app_protos);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":317
 *         ssl_ctx.set_alpn_protocols(app_protos)
 * 
 * cdef _get_stream_user_data(cnghttp2.nghttp2_session *session,             # <<<<<<<<<<<<<<
 *                            int32_t stream_id):
 *     cdef void *stream_user_data
 */

static PyObject *__pyx_f_7nghttp2__get_stream_user_data(nghttp2_session *__pyx_v_session, int32_t __pyx_v_stream_id) {
  void *__pyx_v_stream_user_data;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("_get_stream_user_data", 0);

  /* "nghttp2.pyx":322
 * 
 *     stream_user_data = cnghttp2.nghttp2_session_get_stream_user_data\
 *                        (session, stream_id)             # <<<<<<<<<<<<<<
 *     if stream_user_data == NULL:
 *         return None
 */
  __pyx_v_stream_user_data = nghttp2_session_get_stream_user_data(__pyx_v_session, __pyx_v_stream_id);

  /* "nghttp2.pyx":323
 *     stream_user_data = cnghttp2.nghttp2_session_get_stream_user_data\
 *                        (session, stream_id)
 *     if stream_user_data == NULL:             # <<<<<<<<<<<<<<
 *         return None
 * 
 */
  __pyx_t_1 = ((__pyx_v_stream_user_data == NULL) != 0);
  if (__pyx_t_1) {

    /* "nghttp2.pyx":324
 *                        (session, stream_id)
 *     if stream_user_data == NULL:
 *         return None             # <<<<<<<<<<<<<<
 * 
 *     return <object>stream_user_data
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "nghttp2.pyx":323
 *     stream_user_data = cnghttp2.nghttp2_session_get_stream_user_data\
 *                        (session, stream_id)
 *     if stream_user_data == NULL:             # <<<<<<<<<<<<<<
 *         return None
 * 
 */
  }

  /* "nghttp2.pyx":326
 *         return None
 * 
 *     return <object>stream_user_data             # <<<<<<<<<<<<<<
 * 
 * cdef size_t _make_nva(cnghttp2.nghttp2_nv **nva_ptr, headers):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_stream_user_data));
  __pyx_r = ((PyObject *)__pyx_v_stream_user_data);
  goto __pyx_L0;

  /* "nghttp2.pyx":317
 *         ssl_ctx.set_alpn_protocols(app_protos)
 * 
 * cdef _get_stream_user_data(cnghttp2.nghttp2_session *session,             # <<<<<<<<<<<<<<
 *                            int32_t stream_id):
 *     cdef void *stream_user_data
 */

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

/* "nghttp2.pyx":328
 *     return <object>stream_user_data
 * 
 * cdef size_t _make_nva(cnghttp2.nghttp2_nv **nva_ptr, headers):             # <<<<<<<<<<<<<<
 *     cdef cnghttp2.nghttp2_nv *nva
 *     cdef size_t nvlen
 */

static size_t __pyx_f_7nghttp2__make_nva(nghttp2_nv **__pyx_v_nva_ptr, PyObject *__pyx_v_headers) {
  nghttp2_nv *__pyx_v_nva;
  size_t __pyx_v_nvlen;
  PyObject *__pyx_v_i = NULL;
  PyObject *__pyx_v_k = NULL;
  PyObject *__pyx_v_v = NULL;
  size_t __pyx_r;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *(*__pyx_t_4)(PyObject *);
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *(*__pyx_t_9)(PyObject *);
  uint8_t *__pyx_t_10;
  Py_ssize_t __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_make_nva", 0);

  /* "nghttp2.pyx":332
 *     cdef size_t nvlen
 * 
 *     nvlen = len(headers)             # <<<<<<<<<<<<<<
 *     nva = <cnghttp2.nghttp2_nv*>malloc(sizeof(cnghttp2.nghttp2_nv) * nvlen)
 *     for i, (k, v) in enumerate(headers):
 */
  __pyx_t_1 = PyObject_Length(__pyx_v_headers); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 332, __pyx_L1_error)
  __pyx_v_nvlen = __pyx_t_1;

  /* "nghttp2.pyx":333
 * 
 *     nvlen = len(headers)
 *     nva = <cnghttp2.nghttp2_nv*>malloc(sizeof(cnghttp2.nghttp2_nv) * nvlen)             # <<<<<<<<<<<<<<
 *     for i, (k, v) in enumerate(headers):
 *         nva[i].name = k
 */
  __pyx_v_nva = ((nghttp2_nv *)malloc(((sizeof(nghttp2_nv)) * __pyx_v_nvlen)));

  /* "nghttp2.pyx":334
 *     nvlen = len(headers)
 *     nva = <cnghttp2.nghttp2_nv*>malloc(sizeof(cnghttp2.nghttp2_nv) * nvlen)
 *     for i, (k, v) in enumerate(headers):             # <<<<<<<<<<<<<<
 *         nva[i].name = k
 *         nva[i].namelen = len(k)
 */
  __Pyx_INCREF(__pyx_int_0);
  __pyx_t_2 = __pyx_int_0;
  if (likely(PyList_CheckExact(__pyx_v_headers)) || PyTuple_CheckExact(__pyx_v_headers)) {
    __pyx_t_3 = __pyx_v_headers; __Pyx_INCREF(__pyx_t_3); __pyx_t_1 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_1 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_headers); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 334, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 334, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_4)) {
      if (likely(PyList_CheckExact(__pyx_t_3))) {
        if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_3)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_5 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_5); __pyx_t_1++; if (unlikely(0 < 0)) __PYX_ERR(0, 334, __pyx_L1_error)
        #else
        __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 334, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        #endif
      } else {
        if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_5); __pyx_t_1++; if (unlikely(0 < 0)) __PYX_ERR(0, 334, __pyx_L1_error)
        #else
        __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 334, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        #endif
      }
    } else {
      __pyx_t_5 = __pyx_t_4(__pyx_t_3);
      if (unlikely(!__pyx_t_5)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 334, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_5);
    }
    if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
      PyObject* sequence = __pyx_t_5;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 334, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_6 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_7 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_7);
      #else
      __pyx_t_6 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 334, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 334, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      #endif
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_8 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 334, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_9 = Py_TYPE(__pyx_t_8)->tp_iternext;
      index = 0; __pyx_t_6 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_6)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_6);
      index = 1; __pyx_t_7 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_7)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_7);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 2) < 0) __PYX_ERR(0, 334, __pyx_L1_error)
      __pyx_t_9 = NULL;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      goto __pyx_L6_unpacking_done;
      __pyx_L5_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_9 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 334, __pyx_L1_error)
      __pyx_L6_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_k, __pyx_t_6);
    __pyx_t_6 = 0;
    __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_7);
    __pyx_t_7 = 0;
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_2);
    __pyx_t_5 = __Pyx_PyInt_AddObjC(__pyx_t_2, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 334, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2);
    __pyx_t_2 = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "nghttp2.pyx":335
 *     nva = <cnghttp2.nghttp2_nv*>malloc(sizeof(cnghttp2.nghttp2_nv) * nvlen)
 *     for i, (k, v) in enumerate(headers):
 *         nva[i].name = k             # <<<<<<<<<<<<<<
 *         nva[i].namelen = len(k)
 *         nva[i].value = v
 */
    __pyx_t_10 = __Pyx_PyObject_AsWritableUString(__pyx_v_k); if (unlikely((!__pyx_t_10) && PyErr_Occurred())) __PYX_ERR(0, 335, __pyx_L1_error)
    __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 335, __pyx_L1_error)
    (__pyx_v_nva[__pyx_t_11]).name = __pyx_t_10;

    /* "nghttp2.pyx":336
 *     for i, (k, v) in enumerate(headers):
 *         nva[i].name = k
 *         nva[i].namelen = len(k)             # <<<<<<<<<<<<<<
 *         nva[i].value = v
 *         nva[i].valuelen = len(v)
 */
    __pyx_t_11 = PyObject_Length(__pyx_v_k); if (unlikely(__pyx_t_11 == ((Py_ssize_t)-1))) __PYX_ERR(0, 336, __pyx_L1_error)
    __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 336, __pyx_L1_error)
    (__pyx_v_nva[__pyx_t_12]).namelen = __pyx_t_11;

    /* "nghttp2.pyx":337
 *         nva[i].name = k
 *         nva[i].namelen = len(k)
 *         nva[i].value = v             # <<<<<<<<<<<<<<
 *         nva[i].valuelen = len(v)
 *         nva[i].flags = cnghttp2.NGHTTP2_NV_FLAG_NONE
 */
    __pyx_t_10 = __Pyx_PyObject_AsWritableUString(__pyx_v_v); if (unlikely((!__pyx_t_10) && PyErr_Occurred())) __PYX_ERR(0, 337, __pyx_L1_error)
    __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 337, __pyx_L1_error)
    (__pyx_v_nva[__pyx_t_12]).value = __pyx_t_10;

    /* "nghttp2.pyx":338
 *         nva[i].namelen = len(k)
 *         nva[i].value = v
 *         nva[i].valuelen = len(v)             # <<<<<<<<<<<<<<
 *         nva[i].flags = cnghttp2.NGHTTP2_NV_FLAG_NONE
 * 
 */
    __pyx_t_12 = PyObject_Length(__pyx_v_v); if (unlikely(__pyx_t_12 == ((Py_ssize_t)-1))) __PYX_ERR(0, 338, __pyx_L1_error)
    __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 338, __pyx_L1_error)
    (__pyx_v_nva[__pyx_t_11]).valuelen = __pyx_t_12;

    /* "nghttp2.pyx":339
 *         nva[i].value = v
 *         nva[i].valuelen = len(v)
 *         nva[i].flags = cnghttp2.NGHTTP2_NV_FLAG_NONE             # <<<<<<<<<<<<<<
 * 
 *     nva_ptr[0] = nva
 */
    __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 339, __pyx_L1_error)
    (__pyx_v_nva[__pyx_t_11]).flags = NGHTTP2_NV_FLAG_NONE;

    /* "nghttp2.pyx":334
 *     nvlen = len(headers)
 *     nva = <cnghttp2.nghttp2_nv*>malloc(sizeof(cnghttp2.nghttp2_nv) * nvlen)
 *     for i, (k, v) in enumerate(headers):             # <<<<<<<<<<<<<<
 *         nva[i].name = k
 *         nva[i].namelen = len(k)
 */
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "nghttp2.pyx":341
 *         nva[i].flags = cnghttp2.NGHTTP2_NV_FLAG_NONE
 * 
 *     nva_ptr[0] = nva             # <<<<<<<<<<<<<<
 * 
 *     return nvlen
 */
  (__pyx_v_nva_ptr[0]) = __pyx_v_nva;

  /* "nghttp2.pyx":343
 *     nva_ptr[0] = nva
 * 
 *     return nvlen             # <<<<<<<<<<<<<<
 * 
 * cdef int server_on_header(cnghttp2.nghttp2_session *session,
 */
  __pyx_r = __pyx_v_nvlen;
  goto __pyx_L0;

  /* "nghttp2.pyx":328
 *     return <object>stream_user_data
 * 
 * cdef size_t _make_nva(cnghttp2.nghttp2_nv **nva_ptr, headers):             # <<<<<<<<<<<<<<
 *     cdef cnghttp2.nghttp2_nv *nva
 *     cdef size_t nvlen
 */

  /* 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_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_WriteUnraisable("nghttp2._make_nva", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XDECREF(__pyx_v_k);
  __Pyx_XDECREF(__pyx_v_v);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":345
 *     return nvlen
 * 
 * cdef int server_on_header(cnghttp2.nghttp2_session *session,             # <<<<<<<<<<<<<<
 *                           const cnghttp2.nghttp2_frame *frame,
 *                           const uint8_t *name, size_t namelen,
 */

static int __pyx_f_7nghttp2_server_on_header(nghttp2_session *__pyx_v_session, nghttp2_frame const *__pyx_v_frame, uint8_t const *__pyx_v_name, size_t __pyx_v_namelen, uint8_t const *__pyx_v_value, size_t __pyx_v_valuelen, uint8_t __pyx_v_flags, void *__pyx_v_user_data) {
  CYTHON_UNUSED PyObject *__pyx_v_http2 = 0;
  PyObject *__pyx_v_handler = NULL;
  int __pyx_r;
  __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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("server_on_header", 0);

  /* "nghttp2.pyx":351
 *                           uint8_t flags,
 *                           void *user_data):
 *     cdef http2 = <_HTTP2SessionCoreBase>user_data             # <<<<<<<<<<<<<<
 *     logging.debug('server_on_header, type:%s, stream_id:%s', frame.hd.type, frame.hd.stream_id)
 * 
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_user_data);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_http2 = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "nghttp2.pyx":352
 *                           void *user_data):
 *     cdef http2 = <_HTTP2SessionCoreBase>user_data
 *     logging.debug('server_on_header, type:%s, stream_id:%s', frame.hd.type, frame.hd.stream_id)             # <<<<<<<<<<<<<<
 * 
 *     handler = _get_stream_user_data(session, frame.hd.stream_id)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_logging); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 352, __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(0, 352, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyInt_From_uint8_t(__pyx_v_frame->hd.type); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 352, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyInt_From_int32_t(__pyx_v_frame->hd.stream_id); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 352, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(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[4] = {__pyx_t_5, __pyx_kp_s_server_on_header_type_s_stream_i, __pyx_t_2, __pyx_t_4};
    __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(0, 352, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __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[4] = {__pyx_t_5, __pyx_kp_s_server_on_header_type_s_stream_i, __pyx_t_2, __pyx_t_4};
    __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(0, 352, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 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(0, 352, __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_INCREF(__pyx_kp_s_server_on_header_type_s_stream_i);
    __Pyx_GIVEREF(__pyx_kp_s_server_on_header_type_s_stream_i);
    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_kp_s_server_on_header_type_s_stream_i);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_6, __pyx_t_4);
    __pyx_t_2 = 0;
    __pyx_t_4 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 352, __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;

  /* "nghttp2.pyx":354
 *     logging.debug('server_on_header, type:%s, stream_id:%s', frame.hd.type, frame.hd.stream_id)
 * 
 *     handler = _get_stream_user_data(session, frame.hd.stream_id)             # <<<<<<<<<<<<<<
 *     return on_header(name, namelen, value, valuelen, flags, handler)
 * 
 */
  __pyx_t_1 = __pyx_f_7nghttp2__get_stream_user_data(__pyx_v_session, __pyx_v_frame->hd.stream_id); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 354, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_handler = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "nghttp2.pyx":355
 * 
 *     handler = _get_stream_user_data(session, frame.hd.stream_id)
 *     return on_header(name, namelen, value, valuelen, flags, handler)             # <<<<<<<<<<<<<<
 * 
 * cdef int client_on_header(cnghttp2.nghttp2_session *session,
 */
  __pyx_r = __pyx_f_7nghttp2_on_header(__pyx_v_name, __pyx_v_namelen, __pyx_v_value, __pyx_v_valuelen, __pyx_v_flags, __pyx_v_handler);
  goto __pyx_L0;

  /* "nghttp2.pyx":345
 *     return nvlen
 * 
 * cdef int server_on_header(cnghttp2.nghttp2_session *session,             # <<<<<<<<<<<<<<
 *                           const cnghttp2.nghttp2_frame *frame,
 *                           const uint8_t *name, size_t namelen,
 */

  /* 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_WriteUnraisable("nghttp2.server_on_header", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_http2);
  __Pyx_XDECREF(__pyx_v_handler);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":357
 *     return on_header(name, namelen, value, valuelen, flags, handler)
 * 
 * cdef int client_on_header(cnghttp2.nghttp2_session *session,             # <<<<<<<<<<<<<<
 *                           const cnghttp2.nghttp2_frame *frame,
 *                           const uint8_t *name, size_t namelen,
 */

static int __pyx_f_7nghttp2_client_on_header(nghttp2_session *__pyx_v_session, nghttp2_frame const *__pyx_v_frame, uint8_t const *__pyx_v_name, size_t __pyx_v_namelen, uint8_t const *__pyx_v_value, size_t __pyx_v_valuelen, uint8_t __pyx_v_flags, void *__pyx_v_user_data) {
  CYTHON_UNUSED PyObject *__pyx_v_http2 = 0;
  PyObject *__pyx_v_handler = NULL;
  int __pyx_r;
  __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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("client_on_header", 0);

  /* "nghttp2.pyx":363
 *                           uint8_t flags,
 *                           void *user_data):
 *     cdef http2 = <_HTTP2SessionCoreBase>user_data             # <<<<<<<<<<<<<<
 *     logging.debug('client_on_header, type:%s, stream_id:%s', frame.hd.type, frame.hd.stream_id)
 * 
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_user_data);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_http2 = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "nghttp2.pyx":364
 *                           void *user_data):
 *     cdef http2 = <_HTTP2SessionCoreBase>user_data
 *     logging.debug('client_on_header, type:%s, stream_id:%s', frame.hd.type, frame.hd.stream_id)             # <<<<<<<<<<<<<<
 * 
 *     if frame.hd.type == cnghttp2.NGHTTP2_HEADERS:
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_logging); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 364, __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(0, 364, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyInt_From_uint8_t(__pyx_v_frame->hd.type); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 364, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyInt_From_int32_t(__pyx_v_frame->hd.stream_id); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 364, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(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[4] = {__pyx_t_5, __pyx_kp_s_client_on_header_type_s_stream_i, __pyx_t_2, __pyx_t_4};
    __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(0, 364, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __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[4] = {__pyx_t_5, __pyx_kp_s_client_on_header_type_s_stream_i, __pyx_t_2, __pyx_t_4};
    __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(0, 364, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 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(0, 364, __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_INCREF(__pyx_kp_s_client_on_header_type_s_stream_i);
    __Pyx_GIVEREF(__pyx_kp_s_client_on_header_type_s_stream_i);
    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_kp_s_client_on_header_type_s_stream_i);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_6, __pyx_t_4);
    __pyx_t_2 = 0;
    __pyx_t_4 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 364, __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;

  /* "nghttp2.pyx":366
 *     logging.debug('client_on_header, type:%s, stream_id:%s', frame.hd.type, frame.hd.stream_id)
 * 
 *     if frame.hd.type == cnghttp2.NGHTTP2_HEADERS:             # <<<<<<<<<<<<<<
 *         handler = _get_stream_user_data(session, frame.hd.stream_id)
 *     elif frame.hd.type == cnghttp2.NGHTTP2_PUSH_PROMISE:
 */
  switch (__pyx_v_frame->hd.type) {
    case NGHTTP2_HEADERS:

    /* "nghttp2.pyx":367
 * 
 *     if frame.hd.type == cnghttp2.NGHTTP2_HEADERS:
 *         handler = _get_stream_user_data(session, frame.hd.stream_id)             # <<<<<<<<<<<<<<
 *     elif frame.hd.type == cnghttp2.NGHTTP2_PUSH_PROMISE:
 *         handler = _get_stream_user_data(session, frame.push_promise.promised_stream_id)
 */
    __pyx_t_1 = __pyx_f_7nghttp2__get_stream_user_data(__pyx_v_session, __pyx_v_frame->hd.stream_id); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 367, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_handler = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "nghttp2.pyx":366
 *     logging.debug('client_on_header, type:%s, stream_id:%s', frame.hd.type, frame.hd.stream_id)
 * 
 *     if frame.hd.type == cnghttp2.NGHTTP2_HEADERS:             # <<<<<<<<<<<<<<
 *         handler = _get_stream_user_data(session, frame.hd.stream_id)
 *     elif frame.hd.type == cnghttp2.NGHTTP2_PUSH_PROMISE:
 */
    break;
    case NGHTTP2_PUSH_PROMISE:

    /* "nghttp2.pyx":369
 *         handler = _get_stream_user_data(session, frame.hd.stream_id)
 *     elif frame.hd.type == cnghttp2.NGHTTP2_PUSH_PROMISE:
 *         handler = _get_stream_user_data(session, frame.push_promise.promised_stream_id)             # <<<<<<<<<<<<<<
 * 
 *     return on_header(name, namelen, value, valuelen, flags, handler)
 */
    __pyx_t_1 = __pyx_f_7nghttp2__get_stream_user_data(__pyx_v_session, __pyx_v_frame->push_promise.promised_stream_id); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 369, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_handler = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "nghttp2.pyx":368
 *     if frame.hd.type == cnghttp2.NGHTTP2_HEADERS:
 *         handler = _get_stream_user_data(session, frame.hd.stream_id)
 *     elif frame.hd.type == cnghttp2.NGHTTP2_PUSH_PROMISE:             # <<<<<<<<<<<<<<
 *         handler = _get_stream_user_data(session, frame.push_promise.promised_stream_id)
 * 
 */
    break;
    default: break;
  }

  /* "nghttp2.pyx":371
 *         handler = _get_stream_user_data(session, frame.push_promise.promised_stream_id)
 * 
 *     return on_header(name, namelen, value, valuelen, flags, handler)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  if (unlikely(!__pyx_v_handler)) { __Pyx_RaiseUnboundLocalError("handler"); __PYX_ERR(0, 371, __pyx_L1_error) }
  __pyx_r = __pyx_f_7nghttp2_on_header(__pyx_v_name, __pyx_v_namelen, __pyx_v_value, __pyx_v_valuelen, __pyx_v_flags, __pyx_v_handler);
  goto __pyx_L0;

  /* "nghttp2.pyx":357
 *     return on_header(name, namelen, value, valuelen, flags, handler)
 * 
 * cdef int client_on_header(cnghttp2.nghttp2_session *session,             # <<<<<<<<<<<<<<
 *                           const cnghttp2.nghttp2_frame *frame,
 *                           const uint8_t *name, size_t namelen,
 */

  /* 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_WriteUnraisable("nghttp2.client_on_header", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_http2);
  __Pyx_XDECREF(__pyx_v_handler);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":374
 * 
 * 
 * cdef int on_header(const uint8_t *name, size_t namelen,             # <<<<<<<<<<<<<<
 *                           const uint8_t *value, size_t valuelen,
 *                           uint8_t flags,
 */

static int __pyx_f_7nghttp2_on_header(uint8_t const *__pyx_v_name, size_t __pyx_v_namelen, uint8_t const *__pyx_v_value, size_t __pyx_v_valuelen, CYTHON_UNUSED uint8_t __pyx_v_flags, PyObject *__pyx_v_handler) {
  PyObject *__pyx_v_key = NULL;
  PyObject *__pyx_v_values = NULL;
  PyObject *__pyx_v_v = NULL;
  int __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;
  int __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  PyObject *(*__pyx_t_8)(PyObject *);
  int __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("on_header", 0);

  /* "nghttp2.pyx":378
 *                           uint8_t flags,
 *                           object handler):
 *     if not handler:             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_handler); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 378, __pyx_L1_error)
  __pyx_t_2 = ((!__pyx_t_1) != 0);
  if (__pyx_t_2) {

    /* "nghttp2.pyx":379
 *                           object handler):
 *     if not handler:
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     key = name[:namelen]
 */
    __pyx_r = 0;
    goto __pyx_L0;

    /* "nghttp2.pyx":378
 *                           uint8_t flags,
 *                           object handler):
 *     if not handler:             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */
  }

  /* "nghttp2.pyx":381
 *         return 0
 * 
 *     key = name[:namelen]             # <<<<<<<<<<<<<<
 *     values = value[:valuelen].split(b'\x00')
 *     if key == b':scheme':
 */
  __pyx_t_3 = __Pyx_PyBytes_FromStringAndSize(((const char*)__pyx_v_name) + 0, __pyx_v_namelen - 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 381, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_key = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "nghttp2.pyx":382
 * 
 *     key = name[:namelen]
 *     values = value[:valuelen].split(b'\x00')             # <<<<<<<<<<<<<<
 *     if key == b':scheme':
 *         handler.scheme = values[0]
 */
  __pyx_t_4 = __Pyx_PyBytes_FromStringAndSize(((const char*)__pyx_v_value) + 0, __pyx_v_valuelen - 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 382, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_split); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 382, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_4, __pyx_kp_b__6) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_kp_b__6);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 382, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_values = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "nghttp2.pyx":383
 *     key = name[:namelen]
 *     values = value[:valuelen].split(b'\x00')
 *     if key == b':scheme':             # <<<<<<<<<<<<<<
 *         handler.scheme = values[0]
 *     elif key == b':method':
 */
  __pyx_t_2 = (__Pyx_PyBytes_Equals(__pyx_v_key, __pyx_kp_b_scheme, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 383, __pyx_L1_error)
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "nghttp2.pyx":384
 *     values = value[:valuelen].split(b'\x00')
 *     if key == b':scheme':
 *         handler.scheme = values[0]             # <<<<<<<<<<<<<<
 *     elif key == b':method':
 *         handler.method = values[0]
 */
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_values, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 384, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_handler, __pyx_n_s_scheme_2, __pyx_t_3) < 0) __PYX_ERR(0, 384, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "nghttp2.pyx":383
 *     key = name[:namelen]
 *     values = value[:valuelen].split(b'\x00')
 *     if key == b':scheme':             # <<<<<<<<<<<<<<
 *         handler.scheme = values[0]
 *     elif key == b':method':
 */
    goto __pyx_L4;
  }

  /* "nghttp2.pyx":385
 *     if key == b':scheme':
 *         handler.scheme = values[0]
 *     elif key == b':method':             # <<<<<<<<<<<<<<
 *         handler.method = values[0]
 *     elif key == b':authority' or key == b'host':
 */
  __pyx_t_1 = (__Pyx_PyBytes_Equals(__pyx_v_key, __pyx_kp_b_method, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 385, __pyx_L1_error)
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "nghttp2.pyx":386
 *         handler.scheme = values[0]
 *     elif key == b':method':
 *         handler.method = values[0]             # <<<<<<<<<<<<<<
 *     elif key == b':authority' or key == b'host':
 *         handler.host = values[0]
 */
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_values, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 386, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_handler, __pyx_n_s_method_2, __pyx_t_3) < 0) __PYX_ERR(0, 386, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "nghttp2.pyx":385
 *     if key == b':scheme':
 *         handler.scheme = values[0]
 *     elif key == b':method':             # <<<<<<<<<<<<<<
 *         handler.method = values[0]
 *     elif key == b':authority' or key == b'host':
 */
    goto __pyx_L4;
  }

  /* "nghttp2.pyx":387
 *     elif key == b':method':
 *         handler.method = values[0]
 *     elif key == b':authority' or key == b'host':             # <<<<<<<<<<<<<<
 *         handler.host = values[0]
 *     elif key == b':path':
 */
  __pyx_t_1 = (__Pyx_PyBytes_Equals(__pyx_v_key, __pyx_kp_b_authority, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 387, __pyx_L1_error)
  __pyx_t_6 = (__pyx_t_1 != 0);
  if (!__pyx_t_6) {
  } else {
    __pyx_t_2 = __pyx_t_6;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_6 = (__Pyx_PyBytes_Equals(__pyx_v_key, __pyx_n_b_host, Py_EQ)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 387, __pyx_L1_error)
  __pyx_t_1 = (__pyx_t_6 != 0);
  __pyx_t_2 = __pyx_t_1;
  __pyx_L5_bool_binop_done:;
  if (__pyx_t_2) {

    /* "nghttp2.pyx":388
 *         handler.method = values[0]
 *     elif key == b':authority' or key == b'host':
 *         handler.host = values[0]             # <<<<<<<<<<<<<<
 *     elif key == b':path':
 *         handler.path = values[0]
 */
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_values, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 388, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_handler, __pyx_n_s_host, __pyx_t_3) < 0) __PYX_ERR(0, 388, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "nghttp2.pyx":387
 *     elif key == b':method':
 *         handler.method = values[0]
 *     elif key == b':authority' or key == b'host':             # <<<<<<<<<<<<<<
 *         handler.host = values[0]
 *     elif key == b':path':
 */
    goto __pyx_L4;
  }

  /* "nghttp2.pyx":389
 *     elif key == b':authority' or key == b'host':
 *         handler.host = values[0]
 *     elif key == b':path':             # <<<<<<<<<<<<<<
 *         handler.path = values[0]
 *     elif key == b':status':
 */
  __pyx_t_2 = (__Pyx_PyBytes_Equals(__pyx_v_key, __pyx_kp_b_path, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 389, __pyx_L1_error)
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "nghttp2.pyx":390
 *         handler.host = values[0]
 *     elif key == b':path':
 *         handler.path = values[0]             # <<<<<<<<<<<<<<
 *     elif key == b':status':
 *         handler.status = values[0]
 */
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_values, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 390, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_handler, __pyx_n_s_path_2, __pyx_t_3) < 0) __PYX_ERR(0, 390, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "nghttp2.pyx":389
 *     elif key == b':authority' or key == b'host':
 *         handler.host = values[0]
 *     elif key == b':path':             # <<<<<<<<<<<<<<
 *         handler.path = values[0]
 *     elif key == b':status':
 */
    goto __pyx_L4;
  }

  /* "nghttp2.pyx":391
 *     elif key == b':path':
 *         handler.path = values[0]
 *     elif key == b':status':             # <<<<<<<<<<<<<<
 *         handler.status = values[0]
 * 
 */
  __pyx_t_1 = (__Pyx_PyBytes_Equals(__pyx_v_key, __pyx_kp_b_status, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 391, __pyx_L1_error)
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "nghttp2.pyx":392
 *         handler.path = values[0]
 *     elif key == b':status':
 *         handler.status = values[0]             # <<<<<<<<<<<<<<
 * 
 *     if key == b'cookie':
 */
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_values, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 392, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_handler, __pyx_n_s_status_2, __pyx_t_3) < 0) __PYX_ERR(0, 392, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "nghttp2.pyx":391
 *     elif key == b':path':
 *         handler.path = values[0]
 *     elif key == b':status':             # <<<<<<<<<<<<<<
 *         handler.status = values[0]
 * 
 */
  }
  __pyx_L4:;

  /* "nghttp2.pyx":394
 *         handler.status = values[0]
 * 
 *     if key == b'cookie':             # <<<<<<<<<<<<<<
 *         handler.cookies.extend(values)
 *     else:
 */
  __pyx_t_2 = (__Pyx_PyBytes_Equals(__pyx_v_key, __pyx_n_b_cookie, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 394, __pyx_L1_error)
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "nghttp2.pyx":395
 * 
 *     if key == b'cookie':
 *         handler.cookies.extend(values)             # <<<<<<<<<<<<<<
 *     else:
 *         for v in values:
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_handler, __pyx_n_s_cookies); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 395, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_extend); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 395, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __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);
      }
    }
    __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_v_values) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_values);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 395, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "nghttp2.pyx":394
 *         handler.status = values[0]
 * 
 *     if key == b'cookie':             # <<<<<<<<<<<<<<
 *         handler.cookies.extend(values)
 *     else:
 */
    goto __pyx_L7;
  }

  /* "nghttp2.pyx":397
 *         handler.cookies.extend(values)
 *     else:
 *         for v in values:             # <<<<<<<<<<<<<<
 *             handler.headers.append((key, v))
 * 
 */
  /*else*/ {
    if (likely(PyList_CheckExact(__pyx_v_values)) || PyTuple_CheckExact(__pyx_v_values)) {
      __pyx_t_3 = __pyx_v_values; __Pyx_INCREF(__pyx_t_3); __pyx_t_7 = 0;
      __pyx_t_8 = NULL;
    } else {
      __pyx_t_7 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_values); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 397, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_8 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 397, __pyx_L1_error)
    }
    for (;;) {
      if (likely(!__pyx_t_8)) {
        if (likely(PyList_CheckExact(__pyx_t_3))) {
          if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_3)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_4 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_4); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 397, __pyx_L1_error)
          #else
          __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 397, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          #endif
        } else {
          if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_4); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 397, __pyx_L1_error)
          #else
          __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 397, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          #endif
        }
      } else {
        __pyx_t_4 = __pyx_t_8(__pyx_t_3);
        if (unlikely(!__pyx_t_4)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 397, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_4);
      }
      __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_4);
      __pyx_t_4 = 0;

      /* "nghttp2.pyx":398
 *     else:
 *         for v in values:
 *             handler.headers.append((key, v))             # <<<<<<<<<<<<<<
 * 
 *     return 0
 */
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_handler, __pyx_n_s_headers); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 398, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 398, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_v_key);
      __Pyx_GIVEREF(__pyx_v_key);
      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_key);
      __Pyx_INCREF(__pyx_v_v);
      __Pyx_GIVEREF(__pyx_v_v);
      PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_v);
      __pyx_t_9 = __Pyx_PyObject_Append(__pyx_t_4, __pyx_t_5); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 398, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "nghttp2.pyx":397
 *         handler.cookies.extend(values)
 *     else:
 *         for v in values:             # <<<<<<<<<<<<<<
 *             handler.headers.append((key, v))
 * 
 */
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_L7:;

  /* "nghttp2.pyx":400
 *             handler.headers.append((key, v))
 * 
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef int server_on_begin_request_headers(cnghttp2.nghttp2_session *session,
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "nghttp2.pyx":374
 * 
 * 
 * cdef int on_header(const uint8_t *name, size_t namelen,             # <<<<<<<<<<<<<<
 *                           const uint8_t *value, size_t valuelen,
 *                           uint8_t flags,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_WriteUnraisable("nghttp2.on_header", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_key);
  __Pyx_XDECREF(__pyx_v_values);
  __Pyx_XDECREF(__pyx_v_v);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":402
 *     return 0
 * 
 * cdef int server_on_begin_request_headers(cnghttp2.nghttp2_session *session,             # <<<<<<<<<<<<<<
 *                                          const cnghttp2.nghttp2_frame *frame,
 *                                          void *user_data):
 */

static int __pyx_f_7nghttp2_server_on_begin_request_headers(nghttp2_session *__pyx_v_session, nghttp2_frame const *__pyx_v_frame, void *__pyx_v_user_data) {
  PyObject *__pyx_v_http2 = 0;
  PyObject *__pyx_v_handler = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("server_on_begin_request_headers", 0);

  /* "nghttp2.pyx":405
 *                                          const cnghttp2.nghttp2_frame *frame,
 *                                          void *user_data):
 *     cdef http2 = <_HTTP2SessionCore>user_data             # <<<<<<<<<<<<<<
 * 
 *     handler = http2._make_handler(frame.hd.stream_id)
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_user_data);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_http2 = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "nghttp2.pyx":407
 *     cdef http2 = <_HTTP2SessionCore>user_data
 * 
 *     handler = http2._make_handler(frame.hd.stream_id)             # <<<<<<<<<<<<<<
 *     cnghttp2.nghttp2_session_set_stream_user_data(session, frame.hd.stream_id,
 *                                                   <void*>handler)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_http2, __pyx_n_s_make_handler); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 407, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyInt_From_int32_t(__pyx_v_frame->hd.stream_id); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 407, __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);
    }
  }
  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 407, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_handler = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "nghttp2.pyx":408
 * 
 *     handler = http2._make_handler(frame.hd.stream_id)
 *     cnghttp2.nghttp2_session_set_stream_user_data(session, frame.hd.stream_id,             # <<<<<<<<<<<<<<
 *                                                   <void*>handler)
 * 
 */
  (void)(nghttp2_session_set_stream_user_data(__pyx_v_session, __pyx_v_frame->hd.stream_id, ((void *)__pyx_v_handler)));

  /* "nghttp2.pyx":411
 *                                                   <void*>handler)
 * 
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef int server_on_begin_headers(cnghttp2.nghttp2_session *session,
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "nghttp2.pyx":402
 *     return 0
 * 
 * cdef int server_on_begin_request_headers(cnghttp2.nghttp2_session *session,             # <<<<<<<<<<<<<<
 *                                          const cnghttp2.nghttp2_frame *frame,
 *                                          void *user_data):
 */

  /* 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_WriteUnraisable("nghttp2.server_on_begin_request_headers", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_http2);
  __Pyx_XDECREF(__pyx_v_handler);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":413
 *     return 0
 * 
 * cdef int server_on_begin_headers(cnghttp2.nghttp2_session *session,             # <<<<<<<<<<<<<<
 *                                  const cnghttp2.nghttp2_frame *frame,
 *                                  void *user_data):
 */

static int __pyx_f_7nghttp2_server_on_begin_headers(nghttp2_session *__pyx_v_session, nghttp2_frame const *__pyx_v_frame, void *__pyx_v_user_data) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("server_on_begin_headers", 0);

  /* "nghttp2.pyx":416
 *                                  const cnghttp2.nghttp2_frame *frame,
 *                                  void *user_data):
 *     if frame.hd.type == cnghttp2.NGHTTP2_HEADERS:             # <<<<<<<<<<<<<<
 *         if frame.headers.cat == cnghttp2.NGHTTP2_HCAT_REQUEST:
 *             return server_on_begin_request_headers(session, frame, user_data)
 */
  __pyx_t_1 = ((__pyx_v_frame->hd.type == NGHTTP2_HEADERS) != 0);
  if (__pyx_t_1) {

    /* "nghttp2.pyx":417
 *                                  void *user_data):
 *     if frame.hd.type == cnghttp2.NGHTTP2_HEADERS:
 *         if frame.headers.cat == cnghttp2.NGHTTP2_HCAT_REQUEST:             # <<<<<<<<<<<<<<
 *             return server_on_begin_request_headers(session, frame, user_data)
 * 
 */
    __pyx_t_1 = ((__pyx_v_frame->headers.cat == NGHTTP2_HCAT_REQUEST) != 0);
    if (__pyx_t_1) {

      /* "nghttp2.pyx":418
 *     if frame.hd.type == cnghttp2.NGHTTP2_HEADERS:
 *         if frame.headers.cat == cnghttp2.NGHTTP2_HCAT_REQUEST:
 *             return server_on_begin_request_headers(session, frame, user_data)             # <<<<<<<<<<<<<<
 * 
 *     return 0
 */
      __pyx_r = __pyx_f_7nghttp2_server_on_begin_request_headers(__pyx_v_session, __pyx_v_frame, __pyx_v_user_data);
      goto __pyx_L0;

      /* "nghttp2.pyx":417
 *                                  void *user_data):
 *     if frame.hd.type == cnghttp2.NGHTTP2_HEADERS:
 *         if frame.headers.cat == cnghttp2.NGHTTP2_HCAT_REQUEST:             # <<<<<<<<<<<<<<
 *             return server_on_begin_request_headers(session, frame, user_data)
 * 
 */
    }

    /* "nghttp2.pyx":416
 *                                  const cnghttp2.nghttp2_frame *frame,
 *                                  void *user_data):
 *     if frame.hd.type == cnghttp2.NGHTTP2_HEADERS:             # <<<<<<<<<<<<<<
 *         if frame.headers.cat == cnghttp2.NGHTTP2_HCAT_REQUEST:
 *             return server_on_begin_request_headers(session, frame, user_data)
 */
  }

  /* "nghttp2.pyx":420
 *             return server_on_begin_request_headers(session, frame, user_data)
 * 
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef int server_on_frame_recv(cnghttp2.nghttp2_session *session,
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "nghttp2.pyx":413
 *     return 0
 * 
 * cdef int server_on_begin_headers(cnghttp2.nghttp2_session *session,             # <<<<<<<<<<<<<<
 *                                  const cnghttp2.nghttp2_frame *frame,
 *                                  void *user_data):
 */

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

/* "nghttp2.pyx":422
 *     return 0
 * 
 * cdef int server_on_frame_recv(cnghttp2.nghttp2_session *session,             # <<<<<<<<<<<<<<
 *                               const cnghttp2.nghttp2_frame *frame,
 *                               void *user_data):
 */

static int __pyx_f_7nghttp2_server_on_frame_recv(nghttp2_session *__pyx_v_session, nghttp2_frame const *__pyx_v_frame, void *__pyx_v_user_data) {
  PyObject *__pyx_v_http2 = 0;
  PyObject *__pyx_v_handler = NULL;
  int __pyx_r;
  __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;
  int __pyx_t_8;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  int __pyx_t_15;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("server_on_frame_recv", 0);

  /* "nghttp2.pyx":425
 *                               const cnghttp2.nghttp2_frame *frame,
 *                               void *user_data):
 *     cdef http2 = <_HTTP2SessionCore>user_data             # <<<<<<<<<<<<<<
 *     logging.debug('server_on_frame_recv, type:%s, stream_id:%s', frame.hd.type, frame.hd.stream_id)
 * 
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_user_data);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_http2 = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "nghttp2.pyx":426
 *                               void *user_data):
 *     cdef http2 = <_HTTP2SessionCore>user_data
 *     logging.debug('server_on_frame_recv, type:%s, stream_id:%s', frame.hd.type, frame.hd.stream_id)             # <<<<<<<<<<<<<<
 * 
 *     if frame.hd.type == cnghttp2.NGHTTP2_DATA:
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_logging); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 426, __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(0, 426, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyInt_From_uint8_t(__pyx_v_frame->hd.type); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 426, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyInt_From_int32_t(__pyx_v_frame->hd.stream_id); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 426, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(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[4] = {__pyx_t_5, __pyx_kp_s_server_on_frame_recv_type_s_stre, __pyx_t_2, __pyx_t_4};
    __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(0, 426, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __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[4] = {__pyx_t_5, __pyx_kp_s_server_on_frame_recv_type_s_stre, __pyx_t_2, __pyx_t_4};
    __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(0, 426, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 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(0, 426, __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_INCREF(__pyx_kp_s_server_on_frame_recv_type_s_stre);
    __Pyx_GIVEREF(__pyx_kp_s_server_on_frame_recv_type_s_stre);
    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_kp_s_server_on_frame_recv_type_s_stre);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_6, __pyx_t_4);
    __pyx_t_2 = 0;
    __pyx_t_4 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 426, __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;

  /* "nghttp2.pyx":428
 *     logging.debug('server_on_frame_recv, type:%s, stream_id:%s', frame.hd.type, frame.hd.stream_id)
 * 
 *     if frame.hd.type == cnghttp2.NGHTTP2_DATA:             # <<<<<<<<<<<<<<
 *         if frame.hd.flags & cnghttp2.NGHTTP2_FLAG_END_STREAM:
 *             handler = _get_stream_user_data(session, frame.hd.stream_id)
 */
  switch (__pyx_v_frame->hd.type) {
    case NGHTTP2_DATA:

    /* "nghttp2.pyx":429
 * 
 *     if frame.hd.type == cnghttp2.NGHTTP2_DATA:
 *         if frame.hd.flags & cnghttp2.NGHTTP2_FLAG_END_STREAM:             # <<<<<<<<<<<<<<
 *             handler = _get_stream_user_data(session, frame.hd.stream_id)
 *             if not handler:
 */
    __pyx_t_8 = ((__pyx_v_frame->hd.flags & NGHTTP2_FLAG_END_STREAM) != 0);
    if (__pyx_t_8) {

      /* "nghttp2.pyx":430
 *     if frame.hd.type == cnghttp2.NGHTTP2_DATA:
 *         if frame.hd.flags & cnghttp2.NGHTTP2_FLAG_END_STREAM:
 *             handler = _get_stream_user_data(session, frame.hd.stream_id)             # <<<<<<<<<<<<<<
 *             if not handler:
 *                 return 0
 */
      __pyx_t_1 = __pyx_f_7nghttp2__get_stream_user_data(__pyx_v_session, __pyx_v_frame->hd.stream_id); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 430, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_v_handler = __pyx_t_1;
      __pyx_t_1 = 0;

      /* "nghttp2.pyx":431
 *         if frame.hd.flags & cnghttp2.NGHTTP2_FLAG_END_STREAM:
 *             handler = _get_stream_user_data(session, frame.hd.stream_id)
 *             if not handler:             # <<<<<<<<<<<<<<
 *                 return 0
 *             try:
 */
      __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_handler); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 431, __pyx_L1_error)
      __pyx_t_9 = ((!__pyx_t_8) != 0);
      if (__pyx_t_9) {

        /* "nghttp2.pyx":432
 *             handler = _get_stream_user_data(session, frame.hd.stream_id)
 *             if not handler:
 *                 return 0             # <<<<<<<<<<<<<<
 *             try:
 *                 handler.on_request_done()
 */
        __pyx_r = 0;
        goto __pyx_L0;

        /* "nghttp2.pyx":431
 *         if frame.hd.flags & cnghttp2.NGHTTP2_FLAG_END_STREAM:
 *             handler = _get_stream_user_data(session, frame.hd.stream_id)
 *             if not handler:             # <<<<<<<<<<<<<<
 *                 return 0
 *             try:
 */
      }

      /* "nghttp2.pyx":433
 *             if not handler:
 *                 return 0
 *             try:             # <<<<<<<<<<<<<<
 *                 handler.on_request_done()
 *             except:
 */
      {
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        __Pyx_ExceptionSave(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
        __Pyx_XGOTREF(__pyx_t_10);
        __Pyx_XGOTREF(__pyx_t_11);
        __Pyx_XGOTREF(__pyx_t_12);
        /*try:*/ {

          /* "nghttp2.pyx":434
 *                 return 0
 *             try:
 *                 handler.on_request_done()             # <<<<<<<<<<<<<<
 *             except:
 *                 sys.stderr.write(traceback.format_exc())
 */
          __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_handler, __pyx_n_s_on_request_done); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 434, __pyx_L5_error)
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_7 = NULL;
          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_1 = (__pyx_t_7) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_7) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
          if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 434, __pyx_L5_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

          /* "nghttp2.pyx":433
 *             if not handler:
 *                 return 0
 *             try:             # <<<<<<<<<<<<<<
 *                 handler.on_request_done()
 *             except:
 */
        }
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
        goto __pyx_L10_try_end;
        __pyx_L5_error:;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;

        /* "nghttp2.pyx":435
 *             try:
 *                 handler.on_request_done()
 *             except:             # <<<<<<<<<<<<<<
 *                 sys.stderr.write(traceback.format_exc())
 *                 return http2._rst_stream(frame.hd.stream_id)
 */
        /*except:*/ {
          __Pyx_AddTraceback("nghttp2.server_on_frame_recv", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_3, &__pyx_t_7) < 0) __PYX_ERR(0, 435, __pyx_L7_except_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_GOTREF(__pyx_t_7);

          /* "nghttp2.pyx":436
 *                 handler.on_request_done()
 *             except:
 *                 sys.stderr.write(traceback.format_exc())             # <<<<<<<<<<<<<<
 *                 return http2._rst_stream(frame.hd.stream_id)
 *     elif frame.hd.type == cnghttp2.NGHTTP2_HEADERS:
 */
          __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_sys); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 436, __pyx_L7_except_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_stderr); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 436, __pyx_L7_except_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 436, __pyx_L7_except_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_traceback); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 436, __pyx_L7_except_error)
          __Pyx_GOTREF(__pyx_t_13);
          __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_format_exc); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 436, __pyx_L7_except_error)
          __Pyx_GOTREF(__pyx_t_14);
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          __pyx_t_13 = NULL;
          if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_14))) {
            __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_14);
            if (likely(__pyx_t_13)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
              __Pyx_INCREF(__pyx_t_13);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_14, function);
            }
          }
          __pyx_t_5 = (__pyx_t_13) ? __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_t_13) : __Pyx_PyObject_CallNoArg(__pyx_t_14);
          __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
          if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 436, __pyx_L7_except_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
          __pyx_t_14 = NULL;
          if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
            __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_2);
            if (likely(__pyx_t_14)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
              __Pyx_INCREF(__pyx_t_14);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_2, function);
            }
          }
          __pyx_t_4 = (__pyx_t_14) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_14, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5);
          __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 436, __pyx_L7_except_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

          /* "nghttp2.pyx":437
 *             except:
 *                 sys.stderr.write(traceback.format_exc())
 *                 return http2._rst_stream(frame.hd.stream_id)             # <<<<<<<<<<<<<<
 *     elif frame.hd.type == cnghttp2.NGHTTP2_HEADERS:
 *         if frame.headers.cat == cnghttp2.NGHTTP2_HCAT_REQUEST:
 */
          __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_http2, __pyx_n_s_rst_stream); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 437, __pyx_L7_except_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_5 = __Pyx_PyInt_From_int32_t(__pyx_v_frame->hd.stream_id); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 437, __pyx_L7_except_error)
          __Pyx_GOTREF(__pyx_t_5);
          __pyx_t_14 = NULL;
          if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
            __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_2);
            if (likely(__pyx_t_14)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
              __Pyx_INCREF(__pyx_t_14);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_2, function);
            }
          }
          __pyx_t_4 = (__pyx_t_14) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_14, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5);
          __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 437, __pyx_L7_except_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 437, __pyx_L7_except_error)
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __pyx_r = __pyx_t_6;
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          goto __pyx_L8_except_return;
        }
        __pyx_L7_except_error:;

        /* "nghttp2.pyx":433
 *             if not handler:
 *                 return 0
 *             try:             # <<<<<<<<<<<<<<
 *                 handler.on_request_done()
 *             except:
 */
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
        goto __pyx_L1_error;
        __pyx_L8_except_return:;
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
        goto __pyx_L0;
        __pyx_L10_try_end:;
      }

      /* "nghttp2.pyx":429
 * 
 *     if frame.hd.type == cnghttp2.NGHTTP2_DATA:
 *         if frame.hd.flags & cnghttp2.NGHTTP2_FLAG_END_STREAM:             # <<<<<<<<<<<<<<
 *             handler = _get_stream_user_data(session, frame.hd.stream_id)
 *             if not handler:
 */
    }

    /* "nghttp2.pyx":428
 *     logging.debug('server_on_frame_recv, type:%s, stream_id:%s', frame.hd.type, frame.hd.stream_id)
 * 
 *     if frame.hd.type == cnghttp2.NGHTTP2_DATA:             # <<<<<<<<<<<<<<
 *         if frame.hd.flags & cnghttp2.NGHTTP2_FLAG_END_STREAM:
 *             handler = _get_stream_user_data(session, frame.hd.stream_id)
 */
    break;
    case NGHTTP2_HEADERS:

    /* "nghttp2.pyx":439
 *                 return http2._rst_stream(frame.hd.stream_id)
 *     elif frame.hd.type == cnghttp2.NGHTTP2_HEADERS:
 *         if frame.headers.cat == cnghttp2.NGHTTP2_HCAT_REQUEST:             # <<<<<<<<<<<<<<
 *             handler = _get_stream_user_data(session, frame.hd.stream_id)
 *             if not handler:
 */
    __pyx_t_9 = ((__pyx_v_frame->headers.cat == NGHTTP2_HCAT_REQUEST) != 0);
    if (__pyx_t_9) {

      /* "nghttp2.pyx":440
 *     elif frame.hd.type == cnghttp2.NGHTTP2_HEADERS:
 *         if frame.headers.cat == cnghttp2.NGHTTP2_HCAT_REQUEST:
 *             handler = _get_stream_user_data(session, frame.hd.stream_id)             # <<<<<<<<<<<<<<
 *             if not handler:
 *                 return 0
 */
      __pyx_t_7 = __pyx_f_7nghttp2__get_stream_user_data(__pyx_v_session, __pyx_v_frame->hd.stream_id); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 440, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_v_handler = __pyx_t_7;
      __pyx_t_7 = 0;

      /* "nghttp2.pyx":441
 *         if frame.headers.cat == cnghttp2.NGHTTP2_HCAT_REQUEST:
 *             handler = _get_stream_user_data(session, frame.hd.stream_id)
 *             if not handler:             # <<<<<<<<<<<<<<
 *                 return 0
 *             if handler.cookies:
 */
      __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_handler); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 441, __pyx_L1_error)
      __pyx_t_8 = ((!__pyx_t_9) != 0);
      if (__pyx_t_8) {

        /* "nghttp2.pyx":442
 *             handler = _get_stream_user_data(session, frame.hd.stream_id)
 *             if not handler:
 *                 return 0             # <<<<<<<<<<<<<<
 *             if handler.cookies:
 *                 handler.headers.append((b'cookie',
 */
        __pyx_r = 0;
        goto __pyx_L0;

        /* "nghttp2.pyx":441
 *         if frame.headers.cat == cnghttp2.NGHTTP2_HCAT_REQUEST:
 *             handler = _get_stream_user_data(session, frame.hd.stream_id)
 *             if not handler:             # <<<<<<<<<<<<<<
 *                 return 0
 *             if handler.cookies:
 */
      }

      /* "nghttp2.pyx":443
 *             if not handler:
 *                 return 0
 *             if handler.cookies:             # <<<<<<<<<<<<<<
 *                 handler.headers.append((b'cookie',
 *                                         b'; '.join(handler.cookies)))
 */
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_handler, __pyx_n_s_cookies); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 443, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 443, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (__pyx_t_8) {

        /* "nghttp2.pyx":444
 *                 return 0
 *             if handler.cookies:
 *                 handler.headers.append((b'cookie',             # <<<<<<<<<<<<<<
 *                                         b'; '.join(handler.cookies)))
 *                 handler.cookies = None
 */
        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_handler, __pyx_n_s_headers); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 444, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);

        /* "nghttp2.pyx":445
 *             if handler.cookies:
 *                 handler.headers.append((b'cookie',
 *                                         b'; '.join(handler.cookies)))             # <<<<<<<<<<<<<<
 *                 handler.cookies = None
 *             try:
 */
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_handler, __pyx_n_s_cookies); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 445, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_1 = __Pyx_PyBytes_Join(__pyx_kp_b__7, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 445, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

        /* "nghttp2.pyx":444
 *                 return 0
 *             if handler.cookies:
 *                 handler.headers.append((b'cookie',             # <<<<<<<<<<<<<<
 *                                         b'; '.join(handler.cookies)))
 *                 handler.cookies = None
 */
        __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 444, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_INCREF(__pyx_n_b_cookie);
        __Pyx_GIVEREF(__pyx_n_b_cookie);
        PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_n_b_cookie);
        __Pyx_GIVEREF(__pyx_t_1);
        PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
        __pyx_t_1 = 0;
        __pyx_t_15 = __Pyx_PyObject_Append(__pyx_t_7, __pyx_t_3); if (unlikely(__pyx_t_15 == ((int)-1))) __PYX_ERR(0, 444, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

        /* "nghttp2.pyx":446
 *                 handler.headers.append((b'cookie',
 *                                         b'; '.join(handler.cookies)))
 *                 handler.cookies = None             # <<<<<<<<<<<<<<
 *             try:
 *                 handler.on_headers()
 */
        if (__Pyx_PyObject_SetAttrStr(__pyx_v_handler, __pyx_n_s_cookies, Py_None) < 0) __PYX_ERR(0, 446, __pyx_L1_error)

        /* "nghttp2.pyx":443
 *             if not handler:
 *                 return 0
 *             if handler.cookies:             # <<<<<<<<<<<<<<
 *                 handler.headers.append((b'cookie',
 *                                         b'; '.join(handler.cookies)))
 */
      }

      /* "nghttp2.pyx":447
 *                                         b'; '.join(handler.cookies)))
 *                 handler.cookies = None
 *             try:             # <<<<<<<<<<<<<<
 *                 handler.on_headers()
 *                 if frame.hd.flags & cnghttp2.NGHTTP2_FLAG_END_STREAM:
 */
      {
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        __Pyx_ExceptionSave(&__pyx_t_12, &__pyx_t_11, &__pyx_t_10);
        __Pyx_XGOTREF(__pyx_t_12);
        __Pyx_XGOTREF(__pyx_t_11);
        __Pyx_XGOTREF(__pyx_t_10);
        /*try:*/ {

          /* "nghttp2.pyx":448
 *                 handler.cookies = None
 *             try:
 *                 handler.on_headers()             # <<<<<<<<<<<<<<
 *                 if frame.hd.flags & cnghttp2.NGHTTP2_FLAG_END_STREAM:
 *                     handler.on_request_done()
 */
          __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_handler, __pyx_n_s_on_headers); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 448, __pyx_L16_error)
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_1 = NULL;
          if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
            __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_7);
            if (likely(__pyx_t_1)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
              __Pyx_INCREF(__pyx_t_1);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_7, function);
            }
          }
          __pyx_t_3 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_7);
          __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
          if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 448, __pyx_L16_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

          /* "nghttp2.pyx":449
 *             try:
 *                 handler.on_headers()
 *                 if frame.hd.flags & cnghttp2.NGHTTP2_FLAG_END_STREAM:             # <<<<<<<<<<<<<<
 *                     handler.on_request_done()
 *             except:
 */
          __pyx_t_8 = ((__pyx_v_frame->hd.flags & NGHTTP2_FLAG_END_STREAM) != 0);
          if (__pyx_t_8) {

            /* "nghttp2.pyx":450
 *                 handler.on_headers()
 *                 if frame.hd.flags & cnghttp2.NGHTTP2_FLAG_END_STREAM:
 *                     handler.on_request_done()             # <<<<<<<<<<<<<<
 *             except:
 *                 sys.stderr.write(traceback.format_exc())
 */
            __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_handler, __pyx_n_s_on_request_done); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 450, __pyx_L16_error)
            __Pyx_GOTREF(__pyx_t_7);
            __pyx_t_1 = NULL;
            if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
              __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_7);
              if (likely(__pyx_t_1)) {
                PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
                __Pyx_INCREF(__pyx_t_1);
                __Pyx_INCREF(function);
                __Pyx_DECREF_SET(__pyx_t_7, function);
              }
            }
            __pyx_t_3 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_7);
            __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
            if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 450, __pyx_L16_error)
            __Pyx_GOTREF(__pyx_t_3);
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

            /* "nghttp2.pyx":449
 *             try:
 *                 handler.on_headers()
 *                 if frame.hd.flags & cnghttp2.NGHTTP2_FLAG_END_STREAM:             # <<<<<<<<<<<<<<
 *                     handler.on_request_done()
 *             except:
 */
          }

          /* "nghttp2.pyx":447
 *                                         b'; '.join(handler.cookies)))
 *                 handler.cookies = None
 *             try:             # <<<<<<<<<<<<<<
 *                 handler.on_headers()
 *                 if frame.hd.flags & cnghttp2.NGHTTP2_FLAG_END_STREAM:
 */
        }
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        goto __pyx_L21_try_end;
        __pyx_L16_error:;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
        __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;

        /* "nghttp2.pyx":451
 *                 if frame.hd.flags & cnghttp2.NGHTTP2_FLAG_END_STREAM:
 *                     handler.on_request_done()
 *             except:             # <<<<<<<<<<<<<<
 *                 sys.stderr.write(traceback.format_exc())
 *                 return http2._rst_stream(frame.hd.stream_id)
 */
        /*except:*/ {
          __Pyx_AddTraceback("nghttp2.server_on_frame_recv", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_7, &__pyx_t_1) < 0) __PYX_ERR(0, 451, __pyx_L18_except_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_GOTREF(__pyx_t_1);

          /* "nghttp2.pyx":452
 *                     handler.on_request_done()
 *             except:
 *                 sys.stderr.write(traceback.format_exc())             # <<<<<<<<<<<<<<
 *                 return http2._rst_stream(frame.hd.stream_id)
 *     elif frame.hd.type == cnghttp2.NGHTTP2_SETTINGS:
 */
          __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_sys); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 452, __pyx_L18_except_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_stderr); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 452, __pyx_L18_except_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 452, __pyx_L18_except_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_n_s_traceback); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 452, __pyx_L18_except_error)
          __Pyx_GOTREF(__pyx_t_14);
          __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_format_exc); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 452, __pyx_L18_except_error)
          __Pyx_GOTREF(__pyx_t_13);
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
          __pyx_t_14 = NULL;
          if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_13))) {
            __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_13);
            if (likely(__pyx_t_14)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13);
              __Pyx_INCREF(__pyx_t_14);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_13, function);
            }
          }
          __pyx_t_5 = (__pyx_t_14) ? __Pyx_PyObject_CallOneArg(__pyx_t_13, __pyx_t_14) : __Pyx_PyObject_CallNoArg(__pyx_t_13);
          __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
          if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 452, __pyx_L18_except_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          __pyx_t_13 = NULL;
          if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
            __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_2);
            if (likely(__pyx_t_13)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
              __Pyx_INCREF(__pyx_t_13);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_2, function);
            }
          }
          __pyx_t_4 = (__pyx_t_13) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_13, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5);
          __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 452, __pyx_L18_except_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

          /* "nghttp2.pyx":453
 *             except:
 *                 sys.stderr.write(traceback.format_exc())
 *                 return http2._rst_stream(frame.hd.stream_id)             # <<<<<<<<<<<<<<
 *     elif frame.hd.type == cnghttp2.NGHTTP2_SETTINGS:
 *         if (frame.hd.flags & cnghttp2.NGHTTP2_FLAG_ACK):
 */
          __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_http2, __pyx_n_s_rst_stream); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 453, __pyx_L18_except_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_5 = __Pyx_PyInt_From_int32_t(__pyx_v_frame->hd.stream_id); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 453, __pyx_L18_except_error)
          __Pyx_GOTREF(__pyx_t_5);
          __pyx_t_13 = NULL;
          if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
            __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_2);
            if (likely(__pyx_t_13)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
              __Pyx_INCREF(__pyx_t_13);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_2, function);
            }
          }
          __pyx_t_4 = (__pyx_t_13) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_13, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5);
          __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 453, __pyx_L18_except_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 453, __pyx_L18_except_error)
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __pyx_r = __pyx_t_6;
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          goto __pyx_L19_except_return;
        }
        __pyx_L18_except_error:;

        /* "nghttp2.pyx":447
 *                                         b'; '.join(handler.cookies)))
 *                 handler.cookies = None
 *             try:             # <<<<<<<<<<<<<<
 *                 handler.on_headers()
 *                 if frame.hd.flags & cnghttp2.NGHTTP2_FLAG_END_STREAM:
 */
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_11, __pyx_t_10);
        goto __pyx_L1_error;
        __pyx_L19_except_return:;
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_11, __pyx_t_10);
        goto __pyx_L0;
        __pyx_L21_try_end:;
      }

      /* "nghttp2.pyx":439
 *                 return http2._rst_stream(frame.hd.stream_id)
 *     elif frame.hd.type == cnghttp2.NGHTTP2_HEADERS:
 *         if frame.headers.cat == cnghttp2.NGHTTP2_HCAT_REQUEST:             # <<<<<<<<<<<<<<
 *             handler = _get_stream_user_data(session, frame.hd.stream_id)
 *             if not handler:
 */
    }

    /* "nghttp2.pyx":438
 *                 sys.stderr.write(traceback.format_exc())
 *                 return http2._rst_stream(frame.hd.stream_id)
 *     elif frame.hd.type == cnghttp2.NGHTTP2_HEADERS:             # <<<<<<<<<<<<<<
 *         if frame.headers.cat == cnghttp2.NGHTTP2_HCAT_REQUEST:
 *             handler = _get_stream_user_data(session, frame.hd.stream_id)
 */
    break;
    case NGHTTP2_SETTINGS:

    /* "nghttp2.pyx":455
 *                 return http2._rst_stream(frame.hd.stream_id)
 *     elif frame.hd.type == cnghttp2.NGHTTP2_SETTINGS:
 *         if (frame.hd.flags & cnghttp2.NGHTTP2_FLAG_ACK):             # <<<<<<<<<<<<<<
 *             http2._stop_settings_timer()
 * 
 */
    __pyx_t_8 = ((__pyx_v_frame->hd.flags & NGHTTP2_FLAG_ACK) != 0);
    if (__pyx_t_8) {

      /* "nghttp2.pyx":456
 *     elif frame.hd.type == cnghttp2.NGHTTP2_SETTINGS:
 *         if (frame.hd.flags & cnghttp2.NGHTTP2_FLAG_ACK):
 *             http2._stop_settings_timer()             # <<<<<<<<<<<<<<
 * 
 *     return 0
 */
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_http2, __pyx_n_s_stop_settings_timer); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 456, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_3 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(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_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_7);
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 456, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "nghttp2.pyx":455
 *                 return http2._rst_stream(frame.hd.stream_id)
 *     elif frame.hd.type == cnghttp2.NGHTTP2_SETTINGS:
 *         if (frame.hd.flags & cnghttp2.NGHTTP2_FLAG_ACK):             # <<<<<<<<<<<<<<
 *             http2._stop_settings_timer()
 * 
 */
    }

    /* "nghttp2.pyx":454
 *                 sys.stderr.write(traceback.format_exc())
 *                 return http2._rst_stream(frame.hd.stream_id)
 *     elif frame.hd.type == cnghttp2.NGHTTP2_SETTINGS:             # <<<<<<<<<<<<<<
 *         if (frame.hd.flags & cnghttp2.NGHTTP2_FLAG_ACK):
 *             http2._stop_settings_timer()
 */
    break;
    default: break;
  }

  /* "nghttp2.pyx":458
 *             http2._stop_settings_timer()
 * 
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef int on_data_chunk_recv(cnghttp2.nghttp2_session *session,
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "nghttp2.pyx":422
 *     return 0
 * 
 * cdef int server_on_frame_recv(cnghttp2.nghttp2_session *session,             # <<<<<<<<<<<<<<
 *                               const cnghttp2.nghttp2_frame *frame,
 *                               void *user_data):
 */

  /* 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_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_WriteUnraisable("nghttp2.server_on_frame_recv", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_http2);
  __Pyx_XDECREF(__pyx_v_handler);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":460
 *     return 0
 * 
 * cdef int on_data_chunk_recv(cnghttp2.nghttp2_session *session,             # <<<<<<<<<<<<<<
 *                                    uint8_t flags,
 *                                    int32_t stream_id, const uint8_t *data,
 */

static int __pyx_f_7nghttp2_on_data_chunk_recv(nghttp2_session *__pyx_v_session, CYTHON_UNUSED uint8_t __pyx_v_flags, int32_t __pyx_v_stream_id, uint8_t const *__pyx_v_data, size_t __pyx_v_length, void *__pyx_v_user_data) {
  PyObject *__pyx_v_http2 = 0;
  PyObject *__pyx_v_handler = NULL;
  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;
  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;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  int __pyx_t_14;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("on_data_chunk_recv", 0);

  /* "nghttp2.pyx":464
 *                                    int32_t stream_id, const uint8_t *data,
 *                                    size_t length, void *user_data):
 *     cdef http2 = <_HTTP2SessionCoreBase>user_data             # <<<<<<<<<<<<<<
 * 
 *     handler = _get_stream_user_data(session, stream_id)
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_user_data);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_http2 = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "nghttp2.pyx":466
 *     cdef http2 = <_HTTP2SessionCoreBase>user_data
 * 
 *     handler = _get_stream_user_data(session, stream_id)             # <<<<<<<<<<<<<<
 *     if not handler:
 *         return 0
 */
  __pyx_t_1 = __pyx_f_7nghttp2__get_stream_user_data(__pyx_v_session, __pyx_v_stream_id); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 466, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_handler = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "nghttp2.pyx":467
 * 
 *     handler = _get_stream_user_data(session, stream_id)
 *     if not handler:             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_handler); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 467, __pyx_L1_error)
  __pyx_t_3 = ((!__pyx_t_2) != 0);
  if (__pyx_t_3) {

    /* "nghttp2.pyx":468
 *     handler = _get_stream_user_data(session, stream_id)
 *     if not handler:
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     try:
 */
    __pyx_r = 0;
    goto __pyx_L0;

    /* "nghttp2.pyx":467
 * 
 *     handler = _get_stream_user_data(session, stream_id)
 *     if not handler:             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */
  }

  /* "nghttp2.pyx":470
 *         return 0
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         handler.on_data(data[:length])
 *     except:
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6);
    __Pyx_XGOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_6);
    /*try:*/ {

      /* "nghttp2.pyx":471
 * 
 *     try:
 *         handler.on_data(data[:length])             # <<<<<<<<<<<<<<
 *     except:
 *         sys.stderr.write(traceback.format_exc())
 */
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_handler, __pyx_n_s_on_data); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 471, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = __Pyx_PyBytes_FromStringAndSize(((const char*)__pyx_v_data) + 0, __pyx_v_length - 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 471, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_9 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
        __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_7);
        if (likely(__pyx_t_9)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
          __Pyx_INCREF(__pyx_t_9);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_7, function);
        }
      }
      __pyx_t_1 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_9, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_8);
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 471, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "nghttp2.pyx":470
 *         return 0
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         handler.on_data(data[:length])
 *     except:
 */
    }
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L9_try_end;
    __pyx_L4_error:;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __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;

    /* "nghttp2.pyx":472
 *     try:
 *         handler.on_data(data[:length])
 *     except:             # <<<<<<<<<<<<<<
 *         sys.stderr.write(traceback.format_exc())
 *         return http2._rst_stream(stream_id)
 */
    /*except:*/ {
      __Pyx_AddTraceback("nghttp2.on_data_chunk_recv", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_7, &__pyx_t_8) < 0) __PYX_ERR(0, 472, __pyx_L6_except_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GOTREF(__pyx_t_8);

      /* "nghttp2.pyx":473
 *         handler.on_data(data[:length])
 *     except:
 *         sys.stderr.write(traceback.format_exc())             # <<<<<<<<<<<<<<
 *         return http2._rst_stream(stream_id)
 * 
 */
      __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_sys); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 473, __pyx_L6_except_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_stderr); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 473, __pyx_L6_except_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_write); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 473, __pyx_L6_except_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_traceback); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 473, __pyx_L6_except_error)
      __Pyx_GOTREF(__pyx_t_12);
      __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_format_exc); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 473, __pyx_L6_except_error)
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_t_12 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_13))) {
        __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_13);
        if (likely(__pyx_t_12)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13);
          __Pyx_INCREF(__pyx_t_12);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_13, function);
        }
      }
      __pyx_t_11 = (__pyx_t_12) ? __Pyx_PyObject_CallOneArg(__pyx_t_13, __pyx_t_12) : __Pyx_PyObject_CallNoArg(__pyx_t_13);
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 473, __pyx_L6_except_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __pyx_t_13 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) {
        __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_10);
        if (likely(__pyx_t_13)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
          __Pyx_INCREF(__pyx_t_13);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_10, function);
        }
      }
      __pyx_t_9 = (__pyx_t_13) ? __Pyx_PyObject_Call2Args(__pyx_t_10, __pyx_t_13, __pyx_t_11) : __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_11);
      __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 473, __pyx_L6_except_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

      /* "nghttp2.pyx":474
 *     except:
 *         sys.stderr.write(traceback.format_exc())
 *         return http2._rst_stream(stream_id)             # <<<<<<<<<<<<<<
 * 
 *     return 0
 */
      __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_http2, __pyx_n_s_rst_stream); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 474, __pyx_L6_except_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_11 = __Pyx_PyInt_From_int32_t(__pyx_v_stream_id); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 474, __pyx_L6_except_error)
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_13 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) {
        __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_10);
        if (likely(__pyx_t_13)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
          __Pyx_INCREF(__pyx_t_13);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_10, function);
        }
      }
      __pyx_t_9 = (__pyx_t_13) ? __Pyx_PyObject_Call2Args(__pyx_t_10, __pyx_t_13, __pyx_t_11) : __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_11);
      __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 474, __pyx_L6_except_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_14 = __Pyx_PyInt_As_int(__pyx_t_9); if (unlikely((__pyx_t_14 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 474, __pyx_L6_except_error)
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_r = __pyx_t_14;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      goto __pyx_L7_except_return;
    }
    __pyx_L6_except_error:;

    /* "nghttp2.pyx":470
 *         return 0
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         handler.on_data(data[:length])
 *     except:
 */
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
    goto __pyx_L1_error;
    __pyx_L7_except_return:;
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
    goto __pyx_L0;
    __pyx_L9_try_end:;
  }

  /* "nghttp2.pyx":476
 *         return http2._rst_stream(stream_id)
 * 
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef int server_on_frame_send(cnghttp2.nghttp2_session *session,
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "nghttp2.pyx":460
 *     return 0
 * 
 * cdef int on_data_chunk_recv(cnghttp2.nghttp2_session *session,             # <<<<<<<<<<<<<<
 *                                    uint8_t flags,
 *                                    int32_t stream_id, const uint8_t *data,
 */

  /* 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_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_WriteUnraisable("nghttp2.on_data_chunk_recv", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_http2);
  __Pyx_XDECREF(__pyx_v_handler);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":478
 *     return 0
 * 
 * cdef int server_on_frame_send(cnghttp2.nghttp2_session *session,             # <<<<<<<<<<<<<<
 *                               const cnghttp2.nghttp2_frame *frame,
 *                               void *user_data):
 */

static int __pyx_f_7nghttp2_server_on_frame_send(nghttp2_session *__pyx_v_session, nghttp2_frame const *__pyx_v_frame, void *__pyx_v_user_data) {
  PyObject *__pyx_v_http2 = 0;
  PyObject *__pyx_v_handler = NULL;
  int __pyx_r;
  __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;
  int __pyx_t_8;
  int __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("server_on_frame_send", 0);

  /* "nghttp2.pyx":481
 *                               const cnghttp2.nghttp2_frame *frame,
 *                               void *user_data):
 *     cdef http2 = <_HTTP2SessionCore>user_data             # <<<<<<<<<<<<<<
 *     logging.debug('server_on_frame_send, type:%s, stream_id:%s', frame.hd.type, frame.hd.stream_id)
 * 
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_user_data);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_http2 = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "nghttp2.pyx":482
 *                               void *user_data):
 *     cdef http2 = <_HTTP2SessionCore>user_data
 *     logging.debug('server_on_frame_send, type:%s, stream_id:%s', frame.hd.type, frame.hd.stream_id)             # <<<<<<<<<<<<<<
 * 
 *     if frame.hd.type == cnghttp2.NGHTTP2_PUSH_PROMISE:
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_logging); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 482, __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(0, 482, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyInt_From_uint8_t(__pyx_v_frame->hd.type); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 482, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyInt_From_int32_t(__pyx_v_frame->hd.stream_id); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 482, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(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[4] = {__pyx_t_5, __pyx_kp_s_server_on_frame_send_type_s_stre, __pyx_t_2, __pyx_t_4};
    __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(0, 482, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __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[4] = {__pyx_t_5, __pyx_kp_s_server_on_frame_send_type_s_stre, __pyx_t_2, __pyx_t_4};
    __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(0, 482, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 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(0, 482, __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_INCREF(__pyx_kp_s_server_on_frame_send_type_s_stre);
    __Pyx_GIVEREF(__pyx_kp_s_server_on_frame_send_type_s_stre);
    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_kp_s_server_on_frame_send_type_s_stre);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_6, __pyx_t_4);
    __pyx_t_2 = 0;
    __pyx_t_4 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 482, __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;

  /* "nghttp2.pyx":484
 *     logging.debug('server_on_frame_send, type:%s, stream_id:%s', frame.hd.type, frame.hd.stream_id)
 * 
 *     if frame.hd.type == cnghttp2.NGHTTP2_PUSH_PROMISE:             # <<<<<<<<<<<<<<
 *         # For PUSH_PROMISE, send push response immediately
 *         handler = _get_stream_user_data\
 */
  switch (__pyx_v_frame->hd.type) {
    case NGHTTP2_PUSH_PROMISE:

    /* "nghttp2.pyx":487
 *         # For PUSH_PROMISE, send push response immediately
 *         handler = _get_stream_user_data\
 *                   (session, frame.push_promise.promised_stream_id)             # <<<<<<<<<<<<<<
 *         if not handler:
 *             return 0
 */
    __pyx_t_1 = __pyx_f_7nghttp2__get_stream_user_data(__pyx_v_session, __pyx_v_frame->push_promise.promised_stream_id); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 487, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_handler = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "nghttp2.pyx":488
 *         handler = _get_stream_user_data\
 *                   (session, frame.push_promise.promised_stream_id)
 *         if not handler:             # <<<<<<<<<<<<<<
 *             return 0
 * 
 */
    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_handler); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 488, __pyx_L1_error)
    __pyx_t_9 = ((!__pyx_t_8) != 0);
    if (__pyx_t_9) {

      /* "nghttp2.pyx":489
 *                   (session, frame.push_promise.promised_stream_id)
 *         if not handler:
 *             return 0             # <<<<<<<<<<<<<<
 * 
 *         http2.send_response(handler)
 */
      __pyx_r = 0;
      goto __pyx_L0;

      /* "nghttp2.pyx":488
 *         handler = _get_stream_user_data\
 *                   (session, frame.push_promise.promised_stream_id)
 *         if not handler:             # <<<<<<<<<<<<<<
 *             return 0
 * 
 */
    }

    /* "nghttp2.pyx":491
 *             return 0
 * 
 *         http2.send_response(handler)             # <<<<<<<<<<<<<<
 *     elif frame.hd.type == cnghttp2.NGHTTP2_SETTINGS:
 *         if (frame.hd.flags & cnghttp2.NGHTTP2_FLAG_ACK) != 0:
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_http2, __pyx_n_s_send_response); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 491, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_7 = NULL;
    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_1 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_7, __pyx_v_handler) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_handler);
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 491, __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;

    /* "nghttp2.pyx":484
 *     logging.debug('server_on_frame_send, type:%s, stream_id:%s', frame.hd.type, frame.hd.stream_id)
 * 
 *     if frame.hd.type == cnghttp2.NGHTTP2_PUSH_PROMISE:             # <<<<<<<<<<<<<<
 *         # For PUSH_PROMISE, send push response immediately
 *         handler = _get_stream_user_data\
 */
    break;
    case NGHTTP2_SETTINGS:

    /* "nghttp2.pyx":493
 *         http2.send_response(handler)
 *     elif frame.hd.type == cnghttp2.NGHTTP2_SETTINGS:
 *         if (frame.hd.flags & cnghttp2.NGHTTP2_FLAG_ACK) != 0:             # <<<<<<<<<<<<<<
 *             return 0
 *         http2._start_settings_timer()
 */
    __pyx_t_9 = (((__pyx_v_frame->hd.flags & NGHTTP2_FLAG_ACK) != 0) != 0);
    if (__pyx_t_9) {

      /* "nghttp2.pyx":494
 *     elif frame.hd.type == cnghttp2.NGHTTP2_SETTINGS:
 *         if (frame.hd.flags & cnghttp2.NGHTTP2_FLAG_ACK) != 0:
 *             return 0             # <<<<<<<<<<<<<<
 *         http2._start_settings_timer()
 *     elif frame.hd.type == cnghttp2.NGHTTP2_HEADERS:
 */
      __pyx_r = 0;
      goto __pyx_L0;

      /* "nghttp2.pyx":493
 *         http2.send_response(handler)
 *     elif frame.hd.type == cnghttp2.NGHTTP2_SETTINGS:
 *         if (frame.hd.flags & cnghttp2.NGHTTP2_FLAG_ACK) != 0:             # <<<<<<<<<<<<<<
 *             return 0
 *         http2._start_settings_timer()
 */
    }

    /* "nghttp2.pyx":495
 *         if (frame.hd.flags & cnghttp2.NGHTTP2_FLAG_ACK) != 0:
 *             return 0
 *         http2._start_settings_timer()             # <<<<<<<<<<<<<<
 *     elif frame.hd.type == cnghttp2.NGHTTP2_HEADERS:
 *         if (frame.hd.flags & cnghttp2.NGHTTP2_FLAG_END_STREAM) and \
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_http2, __pyx_n_s_start_settings_timer); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 495, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_7 = NULL;
    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_1 = (__pyx_t_7) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_7) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 495, __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;

    /* "nghttp2.pyx":492
 * 
 *         http2.send_response(handler)
 *     elif frame.hd.type == cnghttp2.NGHTTP2_SETTINGS:             # <<<<<<<<<<<<<<
 *         if (frame.hd.flags & cnghttp2.NGHTTP2_FLAG_ACK) != 0:
 *             return 0
 */
    break;
    case NGHTTP2_HEADERS:

    /* "nghttp2.pyx":497
 *         http2._start_settings_timer()
 *     elif frame.hd.type == cnghttp2.NGHTTP2_HEADERS:
 *         if (frame.hd.flags & cnghttp2.NGHTTP2_FLAG_END_STREAM) and \             # <<<<<<<<<<<<<<
 *            cnghttp2.nghttp2_session_check_server_session(session):
 *             # Send RST_STREAM if remote is not closed yet
 */
    __pyx_t_8 = ((__pyx_v_frame->hd.flags & NGHTTP2_FLAG_END_STREAM) != 0);
    if (__pyx_t_8) {
    } else {
      __pyx_t_9 = __pyx_t_8;
      goto __pyx_L6_bool_binop_done;
    }

    /* "nghttp2.pyx":498
 *     elif frame.hd.type == cnghttp2.NGHTTP2_HEADERS:
 *         if (frame.hd.flags & cnghttp2.NGHTTP2_FLAG_END_STREAM) and \
 *            cnghttp2.nghttp2_session_check_server_session(session):             # <<<<<<<<<<<<<<
 *             # Send RST_STREAM if remote is not closed yet
 *             if cnghttp2.nghttp2_session_get_stream_remote_close(
 */
    __pyx_t_8 = (nghttp2_session_check_server_session(__pyx_v_session) != 0);
    __pyx_t_9 = __pyx_t_8;
    __pyx_L6_bool_binop_done:;

    /* "nghttp2.pyx":497
 *         http2._start_settings_timer()
 *     elif frame.hd.type == cnghttp2.NGHTTP2_HEADERS:
 *         if (frame.hd.flags & cnghttp2.NGHTTP2_FLAG_END_STREAM) and \             # <<<<<<<<<<<<<<
 *            cnghttp2.nghttp2_session_check_server_session(session):
 *             # Send RST_STREAM if remote is not closed yet
 */
    if (__pyx_t_9) {

      /* "nghttp2.pyx":501
 *             # Send RST_STREAM if remote is not closed yet
 *             if cnghttp2.nghttp2_session_get_stream_remote_close(
 *                     session, frame.hd.stream_id) == 0:             # <<<<<<<<<<<<<<
 *                 http2._rst_stream(frame.hd.stream_id, cnghttp2.NGHTTP2_NO_ERROR)
 * 
 */
      __pyx_t_9 = ((nghttp2_session_get_stream_remote_close(__pyx_v_session, __pyx_v_frame->hd.stream_id) == 0) != 0);

      /* "nghttp2.pyx":500
 *            cnghttp2.nghttp2_session_check_server_session(session):
 *             # Send RST_STREAM if remote is not closed yet
 *             if cnghttp2.nghttp2_session_get_stream_remote_close(             # <<<<<<<<<<<<<<
 *                     session, frame.hd.stream_id) == 0:
 *                 http2._rst_stream(frame.hd.stream_id, cnghttp2.NGHTTP2_NO_ERROR)
 */
      if (__pyx_t_9) {

        /* "nghttp2.pyx":502
 *             if cnghttp2.nghttp2_session_get_stream_remote_close(
 *                     session, frame.hd.stream_id) == 0:
 *                 http2._rst_stream(frame.hd.stream_id, cnghttp2.NGHTTP2_NO_ERROR)             # <<<<<<<<<<<<<<
 * 
 * cdef int server_on_frame_not_send(cnghttp2.nghttp2_session *session,
 */
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_http2, __pyx_n_s_rst_stream); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 502, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_7 = __Pyx_PyInt_From_int32_t(__pyx_v_frame->hd.stream_id); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 502, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_4 = __Pyx_PyInt_From_nghttp2_error_code(NGHTTP2_NO_ERROR); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 502, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_2 = NULL;
        __pyx_t_6 = 0;
        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);
            __pyx_t_6 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_t_7, __pyx_t_4};
          __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 502, __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_4); __pyx_t_4 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_t_7, __pyx_t_4};
          __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 502, __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_4); __pyx_t_4 = 0;
        } else
        #endif
        {
          __pyx_t_5 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 502, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          if (__pyx_t_2) {
            __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); __pyx_t_2 = NULL;
          }
          __Pyx_GIVEREF(__pyx_t_7);
          PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_6, __pyx_t_7);
          __Pyx_GIVEREF(__pyx_t_4);
          PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_6, __pyx_t_4);
          __pyx_t_7 = 0;
          __pyx_t_4 = 0;
          __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 502, __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;

        /* "nghttp2.pyx":500
 *            cnghttp2.nghttp2_session_check_server_session(session):
 *             # Send RST_STREAM if remote is not closed yet
 *             if cnghttp2.nghttp2_session_get_stream_remote_close(             # <<<<<<<<<<<<<<
 *                     session, frame.hd.stream_id) == 0:
 *                 http2._rst_stream(frame.hd.stream_id, cnghttp2.NGHTTP2_NO_ERROR)
 */
      }

      /* "nghttp2.pyx":497
 *         http2._start_settings_timer()
 *     elif frame.hd.type == cnghttp2.NGHTTP2_HEADERS:
 *         if (frame.hd.flags & cnghttp2.NGHTTP2_FLAG_END_STREAM) and \             # <<<<<<<<<<<<<<
 *            cnghttp2.nghttp2_session_check_server_session(session):
 *             # Send RST_STREAM if remote is not closed yet
 */
    }

    /* "nghttp2.pyx":496
 *             return 0
 *         http2._start_settings_timer()
 *     elif frame.hd.type == cnghttp2.NGHTTP2_HEADERS:             # <<<<<<<<<<<<<<
 *         if (frame.hd.flags & cnghttp2.NGHTTP2_FLAG_END_STREAM) and \
 *            cnghttp2.nghttp2_session_check_server_session(session):
 */
    break;
    default: break;
  }

  /* "nghttp2.pyx":478
 *     return 0
 * 
 * cdef int server_on_frame_send(cnghttp2.nghttp2_session *session,             # <<<<<<<<<<<<<<
 *                               const cnghttp2.nghttp2_frame *frame,
 *                               void *user_data):
 */

  /* 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_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_WriteUnraisable("nghttp2.server_on_frame_send", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_http2);
  __Pyx_XDECREF(__pyx_v_handler);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":504
 *                 http2._rst_stream(frame.hd.stream_id, cnghttp2.NGHTTP2_NO_ERROR)
 * 
 * cdef int server_on_frame_not_send(cnghttp2.nghttp2_session *session,             # <<<<<<<<<<<<<<
 *                                   const cnghttp2.nghttp2_frame *frame,
 *                                   int lib_error_code,
 */

static int __pyx_f_7nghttp2_server_on_frame_not_send(nghttp2_session *__pyx_v_session, nghttp2_frame const *__pyx_v_frame, CYTHON_UNUSED int __pyx_v_lib_error_code, void *__pyx_v_user_data) {
  PyObject *__pyx_v_http2 = 0;
  PyObject *__pyx_v_handler = NULL;
  int __pyx_r;
  __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;
  int __pyx_t_8;
  int __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("server_on_frame_not_send", 0);

  /* "nghttp2.pyx":508
 *                                   int lib_error_code,
 *                                   void *user_data):
 *     cdef http2 = <_HTTP2SessionCore>user_data             # <<<<<<<<<<<<<<
 *     logging.debug('server_on_frame_not_send, type:%s, stream_id:%s', frame.hd.type, frame.hd.stream_id)
 * 
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_user_data);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_http2 = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "nghttp2.pyx":509
 *                                   void *user_data):
 *     cdef http2 = <_HTTP2SessionCore>user_data
 *     logging.debug('server_on_frame_not_send, type:%s, stream_id:%s', frame.hd.type, frame.hd.stream_id)             # <<<<<<<<<<<<<<
 * 
 *     if frame.hd.type == cnghttp2.NGHTTP2_PUSH_PROMISE:
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_logging); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 509, __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(0, 509, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyInt_From_uint8_t(__pyx_v_frame->hd.type); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 509, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyInt_From_int32_t(__pyx_v_frame->hd.stream_id); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 509, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(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[4] = {__pyx_t_5, __pyx_kp_s_server_on_frame_not_send_type_s, __pyx_t_2, __pyx_t_4};
    __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(0, 509, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __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[4] = {__pyx_t_5, __pyx_kp_s_server_on_frame_not_send_type_s, __pyx_t_2, __pyx_t_4};
    __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(0, 509, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 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(0, 509, __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_INCREF(__pyx_kp_s_server_on_frame_not_send_type_s);
    __Pyx_GIVEREF(__pyx_kp_s_server_on_frame_not_send_type_s);
    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_kp_s_server_on_frame_not_send_type_s);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_6, __pyx_t_4);
    __pyx_t_2 = 0;
    __pyx_t_4 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 509, __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;

  /* "nghttp2.pyx":511
 *     logging.debug('server_on_frame_not_send, type:%s, stream_id:%s', frame.hd.type, frame.hd.stream_id)
 * 
 *     if frame.hd.type == cnghttp2.NGHTTP2_PUSH_PROMISE:             # <<<<<<<<<<<<<<
 *         # We have to remove handler here. Without this, it is not
 *         # removed until session is terminated.
 */
  __pyx_t_8 = ((__pyx_v_frame->hd.type == NGHTTP2_PUSH_PROMISE) != 0);
  if (__pyx_t_8) {

    /* "nghttp2.pyx":515
 *         # removed until session is terminated.
 *         handler = _get_stream_user_data\
 *                   (session, frame.push_promise.promised_stream_id)             # <<<<<<<<<<<<<<
 *         if not handler:
 *             return 0
 */
    __pyx_t_1 = __pyx_f_7nghttp2__get_stream_user_data(__pyx_v_session, __pyx_v_frame->push_promise.promised_stream_id); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 515, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_handler = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "nghttp2.pyx":516
 *         handler = _get_stream_user_data\
 *                   (session, frame.push_promise.promised_stream_id)
 *         if not handler:             # <<<<<<<<<<<<<<
 *             return 0
 *         http2._remove_handler(handler)
 */
    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_handler); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 516, __pyx_L1_error)
    __pyx_t_9 = ((!__pyx_t_8) != 0);
    if (__pyx_t_9) {

      /* "nghttp2.pyx":517
 *                   (session, frame.push_promise.promised_stream_id)
 *         if not handler:
 *             return 0             # <<<<<<<<<<<<<<
 *         http2._remove_handler(handler)
 * 
 */
      __pyx_r = 0;
      goto __pyx_L0;

      /* "nghttp2.pyx":516
 *         handler = _get_stream_user_data\
 *                   (session, frame.push_promise.promised_stream_id)
 *         if not handler:             # <<<<<<<<<<<<<<
 *             return 0
 *         http2._remove_handler(handler)
 */
    }

    /* "nghttp2.pyx":518
 *         if not handler:
 *             return 0
 *         http2._remove_handler(handler)             # <<<<<<<<<<<<<<
 * 
 * cdef int on_stream_close(cnghttp2.nghttp2_session *session,
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_http2, __pyx_n_s_remove_handler); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 518, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_7 = NULL;
    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_1 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_7, __pyx_v_handler) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_handler);
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 518, __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;

    /* "nghttp2.pyx":511
 *     logging.debug('server_on_frame_not_send, type:%s, stream_id:%s', frame.hd.type, frame.hd.stream_id)
 * 
 *     if frame.hd.type == cnghttp2.NGHTTP2_PUSH_PROMISE:             # <<<<<<<<<<<<<<
 *         # We have to remove handler here. Without this, it is not
 *         # removed until session is terminated.
 */
  }

  /* "nghttp2.pyx":504
 *                 http2._rst_stream(frame.hd.stream_id, cnghttp2.NGHTTP2_NO_ERROR)
 * 
 * cdef int server_on_frame_not_send(cnghttp2.nghttp2_session *session,             # <<<<<<<<<<<<<<
 *                                   const cnghttp2.nghttp2_frame *frame,
 *                                   int lib_error_code,
 */

  /* 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_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_WriteUnraisable("nghttp2.server_on_frame_not_send", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_http2);
  __Pyx_XDECREF(__pyx_v_handler);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":520
 *         http2._remove_handler(handler)
 * 
 * cdef int on_stream_close(cnghttp2.nghttp2_session *session,             # <<<<<<<<<<<<<<
 *                                 int32_t stream_id,
 *                                 uint32_t error_code,
 */

static int __pyx_f_7nghttp2_on_stream_close(nghttp2_session *__pyx_v_session, int32_t __pyx_v_stream_id, uint32_t __pyx_v_error_code, void *__pyx_v_user_data) {
  PyObject *__pyx_v_http2 = 0;
  PyObject *__pyx_v_handler = NULL;
  int __pyx_r;
  __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;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("on_stream_close", 0);

  /* "nghttp2.pyx":524
 *                                 uint32_t error_code,
 *                                 void *user_data):
 *     cdef http2 = <_HTTP2SessionCoreBase>user_data             # <<<<<<<<<<<<<<
 *     logging.debug('on_stream_close, stream_id:%s', stream_id)
 * 
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_user_data);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_http2 = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "nghttp2.pyx":525
 *                                 void *user_data):
 *     cdef http2 = <_HTTP2SessionCoreBase>user_data
 *     logging.debug('on_stream_close, stream_id:%s', stream_id)             # <<<<<<<<<<<<<<
 * 
 *     handler = _get_stream_user_data(session, stream_id)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_logging); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 525, __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(0, 525, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyInt_From_int32_t(__pyx_v_stream_id); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 525, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __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_kp_s_on_stream_close_stream_id_s, __pyx_t_2};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 525, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 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_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_kp_s_on_stream_close_stream_id_s, __pyx_t_2};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 525, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else
  #endif
  {
    __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 525, __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_kp_s_on_stream_close_stream_id_s);
    __Pyx_GIVEREF(__pyx_kp_s_on_stream_close_stream_id_s);
    PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_kp_s_on_stream_close_stream_id_s);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 525, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "nghttp2.pyx":527
 *     logging.debug('on_stream_close, stream_id:%s', stream_id)
 * 
 *     handler = _get_stream_user_data(session, stream_id)             # <<<<<<<<<<<<<<
 *     if not handler:
 *         return 0
 */
  __pyx_t_1 = __pyx_f_7nghttp2__get_stream_user_data(__pyx_v_session, __pyx_v_stream_id); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 527, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_handler = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "nghttp2.pyx":528
 * 
 *     handler = _get_stream_user_data(session, stream_id)
 *     if not handler:             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_handler); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 528, __pyx_L1_error)
  __pyx_t_8 = ((!__pyx_t_7) != 0);
  if (__pyx_t_8) {

    /* "nghttp2.pyx":529
 *     handler = _get_stream_user_data(session, stream_id)
 *     if not handler:
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     try:
 */
    __pyx_r = 0;
    goto __pyx_L0;

    /* "nghttp2.pyx":528
 * 
 *     handler = _get_stream_user_data(session, stream_id)
 *     if not handler:             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */
  }

  /* "nghttp2.pyx":531
 *         return 0
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         handler.on_close(error_code)
 *     except:
 */
  {
    __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:*/ {

      /* "nghttp2.pyx":532
 * 
 *     try:
 *         handler.on_close(error_code)             # <<<<<<<<<<<<<<
 *     except:
 *         sys.stderr.write(traceback.format_exc())
 */
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_handler, __pyx_n_s_on_close); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 532, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_6 = __Pyx_PyInt_From_uint32_t(__pyx_v_error_code); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 532, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_6);
      __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);
        }
      }
      __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_6);
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 532, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "nghttp2.pyx":531
 *         return 0
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         handler.on_close(error_code)
 *     except:
 */
    }
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
    goto __pyx_L9_try_end;
    __pyx_L4_error:;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "nghttp2.pyx":533
 *     try:
 *         handler.on_close(error_code)
 *     except:             # <<<<<<<<<<<<<<
 *         sys.stderr.write(traceback.format_exc())
 * 
 */
    /*except:*/ {
      __Pyx_AddTraceback("nghttp2.on_stream_close", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_3, &__pyx_t_6) < 0) __PYX_ERR(0, 533, __pyx_L6_except_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_6);

      /* "nghttp2.pyx":534
 *         handler.on_close(error_code)
 *     except:
 *         sys.stderr.write(traceback.format_exc())             # <<<<<<<<<<<<<<
 * 
 *     http2._remove_handler(handler)
 */
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_sys); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 534, __pyx_L6_except_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_stderr); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 534, __pyx_L6_except_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_write); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 534, __pyx_L6_except_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_traceback); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 534, __pyx_L6_except_error)
      __Pyx_GOTREF(__pyx_t_13);
      __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_format_exc); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 534, __pyx_L6_except_error)
      __Pyx_GOTREF(__pyx_t_14);
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __pyx_t_13 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_14))) {
        __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_14);
        if (likely(__pyx_t_13)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
          __Pyx_INCREF(__pyx_t_13);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_14, function);
        }
      }
      __pyx_t_12 = (__pyx_t_13) ? __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_t_13) : __Pyx_PyObject_CallNoArg(__pyx_t_14);
      __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
      if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 534, __pyx_L6_except_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      __pyx_t_14 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_14)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_14);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
        }
      }
      __pyx_t_2 = (__pyx_t_14) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_14, __pyx_t_12) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_12);
      __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 534, __pyx_L6_except_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L5_exception_handled;
    }
    __pyx_L6_except_error:;

    /* "nghttp2.pyx":531
 *         return 0
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         handler.on_close(error_code)
 *     except:
 */
    __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_L5_exception_handled:;
    __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);
    __pyx_L9_try_end:;
  }

  /* "nghttp2.pyx":536
 *         sys.stderr.write(traceback.format_exc())
 * 
 *     http2._remove_handler(handler)             # <<<<<<<<<<<<<<
 * 
 *     return 0
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_http2, __pyx_n_s_remove_handler); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 536, __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);
    }
  }
  __pyx_t_6 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_1, __pyx_v_handler) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_handler);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 536, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "nghttp2.pyx":538
 *     http2._remove_handler(handler)
 * 
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef ssize_t data_source_read(cnghttp2.nghttp2_session *session,
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "nghttp2.pyx":520
 *         http2._remove_handler(handler)
 * 
 * cdef int on_stream_close(cnghttp2.nghttp2_session *session,             # <<<<<<<<<<<<<<
 *                                 int32_t stream_id,
 *                                 uint32_t error_code,
 */

  /* 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_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_WriteUnraisable("nghttp2.on_stream_close", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_http2);
  __Pyx_XDECREF(__pyx_v_handler);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":540
 *     return 0
 * 
 * cdef ssize_t data_source_read(cnghttp2.nghttp2_session *session,             # <<<<<<<<<<<<<<
 *                               int32_t stream_id,
 *                               uint8_t *buf, size_t length,
 */

static Py_ssize_t __pyx_f_7nghttp2_data_source_read(nghttp2_session *__pyx_v_session, int32_t __pyx_v_stream_id, uint8_t *__pyx_v_buf, size_t __pyx_v_length, uint32_t *__pyx_v_data_flags, nghttp2_data_source *__pyx_v_source, void *__pyx_v_user_data) {
  PyObject *__pyx_v_http2 = 0;
  PyObject *__pyx_v_generator = NULL;
  PyObject *__pyx_v_data = NULL;
  PyObject *__pyx_v_flag = NULL;
  Py_ssize_t __pyx_v_nread;
  Py_ssize_t __pyx_r;
  __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)(PyObject *);
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_t_13;
  int __pyx_t_14;
  char const *__pyx_t_15;
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  PyObject *__pyx_t_18 = NULL;
  Py_ssize_t __pyx_t_19;
  int __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  uint8_t *__pyx_t_22;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("data_source_read", 0);

  /* "nghttp2.pyx":546
 *                               cnghttp2.nghttp2_data_source *source,
 *                               void *user_data):
 *     cdef http2 = <_HTTP2SessionCoreBase>user_data             # <<<<<<<<<<<<<<
 *     generator = <object>source.ptr
 * 
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_user_data);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_http2 = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "nghttp2.pyx":547
 *                               void *user_data):
 *     cdef http2 = <_HTTP2SessionCoreBase>user_data
 *     generator = <object>source.ptr             # <<<<<<<<<<<<<<
 * 
 *     http2.enter_callback()
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_source->ptr);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_generator = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "nghttp2.pyx":549
 *     generator = <object>source.ptr
 * 
 *     http2.enter_callback()             # <<<<<<<<<<<<<<
 *     try:
 *         data, flag = generator(length)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_http2, __pyx_n_s_enter_callback); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 549, __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);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 549, __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;

  /* "nghttp2.pyx":550
 * 
 *     http2.enter_callback()
 *     try:             # <<<<<<<<<<<<<<
 *         data, flag = generator(length)
 *     except:
 */
  /*try:*/ {
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_6);
      /*try:*/ {

        /* "nghttp2.pyx":551
 *     http2.enter_callback()
 *     try:
 *         data, flag = generator(length)             # <<<<<<<<<<<<<<
 *     except:
 *         sys.stderr.write(traceback.format_exc())
 */
        __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_length); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 551, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_INCREF(__pyx_v_generator);
        __pyx_t_3 = __pyx_v_generator; __pyx_t_7 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(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_1 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_7, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2);
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 551, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
          PyObject* sequence = __pyx_t_1;
          Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
          if (unlikely(size != 2)) {
            if (size > 2) __Pyx_RaiseTooManyValuesError(2);
            else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
            __PYX_ERR(0, 551, __pyx_L6_error)
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          if (likely(PyTuple_CheckExact(sequence))) {
            __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
            __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); 
          } else {
            __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
            __pyx_t_2 = PyList_GET_ITEM(sequence, 1); 
          }
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_2);
          #else
          __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 551, __pyx_L6_error)
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 551, __pyx_L6_error)
          __Pyx_GOTREF(__pyx_t_2);
          #endif
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        } else {
          Py_ssize_t index = -1;
          __pyx_t_7 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 551, __pyx_L6_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
          index = 0; __pyx_t_3 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_3)) goto __pyx_L12_unpacking_failed;
          __Pyx_GOTREF(__pyx_t_3);
          index = 1; __pyx_t_2 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_2)) goto __pyx_L12_unpacking_failed;
          __Pyx_GOTREF(__pyx_t_2);
          if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) __PYX_ERR(0, 551, __pyx_L6_error)
          __pyx_t_8 = NULL;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          goto __pyx_L13_unpacking_done;
          __pyx_L12_unpacking_failed:;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __pyx_t_8 = NULL;
          if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
          __PYX_ERR(0, 551, __pyx_L6_error)
          __pyx_L13_unpacking_done:;
        }
        __pyx_v_data = __pyx_t_3;
        __pyx_t_3 = 0;
        __pyx_v_flag = __pyx_t_2;
        __pyx_t_2 = 0;

        /* "nghttp2.pyx":550
 * 
 *     http2.enter_callback()
 *     try:             # <<<<<<<<<<<<<<
 *         data, flag = generator(length)
 *     except:
 */
      }
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L11_try_end;
      __pyx_L6_error:;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "nghttp2.pyx":552
 *     try:
 *         data, flag = generator(length)
 *     except:             # <<<<<<<<<<<<<<
 *         sys.stderr.write(traceback.format_exc())
 *         return cnghttp2.NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE;
 */
      /*except:*/ {
        __Pyx_AddTraceback("nghttp2.data_source_read", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3) < 0) __PYX_ERR(0, 552, __pyx_L8_except_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_GOTREF(__pyx_t_3);

        /* "nghttp2.pyx":553
 *         data, flag = generator(length)
 *     except:
 *         sys.stderr.write(traceback.format_exc())             # <<<<<<<<<<<<<<
 *         return cnghttp2.NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE;
 *     finally:
 */
        __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_sys); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 553, __pyx_L8_except_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_stderr); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 553, __pyx_L8_except_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_write); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 553, __pyx_L8_except_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_traceback); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 553, __pyx_L8_except_error)
        __Pyx_GOTREF(__pyx_t_11);
        __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_format_exc); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 553, __pyx_L8_except_error)
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __pyx_t_11 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_12))) {
          __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_12);
          if (likely(__pyx_t_11)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
            __Pyx_INCREF(__pyx_t_11);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_12, function);
          }
        }
        __pyx_t_10 = (__pyx_t_11) ? __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_t_11) : __Pyx_PyObject_CallNoArg(__pyx_t_12);
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 553, __pyx_L8_except_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        __pyx_t_12 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) {
          __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_9);
          if (likely(__pyx_t_12)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
            __Pyx_INCREF(__pyx_t_12);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_9, function);
          }
        }
        __pyx_t_7 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_12, __pyx_t_10) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_10);
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 553, __pyx_L8_except_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

        /* "nghttp2.pyx":554
 *     except:
 *         sys.stderr.write(traceback.format_exc())
 *         return cnghttp2.NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE;             # <<<<<<<<<<<<<<
 *     finally:
 *         http2.leave_callback()
 */
        __pyx_r = NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE;
        __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_L9_except_return;
      }
      __pyx_L8_except_error:;

      /* "nghttp2.pyx":550
 * 
 *     http2.enter_callback()
 *     try:             # <<<<<<<<<<<<<<
 *         data, flag = generator(length)
 *     except:
 */
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
      goto __pyx_L4_error;
      __pyx_L9_except_return:;
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
      goto __pyx_L3_return;
      __pyx_L11_try_end:;
    }
  }

  /* "nghttp2.pyx":556
 *         return cnghttp2.NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE;
 *     finally:
 *         http2.leave_callback()             # <<<<<<<<<<<<<<
 * 
 *     if flag == DATA_DEFERRED:
 */
  /*finally:*/ {
    /*normal exit:*/{
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_http2, __pyx_n_s_leave_callback); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 556, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __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);
        }
      }
      __pyx_t_3 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 556, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      goto __pyx_L5;
    }
    __pyx_L4_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_6 = 0; __pyx_t_5 = 0; __pyx_t_4 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_16, &__pyx_t_17, &__pyx_t_18);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_6, &__pyx_t_5, &__pyx_t_4) < 0)) __Pyx_ErrFetch(&__pyx_t_6, &__pyx_t_5, &__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_16);
      __Pyx_XGOTREF(__pyx_t_17);
      __Pyx_XGOTREF(__pyx_t_18);
      __pyx_t_13 = __pyx_lineno; __pyx_t_14 = __pyx_clineno; __pyx_t_15 = __pyx_filename;
      {
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_http2, __pyx_n_s_leave_callback); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 556, __pyx_L17_error)
        __Pyx_GOTREF(__pyx_t_2);
        __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);
          }
        }
        __pyx_t_3 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 556, __pyx_L17_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      }
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_16);
        __Pyx_XGIVEREF(__pyx_t_17);
        __Pyx_XGIVEREF(__pyx_t_18);
        __Pyx_ExceptionReset(__pyx_t_16, __pyx_t_17, __pyx_t_18);
      }
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_ErrRestore(__pyx_t_6, __pyx_t_5, __pyx_t_4);
      __pyx_t_6 = 0; __pyx_t_5 = 0; __pyx_t_4 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0;
      __pyx_lineno = __pyx_t_13; __pyx_clineno = __pyx_t_14; __pyx_filename = __pyx_t_15;
      goto __pyx_L1_error;
      __pyx_L17_error:;
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_16);
        __Pyx_XGIVEREF(__pyx_t_17);
        __Pyx_XGIVEREF(__pyx_t_18);
        __Pyx_ExceptionReset(__pyx_t_16, __pyx_t_17, __pyx_t_18);
      }
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0;
      goto __pyx_L1_error;
    }
    __pyx_L3_return: {
      __pyx_t_19 = __pyx_r;
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_http2, __pyx_n_s_leave_callback); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 556, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __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);
        }
      }
      __pyx_t_3 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 556, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_r = __pyx_t_19;
      goto __pyx_L0;
    }
    __pyx_L5:;
  }

  /* "nghttp2.pyx":558
 *         http2.leave_callback()
 * 
 *     if flag == DATA_DEFERRED:             # <<<<<<<<<<<<<<
 *         return cnghttp2.NGHTTP2_ERR_DEFERRED
 * 
 */
  if (unlikely(!__pyx_v_flag)) { __Pyx_RaiseUnboundLocalError("flag"); __PYX_ERR(0, 558, __pyx_L1_error) }
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_DATA_DEFERRED); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 558, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyObject_RichCompare(__pyx_v_flag, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 558, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_20 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_20 < 0)) __PYX_ERR(0, 558, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_20) {

    /* "nghttp2.pyx":559
 * 
 *     if flag == DATA_DEFERRED:
 *         return cnghttp2.NGHTTP2_ERR_DEFERRED             # <<<<<<<<<<<<<<
 * 
 *     if data:
 */
    __pyx_r = NGHTTP2_ERR_DEFERRED;
    goto __pyx_L0;

    /* "nghttp2.pyx":558
 *         http2.leave_callback()
 * 
 *     if flag == DATA_DEFERRED:             # <<<<<<<<<<<<<<
 *         return cnghttp2.NGHTTP2_ERR_DEFERRED
 * 
 */
  }

  /* "nghttp2.pyx":561
 *         return cnghttp2.NGHTTP2_ERR_DEFERRED
 * 
 *     if data:             # <<<<<<<<<<<<<<
 *         nread = len(data)
 *         memcpy(buf, <uint8_t*>data, nread)
 */
  if (unlikely(!__pyx_v_data)) { __Pyx_RaiseUnboundLocalError("data"); __PYX_ERR(0, 561, __pyx_L1_error) }
  __pyx_t_20 = __Pyx_PyObject_IsTrue(__pyx_v_data); if (unlikely(__pyx_t_20 < 0)) __PYX_ERR(0, 561, __pyx_L1_error)
  if (__pyx_t_20) {

    /* "nghttp2.pyx":562
 * 
 *     if data:
 *         nread = len(data)             # <<<<<<<<<<<<<<
 *         memcpy(buf, <uint8_t*>data, nread)
 *     else:
 */
    if (unlikely(!__pyx_v_data)) { __Pyx_RaiseUnboundLocalError("data"); __PYX_ERR(0, 562, __pyx_L1_error) }
    __pyx_t_21 = PyObject_Length(__pyx_v_data); if (unlikely(__pyx_t_21 == ((Py_ssize_t)-1))) __PYX_ERR(0, 562, __pyx_L1_error)
    __pyx_v_nread = __pyx_t_21;

    /* "nghttp2.pyx":563
 *     if data:
 *         nread = len(data)
 *         memcpy(buf, <uint8_t*>data, nread)             # <<<<<<<<<<<<<<
 *     else:
 *         nread = 0
 */
    if (unlikely(!__pyx_v_data)) { __Pyx_RaiseUnboundLocalError("data"); __PYX_ERR(0, 563, __pyx_L1_error) }
    __pyx_t_22 = __Pyx_PyObject_AsWritableUString(__pyx_v_data); if (unlikely((!__pyx_t_22) && PyErr_Occurred())) __PYX_ERR(0, 563, __pyx_L1_error)
    (void)(memcpy(__pyx_v_buf, ((uint8_t *)__pyx_t_22), __pyx_v_nread));

    /* "nghttp2.pyx":561
 *         return cnghttp2.NGHTTP2_ERR_DEFERRED
 * 
 *     if data:             # <<<<<<<<<<<<<<
 *         nread = len(data)
 *         memcpy(buf, <uint8_t*>data, nread)
 */
    goto __pyx_L19;
  }

  /* "nghttp2.pyx":565
 *         memcpy(buf, <uint8_t*>data, nread)
 *     else:
 *         nread = 0             # <<<<<<<<<<<<<<
 * 
 *     if flag == DATA_EOF:
 */
  /*else*/ {
    __pyx_v_nread = 0;
  }
  __pyx_L19:;

  /* "nghttp2.pyx":567
 *         nread = 0
 * 
 *     if flag == DATA_EOF:             # <<<<<<<<<<<<<<
 *         data_flags[0] = cnghttp2.NGHTTP2_DATA_FLAG_EOF
 *         if cnghttp2.nghttp2_session_check_server_session(session):
 */
  if (unlikely(!__pyx_v_flag)) { __Pyx_RaiseUnboundLocalError("flag"); __PYX_ERR(0, 567, __pyx_L1_error) }
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_DATA_EOF); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 567, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_RichCompare(__pyx_v_flag, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 567, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_20 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_20 < 0)) __PYX_ERR(0, 567, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_20) {

    /* "nghttp2.pyx":568
 * 
 *     if flag == DATA_EOF:
 *         data_flags[0] = cnghttp2.NGHTTP2_DATA_FLAG_EOF             # <<<<<<<<<<<<<<
 *         if cnghttp2.nghttp2_session_check_server_session(session):
 *             # Send RST_STREAM if remote is not closed yet
 */
    (__pyx_v_data_flags[0]) = NGHTTP2_DATA_FLAG_EOF;

    /* "nghttp2.pyx":569
 *     if flag == DATA_EOF:
 *         data_flags[0] = cnghttp2.NGHTTP2_DATA_FLAG_EOF
 *         if cnghttp2.nghttp2_session_check_server_session(session):             # <<<<<<<<<<<<<<
 *             # Send RST_STREAM if remote is not closed yet
 *             if cnghttp2.nghttp2_session_get_stream_remote_close(
 */
    __pyx_t_20 = (nghttp2_session_check_server_session(__pyx_v_session) != 0);
    if (__pyx_t_20) {

      /* "nghttp2.pyx":572
 *             # Send RST_STREAM if remote is not closed yet
 *             if cnghttp2.nghttp2_session_get_stream_remote_close(
 *                     session, stream_id) == 0:             # <<<<<<<<<<<<<<
 *                 http2._rst_stream(stream_id, cnghttp2.NGHTTP2_NO_ERROR)
 *     elif flag != DATA_OK:
 */
      __pyx_t_20 = ((nghttp2_session_get_stream_remote_close(__pyx_v_session, __pyx_v_stream_id) == 0) != 0);

      /* "nghttp2.pyx":571
 *         if cnghttp2.nghttp2_session_check_server_session(session):
 *             # Send RST_STREAM if remote is not closed yet
 *             if cnghttp2.nghttp2_session_get_stream_remote_close(             # <<<<<<<<<<<<<<
 *                     session, stream_id) == 0:
 *                 http2._rst_stream(stream_id, cnghttp2.NGHTTP2_NO_ERROR)
 */
      if (__pyx_t_20) {

        /* "nghttp2.pyx":573
 *             if cnghttp2.nghttp2_session_get_stream_remote_close(
 *                     session, stream_id) == 0:
 *                 http2._rst_stream(stream_id, cnghttp2.NGHTTP2_NO_ERROR)             # <<<<<<<<<<<<<<
 *     elif flag != DATA_OK:
 *         return cnghttp2.NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE
 */
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_http2, __pyx_n_s_rst_stream); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 573, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_1 = __Pyx_PyInt_From_int32_t(__pyx_v_stream_id); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 573, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_7 = __Pyx_PyInt_From_nghttp2_error_code(NGHTTP2_NO_ERROR); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 573, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_9 = NULL;
        __pyx_t_14 = 0;
        if (CYTHON_UNPACK_METHODS && likely(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_14 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_2)) {
          PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_t_1, __pyx_t_7};
          __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_14, 2+__pyx_t_14); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 573, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 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[3] = {__pyx_t_9, __pyx_t_1, __pyx_t_7};
          __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_14, 2+__pyx_t_14); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 573, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        } else
        #endif
        {
          __pyx_t_10 = PyTuple_New(2+__pyx_t_14); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 573, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_10);
          if (__pyx_t_9) {
            __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_9); __pyx_t_9 = NULL;
          }
          __Pyx_GIVEREF(__pyx_t_1);
          PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_14, __pyx_t_1);
          __Pyx_GIVEREF(__pyx_t_7);
          PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_14, __pyx_t_7);
          __pyx_t_1 = 0;
          __pyx_t_7 = 0;
          __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_10, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 573, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        }
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

        /* "nghttp2.pyx":571
 *         if cnghttp2.nghttp2_session_check_server_session(session):
 *             # Send RST_STREAM if remote is not closed yet
 *             if cnghttp2.nghttp2_session_get_stream_remote_close(             # <<<<<<<<<<<<<<
 *                     session, stream_id) == 0:
 *                 http2._rst_stream(stream_id, cnghttp2.NGHTTP2_NO_ERROR)
 */
      }

      /* "nghttp2.pyx":569
 *     if flag == DATA_EOF:
 *         data_flags[0] = cnghttp2.NGHTTP2_DATA_FLAG_EOF
 *         if cnghttp2.nghttp2_session_check_server_session(session):             # <<<<<<<<<<<<<<
 *             # Send RST_STREAM if remote is not closed yet
 *             if cnghttp2.nghttp2_session_get_stream_remote_close(
 */
    }

    /* "nghttp2.pyx":567
 *         nread = 0
 * 
 *     if flag == DATA_EOF:             # <<<<<<<<<<<<<<
 *         data_flags[0] = cnghttp2.NGHTTP2_DATA_FLAG_EOF
 *         if cnghttp2.nghttp2_session_check_server_session(session):
 */
    goto __pyx_L20;
  }

  /* "nghttp2.pyx":574
 *                     session, stream_id) == 0:
 *                 http2._rst_stream(stream_id, cnghttp2.NGHTTP2_NO_ERROR)
 *     elif flag != DATA_OK:             # <<<<<<<<<<<<<<
 *         return cnghttp2.NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE
 * 
 */
  if (unlikely(!__pyx_v_flag)) { __Pyx_RaiseUnboundLocalError("flag"); __PYX_ERR(0, 574, __pyx_L1_error) }
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_DATA_OK); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 574, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyObject_RichCompare(__pyx_v_flag, __pyx_t_3, Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 574, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_20 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_20 < 0)) __PYX_ERR(0, 574, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_20) {

    /* "nghttp2.pyx":575
 *                 http2._rst_stream(stream_id, cnghttp2.NGHTTP2_NO_ERROR)
 *     elif flag != DATA_OK:
 *         return cnghttp2.NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE             # <<<<<<<<<<<<<<
 * 
 *     return nread
 */
    __pyx_r = NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE;
    goto __pyx_L0;

    /* "nghttp2.pyx":574
 *                     session, stream_id) == 0:
 *                 http2._rst_stream(stream_id, cnghttp2.NGHTTP2_NO_ERROR)
 *     elif flag != DATA_OK:             # <<<<<<<<<<<<<<
 *         return cnghttp2.NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE
 * 
 */
  }
  __pyx_L20:;

  /* "nghttp2.pyx":577
 *         return cnghttp2.NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE
 * 
 *     return nread             # <<<<<<<<<<<<<<
 * 
 * cdef int client_on_begin_headers(cnghttp2.nghttp2_session *session,
 */
  __pyx_r = __pyx_v_nread;
  goto __pyx_L0;

  /* "nghttp2.pyx":540
 *     return 0
 * 
 * cdef ssize_t data_source_read(cnghttp2.nghttp2_session *session,             # <<<<<<<<<<<<<<
 *                               int32_t stream_id,
 *                               uint8_t *buf, size_t length,
 */

  /* 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_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_WriteUnraisable("nghttp2.data_source_read", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_http2);
  __Pyx_XDECREF(__pyx_v_generator);
  __Pyx_XDECREF(__pyx_v_data);
  __Pyx_XDECREF(__pyx_v_flag);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":579
 *     return nread
 * 
 * cdef int client_on_begin_headers(cnghttp2.nghttp2_session *session,             # <<<<<<<<<<<<<<
 *                                  const cnghttp2.nghttp2_frame *frame,
 *                                  void *user_data):
 */

static int __pyx_f_7nghttp2_client_on_begin_headers(nghttp2_session *__pyx_v_session, nghttp2_frame const *__pyx_v_frame, void *__pyx_v_user_data) {
  PyObject *__pyx_v_http2 = 0;
  PyObject *__pyx_v_push_handler = NULL;
  int __pyx_r;
  __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;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("client_on_begin_headers", 0);

  /* "nghttp2.pyx":582
 *                                  const cnghttp2.nghttp2_frame *frame,
 *                                  void *user_data):
 *     cdef http2 = <_HTTP2ClientSessionCore>user_data             # <<<<<<<<<<<<<<
 * 
 *     if frame.hd.type == cnghttp2.NGHTTP2_PUSH_PROMISE:
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_user_data);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_http2 = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "nghttp2.pyx":584
 *     cdef http2 = <_HTTP2ClientSessionCore>user_data
 * 
 *     if frame.hd.type == cnghttp2.NGHTTP2_PUSH_PROMISE:             # <<<<<<<<<<<<<<
 *         # Generate a temporary handler until the headers are all received
 *         push_handler = BaseResponseHandler()
 */
  __pyx_t_2 = ((__pyx_v_frame->hd.type == NGHTTP2_PUSH_PROMISE) != 0);
  if (__pyx_t_2) {

    /* "nghttp2.pyx":586
 *     if frame.hd.type == cnghttp2.NGHTTP2_PUSH_PROMISE:
 *         # Generate a temporary handler until the headers are all received
 *         push_handler = BaseResponseHandler()             # <<<<<<<<<<<<<<
 *         http2._add_handler(push_handler, frame.push_promise.promised_stream_id)
 *         cnghttp2.nghttp2_session_set_stream_user_data(session, frame.push_promise.promised_stream_id,
 */
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_BaseResponseHandler); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 586, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __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);
      }
    }
    __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 586, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_push_handler = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "nghttp2.pyx":587
 *         # Generate a temporary handler until the headers are all received
 *         push_handler = BaseResponseHandler()
 *         http2._add_handler(push_handler, frame.push_promise.promised_stream_id)             # <<<<<<<<<<<<<<
 *         cnghttp2.nghttp2_session_set_stream_user_data(session, frame.push_promise.promised_stream_id,
 *                                                       <void*>push_handler)
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_http2, __pyx_n_s_add_handler); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 587, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyInt_From_int32_t(__pyx_v_frame->push_promise.promised_stream_id); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 587, __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_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_v_push_handler, __pyx_t_4};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 587, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 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[3] = {__pyx_t_5, __pyx_v_push_handler, __pyx_t_4};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 587, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __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(0, 587, __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_INCREF(__pyx_v_push_handler);
      __Pyx_GIVEREF(__pyx_v_push_handler);
      PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_v_push_handler);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 587, __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;

    /* "nghttp2.pyx":588
 *         push_handler = BaseResponseHandler()
 *         http2._add_handler(push_handler, frame.push_promise.promised_stream_id)
 *         cnghttp2.nghttp2_session_set_stream_user_data(session, frame.push_promise.promised_stream_id,             # <<<<<<<<<<<<<<
 *                                                       <void*>push_handler)
 * 
 */
    (void)(nghttp2_session_set_stream_user_data(__pyx_v_session, __pyx_v_frame->push_promise.promised_stream_id, ((void *)__pyx_v_push_handler)));

    /* "nghttp2.pyx":584
 *     cdef http2 = <_HTTP2ClientSessionCore>user_data
 * 
 *     if frame.hd.type == cnghttp2.NGHTTP2_PUSH_PROMISE:             # <<<<<<<<<<<<<<
 *         # Generate a temporary handler until the headers are all received
 *         push_handler = BaseResponseHandler()
 */
  }

  /* "nghttp2.pyx":591
 *                                                       <void*>push_handler)
 * 
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef int client_on_frame_recv(cnghttp2.nghttp2_session *session,
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "nghttp2.pyx":579
 *     return nread
 * 
 * cdef int client_on_begin_headers(cnghttp2.nghttp2_session *session,             # <<<<<<<<<<<<<<
 *                                  const cnghttp2.nghttp2_frame *frame,
 *                                  void *user_data):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_WriteUnraisable("nghttp2.client_on_begin_headers", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_http2);
  __Pyx_XDECREF(__pyx_v_push_handler);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":593
 *     return 0
 * 
 * cdef int client_on_frame_recv(cnghttp2.nghttp2_session *session,             # <<<<<<<<<<<<<<
 *                               const cnghttp2.nghttp2_frame *frame,
 *                               void *user_data):
 */

static int __pyx_f_7nghttp2_client_on_frame_recv(nghttp2_session *__pyx_v_session, nghttp2_frame const *__pyx_v_frame, void *__pyx_v_user_data) {
  PyObject *__pyx_v_http2 = 0;
  PyObject *__pyx_v_handler = NULL;
  PyObject *__pyx_v_push_handler = NULL;
  int __pyx_r;
  __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;
  int __pyx_t_8;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  int __pyx_t_15;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("client_on_frame_recv", 0);

  /* "nghttp2.pyx":596
 *                               const cnghttp2.nghttp2_frame *frame,
 *                               void *user_data):
 *     cdef http2 = <_HTTP2ClientSessionCore>user_data             # <<<<<<<<<<<<<<
 *     logging.debug('client_on_frame_recv, type:%s, stream_id:%s', frame.hd.type, frame.hd.stream_id)
 * 
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_user_data);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_http2 = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "nghttp2.pyx":597
 *                               void *user_data):
 *     cdef http2 = <_HTTP2ClientSessionCore>user_data
 *     logging.debug('client_on_frame_recv, type:%s, stream_id:%s', frame.hd.type, frame.hd.stream_id)             # <<<<<<<<<<<<<<
 * 
 *     if frame.hd.type == cnghttp2.NGHTTP2_DATA:
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_logging); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 597, __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(0, 597, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyInt_From_uint8_t(__pyx_v_frame->hd.type); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 597, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyInt_From_int32_t(__pyx_v_frame->hd.stream_id); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 597, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(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[4] = {__pyx_t_5, __pyx_kp_s_client_on_frame_recv_type_s_stre, __pyx_t_2, __pyx_t_4};
    __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(0, 597, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __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[4] = {__pyx_t_5, __pyx_kp_s_client_on_frame_recv_type_s_stre, __pyx_t_2, __pyx_t_4};
    __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(0, 597, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 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(0, 597, __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_INCREF(__pyx_kp_s_client_on_frame_recv_type_s_stre);
    __Pyx_GIVEREF(__pyx_kp_s_client_on_frame_recv_type_s_stre);
    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_kp_s_client_on_frame_recv_type_s_stre);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_6, __pyx_t_4);
    __pyx_t_2 = 0;
    __pyx_t_4 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 597, __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;

  /* "nghttp2.pyx":599
 *     logging.debug('client_on_frame_recv, type:%s, stream_id:%s', frame.hd.type, frame.hd.stream_id)
 * 
 *     if frame.hd.type == cnghttp2.NGHTTP2_DATA:             # <<<<<<<<<<<<<<
 *         if frame.hd.flags & cnghttp2.NGHTTP2_FLAG_END_STREAM:
 *             handler = _get_stream_user_data(session, frame.hd.stream_id)
 */
  switch (__pyx_v_frame->hd.type) {
    case NGHTTP2_DATA:

    /* "nghttp2.pyx":600
 * 
 *     if frame.hd.type == cnghttp2.NGHTTP2_DATA:
 *         if frame.hd.flags & cnghttp2.NGHTTP2_FLAG_END_STREAM:             # <<<<<<<<<<<<<<
 *             handler = _get_stream_user_data(session, frame.hd.stream_id)
 *             if not handler:
 */
    __pyx_t_8 = ((__pyx_v_frame->hd.flags & NGHTTP2_FLAG_END_STREAM) != 0);
    if (__pyx_t_8) {

      /* "nghttp2.pyx":601
 *     if frame.hd.type == cnghttp2.NGHTTP2_DATA:
 *         if frame.hd.flags & cnghttp2.NGHTTP2_FLAG_END_STREAM:
 *             handler = _get_stream_user_data(session, frame.hd.stream_id)             # <<<<<<<<<<<<<<
 *             if not handler:
 *                 return 0
 */
      __pyx_t_1 = __pyx_f_7nghttp2__get_stream_user_data(__pyx_v_session, __pyx_v_frame->hd.stream_id); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 601, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_v_handler = __pyx_t_1;
      __pyx_t_1 = 0;

      /* "nghttp2.pyx":602
 *         if frame.hd.flags & cnghttp2.NGHTTP2_FLAG_END_STREAM:
 *             handler = _get_stream_user_data(session, frame.hd.stream_id)
 *             if not handler:             # <<<<<<<<<<<<<<
 *                 return 0
 *             try:
 */
      __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_handler); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 602, __pyx_L1_error)
      __pyx_t_9 = ((!__pyx_t_8) != 0);
      if (__pyx_t_9) {

        /* "nghttp2.pyx":603
 *             handler = _get_stream_user_data(session, frame.hd.stream_id)
 *             if not handler:
 *                 return 0             # <<<<<<<<<<<<<<
 *             try:
 *                 handler.on_response_done()
 */
        __pyx_r = 0;
        goto __pyx_L0;

        /* "nghttp2.pyx":602
 *         if frame.hd.flags & cnghttp2.NGHTTP2_FLAG_END_STREAM:
 *             handler = _get_stream_user_data(session, frame.hd.stream_id)
 *             if not handler:             # <<<<<<<<<<<<<<
 *                 return 0
 *             try:
 */
      }

      /* "nghttp2.pyx":604
 *             if not handler:
 *                 return 0
 *             try:             # <<<<<<<<<<<<<<
 *                 handler.on_response_done()
 *             except:
 */
      {
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        __Pyx_ExceptionSave(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
        __Pyx_XGOTREF(__pyx_t_10);
        __Pyx_XGOTREF(__pyx_t_11);
        __Pyx_XGOTREF(__pyx_t_12);
        /*try:*/ {

          /* "nghttp2.pyx":605
 *                 return 0
 *             try:
 *                 handler.on_response_done()             # <<<<<<<<<<<<<<
 *             except:
 *                 sys.stderr.write(traceback.format_exc())
 */
          __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_handler, __pyx_n_s_on_response_done); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 605, __pyx_L5_error)
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_7 = NULL;
          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_1 = (__pyx_t_7) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_7) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
          if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 605, __pyx_L5_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

          /* "nghttp2.pyx":604
 *             if not handler:
 *                 return 0
 *             try:             # <<<<<<<<<<<<<<
 *                 handler.on_response_done()
 *             except:
 */
        }
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
        goto __pyx_L10_try_end;
        __pyx_L5_error:;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;

        /* "nghttp2.pyx":606
 *             try:
 *                 handler.on_response_done()
 *             except:             # <<<<<<<<<<<<<<
 *                 sys.stderr.write(traceback.format_exc())
 *                 return http2._rst_stream(frame.hd.stream_id)
 */
        /*except:*/ {
          __Pyx_AddTraceback("nghttp2.client_on_frame_recv", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_3, &__pyx_t_7) < 0) __PYX_ERR(0, 606, __pyx_L7_except_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_GOTREF(__pyx_t_7);

          /* "nghttp2.pyx":607
 *                 handler.on_response_done()
 *             except:
 *                 sys.stderr.write(traceback.format_exc())             # <<<<<<<<<<<<<<
 *                 return http2._rst_stream(frame.hd.stream_id)
 *     elif frame.hd.type == cnghttp2.NGHTTP2_HEADERS:
 */
          __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_sys); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 607, __pyx_L7_except_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_stderr); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 607, __pyx_L7_except_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 607, __pyx_L7_except_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_traceback); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 607, __pyx_L7_except_error)
          __Pyx_GOTREF(__pyx_t_13);
          __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_format_exc); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 607, __pyx_L7_except_error)
          __Pyx_GOTREF(__pyx_t_14);
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          __pyx_t_13 = NULL;
          if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_14))) {
            __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_14);
            if (likely(__pyx_t_13)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
              __Pyx_INCREF(__pyx_t_13);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_14, function);
            }
          }
          __pyx_t_5 = (__pyx_t_13) ? __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_t_13) : __Pyx_PyObject_CallNoArg(__pyx_t_14);
          __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
          if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 607, __pyx_L7_except_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
          __pyx_t_14 = NULL;
          if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
            __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_2);
            if (likely(__pyx_t_14)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
              __Pyx_INCREF(__pyx_t_14);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_2, function);
            }
          }
          __pyx_t_4 = (__pyx_t_14) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_14, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5);
          __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 607, __pyx_L7_except_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

          /* "nghttp2.pyx":608
 *             except:
 *                 sys.stderr.write(traceback.format_exc())
 *                 return http2._rst_stream(frame.hd.stream_id)             # <<<<<<<<<<<<<<
 *     elif frame.hd.type == cnghttp2.NGHTTP2_HEADERS:
 *         if frame.headers.cat == cnghttp2.NGHTTP2_HCAT_RESPONSE or frame.headers.cat == cnghttp2.NGHTTP2_HCAT_PUSH_RESPONSE:
 */
          __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_http2, __pyx_n_s_rst_stream); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 608, __pyx_L7_except_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_5 = __Pyx_PyInt_From_int32_t(__pyx_v_frame->hd.stream_id); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 608, __pyx_L7_except_error)
          __Pyx_GOTREF(__pyx_t_5);
          __pyx_t_14 = NULL;
          if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
            __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_2);
            if (likely(__pyx_t_14)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
              __Pyx_INCREF(__pyx_t_14);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_2, function);
            }
          }
          __pyx_t_4 = (__pyx_t_14) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_14, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5);
          __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 608, __pyx_L7_except_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 608, __pyx_L7_except_error)
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __pyx_r = __pyx_t_6;
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          goto __pyx_L8_except_return;
        }
        __pyx_L7_except_error:;

        /* "nghttp2.pyx":604
 *             if not handler:
 *                 return 0
 *             try:             # <<<<<<<<<<<<<<
 *                 handler.on_response_done()
 *             except:
 */
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
        goto __pyx_L1_error;
        __pyx_L8_except_return:;
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
        goto __pyx_L0;
        __pyx_L10_try_end:;
      }

      /* "nghttp2.pyx":600
 * 
 *     if frame.hd.type == cnghttp2.NGHTTP2_DATA:
 *         if frame.hd.flags & cnghttp2.NGHTTP2_FLAG_END_STREAM:             # <<<<<<<<<<<<<<
 *             handler = _get_stream_user_data(session, frame.hd.stream_id)
 *             if not handler:
 */
    }

    /* "nghttp2.pyx":599
 *     logging.debug('client_on_frame_recv, type:%s, stream_id:%s', frame.hd.type, frame.hd.stream_id)
 * 
 *     if frame.hd.type == cnghttp2.NGHTTP2_DATA:             # <<<<<<<<<<<<<<
 *         if frame.hd.flags & cnghttp2.NGHTTP2_FLAG_END_STREAM:
 *             handler = _get_stream_user_data(session, frame.hd.stream_id)
 */
    break;
    case NGHTTP2_HEADERS:

    /* "nghttp2.pyx":610
 *                 return http2._rst_stream(frame.hd.stream_id)
 *     elif frame.hd.type == cnghttp2.NGHTTP2_HEADERS:
 *         if frame.headers.cat == cnghttp2.NGHTTP2_HCAT_RESPONSE or frame.headers.cat == cnghttp2.NGHTTP2_HCAT_PUSH_RESPONSE:             # <<<<<<<<<<<<<<
 *             handler = _get_stream_user_data(session, frame.hd.stream_id)
 * 
 */
    switch (__pyx_v_frame->headers.cat) {
      case NGHTTP2_HCAT_RESPONSE:
      case NGHTTP2_HCAT_PUSH_RESPONSE:

      /* "nghttp2.pyx":611
 *     elif frame.hd.type == cnghttp2.NGHTTP2_HEADERS:
 *         if frame.headers.cat == cnghttp2.NGHTTP2_HCAT_RESPONSE or frame.headers.cat == cnghttp2.NGHTTP2_HCAT_PUSH_RESPONSE:
 *             handler = _get_stream_user_data(session, frame.hd.stream_id)             # <<<<<<<<<<<<<<
 * 
 *             if not handler:
 */
      __pyx_t_7 = __pyx_f_7nghttp2__get_stream_user_data(__pyx_v_session, __pyx_v_frame->hd.stream_id); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 611, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_v_handler = __pyx_t_7;
      __pyx_t_7 = 0;

      /* "nghttp2.pyx":613
 *             handler = _get_stream_user_data(session, frame.hd.stream_id)
 * 
 *             if not handler:             # <<<<<<<<<<<<<<
 *                 return 0
 *             # TODO handle 1xx non-final response
 */
      __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_handler); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 613, __pyx_L1_error)
      __pyx_t_8 = ((!__pyx_t_9) != 0);
      if (__pyx_t_8) {

        /* "nghttp2.pyx":614
 * 
 *             if not handler:
 *                 return 0             # <<<<<<<<<<<<<<
 *             # TODO handle 1xx non-final response
 *             if handler.cookies:
 */
        __pyx_r = 0;
        goto __pyx_L0;

        /* "nghttp2.pyx":613
 *             handler = _get_stream_user_data(session, frame.hd.stream_id)
 * 
 *             if not handler:             # <<<<<<<<<<<<<<
 *                 return 0
 *             # TODO handle 1xx non-final response
 */
      }

      /* "nghttp2.pyx":616
 *                 return 0
 *             # TODO handle 1xx non-final response
 *             if handler.cookies:             # <<<<<<<<<<<<<<
 *                 handler.headers.append((b'cookie',
 *                                         b'; '.join(handler.cookies)))
 */
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_handler, __pyx_n_s_cookies); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 616, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 616, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (__pyx_t_8) {

        /* "nghttp2.pyx":617
 *             # TODO handle 1xx non-final response
 *             if handler.cookies:
 *                 handler.headers.append((b'cookie',             # <<<<<<<<<<<<<<
 *                                         b'; '.join(handler.cookies)))
 *                 handler.cookies = None
 */
        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_handler, __pyx_n_s_headers); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 617, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);

        /* "nghttp2.pyx":618
 *             if handler.cookies:
 *                 handler.headers.append((b'cookie',
 *                                         b'; '.join(handler.cookies)))             # <<<<<<<<<<<<<<
 *                 handler.cookies = None
 *             try:
 */
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_handler, __pyx_n_s_cookies); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 618, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_1 = __Pyx_PyBytes_Join(__pyx_kp_b__7, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 618, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

        /* "nghttp2.pyx":617
 *             # TODO handle 1xx non-final response
 *             if handler.cookies:
 *                 handler.headers.append((b'cookie',             # <<<<<<<<<<<<<<
 *                                         b'; '.join(handler.cookies)))
 *                 handler.cookies = None
 */
        __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 617, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_INCREF(__pyx_n_b_cookie);
        __Pyx_GIVEREF(__pyx_n_b_cookie);
        PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_n_b_cookie);
        __Pyx_GIVEREF(__pyx_t_1);
        PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
        __pyx_t_1 = 0;
        __pyx_t_15 = __Pyx_PyObject_Append(__pyx_t_7, __pyx_t_3); if (unlikely(__pyx_t_15 == ((int)-1))) __PYX_ERR(0, 617, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

        /* "nghttp2.pyx":619
 *                 handler.headers.append((b'cookie',
 *                                         b'; '.join(handler.cookies)))
 *                 handler.cookies = None             # <<<<<<<<<<<<<<
 *             try:
 *                 handler.on_headers()
 */
        if (__Pyx_PyObject_SetAttrStr(__pyx_v_handler, __pyx_n_s_cookies, Py_None) < 0) __PYX_ERR(0, 619, __pyx_L1_error)

        /* "nghttp2.pyx":616
 *                 return 0
 *             # TODO handle 1xx non-final response
 *             if handler.cookies:             # <<<<<<<<<<<<<<
 *                 handler.headers.append((b'cookie',
 *                                         b'; '.join(handler.cookies)))
 */
      }

      /* "nghttp2.pyx":620
 *                                         b'; '.join(handler.cookies)))
 *                 handler.cookies = None
 *             try:             # <<<<<<<<<<<<<<
 *                 handler.on_headers()
 *                 if frame.hd.flags & cnghttp2.NGHTTP2_FLAG_END_STREAM:
 */
      {
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        __Pyx_ExceptionSave(&__pyx_t_12, &__pyx_t_11, &__pyx_t_10);
        __Pyx_XGOTREF(__pyx_t_12);
        __Pyx_XGOTREF(__pyx_t_11);
        __Pyx_XGOTREF(__pyx_t_10);
        /*try:*/ {

          /* "nghttp2.pyx":621
 *                 handler.cookies = None
 *             try:
 *                 handler.on_headers()             # <<<<<<<<<<<<<<
 *                 if frame.hd.flags & cnghttp2.NGHTTP2_FLAG_END_STREAM:
 *                     handler.on_response_done()
 */
          __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_handler, __pyx_n_s_on_headers); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 621, __pyx_L15_error)
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_1 = NULL;
          if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
            __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_7);
            if (likely(__pyx_t_1)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
              __Pyx_INCREF(__pyx_t_1);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_7, function);
            }
          }
          __pyx_t_3 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_7);
          __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
          if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 621, __pyx_L15_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

          /* "nghttp2.pyx":622
 *             try:
 *                 handler.on_headers()
 *                 if frame.hd.flags & cnghttp2.NGHTTP2_FLAG_END_STREAM:             # <<<<<<<<<<<<<<
 *                     handler.on_response_done()
 *             except:
 */
          __pyx_t_8 = ((__pyx_v_frame->hd.flags & NGHTTP2_FLAG_END_STREAM) != 0);
          if (__pyx_t_8) {

            /* "nghttp2.pyx":623
 *                 handler.on_headers()
 *                 if frame.hd.flags & cnghttp2.NGHTTP2_FLAG_END_STREAM:
 *                     handler.on_response_done()             # <<<<<<<<<<<<<<
 *             except:
 *                 sys.stderr.write(traceback.format_exc())
 */
            __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_handler, __pyx_n_s_on_response_done); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 623, __pyx_L15_error)
            __Pyx_GOTREF(__pyx_t_7);
            __pyx_t_1 = NULL;
            if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
              __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_7);
              if (likely(__pyx_t_1)) {
                PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
                __Pyx_INCREF(__pyx_t_1);
                __Pyx_INCREF(function);
                __Pyx_DECREF_SET(__pyx_t_7, function);
              }
            }
            __pyx_t_3 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_7);
            __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
            if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 623, __pyx_L15_error)
            __Pyx_GOTREF(__pyx_t_3);
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

            /* "nghttp2.pyx":622
 *             try:
 *                 handler.on_headers()
 *                 if frame.hd.flags & cnghttp2.NGHTTP2_FLAG_END_STREAM:             # <<<<<<<<<<<<<<
 *                     handler.on_response_done()
 *             except:
 */
          }

          /* "nghttp2.pyx":620
 *                                         b'; '.join(handler.cookies)))
 *                 handler.cookies = None
 *             try:             # <<<<<<<<<<<<<<
 *                 handler.on_headers()
 *                 if frame.hd.flags & cnghttp2.NGHTTP2_FLAG_END_STREAM:
 */
        }
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        goto __pyx_L20_try_end;
        __pyx_L15_error:;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
        __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;

        /* "nghttp2.pyx":624
 *                 if frame.hd.flags & cnghttp2.NGHTTP2_FLAG_END_STREAM:
 *                     handler.on_response_done()
 *             except:             # <<<<<<<<<<<<<<
 *                 sys.stderr.write(traceback.format_exc())
 *                 return http2._rst_stream(frame.hd.stream_id)
 */
        /*except:*/ {
          __Pyx_AddTraceback("nghttp2.client_on_frame_recv", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_7, &__pyx_t_1) < 0) __PYX_ERR(0, 624, __pyx_L17_except_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_GOTREF(__pyx_t_1);

          /* "nghttp2.pyx":625
 *                     handler.on_response_done()
 *             except:
 *                 sys.stderr.write(traceback.format_exc())             # <<<<<<<<<<<<<<
 *                 return http2._rst_stream(frame.hd.stream_id)
 *     elif frame.hd.type == cnghttp2.NGHTTP2_SETTINGS:
 */
          __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_sys); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 625, __pyx_L17_except_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_stderr); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 625, __pyx_L17_except_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 625, __pyx_L17_except_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_n_s_traceback); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 625, __pyx_L17_except_error)
          __Pyx_GOTREF(__pyx_t_14);
          __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_format_exc); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 625, __pyx_L17_except_error)
          __Pyx_GOTREF(__pyx_t_13);
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
          __pyx_t_14 = NULL;
          if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_13))) {
            __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_13);
            if (likely(__pyx_t_14)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13);
              __Pyx_INCREF(__pyx_t_14);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_13, function);
            }
          }
          __pyx_t_5 = (__pyx_t_14) ? __Pyx_PyObject_CallOneArg(__pyx_t_13, __pyx_t_14) : __Pyx_PyObject_CallNoArg(__pyx_t_13);
          __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
          if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 625, __pyx_L17_except_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          __pyx_t_13 = NULL;
          if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
            __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_2);
            if (likely(__pyx_t_13)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
              __Pyx_INCREF(__pyx_t_13);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_2, function);
            }
          }
          __pyx_t_4 = (__pyx_t_13) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_13, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5);
          __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 625, __pyx_L17_except_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

          /* "nghttp2.pyx":626
 *             except:
 *                 sys.stderr.write(traceback.format_exc())
 *                 return http2._rst_stream(frame.hd.stream_id)             # <<<<<<<<<<<<<<
 *     elif frame.hd.type == cnghttp2.NGHTTP2_SETTINGS:
 *         if (frame.hd.flags & cnghttp2.NGHTTP2_FLAG_ACK):
 */
          __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_http2, __pyx_n_s_rst_stream); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 626, __pyx_L17_except_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_5 = __Pyx_PyInt_From_int32_t(__pyx_v_frame->hd.stream_id); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 626, __pyx_L17_except_error)
          __Pyx_GOTREF(__pyx_t_5);
          __pyx_t_13 = NULL;
          if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
            __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_2);
            if (likely(__pyx_t_13)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
              __Pyx_INCREF(__pyx_t_13);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_2, function);
            }
          }
          __pyx_t_4 = (__pyx_t_13) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_13, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5);
          __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 626, __pyx_L17_except_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 626, __pyx_L17_except_error)
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __pyx_r = __pyx_t_6;
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          goto __pyx_L18_except_return;
        }
        __pyx_L17_except_error:;

        /* "nghttp2.pyx":620
 *                                         b'; '.join(handler.cookies)))
 *                 handler.cookies = None
 *             try:             # <<<<<<<<<<<<<<
 *                 handler.on_headers()
 *                 if frame.hd.flags & cnghttp2.NGHTTP2_FLAG_END_STREAM:
 */
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_11, __pyx_t_10);
        goto __pyx_L1_error;
        __pyx_L18_except_return:;
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_11, __pyx_t_10);
        goto __pyx_L0;
        __pyx_L20_try_end:;
      }

      /* "nghttp2.pyx":610
 *                 return http2._rst_stream(frame.hd.stream_id)
 *     elif frame.hd.type == cnghttp2.NGHTTP2_HEADERS:
 *         if frame.headers.cat == cnghttp2.NGHTTP2_HCAT_RESPONSE or frame.headers.cat == cnghttp2.NGHTTP2_HCAT_PUSH_RESPONSE:             # <<<<<<<<<<<<<<
 *             handler = _get_stream_user_data(session, frame.hd.stream_id)
 * 
 */
      break;
      default: break;
    }

    /* "nghttp2.pyx":609
 *                 sys.stderr.write(traceback.format_exc())
 *                 return http2._rst_stream(frame.hd.stream_id)
 *     elif frame.hd.type == cnghttp2.NGHTTP2_HEADERS:             # <<<<<<<<<<<<<<
 *         if frame.headers.cat == cnghttp2.NGHTTP2_HCAT_RESPONSE or frame.headers.cat == cnghttp2.NGHTTP2_HCAT_PUSH_RESPONSE:
 *             handler = _get_stream_user_data(session, frame.hd.stream_id)
 */
    break;
    case NGHTTP2_SETTINGS:

    /* "nghttp2.pyx":628
 *                 return http2._rst_stream(frame.hd.stream_id)
 *     elif frame.hd.type == cnghttp2.NGHTTP2_SETTINGS:
 *         if (frame.hd.flags & cnghttp2.NGHTTP2_FLAG_ACK):             # <<<<<<<<<<<<<<
 *             http2._stop_settings_timer()
 *     elif frame.hd.type == cnghttp2.NGHTTP2_PUSH_PROMISE:
 */
    __pyx_t_8 = ((__pyx_v_frame->hd.flags & NGHTTP2_FLAG_ACK) != 0);
    if (__pyx_t_8) {

      /* "nghttp2.pyx":629
 *     elif frame.hd.type == cnghttp2.NGHTTP2_SETTINGS:
 *         if (frame.hd.flags & cnghttp2.NGHTTP2_FLAG_ACK):
 *             http2._stop_settings_timer()             # <<<<<<<<<<<<<<
 *     elif frame.hd.type == cnghttp2.NGHTTP2_PUSH_PROMISE:
 *         handler = _get_stream_user_data(session, frame.hd.stream_id)
 */
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_http2, __pyx_n_s_stop_settings_timer); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 629, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_3 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(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_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_7);
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 629, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "nghttp2.pyx":628
 *                 return http2._rst_stream(frame.hd.stream_id)
 *     elif frame.hd.type == cnghttp2.NGHTTP2_SETTINGS:
 *         if (frame.hd.flags & cnghttp2.NGHTTP2_FLAG_ACK):             # <<<<<<<<<<<<<<
 *             http2._stop_settings_timer()
 *     elif frame.hd.type == cnghttp2.NGHTTP2_PUSH_PROMISE:
 */
    }

    /* "nghttp2.pyx":627
 *                 sys.stderr.write(traceback.format_exc())
 *                 return http2._rst_stream(frame.hd.stream_id)
 *     elif frame.hd.type == cnghttp2.NGHTTP2_SETTINGS:             # <<<<<<<<<<<<<<
 *         if (frame.hd.flags & cnghttp2.NGHTTP2_FLAG_ACK):
 *             http2._stop_settings_timer()
 */
    break;
    case NGHTTP2_PUSH_PROMISE:

    /* "nghttp2.pyx":631
 *             http2._stop_settings_timer()
 *     elif frame.hd.type == cnghttp2.NGHTTP2_PUSH_PROMISE:
 *         handler = _get_stream_user_data(session, frame.hd.stream_id)             # <<<<<<<<<<<<<<
 *         if not handler:
 *             return 0
 */
    __pyx_t_1 = __pyx_f_7nghttp2__get_stream_user_data(__pyx_v_session, __pyx_v_frame->hd.stream_id); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 631, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_handler = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "nghttp2.pyx":632
 *     elif frame.hd.type == cnghttp2.NGHTTP2_PUSH_PROMISE:
 *         handler = _get_stream_user_data(session, frame.hd.stream_id)
 *         if not handler:             # <<<<<<<<<<<<<<
 *             return 0
 *         # Get the temporary push_handler which now should have all of the header data
 */
    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_handler); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 632, __pyx_L1_error)
    __pyx_t_9 = ((!__pyx_t_8) != 0);
    if (__pyx_t_9) {

      /* "nghttp2.pyx":633
 *         handler = _get_stream_user_data(session, frame.hd.stream_id)
 *         if not handler:
 *             return 0             # <<<<<<<<<<<<<<
 *         # Get the temporary push_handler which now should have all of the header data
 *         push_handler = _get_stream_user_data(session, frame.push_promise.promised_stream_id)
 */
      __pyx_r = 0;
      goto __pyx_L0;

      /* "nghttp2.pyx":632
 *     elif frame.hd.type == cnghttp2.NGHTTP2_PUSH_PROMISE:
 *         handler = _get_stream_user_data(session, frame.hd.stream_id)
 *         if not handler:             # <<<<<<<<<<<<<<
 *             return 0
 *         # Get the temporary push_handler which now should have all of the header data
 */
    }

    /* "nghttp2.pyx":635
 *             return 0
 *         # Get the temporary push_handler which now should have all of the header data
 *         push_handler = _get_stream_user_data(session, frame.push_promise.promised_stream_id)             # <<<<<<<<<<<<<<
 *         if not push_handler:
 *             return 0
 */
    __pyx_t_1 = __pyx_f_7nghttp2__get_stream_user_data(__pyx_v_session, __pyx_v_frame->push_promise.promised_stream_id); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 635, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_push_handler = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "nghttp2.pyx":636
 *         # Get the temporary push_handler which now should have all of the header data
 *         push_handler = _get_stream_user_data(session, frame.push_promise.promised_stream_id)
 *         if not push_handler:             # <<<<<<<<<<<<<<
 *             return 0
 *         # Remove the temporary handler
 */
    __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_push_handler); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 636, __pyx_L1_error)
    __pyx_t_8 = ((!__pyx_t_9) != 0);
    if (__pyx_t_8) {

      /* "nghttp2.pyx":637
 *         push_handler = _get_stream_user_data(session, frame.push_promise.promised_stream_id)
 *         if not push_handler:
 *             return 0             # <<<<<<<<<<<<<<
 *         # Remove the temporary handler
 *         http2._remove_handler(push_handler)
 */
      __pyx_r = 0;
      goto __pyx_L0;

      /* "nghttp2.pyx":636
 *         # Get the temporary push_handler which now should have all of the header data
 *         push_handler = _get_stream_user_data(session, frame.push_promise.promised_stream_id)
 *         if not push_handler:             # <<<<<<<<<<<<<<
 *             return 0
 *         # Remove the temporary handler
 */
    }

    /* "nghttp2.pyx":639
 *             return 0
 *         # Remove the temporary handler
 *         http2._remove_handler(push_handler)             # <<<<<<<<<<<<<<
 *         cnghttp2.nghttp2_session_set_stream_user_data(session, frame.push_promise.promised_stream_id,
 *                                                       <void*>NULL)
 */
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_http2, __pyx_n_s_remove_handler); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 639, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(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_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_3, __pyx_v_push_handler) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_push_handler);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 639, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "nghttp2.pyx":640
 *         # Remove the temporary handler
 *         http2._remove_handler(push_handler)
 *         cnghttp2.nghttp2_session_set_stream_user_data(session, frame.push_promise.promised_stream_id,             # <<<<<<<<<<<<<<
 *                                                       <void*>NULL)
 * 
 */
    (void)(nghttp2_session_set_stream_user_data(__pyx_v_session, __pyx_v_frame->push_promise.promised_stream_id, ((void *)NULL)));

    /* "nghttp2.pyx":643
 *                                                       <void*>NULL)
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             handler.on_push_promise(push_handler)
 *         except:
 */
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_12);
      /*try:*/ {

        /* "nghttp2.pyx":644
 * 
 *         try:
 *             handler.on_push_promise(push_handler)             # <<<<<<<<<<<<<<
 *         except:
 *             sys.stderr.write(traceback.format_exc())
 */
        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_handler, __pyx_n_s_on_push_promise); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 644, __pyx_L27_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_3 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(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_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_3, __pyx_v_push_handler) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_push_handler);
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 644, __pyx_L27_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

        /* "nghttp2.pyx":643
 *                                                       <void*>NULL)
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             handler.on_push_promise(push_handler)
 *         except:
 */
      }
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      goto __pyx_L32_try_end;
      __pyx_L27_error:;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "nghttp2.pyx":645
 *         try:
 *             handler.on_push_promise(push_handler)
 *         except:             # <<<<<<<<<<<<<<
 *             sys.stderr.write(traceback.format_exc())
 *             return http2._rst_stream(frame.hd.stream_id)
 */
      /*except:*/ {
        __Pyx_AddTraceback("nghttp2.client_on_frame_recv", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_7, &__pyx_t_3) < 0) __PYX_ERR(0, 645, __pyx_L29_except_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_GOTREF(__pyx_t_3);

        /* "nghttp2.pyx":646
 *             handler.on_push_promise(push_handler)
 *         except:
 *             sys.stderr.write(traceback.format_exc())             # <<<<<<<<<<<<<<
 *             return http2._rst_stream(frame.hd.stream_id)
 * 
 */
        __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_sys); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 646, __pyx_L29_except_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_stderr); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 646, __pyx_L29_except_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 646, __pyx_L29_except_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_traceback); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 646, __pyx_L29_except_error)
        __Pyx_GOTREF(__pyx_t_13);
        __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_format_exc); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 646, __pyx_L29_except_error)
        __Pyx_GOTREF(__pyx_t_14);
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        __pyx_t_13 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_14))) {
          __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_14);
          if (likely(__pyx_t_13)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
            __Pyx_INCREF(__pyx_t_13);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_14, function);
          }
        }
        __pyx_t_5 = (__pyx_t_13) ? __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_t_13) : __Pyx_PyObject_CallNoArg(__pyx_t_14);
        __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
        if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 646, __pyx_L29_except_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        __pyx_t_14 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
          __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_2);
          if (likely(__pyx_t_14)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
            __Pyx_INCREF(__pyx_t_14);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_2, function);
          }
        }
        __pyx_t_4 = (__pyx_t_14) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_14, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5);
        __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 646, __pyx_L29_except_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

        /* "nghttp2.pyx":647
 *         except:
 *             sys.stderr.write(traceback.format_exc())
 *             return http2._rst_stream(frame.hd.stream_id)             # <<<<<<<<<<<<<<
 * 
 *     return 0
 */
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_http2, __pyx_n_s_rst_stream); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 647, __pyx_L29_except_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_5 = __Pyx_PyInt_From_int32_t(__pyx_v_frame->hd.stream_id); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 647, __pyx_L29_except_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_14 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
          __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_2);
          if (likely(__pyx_t_14)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
            __Pyx_INCREF(__pyx_t_14);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_2, function);
          }
        }
        __pyx_t_4 = (__pyx_t_14) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_14, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5);
        __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 647, __pyx_L29_except_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 647, __pyx_L29_except_error)
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_r = __pyx_t_6;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        goto __pyx_L30_except_return;
      }
      __pyx_L29_except_error:;

      /* "nghttp2.pyx":643
 *                                                       <void*>NULL)
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             handler.on_push_promise(push_handler)
 *         except:
 */
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      goto __pyx_L1_error;
      __pyx_L30_except_return:;
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      goto __pyx_L0;
      __pyx_L32_try_end:;
    }

    /* "nghttp2.pyx":630
 *         if (frame.hd.flags & cnghttp2.NGHTTP2_FLAG_ACK):
 *             http2._stop_settings_timer()
 *     elif frame.hd.type == cnghttp2.NGHTTP2_PUSH_PROMISE:             # <<<<<<<<<<<<<<
 *         handler = _get_stream_user_data(session, frame.hd.stream_id)
 *         if not handler:
 */
    break;
    default: break;
  }

  /* "nghttp2.pyx":649
 *             return http2._rst_stream(frame.hd.stream_id)
 * 
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef int client_on_frame_send(cnghttp2.nghttp2_session *session,
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "nghttp2.pyx":593
 *     return 0
 * 
 * cdef int client_on_frame_recv(cnghttp2.nghttp2_session *session,             # <<<<<<<<<<<<<<
 *                               const cnghttp2.nghttp2_frame *frame,
 *                               void *user_data):
 */

  /* 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_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_WriteUnraisable("nghttp2.client_on_frame_recv", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_http2);
  __Pyx_XDECREF(__pyx_v_handler);
  __Pyx_XDECREF(__pyx_v_push_handler);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":651
 *     return 0
 * 
 * cdef int client_on_frame_send(cnghttp2.nghttp2_session *session,             # <<<<<<<<<<<<<<
 *                               const cnghttp2.nghttp2_frame *frame,
 *                               void *user_data):
 */

static int __pyx_f_7nghttp2_client_on_frame_send(CYTHON_UNUSED nghttp2_session *__pyx_v_session, nghttp2_frame const *__pyx_v_frame, void *__pyx_v_user_data) {
  PyObject *__pyx_v_http2 = 0;
  int __pyx_r;
  __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;
  int __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("client_on_frame_send", 0);

  /* "nghttp2.pyx":654
 *                               const cnghttp2.nghttp2_frame *frame,
 *                               void *user_data):
 *     cdef http2 = <_HTTP2ClientSessionCore>user_data             # <<<<<<<<<<<<<<
 *     logging.debug('client_on_frame_send, type:%s, stream_id:%s', frame.hd.type, frame.hd.stream_id)
 * 
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_user_data);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_http2 = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "nghttp2.pyx":655
 *                               void *user_data):
 *     cdef http2 = <_HTTP2ClientSessionCore>user_data
 *     logging.debug('client_on_frame_send, type:%s, stream_id:%s', frame.hd.type, frame.hd.stream_id)             # <<<<<<<<<<<<<<
 * 
 *     if frame.hd.type == cnghttp2.NGHTTP2_SETTINGS:
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_logging); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 655, __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(0, 655, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyInt_From_uint8_t(__pyx_v_frame->hd.type); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 655, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyInt_From_int32_t(__pyx_v_frame->hd.stream_id); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 655, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(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[4] = {__pyx_t_5, __pyx_kp_s_client_on_frame_send_type_s_stre, __pyx_t_2, __pyx_t_4};
    __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(0, 655, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __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[4] = {__pyx_t_5, __pyx_kp_s_client_on_frame_send_type_s_stre, __pyx_t_2, __pyx_t_4};
    __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(0, 655, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 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(0, 655, __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_INCREF(__pyx_kp_s_client_on_frame_send_type_s_stre);
    __Pyx_GIVEREF(__pyx_kp_s_client_on_frame_send_type_s_stre);
    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_kp_s_client_on_frame_send_type_s_stre);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_6, __pyx_t_4);
    __pyx_t_2 = 0;
    __pyx_t_4 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 655, __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;

  /* "nghttp2.pyx":657
 *     logging.debug('client_on_frame_send, type:%s, stream_id:%s', frame.hd.type, frame.hd.stream_id)
 * 
 *     if frame.hd.type == cnghttp2.NGHTTP2_SETTINGS:             # <<<<<<<<<<<<<<
 *         if (frame.hd.flags & cnghttp2.NGHTTP2_FLAG_ACK) != 0:
 *             return 0
 */
  __pyx_t_8 = ((__pyx_v_frame->hd.type == NGHTTP2_SETTINGS) != 0);
  if (__pyx_t_8) {

    /* "nghttp2.pyx":658
 * 
 *     if frame.hd.type == cnghttp2.NGHTTP2_SETTINGS:
 *         if (frame.hd.flags & cnghttp2.NGHTTP2_FLAG_ACK) != 0:             # <<<<<<<<<<<<<<
 *             return 0
 *         http2._start_settings_timer()
 */
    __pyx_t_8 = (((__pyx_v_frame->hd.flags & NGHTTP2_FLAG_ACK) != 0) != 0);
    if (__pyx_t_8) {

      /* "nghttp2.pyx":659
 *     if frame.hd.type == cnghttp2.NGHTTP2_SETTINGS:
 *         if (frame.hd.flags & cnghttp2.NGHTTP2_FLAG_ACK) != 0:
 *             return 0             # <<<<<<<<<<<<<<
 *         http2._start_settings_timer()
 * 
 */
      __pyx_r = 0;
      goto __pyx_L0;

      /* "nghttp2.pyx":658
 * 
 *     if frame.hd.type == cnghttp2.NGHTTP2_SETTINGS:
 *         if (frame.hd.flags & cnghttp2.NGHTTP2_FLAG_ACK) != 0:             # <<<<<<<<<<<<<<
 *             return 0
 *         http2._start_settings_timer()
 */
    }

    /* "nghttp2.pyx":660
 *         if (frame.hd.flags & cnghttp2.NGHTTP2_FLAG_ACK) != 0:
 *             return 0
 *         http2._start_settings_timer()             # <<<<<<<<<<<<<<
 * 
 * cdef class _HTTP2SessionCoreBase:
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_http2, __pyx_n_s_start_settings_timer); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 660, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_7 = NULL;
    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_1 = (__pyx_t_7) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_7) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 660, __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;

    /* "nghttp2.pyx":657
 *     logging.debug('client_on_frame_send, type:%s, stream_id:%s', frame.hd.type, frame.hd.stream_id)
 * 
 *     if frame.hd.type == cnghttp2.NGHTTP2_SETTINGS:             # <<<<<<<<<<<<<<
 *         if (frame.hd.flags & cnghttp2.NGHTTP2_FLAG_ACK) != 0:
 *             return 0
 */
  }

  /* "nghttp2.pyx":651
 *     return 0
 * 
 * cdef int client_on_frame_send(cnghttp2.nghttp2_session *session,             # <<<<<<<<<<<<<<
 *                               const cnghttp2.nghttp2_frame *frame,
 *                               void *user_data):
 */

  /* 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_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_WriteUnraisable("nghttp2.client_on_frame_send", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_http2);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":670
 *     cdef inside_callback
 * 
 *     def __cinit__(self, transport, handler_class=None):             # <<<<<<<<<<<<<<
 *         self.session = NULL
 *         self.transport = transport
 */

/* Python wrapper */
static int __pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_transport = 0;
  PyObject *__pyx_v_handler_class = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_transport,&__pyx_n_s_handler_class,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_transport)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_handler_class);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(0, 670, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_transport = values[0];
    __pyx_v_handler_class = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 670, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("nghttp2._HTTP2SessionCoreBase.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7nghttp2_21_HTTP2SessionCoreBase___cinit__(((struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *)__pyx_v_self), __pyx_v_transport, __pyx_v_handler_class);

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

static int __pyx_pf_7nghttp2_21_HTTP2SessionCoreBase___cinit__(struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *__pyx_v_self, PyObject *__pyx_v_transport, PyObject *__pyx_v_handler_class) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "nghttp2.pyx":671
 * 
 *     def __cinit__(self, transport, handler_class=None):
 *         self.session = NULL             # <<<<<<<<<<<<<<
 *         self.transport = transport
 *         self.handler_class = handler_class
 */
  __pyx_v_self->session = NULL;

  /* "nghttp2.pyx":672
 *     def __cinit__(self, transport, handler_class=None):
 *         self.session = NULL
 *         self.transport = transport             # <<<<<<<<<<<<<<
 *         self.handler_class = handler_class
 *         self.handlers = set()
 */
  __Pyx_INCREF(__pyx_v_transport);
  __Pyx_GIVEREF(__pyx_v_transport);
  __Pyx_GOTREF(__pyx_v_self->transport);
  __Pyx_DECREF(__pyx_v_self->transport);
  __pyx_v_self->transport = __pyx_v_transport;

  /* "nghttp2.pyx":673
 *         self.session = NULL
 *         self.transport = transport
 *         self.handler_class = handler_class             # <<<<<<<<<<<<<<
 *         self.handlers = set()
 *         self.settings_timer = None
 */
  __Pyx_INCREF(__pyx_v_handler_class);
  __Pyx_GIVEREF(__pyx_v_handler_class);
  __Pyx_GOTREF(__pyx_v_self->handler_class);
  __Pyx_DECREF(__pyx_v_self->handler_class);
  __pyx_v_self->handler_class = __pyx_v_handler_class;

  /* "nghttp2.pyx":674
 *         self.transport = transport
 *         self.handler_class = handler_class
 *         self.handlers = set()             # <<<<<<<<<<<<<<
 *         self.settings_timer = None
 *         self.inside_callback = False
 */
  __pyx_t_1 = PySet_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 674, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->handlers);
  __Pyx_DECREF(__pyx_v_self->handlers);
  __pyx_v_self->handlers = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "nghttp2.pyx":675
 *         self.handler_class = handler_class
 *         self.handlers = set()
 *         self.settings_timer = None             # <<<<<<<<<<<<<<
 *         self.inside_callback = False
 * 
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->settings_timer);
  __Pyx_DECREF(__pyx_v_self->settings_timer);
  __pyx_v_self->settings_timer = Py_None;

  /* "nghttp2.pyx":676
 *         self.handlers = set()
 *         self.settings_timer = None
 *         self.inside_callback = False             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
  __Pyx_INCREF(Py_False);
  __Pyx_GIVEREF(Py_False);
  __Pyx_GOTREF(__pyx_v_self->inside_callback);
  __Pyx_DECREF(__pyx_v_self->inside_callback);
  __pyx_v_self->inside_callback = Py_False;

  /* "nghttp2.pyx":670
 *     cdef inside_callback
 * 
 *     def __cinit__(self, transport, handler_class=None):             # <<<<<<<<<<<<<<
 *         self.session = NULL
 *         self.transport = transport
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("nghttp2._HTTP2SessionCoreBase.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":678
 *         self.inside_callback = False
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         cnghttp2.nghttp2_session_del(self.session)
 * 
 */

/* Python wrapper */
static void __pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_3__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_2__dealloc__(((struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *)__pyx_v_self));

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

static void __pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_2__dealloc__(struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "nghttp2.pyx":679
 * 
 *     def __dealloc__(self):
 *         cnghttp2.nghttp2_session_del(self.session)             # <<<<<<<<<<<<<<
 * 
 *     def data_received(self, data):
 */
  nghttp2_session_del(__pyx_v_self->session);

  /* "nghttp2.pyx":678
 *         self.inside_callback = False
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         cnghttp2.nghttp2_session_del(self.session)
 * 
 */

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

/* "nghttp2.pyx":681
 *         cnghttp2.nghttp2_session_del(self.session)
 * 
 *     def data_received(self, data):             # <<<<<<<<<<<<<<
 *         cdef ssize_t rv
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_5data_received(PyObject *__pyx_v_self, PyObject *__pyx_v_data); /*proto*/
static PyObject *__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_5data_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_7nghttp2_21_HTTP2SessionCoreBase_4data_received(((struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *)__pyx_v_self), ((PyObject *)__pyx_v_data));

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

static PyObject *__pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_4data_received(struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *__pyx_v_self, PyObject *__pyx_v_data) {
  Py_ssize_t __pyx_v_rv;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  uint8_t const *__pyx_t_1;
  Py_ssize_t __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("data_received", 0);

  /* "nghttp2.pyx":684
 *         cdef ssize_t rv
 * 
 *         rv = cnghttp2.nghttp2_session_mem_recv(self.session, data, len(data))             # <<<<<<<<<<<<<<
 *         if rv < 0:
 *             raise Exception('nghttp2_session_mem_recv failed: {}'.format\
 */
  __pyx_t_1 = __Pyx_PyObject_AsUString(__pyx_v_data); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) __PYX_ERR(0, 684, __pyx_L1_error)
  __pyx_t_2 = PyObject_Length(__pyx_v_data); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 684, __pyx_L1_error)
  __pyx_v_rv = nghttp2_session_mem_recv(__pyx_v_self->session, __pyx_t_1, __pyx_t_2);

  /* "nghttp2.pyx":685
 * 
 *         rv = cnghttp2.nghttp2_session_mem_recv(self.session, data, len(data))
 *         if rv < 0:             # <<<<<<<<<<<<<<
 *             raise Exception('nghttp2_session_mem_recv failed: {}'.format\
 *                             (_strerror(rv)))
 */
  __pyx_t_3 = ((__pyx_v_rv < 0) != 0);
  if (unlikely(__pyx_t_3)) {

    /* "nghttp2.pyx":686
 *         rv = cnghttp2.nghttp2_session_mem_recv(self.session, data, len(data))
 *         if rv < 0:
 *             raise Exception('nghttp2_session_mem_recv failed: {}'.format\             # <<<<<<<<<<<<<<
 *                             (_strerror(rv)))
 *         self.send_data()
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_nghttp2_session_mem_recv_failed, __pyx_n_s_format); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 686, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);

    /* "nghttp2.pyx":687
 *         if rv < 0:
 *             raise Exception('nghttp2_session_mem_recv failed: {}'.format\
 *                             (_strerror(rv)))             # <<<<<<<<<<<<<<
 *         self.send_data()
 * 
 */
    __pyx_t_6 = __pyx_f_7nghttp2__strerror(__pyx_v_rv); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 687, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    __pyx_t_4 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_7, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6);
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 687, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "nghttp2.pyx":686
 *         rv = cnghttp2.nghttp2_session_mem_recv(self.session, data, len(data))
 *         if rv < 0:
 *             raise Exception('nghttp2_session_mem_recv failed: {}'.format\             # <<<<<<<<<<<<<<
 *                             (_strerror(rv)))
 *         self.send_data()
 */
    __pyx_t_5 = __Pyx_PyObject_CallOneArg(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 686, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_Raise(__pyx_t_5, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __PYX_ERR(0, 686, __pyx_L1_error)

    /* "nghttp2.pyx":685
 * 
 *         rv = cnghttp2.nghttp2_session_mem_recv(self.session, data, len(data))
 *         if rv < 0:             # <<<<<<<<<<<<<<
 *             raise Exception('nghttp2_session_mem_recv failed: {}'.format\
 *                             (_strerror(rv)))
 */
  }

  /* "nghttp2.pyx":688
 *             raise Exception('nghttp2_session_mem_recv failed: {}'.format\
 *                             (_strerror(rv)))
 *         self.send_data()             # <<<<<<<<<<<<<<
 * 
 *     OUTBUF_MAX = 65535
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_send_data); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 688, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_5 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 688, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "nghttp2.pyx":681
 *         cnghttp2.nghttp2_session_del(self.session)
 * 
 *     def data_received(self, data):             # <<<<<<<<<<<<<<
 *         cdef ssize_t rv
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("nghttp2._HTTP2SessionCoreBase.data_received", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":693
 *     SETTINGS_TIMEOUT = 5.0
 * 
 *     def send_data(self):             # <<<<<<<<<<<<<<
 *         cdef ssize_t outbuflen
 *         cdef const uint8_t *outbuf
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_7send_data(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_7send_data(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("send_data (wrapper)", 0);
  __pyx_r = __pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_6send_data(((struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *)__pyx_v_self));

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

static PyObject *__pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_6send_data(struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *__pyx_v_self) {
  Py_ssize_t __pyx_v_outbuflen;
  uint8_t const *__pyx_v_outbuf;
  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;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("send_data", 0);

  /* "nghttp2.pyx":697
 *         cdef const uint8_t *outbuf
 * 
 *         while True:             # <<<<<<<<<<<<<<
 *             if self.transport.get_write_buffer_size() > self.OUTBUF_MAX:
 *                 break
 */
  while (1) {

    /* "nghttp2.pyx":698
 * 
 *         while True:
 *             if self.transport.get_write_buffer_size() > self.OUTBUF_MAX:             # <<<<<<<<<<<<<<
 *                 break
 *             outbuflen = cnghttp2.nghttp2_session_mem_send(self.session, &outbuf)
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->transport, __pyx_n_s_get_write_buffer_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 698, __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);
      }
    }
    __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 698, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_OUTBUF_MAX); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 698, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_GT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 698, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 698, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_4) {

      /* "nghttp2.pyx":699
 *         while True:
 *             if self.transport.get_write_buffer_size() > self.OUTBUF_MAX:
 *                 break             # <<<<<<<<<<<<<<
 *             outbuflen = cnghttp2.nghttp2_session_mem_send(self.session, &outbuf)
 *             if outbuflen == 0:
 */
      goto __pyx_L4_break;

      /* "nghttp2.pyx":698
 * 
 *         while True:
 *             if self.transport.get_write_buffer_size() > self.OUTBUF_MAX:             # <<<<<<<<<<<<<<
 *                 break
 *             outbuflen = cnghttp2.nghttp2_session_mem_send(self.session, &outbuf)
 */
    }

    /* "nghttp2.pyx":700
 *             if self.transport.get_write_buffer_size() > self.OUTBUF_MAX:
 *                 break
 *             outbuflen = cnghttp2.nghttp2_session_mem_send(self.session, &outbuf)             # <<<<<<<<<<<<<<
 *             if outbuflen == 0:
 *                 break
 */
    __pyx_v_outbuflen = nghttp2_session_mem_send(__pyx_v_self->session, (&__pyx_v_outbuf));

    /* "nghttp2.pyx":701
 *                 break
 *             outbuflen = cnghttp2.nghttp2_session_mem_send(self.session, &outbuf)
 *             if outbuflen == 0:             # <<<<<<<<<<<<<<
 *                 break
 *             if outbuflen < 0:
 */
    __pyx_t_4 = ((__pyx_v_outbuflen == 0) != 0);
    if (__pyx_t_4) {

      /* "nghttp2.pyx":702
 *             outbuflen = cnghttp2.nghttp2_session_mem_send(self.session, &outbuf)
 *             if outbuflen == 0:
 *                 break             # <<<<<<<<<<<<<<
 *             if outbuflen < 0:
 *                 raise Exception('nghttp2_session_mem_send failed: {}'.format\
 */
      goto __pyx_L4_break;

      /* "nghttp2.pyx":701
 *                 break
 *             outbuflen = cnghttp2.nghttp2_session_mem_send(self.session, &outbuf)
 *             if outbuflen == 0:             # <<<<<<<<<<<<<<
 *                 break
 *             if outbuflen < 0:
 */
    }

    /* "nghttp2.pyx":703
 *             if outbuflen == 0:
 *                 break
 *             if outbuflen < 0:             # <<<<<<<<<<<<<<
 *                 raise Exception('nghttp2_session_mem_send failed: {}'.format\
 *                                 (_strerror(outbuflen)))
 */
    __pyx_t_4 = ((__pyx_v_outbuflen < 0) != 0);
    if (unlikely(__pyx_t_4)) {

      /* "nghttp2.pyx":704
 *                 break
 *             if outbuflen < 0:
 *                 raise Exception('nghttp2_session_mem_send failed: {}'.format\             # <<<<<<<<<<<<<<
 *                                 (_strerror(outbuflen)))
 *             self.transport.write(outbuf[:outbuflen])
 */
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_nghttp2_session_mem_send_failed, __pyx_n_s_format); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 704, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);

      /* "nghttp2.pyx":705
 *             if outbuflen < 0:
 *                 raise Exception('nghttp2_session_mem_send failed: {}'.format\
 *                                 (_strerror(outbuflen)))             # <<<<<<<<<<<<<<
 *             self.transport.write(outbuf[:outbuflen])
 * 
 */
      __pyx_t_1 = __pyx_f_7nghttp2__strerror(__pyx_v_outbuflen); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 705, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_5 = NULL;
      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_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_1);
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 705, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "nghttp2.pyx":704
 *                 break
 *             if outbuflen < 0:
 *                 raise Exception('nghttp2_session_mem_send failed: {}'.format\             # <<<<<<<<<<<<<<
 *                                 (_strerror(outbuflen)))
 *             self.transport.write(outbuf[:outbuflen])
 */
      __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 704, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_Raise(__pyx_t_2, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(0, 704, __pyx_L1_error)

      /* "nghttp2.pyx":703
 *             if outbuflen == 0:
 *                 break
 *             if outbuflen < 0:             # <<<<<<<<<<<<<<
 *                 raise Exception('nghttp2_session_mem_send failed: {}'.format\
 *                                 (_strerror(outbuflen)))
 */
    }

    /* "nghttp2.pyx":706
 *                 raise Exception('nghttp2_session_mem_send failed: {}'.format\
 *                                 (_strerror(outbuflen)))
 *             self.transport.write(outbuf[:outbuflen])             # <<<<<<<<<<<<<<
 * 
 *         if self.transport.get_write_buffer_size() == 0 and \
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->transport, __pyx_n_s_write); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 706, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(((const char*)__pyx_v_outbuf) + 0, __pyx_v_outbuflen - 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 706, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = NULL;
    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_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_1);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 706, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __pyx_L4_break:;

  /* "nghttp2.pyx":708
 *             self.transport.write(outbuf[:outbuflen])
 * 
 *         if self.transport.get_write_buffer_size() == 0 and \             # <<<<<<<<<<<<<<
 *            cnghttp2.nghttp2_session_want_read(self.session) == 0 and \
 *            cnghttp2.nghttp2_session_want_write(self.session) == 0:
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->transport, __pyx_n_s_get_write_buffer_size); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 708, __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);
    }
  }
  __pyx_t_2 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 708, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyInt_EqObjC(__pyx_t_2, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 708, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 708, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_6) {
  } else {
    __pyx_t_4 = __pyx_t_6;
    goto __pyx_L9_bool_binop_done;
  }

  /* "nghttp2.pyx":709
 * 
 *         if self.transport.get_write_buffer_size() == 0 and \
 *            cnghttp2.nghttp2_session_want_read(self.session) == 0 and \             # <<<<<<<<<<<<<<
 *            cnghttp2.nghttp2_session_want_write(self.session) == 0:
 *             self.transport.close()
 */
  __pyx_t_6 = ((nghttp2_session_want_read(__pyx_v_self->session) == 0) != 0);
  if (__pyx_t_6) {
  } else {
    __pyx_t_4 = __pyx_t_6;
    goto __pyx_L9_bool_binop_done;
  }

  /* "nghttp2.pyx":710
 *         if self.transport.get_write_buffer_size() == 0 and \
 *            cnghttp2.nghttp2_session_want_read(self.session) == 0 and \
 *            cnghttp2.nghttp2_session_want_write(self.session) == 0:             # <<<<<<<<<<<<<<
 *             self.transport.close()
 * 
 */
  __pyx_t_6 = ((nghttp2_session_want_write(__pyx_v_self->session) == 0) != 0);
  __pyx_t_4 = __pyx_t_6;
  __pyx_L9_bool_binop_done:;

  /* "nghttp2.pyx":708
 *             self.transport.write(outbuf[:outbuflen])
 * 
 *         if self.transport.get_write_buffer_size() == 0 and \             # <<<<<<<<<<<<<<
 *            cnghttp2.nghttp2_session_want_read(self.session) == 0 and \
 *            cnghttp2.nghttp2_session_want_write(self.session) == 0:
 */
  if (__pyx_t_4) {

    /* "nghttp2.pyx":711
 *            cnghttp2.nghttp2_session_want_read(self.session) == 0 and \
 *            cnghttp2.nghttp2_session_want_write(self.session) == 0:
 *             self.transport.close()             # <<<<<<<<<<<<<<
 * 
 *     def resume(self, stream_id):
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->transport, __pyx_n_s_close); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 711, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __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);
      }
    }
    __pyx_t_3 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 711, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "nghttp2.pyx":708
 *             self.transport.write(outbuf[:outbuflen])
 * 
 *         if self.transport.get_write_buffer_size() == 0 and \             # <<<<<<<<<<<<<<
 *            cnghttp2.nghttp2_session_want_read(self.session) == 0 and \
 *            cnghttp2.nghttp2_session_want_write(self.session) == 0:
 */
  }

  /* "nghttp2.pyx":693
 *     SETTINGS_TIMEOUT = 5.0
 * 
 *     def send_data(self):             # <<<<<<<<<<<<<<
 *         cdef ssize_t outbuflen
 *         cdef const uint8_t *outbuf
 */

  /* 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_AddTraceback("nghttp2._HTTP2SessionCoreBase.send_data", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":713
 *             self.transport.close()
 * 
 *     def resume(self, stream_id):             # <<<<<<<<<<<<<<
 *         cnghttp2.nghttp2_session_resume_data(self.session, stream_id)
 *         if not self.inside_callback:
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_9resume(PyObject *__pyx_v_self, PyObject *__pyx_v_stream_id); /*proto*/
static PyObject *__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_9resume(PyObject *__pyx_v_self, PyObject *__pyx_v_stream_id) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("resume (wrapper)", 0);
  __pyx_r = __pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_8resume(((struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *)__pyx_v_self), ((PyObject *)__pyx_v_stream_id));

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

static PyObject *__pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_8resume(struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *__pyx_v_self, PyObject *__pyx_v_stream_id) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int32_t __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("resume", 0);

  /* "nghttp2.pyx":714
 * 
 *     def resume(self, stream_id):
 *         cnghttp2.nghttp2_session_resume_data(self.session, stream_id)             # <<<<<<<<<<<<<<
 *         if not self.inside_callback:
 *             self.send_data()
 */
  __pyx_t_1 = __Pyx_PyInt_As_int32_t(__pyx_v_stream_id); if (unlikely((__pyx_t_1 == ((int32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 714, __pyx_L1_error)
  (void)(nghttp2_session_resume_data(__pyx_v_self->session, __pyx_t_1));

  /* "nghttp2.pyx":715
 *     def resume(self, stream_id):
 *         cnghttp2.nghttp2_session_resume_data(self.session, stream_id)
 *         if not self.inside_callback:             # <<<<<<<<<<<<<<
 *             self.send_data()
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_self->inside_callback); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 715, __pyx_L1_error)
  __pyx_t_3 = ((!__pyx_t_2) != 0);
  if (__pyx_t_3) {

    /* "nghttp2.pyx":716
 *         cnghttp2.nghttp2_session_resume_data(self.session, stream_id)
 *         if not self.inside_callback:
 *             self.send_data()             # <<<<<<<<<<<<<<
 * 
 *     def enter_callback(self):
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_send_data); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 716, __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);
      }
    }
    __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 716, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "nghttp2.pyx":715
 *     def resume(self, stream_id):
 *         cnghttp2.nghttp2_session_resume_data(self.session, stream_id)
 *         if not self.inside_callback:             # <<<<<<<<<<<<<<
 *             self.send_data()
 * 
 */
  }

  /* "nghttp2.pyx":713
 *             self.transport.close()
 * 
 *     def resume(self, stream_id):             # <<<<<<<<<<<<<<
 *         cnghttp2.nghttp2_session_resume_data(self.session, stream_id)
 *         if not self.inside_callback:
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("nghttp2._HTTP2SessionCoreBase.resume", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":718
 *             self.send_data()
 * 
 *     def enter_callback(self):             # <<<<<<<<<<<<<<
 *         self.inside_callback = True
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_11enter_callback(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_11enter_callback(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("enter_callback (wrapper)", 0);
  __pyx_r = __pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_10enter_callback(((struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *)__pyx_v_self));

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

static PyObject *__pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_10enter_callback(struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("enter_callback", 0);

  /* "nghttp2.pyx":719
 * 
 *     def enter_callback(self):
 *         self.inside_callback = True             # <<<<<<<<<<<<<<
 * 
 *     def leave_callback(self):
 */
  __Pyx_INCREF(Py_True);
  __Pyx_GIVEREF(Py_True);
  __Pyx_GOTREF(__pyx_v_self->inside_callback);
  __Pyx_DECREF(__pyx_v_self->inside_callback);
  __pyx_v_self->inside_callback = Py_True;

  /* "nghttp2.pyx":718
 *             self.send_data()
 * 
 *     def enter_callback(self):             # <<<<<<<<<<<<<<
 *         self.inside_callback = True
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":721
 *         self.inside_callback = True
 * 
 *     def leave_callback(self):             # <<<<<<<<<<<<<<
 *         self.inside_callback = False
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_13leave_callback(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_13leave_callback(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("leave_callback (wrapper)", 0);
  __pyx_r = __pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_12leave_callback(((struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *)__pyx_v_self));

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

static PyObject *__pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_12leave_callback(struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("leave_callback", 0);

  /* "nghttp2.pyx":722
 * 
 *     def leave_callback(self):
 *         self.inside_callback = False             # <<<<<<<<<<<<<<
 * 
 *     def _make_handler(self, stream_id):
 */
  __Pyx_INCREF(Py_False);
  __Pyx_GIVEREF(Py_False);
  __Pyx_GOTREF(__pyx_v_self->inside_callback);
  __Pyx_DECREF(__pyx_v_self->inside_callback);
  __pyx_v_self->inside_callback = Py_False;

  /* "nghttp2.pyx":721
 *         self.inside_callback = True
 * 
 *     def leave_callback(self):             # <<<<<<<<<<<<<<
 *         self.inside_callback = False
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":724
 *         self.inside_callback = False
 * 
 *     def _make_handler(self, stream_id):             # <<<<<<<<<<<<<<
 *         logging.debug('_make_handler, stream_id:%s', stream_id)
 *         handler = self.handler_class(self, stream_id)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_15_make_handler(PyObject *__pyx_v_self, PyObject *__pyx_v_stream_id); /*proto*/
static PyObject *__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_15_make_handler(PyObject *__pyx_v_self, PyObject *__pyx_v_stream_id) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_make_handler (wrapper)", 0);
  __pyx_r = __pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_14_make_handler(((struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *)__pyx_v_self), ((PyObject *)__pyx_v_stream_id));

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

static PyObject *__pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_14_make_handler(struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *__pyx_v_self, PyObject *__pyx_v_stream_id) {
  PyObject *__pyx_v_handler = 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;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_make_handler", 0);

  /* "nghttp2.pyx":725
 * 
 *     def _make_handler(self, stream_id):
 *         logging.debug('_make_handler, stream_id:%s', stream_id)             # <<<<<<<<<<<<<<
 *         handler = self.handler_class(self, stream_id)
 *         self.handlers.add(handler)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_logging); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 725, __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(0, 725, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  __pyx_t_4 = 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_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_kp_s_make_handler_stream_id_s, __pyx_v_stream_id};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 725, __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[3] = {__pyx_t_2, __pyx_kp_s_make_handler_stream_id_s, __pyx_v_stream_id};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 725, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 725, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_2) {
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); __pyx_t_2 = NULL;
    }
    __Pyx_INCREF(__pyx_kp_s_make_handler_stream_id_s);
    __Pyx_GIVEREF(__pyx_kp_s_make_handler_stream_id_s);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_kp_s_make_handler_stream_id_s);
    __Pyx_INCREF(__pyx_v_stream_id);
    __Pyx_GIVEREF(__pyx_v_stream_id);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_stream_id);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 725, __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;

  /* "nghttp2.pyx":726
 *     def _make_handler(self, stream_id):
 *         logging.debug('_make_handler, stream_id:%s', stream_id)
 *         handler = self.handler_class(self, stream_id)             # <<<<<<<<<<<<<<
 *         self.handlers.add(handler)
 *         return handler
 */
  __Pyx_INCREF(__pyx_v_self->handler_class);
  __pyx_t_3 = __pyx_v_self->handler_class; __pyx_t_5 = NULL;
  __pyx_t_4 = 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_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_5, ((PyObject *)__pyx_v_self), __pyx_v_stream_id};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 726, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_5, ((PyObject *)__pyx_v_self), __pyx_v_stream_id};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 726, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_2 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 726, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (__pyx_t_5) {
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_5); __pyx_t_5 = NULL;
    }
    __Pyx_INCREF(((PyObject *)__pyx_v_self));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
    PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_4, ((PyObject *)__pyx_v_self));
    __Pyx_INCREF(__pyx_v_stream_id);
    __Pyx_GIVEREF(__pyx_v_stream_id);
    PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_4, __pyx_v_stream_id);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 726, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_handler = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "nghttp2.pyx":727
 *         logging.debug('_make_handler, stream_id:%s', stream_id)
 *         handler = self.handler_class(self, stream_id)
 *         self.handlers.add(handler)             # <<<<<<<<<<<<<<
 *         return handler
 * 
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->handlers, __pyx_n_s_add); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 727, __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);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_v_handler) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_handler);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 727, __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;

  /* "nghttp2.pyx":728
 *         handler = self.handler_class(self, stream_id)
 *         self.handlers.add(handler)
 *         return handler             # <<<<<<<<<<<<<<
 * 
 *     def _remove_handler(self, handler):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_handler);
  __pyx_r = __pyx_v_handler;
  goto __pyx_L0;

  /* "nghttp2.pyx":724
 *         self.inside_callback = False
 * 
 *     def _make_handler(self, stream_id):             # <<<<<<<<<<<<<<
 *         logging.debug('_make_handler, stream_id:%s', stream_id)
 *         handler = self.handler_class(self, stream_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_5);
  __Pyx_AddTraceback("nghttp2._HTTP2SessionCoreBase._make_handler", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_handler);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":730
 *         return handler
 * 
 *     def _remove_handler(self, handler):             # <<<<<<<<<<<<<<
 *         logging.debug('_remove_handler, stream_id:%s', handler.stream_id)
 *         self.handlers.remove(handler)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_17_remove_handler(PyObject *__pyx_v_self, PyObject *__pyx_v_handler); /*proto*/
static PyObject *__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_17_remove_handler(PyObject *__pyx_v_self, PyObject *__pyx_v_handler) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_remove_handler (wrapper)", 0);
  __pyx_r = __pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_16_remove_handler(((struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *)__pyx_v_self), ((PyObject *)__pyx_v_handler));

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

static PyObject *__pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_16_remove_handler(struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *__pyx_v_self, PyObject *__pyx_v_handler) {
  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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_remove_handler", 0);

  /* "nghttp2.pyx":731
 * 
 *     def _remove_handler(self, handler):
 *         logging.debug('_remove_handler, stream_id:%s', handler.stream_id)             # <<<<<<<<<<<<<<
 *         self.handlers.remove(handler)
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_logging); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 731, __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(0, 731, __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_handler, __pyx_n_s_stream_id); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 731, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __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_kp_s_remove_handler_stream_id_s, __pyx_t_2};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 731, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 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_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_kp_s_remove_handler_stream_id_s, __pyx_t_2};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 731, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else
  #endif
  {
    __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 731, __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_kp_s_remove_handler_stream_id_s);
    __Pyx_GIVEREF(__pyx_kp_s_remove_handler_stream_id_s);
    PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_kp_s_remove_handler_stream_id_s);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 731, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "nghttp2.pyx":732
 *     def _remove_handler(self, handler):
 *         logging.debug('_remove_handler, stream_id:%s', handler.stream_id)
 *         self.handlers.remove(handler)             # <<<<<<<<<<<<<<
 * 
 *     def _add_handler(self, handler, stream_id):
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->handlers, __pyx_n_s_remove); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 732, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_6 = NULL;
  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_1 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_6, __pyx_v_handler) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_handler);
  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 732, __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;

  /* "nghttp2.pyx":730
 *         return handler
 * 
 *     def _remove_handler(self, handler):             # <<<<<<<<<<<<<<
 *         logging.debug('_remove_handler, stream_id:%s', handler.stream_id)
 *         self.handlers.remove(handler)
 */

  /* 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_6);
  __Pyx_AddTraceback("nghttp2._HTTP2SessionCoreBase._remove_handler", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":734
 *         self.handlers.remove(handler)
 * 
 *     def _add_handler(self, handler, stream_id):             # <<<<<<<<<<<<<<
 *         logging.debug('_add_handler, stream_id:%s', stream_id)
 *         handler.stream_id = stream_id
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_19_add_handler(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_19_add_handler(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_handler = 0;
  PyObject *__pyx_v_stream_id = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_add_handler (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_handler,&__pyx_n_s_stream_id,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);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_handler)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_stream_id)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_add_handler", 1, 2, 2, 1); __PYX_ERR(0, 734, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_add_handler") < 0)) __PYX_ERR(0, 734, __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_handler = values[0];
    __pyx_v_stream_id = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_add_handler", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 734, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("nghttp2._HTTP2SessionCoreBase._add_handler", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_18_add_handler(((struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *)__pyx_v_self), __pyx_v_handler, __pyx_v_stream_id);

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

static PyObject *__pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_18_add_handler(struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *__pyx_v_self, PyObject *__pyx_v_handler, PyObject *__pyx_v_stream_id) {
  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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_add_handler", 0);

  /* "nghttp2.pyx":735
 * 
 *     def _add_handler(self, handler, stream_id):
 *         logging.debug('_add_handler, stream_id:%s', stream_id)             # <<<<<<<<<<<<<<
 *         handler.stream_id = stream_id
 *         handler.http2 = self
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_logging); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 735, __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(0, 735, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  __pyx_t_4 = 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_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_kp_s_add_handler_stream_id_s, __pyx_v_stream_id};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 735, __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[3] = {__pyx_t_2, __pyx_kp_s_add_handler_stream_id_s, __pyx_v_stream_id};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 735, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 735, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_2) {
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); __pyx_t_2 = NULL;
    }
    __Pyx_INCREF(__pyx_kp_s_add_handler_stream_id_s);
    __Pyx_GIVEREF(__pyx_kp_s_add_handler_stream_id_s);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_kp_s_add_handler_stream_id_s);
    __Pyx_INCREF(__pyx_v_stream_id);
    __Pyx_GIVEREF(__pyx_v_stream_id);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_stream_id);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 735, __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;

  /* "nghttp2.pyx":736
 *     def _add_handler(self, handler, stream_id):
 *         logging.debug('_add_handler, stream_id:%s', stream_id)
 *         handler.stream_id = stream_id             # <<<<<<<<<<<<<<
 *         handler.http2 = self
 *         handler.remote_address = self._get_remote_address()
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_handler, __pyx_n_s_stream_id, __pyx_v_stream_id) < 0) __PYX_ERR(0, 736, __pyx_L1_error)

  /* "nghttp2.pyx":737
 *         logging.debug('_add_handler, stream_id:%s', stream_id)
 *         handler.stream_id = stream_id
 *         handler.http2 = self             # <<<<<<<<<<<<<<
 *         handler.remote_address = self._get_remote_address()
 *         handler.client_certificate = self._get_client_certificate()
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_handler, __pyx_n_s_http2, ((PyObject *)__pyx_v_self)) < 0) __PYX_ERR(0, 737, __pyx_L1_error)

  /* "nghttp2.pyx":738
 *         handler.stream_id = stream_id
 *         handler.http2 = self
 *         handler.remote_address = self._get_remote_address()             # <<<<<<<<<<<<<<
 *         handler.client_certificate = self._get_client_certificate()
 *         self.handlers.add(handler)
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_remote_address); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 738, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = NULL;
  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_1 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 738, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_handler, __pyx_n_s_remote_address, __pyx_t_1) < 0) __PYX_ERR(0, 738, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "nghttp2.pyx":739
 *         handler.http2 = self
 *         handler.remote_address = self._get_remote_address()
 *         handler.client_certificate = self._get_client_certificate()             # <<<<<<<<<<<<<<
 *         self.handlers.add(handler)
 * 
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_client_certificate); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 739, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = NULL;
  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_1 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 739, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_handler, __pyx_n_s_client_certificate, __pyx_t_1) < 0) __PYX_ERR(0, 739, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "nghttp2.pyx":740
 *         handler.remote_address = self._get_remote_address()
 *         handler.client_certificate = self._get_client_certificate()
 *         self.handlers.add(handler)             # <<<<<<<<<<<<<<
 * 
 *     def _rst_stream(self, stream_id,
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->handlers, __pyx_n_s_add); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 740, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = NULL;
  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_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_v_handler) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_handler);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 740, __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;

  /* "nghttp2.pyx":734
 *         self.handlers.remove(handler)
 * 
 *     def _add_handler(self, handler, stream_id):             # <<<<<<<<<<<<<<
 *         logging.debug('_add_handler, stream_id:%s', stream_id)
 *         handler.stream_id = stream_id
 */

  /* 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_AddTraceback("nghttp2._HTTP2SessionCoreBase._add_handler", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":742
 *         self.handlers.add(handler)
 * 
 *     def _rst_stream(self, stream_id,             # <<<<<<<<<<<<<<
 *                    error_code=cnghttp2.NGHTTP2_INTERNAL_ERROR):
 *         cdef int rv
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_21_rst_stream(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_21_rst_stream(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_stream_id = 0;
  PyObject *__pyx_v_error_code = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_rst_stream (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_stream_id,&__pyx_n_s_error_code,0};
    PyObject* values[2] = {0,0};
    values[1] = __pyx_k__8;
    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);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_stream_id)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_error_code);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_rst_stream") < 0)) __PYX_ERR(0, 742, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_stream_id = values[0];
    __pyx_v_error_code = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_rst_stream", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 742, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("nghttp2._HTTP2SessionCoreBase._rst_stream", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_20_rst_stream(((struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *)__pyx_v_self), __pyx_v_stream_id, __pyx_v_error_code);

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

static PyObject *__pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_20_rst_stream(struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *__pyx_v_self, PyObject *__pyx_v_stream_id, PyObject *__pyx_v_error_code) {
  int __pyx_v_rv;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int32_t __pyx_t_1;
  uint32_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_rst_stream", 0);

  /* "nghttp2.pyx":748
 *         rv = cnghttp2.nghttp2_submit_rst_stream\
 *              (self.session, cnghttp2.NGHTTP2_FLAG_NONE,
 *               stream_id, error_code)             # <<<<<<<<<<<<<<
 * 
 *         return rv
 */
  __pyx_t_1 = __Pyx_PyInt_As_int32_t(__pyx_v_stream_id); if (unlikely((__pyx_t_1 == ((int32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 748, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyInt_As_uint32_t(__pyx_v_error_code); if (unlikely((__pyx_t_2 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 748, __pyx_L1_error)

  /* "nghttp2.pyx":747
 * 
 *         rv = cnghttp2.nghttp2_submit_rst_stream\
 *              (self.session, cnghttp2.NGHTTP2_FLAG_NONE,             # <<<<<<<<<<<<<<
 *               stream_id, error_code)
 * 
 */
  __pyx_v_rv = nghttp2_submit_rst_stream(__pyx_v_self->session, NGHTTP2_FLAG_NONE, __pyx_t_1, __pyx_t_2);

  /* "nghttp2.pyx":750
 *               stream_id, error_code)
 * 
 *         return rv             # <<<<<<<<<<<<<<
 * 
 *     def _get_remote_address(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_rv); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 750, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "nghttp2.pyx":742
 *         self.handlers.add(handler)
 * 
 *     def _rst_stream(self, stream_id,             # <<<<<<<<<<<<<<
 *                    error_code=cnghttp2.NGHTTP2_INTERNAL_ERROR):
 *         cdef int rv
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("nghttp2._HTTP2SessionCoreBase._rst_stream", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":752
 *         return rv
 * 
 *     def _get_remote_address(self):             # <<<<<<<<<<<<<<
 *         return self.transport.get_extra_info('peername')
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_23_get_remote_address(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_23_get_remote_address(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_get_remote_address (wrapper)", 0);
  __pyx_r = __pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_22_get_remote_address(((struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *)__pyx_v_self));

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

static PyObject *__pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_22_get_remote_address(struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_get_remote_address", 0);

  /* "nghttp2.pyx":753
 * 
 *     def _get_remote_address(self):
 *         return self.transport.get_extra_info('peername')             # <<<<<<<<<<<<<<
 * 
 *     def _get_client_certificate(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->transport, __pyx_n_s_get_extra_info); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 753, __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);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_n_s_peername) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_n_s_peername);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 753, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "nghttp2.pyx":752
 *         return rv
 * 
 *     def _get_remote_address(self):             # <<<<<<<<<<<<<<
 *         return self.transport.get_extra_info('peername')
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("nghttp2._HTTP2SessionCoreBase._get_remote_address", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":755
 *         return self.transport.get_extra_info('peername')
 * 
 *     def _get_client_certificate(self):             # <<<<<<<<<<<<<<
 *         sock = self.transport.get_extra_info('socket')
 *         try:
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_25_get_client_certificate(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_25_get_client_certificate(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_get_client_certificate (wrapper)", 0);
  __pyx_r = __pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_24_get_client_certificate(((struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *)__pyx_v_self));

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

static PyObject *__pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_24_get_client_certificate(struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *__pyx_v_self) {
  PyObject *__pyx_v_sock = 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;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_get_client_certificate", 0);

  /* "nghttp2.pyx":756
 * 
 *     def _get_client_certificate(self):
 *         sock = self.transport.get_extra_info('socket')             # <<<<<<<<<<<<<<
 *         try:
 *             return sock.getpeercert()
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->transport, __pyx_n_s_get_extra_info); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 756, __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);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_n_s_socket) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_n_s_socket);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 756, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_sock = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "nghttp2.pyx":757
 *     def _get_client_certificate(self):
 *         sock = self.transport.get_extra_info('socket')
 *         try:             # <<<<<<<<<<<<<<
 *             return sock.getpeercert()
 *         except AttributeError:
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6);
    __Pyx_XGOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_6);
    /*try:*/ {

      /* "nghttp2.pyx":758
 *         sock = self.transport.get_extra_info('socket')
 *         try:
 *             return sock.getpeercert()             # <<<<<<<<<<<<<<
 *         except AttributeError:
 *             return None
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_sock, __pyx_n_s_getpeercert); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 758, __pyx_L3_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);
        }
      }
      __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 758, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L7_try_return;

      /* "nghttp2.pyx":757
 *     def _get_client_certificate(self):
 *         sock = self.transport.get_extra_info('socket')
 *         try:             # <<<<<<<<<<<<<<
 *             return sock.getpeercert()
 *         except AttributeError:
 */
    }
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "nghttp2.pyx":759
 *         try:
 *             return sock.getpeercert()
 *         except AttributeError:             # <<<<<<<<<<<<<<
 *             return None
 * 
 */
    __pyx_t_7 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
    if (__pyx_t_7) {
      __Pyx_AddTraceback("nghttp2._HTTP2SessionCoreBase._get_client_certificate", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3) < 0) __PYX_ERR(0, 759, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GOTREF(__pyx_t_3);

      /* "nghttp2.pyx":760
 *             return sock.getpeercert()
 *         except AttributeError:
 *             return None             # <<<<<<<<<<<<<<
 * 
 *     def _start_settings_timer(self):
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_r = Py_None; __Pyx_INCREF(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:;

    /* "nghttp2.pyx":757
 *     def _get_client_certificate(self):
 *         sock = self.transport.get_extra_info('socket')
 *         try:             # <<<<<<<<<<<<<<
 *             return sock.getpeercert()
 *         except AttributeError:
 */
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
    goto __pyx_L1_error;
    __pyx_L7_try_return:;
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
    goto __pyx_L0;
    __pyx_L6_except_return:;
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
    goto __pyx_L0;
  }

  /* "nghttp2.pyx":755
 *         return self.transport.get_extra_info('peername')
 * 
 *     def _get_client_certificate(self):             # <<<<<<<<<<<<<<
 *         sock = self.transport.get_extra_info('socket')
 *         try:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("nghttp2._HTTP2SessionCoreBase._get_client_certificate", __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;
}

/* "nghttp2.pyx":762
 *             return None
 * 
 *     def _start_settings_timer(self):             # <<<<<<<<<<<<<<
 *         loop = asyncio.get_event_loop()
 *         self.settings_timer = loop.call_later(self.SETTINGS_TIMEOUT,
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_27_start_settings_timer(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_27_start_settings_timer(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_start_settings_timer (wrapper)", 0);
  __pyx_r = __pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_26_start_settings_timer(((struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *)__pyx_v_self));

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

static PyObject *__pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_26_start_settings_timer(struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *__pyx_v_self) {
  PyObject *__pyx_v_loop = 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;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_start_settings_timer", 0);

  /* "nghttp2.pyx":763
 * 
 *     def _start_settings_timer(self):
 *         loop = asyncio.get_event_loop()             # <<<<<<<<<<<<<<
 *         self.settings_timer = loop.call_later(self.SETTINGS_TIMEOUT,
 *                                               self._settings_timeout)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_asyncio); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 763, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_get_event_loop); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 763, __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);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 763, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_loop = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "nghttp2.pyx":764
 *     def _start_settings_timer(self):
 *         loop = asyncio.get_event_loop()
 *         self.settings_timer = loop.call_later(self.SETTINGS_TIMEOUT,             # <<<<<<<<<<<<<<
 *                                               self._settings_timeout)
 * 
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_loop, __pyx_n_s_call_later); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 764, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_SETTINGS_TIMEOUT); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 764, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "nghttp2.pyx":765
 *         loop = asyncio.get_event_loop()
 *         self.settings_timer = loop.call_later(self.SETTINGS_TIMEOUT,
 *                                               self._settings_timeout)             # <<<<<<<<<<<<<<
 * 
 *     def _stop_settings_timer(self):
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_settings_timeout); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 765, __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_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_2, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 764, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __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_2, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 764, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 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(0, 764, __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_2);
    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_4);
    __pyx_t_2 = 0;
    __pyx_t_4 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 764, __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;

  /* "nghttp2.pyx":764
 *     def _start_settings_timer(self):
 *         loop = asyncio.get_event_loop()
 *         self.settings_timer = loop.call_later(self.SETTINGS_TIMEOUT,             # <<<<<<<<<<<<<<
 *                                               self._settings_timeout)
 * 
 */
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->settings_timer);
  __Pyx_DECREF(__pyx_v_self->settings_timer);
  __pyx_v_self->settings_timer = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "nghttp2.pyx":762
 *             return None
 * 
 *     def _start_settings_timer(self):             # <<<<<<<<<<<<<<
 *         loop = asyncio.get_event_loop()
 *         self.settings_timer = loop.call_later(self.SETTINGS_TIMEOUT,
 */

  /* 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_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("nghttp2._HTTP2SessionCoreBase._start_settings_timer", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_loop);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":767
 *                                               self._settings_timeout)
 * 
 *     def _stop_settings_timer(self):             # <<<<<<<<<<<<<<
 *         if self.settings_timer:
 *             self.settings_timer.cancel()
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_29_stop_settings_timer(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_29_stop_settings_timer(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_stop_settings_timer (wrapper)", 0);
  __pyx_r = __pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_28_stop_settings_timer(((struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *)__pyx_v_self));

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

static PyObject *__pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_28_stop_settings_timer(struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_stop_settings_timer", 0);

  /* "nghttp2.pyx":768
 * 
 *     def _stop_settings_timer(self):
 *         if self.settings_timer:             # <<<<<<<<<<<<<<
 *             self.settings_timer.cancel()
 *             self.settings_timer = None
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_self->settings_timer); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 768, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "nghttp2.pyx":769
 *     def _stop_settings_timer(self):
 *         if self.settings_timer:
 *             self.settings_timer.cancel()             # <<<<<<<<<<<<<<
 *             self.settings_timer = None
 * 
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->settings_timer, __pyx_n_s_cancel); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 769, __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);
      }
    }
    __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 769, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "nghttp2.pyx":770
 *         if self.settings_timer:
 *             self.settings_timer.cancel()
 *             self.settings_timer = None             # <<<<<<<<<<<<<<
 * 
 *     def _settings_timeout(self):
 */
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_GOTREF(__pyx_v_self->settings_timer);
    __Pyx_DECREF(__pyx_v_self->settings_timer);
    __pyx_v_self->settings_timer = Py_None;

    /* "nghttp2.pyx":768
 * 
 *     def _stop_settings_timer(self):
 *         if self.settings_timer:             # <<<<<<<<<<<<<<
 *             self.settings_timer.cancel()
 *             self.settings_timer = None
 */
  }

  /* "nghttp2.pyx":767
 *                                               self._settings_timeout)
 * 
 *     def _stop_settings_timer(self):             # <<<<<<<<<<<<<<
 *         if self.settings_timer:
 *             self.settings_timer.cancel()
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("nghttp2._HTTP2SessionCoreBase._stop_settings_timer", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":772
 *             self.settings_timer = None
 * 
 *     def _settings_timeout(self):             # <<<<<<<<<<<<<<
 *         cdef int rv
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_31_settings_timeout(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_31_settings_timeout(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_settings_timeout (wrapper)", 0);
  __pyx_r = __pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_30_settings_timeout(((struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *)__pyx_v_self));

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

static PyObject *__pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_30_settings_timeout(struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *__pyx_v_self) {
  CYTHON_UNUSED int __pyx_v_rv;
  CYTHON_UNUSED PyObject *__pyx_v_err = 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;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_settings_timeout", 0);

  /* "nghttp2.pyx":775
 *         cdef int rv
 * 
 *         logging.debug('_settings_timeout')             # <<<<<<<<<<<<<<
 * 
 *         self.settings_timer = None
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_logging); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 775, __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(0, 775, __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);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_n_s_settings_timeout) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_n_s_settings_timeout);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 775, __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;

  /* "nghttp2.pyx":777
 *         logging.debug('_settings_timeout')
 * 
 *         self.settings_timer = None             # <<<<<<<<<<<<<<
 * 
 *         rv = cnghttp2.nghttp2_session_terminate_session\
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->settings_timer);
  __Pyx_DECREF(__pyx_v_self->settings_timer);
  __pyx_v_self->settings_timer = Py_None;

  /* "nghttp2.pyx":780
 * 
 *         rv = cnghttp2.nghttp2_session_terminate_session\
 *              (self.session, cnghttp2.NGHTTP2_SETTINGS_TIMEOUT)             # <<<<<<<<<<<<<<
 *         try:
 *             self.send_data()
 */
  __pyx_v_rv = nghttp2_session_terminate_session(__pyx_v_self->session, NGHTTP2_SETTINGS_TIMEOUT);

  /* "nghttp2.pyx":781
 *         rv = cnghttp2.nghttp2_session_terminate_session\
 *              (self.session, cnghttp2.NGHTTP2_SETTINGS_TIMEOUT)
 *         try:             # <<<<<<<<<<<<<<
 *             self.send_data()
 *         except Exception as err:
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6);
    __Pyx_XGOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_6);
    /*try:*/ {

      /* "nghttp2.pyx":782
 *              (self.session, cnghttp2.NGHTTP2_SETTINGS_TIMEOUT)
 *         try:
 *             self.send_data()             # <<<<<<<<<<<<<<
 *         except Exception as err:
 *             sys.stderr.write(traceback.format_exc())
 */
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_send_data); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 782, __pyx_L3_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);
        }
      }
      __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 782, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "nghttp2.pyx":781
 *         rv = cnghttp2.nghttp2_session_terminate_session\
 *              (self.session, cnghttp2.NGHTTP2_SETTINGS_TIMEOUT)
 *         try:             # <<<<<<<<<<<<<<
 *             self.send_data()
 *         except Exception as err:
 */
    }
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L8_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "nghttp2.pyx":783
 *         try:
 *             self.send_data()
 *         except Exception as err:             # <<<<<<<<<<<<<<
 *             sys.stderr.write(traceback.format_exc())
 *             self.transport.close()
 */
    __pyx_t_7 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
    if (__pyx_t_7) {
      __Pyx_AddTraceback("nghttp2._HTTP2SessionCoreBase._settings_timeout", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_3, &__pyx_t_2) < 0) __PYX_ERR(0, 783, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __pyx_v_err = __pyx_t_3;

      /* "nghttp2.pyx":784
 *             self.send_data()
 *         except Exception as err:
 *             sys.stderr.write(traceback.format_exc())             # <<<<<<<<<<<<<<
 *             self.transport.close()
 *             return
 */
      __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_sys); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 784, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_stderr); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 784, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_write); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 784, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_traceback); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 784, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_format_exc); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 784, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __pyx_t_11 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_12))) {
        __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_12);
        if (likely(__pyx_t_11)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
          __Pyx_INCREF(__pyx_t_11);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_12, function);
        }
      }
      __pyx_t_10 = (__pyx_t_11) ? __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_t_11) : __Pyx_PyObject_CallNoArg(__pyx_t_12);
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 784, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_t_12 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) {
        __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_9);
        if (likely(__pyx_t_12)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
          __Pyx_INCREF(__pyx_t_12);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_9, function);
        }
      }
      __pyx_t_8 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_12, __pyx_t_10) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_10);
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 784, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

      /* "nghttp2.pyx":785
 *         except Exception as err:
 *             sys.stderr.write(traceback.format_exc())
 *             self.transport.close()             # <<<<<<<<<<<<<<
 *             return
 * 
 */
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->transport, __pyx_n_s_close); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 785, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_10 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) {
        __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_9);
        if (likely(__pyx_t_10)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
          __Pyx_INCREF(__pyx_t_10);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_9, function);
        }
      }
      __pyx_t_8 = (__pyx_t_10) ? __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_10) : __Pyx_PyObject_CallNoArg(__pyx_t_9);
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 785, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

      /* "nghttp2.pyx":786
 *             sys.stderr.write(traceback.format_exc())
 *             self.transport.close()
 *             return             # <<<<<<<<<<<<<<
 * 
 *     def _log_request(self, handler):
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_r = Py_None; __Pyx_INCREF(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:;

    /* "nghttp2.pyx":781
 *         rv = cnghttp2.nghttp2_session_terminate_session\
 *              (self.session, cnghttp2.NGHTTP2_SETTINGS_TIMEOUT)
 *         try:             # <<<<<<<<<<<<<<
 *             self.send_data()
 *         except Exception as err:
 */
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
    goto __pyx_L1_error;
    __pyx_L6_except_return:;
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
    goto __pyx_L0;
    __pyx_L8_try_end:;
  }

  /* "nghttp2.pyx":772
 *             self.settings_timer = None
 * 
 *     def _settings_timeout(self):             # <<<<<<<<<<<<<<
 *         cdef int rv
 * 
 */

  /* 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_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("nghttp2._HTTP2SessionCoreBase._settings_timeout", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_err);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":788
 *             return
 * 
 *     def _log_request(self, handler):             # <<<<<<<<<<<<<<
 *         now = datetime.datetime.now()
 *         tv = time.mktime(now.timetuple())
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_33_log_request(PyObject *__pyx_v_self, PyObject *__pyx_v_handler); /*proto*/
static PyObject *__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_33_log_request(PyObject *__pyx_v_self, PyObject *__pyx_v_handler) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_log_request (wrapper)", 0);
  __pyx_r = __pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_32_log_request(((struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *)__pyx_v_self), ((PyObject *)__pyx_v_handler));

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

static PyObject *__pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_32_log_request(CYTHON_UNUSED struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *__pyx_v_self, PyObject *__pyx_v_handler) {
  PyObject *__pyx_v_now = NULL;
  PyObject *__pyx_v_tv = NULL;
  PyObject *__pyx_v_datestr = NULL;
  PyObject *__pyx_v_method = NULL;
  PyObject *__pyx_v_path = 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;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  int __pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_log_request", 0);

  /* "nghttp2.pyx":789
 * 
 *     def _log_request(self, handler):
 *         now = datetime.datetime.now()             # <<<<<<<<<<<<<<
 *         tv = time.mktime(now.timetuple())
 *         datestr = email.utils.formatdate(timeval=tv, localtime=False,
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_datetime); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 789, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_datetime); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 789, __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_now); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 789, __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);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 789, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_now = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "nghttp2.pyx":790
 *     def _log_request(self, handler):
 *         now = datetime.datetime.now()
 *         tv = time.mktime(now.timetuple())             # <<<<<<<<<<<<<<
 *         datestr = email.utils.formatdate(timeval=tv, localtime=False,
 *                                         usegmt=True)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_time); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 790, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_mktime); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 790, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_now, __pyx_n_s_timetuple); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 790, __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);
    }
  }
  __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 790, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __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);
    }
  }
  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 790, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_tv = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "nghttp2.pyx":791
 *         now = datetime.datetime.now()
 *         tv = time.mktime(now.timetuple())
 *         datestr = email.utils.formatdate(timeval=tv, localtime=False,             # <<<<<<<<<<<<<<
 *                                         usegmt=True)
 *         try:
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_email); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 791, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_utils); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 791, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_formatdate); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 791, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 791, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_timeval, __pyx_v_tv) < 0) __PYX_ERR(0, 791, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_localtime, Py_False) < 0) __PYX_ERR(0, 791, __pyx_L1_error)

  /* "nghttp2.pyx":792
 *         tv = time.mktime(now.timetuple())
 *         datestr = email.utils.formatdate(timeval=tv, localtime=False,
 *                                         usegmt=True)             # <<<<<<<<<<<<<<
 *         try:
 *             method = handler.method.decode('utf-8')
 */
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_usegmt, Py_True) < 0) __PYX_ERR(0, 791, __pyx_L1_error)

  /* "nghttp2.pyx":791
 *         now = datetime.datetime.now()
 *         tv = time.mktime(now.timetuple())
 *         datestr = email.utils.formatdate(timeval=tv, localtime=False,             # <<<<<<<<<<<<<<
 *                                         usegmt=True)
 *         try:
 */
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 791, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_datestr = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "nghttp2.pyx":793
 *         datestr = email.utils.formatdate(timeval=tv, localtime=False,
 *                                         usegmt=True)
 *         try:             # <<<<<<<<<<<<<<
 *             method = handler.method.decode('utf-8')
 *         except:
 */
  {
    __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:*/ {

      /* "nghttp2.pyx":794
 *                                         usegmt=True)
 *         try:
 *             method = handler.method.decode('utf-8')             # <<<<<<<<<<<<<<
 *         except:
 *             method = handler.method
 */
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_handler, __pyx_n_s_method_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 794, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_decode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 794, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_3)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
        }
      }
      __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_3, __pyx_kp_s_utf_8) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_kp_s_utf_8);
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 794, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_method = __pyx_t_2;
      __pyx_t_2 = 0;

      /* "nghttp2.pyx":793
 *         datestr = email.utils.formatdate(timeval=tv, localtime=False,
 *                                         usegmt=True)
 *         try:             # <<<<<<<<<<<<<<
 *             method = handler.method.decode('utf-8')
 *         except:
 */
    }
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    goto __pyx_L8_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "nghttp2.pyx":795
 *         try:
 *             method = handler.method.decode('utf-8')
 *         except:             # <<<<<<<<<<<<<<
 *             method = handler.method
 *         try:
 */
    /*except:*/ {
      __Pyx_AddTraceback("nghttp2._HTTP2SessionCoreBase._log_request", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_1, &__pyx_t_3) < 0) __PYX_ERR(0, 795, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_3);

      /* "nghttp2.pyx":796
 *             method = handler.method.decode('utf-8')
 *         except:
 *             method = handler.method             # <<<<<<<<<<<<<<
 *         try:
 *             path = handler.path.decode('utf-8')
 */
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_handler, __pyx_n_s_method_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 796, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_XDECREF_SET(__pyx_v_method, __pyx_t_4);
      __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      goto __pyx_L4_exception_handled;
    }
    __pyx_L5_except_error:;

    /* "nghttp2.pyx":793
 *         datestr = email.utils.formatdate(timeval=tv, localtime=False,
 *                                         usegmt=True)
 *         try:             # <<<<<<<<<<<<<<
 *             method = handler.method.decode('utf-8')
 *         except:
 */
    __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_L4_exception_handled:;
    __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);
    __pyx_L8_try_end:;
  }

  /* "nghttp2.pyx":797
 *         except:
 *             method = handler.method
 *         try:             # <<<<<<<<<<<<<<
 *             path = handler.path.decode('utf-8')
 *         except:
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6);
    __Pyx_XGOTREF(__pyx_t_8);
    __Pyx_XGOTREF(__pyx_t_7);
    __Pyx_XGOTREF(__pyx_t_6);
    /*try:*/ {

      /* "nghttp2.pyx":798
 *             method = handler.method
 *         try:
 *             path = handler.path.decode('utf-8')             # <<<<<<<<<<<<<<
 *         except:
 *             path = handler.path
 */
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_handler, __pyx_n_s_path_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 798, __pyx_L11_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_decode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 798, __pyx_L11_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __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);
        }
      }
      __pyx_t_3 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_1, __pyx_kp_s_utf_8) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_s_utf_8);
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 798, __pyx_L11_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_path = __pyx_t_3;
      __pyx_t_3 = 0;

      /* "nghttp2.pyx":797
 *         except:
 *             method = handler.method
 *         try:             # <<<<<<<<<<<<<<
 *             path = handler.path.decode('utf-8')
 *         except:
 */
    }
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L16_try_end;
    __pyx_L11_error:;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "nghttp2.pyx":799
 *         try:
 *             path = handler.path.decode('utf-8')
 *         except:             # <<<<<<<<<<<<<<
 *             path = handler.path
 *         logging.info('%s - - [%s] "%s %s HTTP/2" %s - %s', handler.remote_address[0],
 */
    /*except:*/ {
      __Pyx_AddTraceback("nghttp2._HTTP2SessionCoreBase._log_request", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1) < 0) __PYX_ERR(0, 799, __pyx_L13_except_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GOTREF(__pyx_t_1);

      /* "nghttp2.pyx":800
 *             path = handler.path.decode('utf-8')
 *         except:
 *             path = handler.path             # <<<<<<<<<<<<<<
 *         logging.info('%s - - [%s] "%s %s HTTP/2" %s - %s', handler.remote_address[0],
 *                           datestr, method, path, handler.status,
 */
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_handler, __pyx_n_s_path_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 800, __pyx_L13_except_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_XDECREF_SET(__pyx_v_path, __pyx_t_4);
      __pyx_t_4 = 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;
      goto __pyx_L12_exception_handled;
    }
    __pyx_L13_except_error:;

    /* "nghttp2.pyx":797
 *         except:
 *             method = handler.method
 *         try:             # <<<<<<<<<<<<<<
 *             path = handler.path.decode('utf-8')
 *         except:
 */
    __Pyx_XGIVEREF(__pyx_t_8);
    __Pyx_XGIVEREF(__pyx_t_7);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_7, __pyx_t_6);
    goto __pyx_L1_error;
    __pyx_L12_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_8);
    __Pyx_XGIVEREF(__pyx_t_7);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_7, __pyx_t_6);
    __pyx_L16_try_end:;
  }

  /* "nghttp2.pyx":801
 *         except:
 *             path = handler.path
 *         logging.info('%s - - [%s] "%s %s HTTP/2" %s - %s', handler.remote_address[0],             # <<<<<<<<<<<<<<
 *                           datestr, method, path, handler.status,
 *                           'P' if handler.pushed else '-')
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_logging); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 801, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_info); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 801, __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_handler, __pyx_n_s_remote_address); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 801, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_2, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 801, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "nghttp2.pyx":802
 *             path = handler.path
 *         logging.info('%s - - [%s] "%s %s HTTP/2" %s - %s', handler.remote_address[0],
 *                           datestr, method, path, handler.status,             # <<<<<<<<<<<<<<
 *                           'P' if handler.pushed else '-')
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_handler, __pyx_n_s_status_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 802, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "nghttp2.pyx":803
 *         logging.info('%s - - [%s] "%s %s HTTP/2" %s - %s', handler.remote_address[0],
 *                           datestr, method, path, handler.status,
 *                           'P' if handler.pushed else '-')             # <<<<<<<<<<<<<<
 * 
 *     def close(self):
 */
  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_handler, __pyx_n_s_pushed); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 803, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 803, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  if (__pyx_t_10) {
    __Pyx_INCREF(__pyx_n_s_P);
    __pyx_t_5 = __pyx_n_s_P;
  } else {
    __Pyx_INCREF(__pyx_kp_s__9);
    __pyx_t_5 = __pyx_kp_s__9;
  }
  __pyx_t_9 = NULL;
  __pyx_t_11 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(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_11 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[8] = {__pyx_t_9, __pyx_kp_s_s_s_s_s_HTTP_2_s_s, __pyx_t_4, __pyx_v_datestr, __pyx_v_method, __pyx_v_path, __pyx_t_2, __pyx_t_5};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_11, 7+__pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 801, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __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_5); __pyx_t_5 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[8] = {__pyx_t_9, __pyx_kp_s_s_s_s_s_HTTP_2_s_s, __pyx_t_4, __pyx_v_datestr, __pyx_v_method, __pyx_v_path, __pyx_t_2, __pyx_t_5};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_11, 7+__pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 801, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __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_5); __pyx_t_5 = 0;
  } else
  #endif
  {
    __pyx_t_12 = PyTuple_New(7+__pyx_t_11); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 801, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    if (__pyx_t_9) {
      __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_9); __pyx_t_9 = NULL;
    }
    __Pyx_INCREF(__pyx_kp_s_s_s_s_s_HTTP_2_s_s);
    __Pyx_GIVEREF(__pyx_kp_s_s_s_s_s_HTTP_2_s_s);
    PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_11, __pyx_kp_s_s_s_s_s_HTTP_2_s_s);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_11, __pyx_t_4);
    __Pyx_INCREF(__pyx_v_datestr);
    __Pyx_GIVEREF(__pyx_v_datestr);
    PyTuple_SET_ITEM(__pyx_t_12, 2+__pyx_t_11, __pyx_v_datestr);
    __Pyx_INCREF(__pyx_v_method);
    __Pyx_GIVEREF(__pyx_v_method);
    PyTuple_SET_ITEM(__pyx_t_12, 3+__pyx_t_11, __pyx_v_method);
    __Pyx_INCREF(__pyx_v_path);
    __Pyx_GIVEREF(__pyx_v_path);
    PyTuple_SET_ITEM(__pyx_t_12, 4+__pyx_t_11, __pyx_v_path);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_12, 5+__pyx_t_11, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_12, 6+__pyx_t_11, __pyx_t_5);
    __pyx_t_4 = 0;
    __pyx_t_2 = 0;
    __pyx_t_5 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_12, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 801, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "nghttp2.pyx":788
 *             return
 * 
 *     def _log_request(self, handler):             # <<<<<<<<<<<<<<
 *         now = datetime.datetime.now()
 *         tv = time.mktime(now.timetuple())
 */

  /* 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_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("nghttp2._HTTP2SessionCoreBase._log_request", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_now);
  __Pyx_XDECREF(__pyx_v_tv);
  __Pyx_XDECREF(__pyx_v_datestr);
  __Pyx_XDECREF(__pyx_v_method);
  __Pyx_XDECREF(__pyx_v_path);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":805
 *                           'P' if handler.pushed else '-')
 * 
 *     def close(self):             # <<<<<<<<<<<<<<
 *         rv = cnghttp2.nghttp2_session_terminate_session\
 *              (self.session, cnghttp2.NGHTTP2_NO_ERROR)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_35close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_35close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("close (wrapper)", 0);
  __pyx_r = __pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_34close(((struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *)__pyx_v_self));

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

static PyObject *__pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_34close(struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *__pyx_v_self) {
  CYTHON_UNUSED int __pyx_v_rv;
  CYTHON_UNUSED PyObject *__pyx_v_err = 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;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("close", 0);

  /* "nghttp2.pyx":807
 *     def close(self):
 *         rv = cnghttp2.nghttp2_session_terminate_session\
 *              (self.session, cnghttp2.NGHTTP2_NO_ERROR)             # <<<<<<<<<<<<<<
 *         try:
 *             self.send_data()
 */
  __pyx_v_rv = nghttp2_session_terminate_session(__pyx_v_self->session, NGHTTP2_NO_ERROR);

  /* "nghttp2.pyx":808
 *         rv = cnghttp2.nghttp2_session_terminate_session\
 *              (self.session, cnghttp2.NGHTTP2_NO_ERROR)
 *         try:             # <<<<<<<<<<<<<<
 *             self.send_data()
 *         except Exception as err:
 */
  {
    __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:*/ {

      /* "nghttp2.pyx":809
 *              (self.session, cnghttp2.NGHTTP2_NO_ERROR)
 *         try:
 *             self.send_data()             # <<<<<<<<<<<<<<
 *         except Exception as err:
 *             sys.stderr.write(traceback.format_exc())
 */
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_send_data); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 809, __pyx_L3_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);
        }
      }
      __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 809, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "nghttp2.pyx":808
 *         rv = cnghttp2.nghttp2_session_terminate_session\
 *              (self.session, cnghttp2.NGHTTP2_NO_ERROR)
 *         try:             # <<<<<<<<<<<<<<
 *             self.send_data()
 *         except Exception as err:
 */
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L8_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "nghttp2.pyx":810
 *         try:
 *             self.send_data()
 *         except Exception as err:             # <<<<<<<<<<<<<<
 *             sys.stderr.write(traceback.format_exc())
 *             self.transport.close()
 */
    __pyx_t_7 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
    if (__pyx_t_7) {
      __Pyx_AddTraceback("nghttp2._HTTP2SessionCoreBase.close", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6) < 0) __PYX_ERR(0, 810, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_5);
      __pyx_v_err = __pyx_t_5;

      /* "nghttp2.pyx":811
 *             self.send_data()
 *         except Exception as err:
 *             sys.stderr.write(traceback.format_exc())             # <<<<<<<<<<<<<<
 *             self.transport.close()
 *             return
 */
      __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_sys); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 811, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_stderr); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 811, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_write); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 811, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_traceback); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 811, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_format_exc); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 811, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __pyx_t_11 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_12))) {
        __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_12);
        if (likely(__pyx_t_11)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
          __Pyx_INCREF(__pyx_t_11);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_12, function);
        }
      }
      __pyx_t_10 = (__pyx_t_11) ? __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_t_11) : __Pyx_PyObject_CallNoArg(__pyx_t_12);
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 811, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_t_12 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) {
        __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_9);
        if (likely(__pyx_t_12)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
          __Pyx_INCREF(__pyx_t_12);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_9, function);
        }
      }
      __pyx_t_8 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_12, __pyx_t_10) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_10);
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 811, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

      /* "nghttp2.pyx":812
 *         except Exception as err:
 *             sys.stderr.write(traceback.format_exc())
 *             self.transport.close()             # <<<<<<<<<<<<<<
 *             return
 * 
 */
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->transport, __pyx_n_s_close); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 812, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_10 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) {
        __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_9);
        if (likely(__pyx_t_10)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
          __Pyx_INCREF(__pyx_t_10);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_9, function);
        }
      }
      __pyx_t_8 = (__pyx_t_10) ? __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_10) : __Pyx_PyObject_CallNoArg(__pyx_t_9);
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 812, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

      /* "nghttp2.pyx":813
 *             sys.stderr.write(traceback.format_exc())
 *             self.transport.close()
 *             return             # <<<<<<<<<<<<<<
 * 
 * cdef class _HTTP2SessionCore(_HTTP2SessionCoreBase):
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      __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;
      goto __pyx_L6_except_return;
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "nghttp2.pyx":808
 *         rv = cnghttp2.nghttp2_session_terminate_session\
 *              (self.session, cnghttp2.NGHTTP2_NO_ERROR)
 *         try:             # <<<<<<<<<<<<<<
 *             self.send_data()
 *         except Exception as err:
 */
    __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_L6_except_return:;
    __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_L8_try_end:;
  }

  /* "nghttp2.pyx":805
 *                           'P' if handler.pushed else '-')
 * 
 *     def close(self):             # <<<<<<<<<<<<<<
 *         rv = cnghttp2.nghttp2_session_terminate_session\
 *              (self.session, cnghttp2.NGHTTP2_NO_ERROR)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("nghttp2._HTTP2SessionCoreBase.close", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_err);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_37__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_37__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_36__reduce_cython__(((struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *)__pyx_v_self));

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

static PyObject *__pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_36__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __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(1, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("nghttp2._HTTP2SessionCoreBase.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_39__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static PyObject *__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_39__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_38__setstate_cython__(((struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_38__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __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(1, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("nghttp2._HTTP2SessionCoreBase.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":816
 * 
 * cdef class _HTTP2SessionCore(_HTTP2SessionCoreBase):
 *     def __cinit__(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         cdef cnghttp2.nghttp2_session_callbacks *callbacks
 *         cdef cnghttp2.nghttp2_settings_entry iv[2]
 */

/* Python wrapper */
static int __pyx_pw_7nghttp2_17_HTTP2SessionCore_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_7nghttp2_17_HTTP2SessionCore_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_kwargs = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  if (unlikely(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 1))) return -1;
  __pyx_v_kwargs = (__pyx_kwds) ? PyDict_Copy(__pyx_kwds) : PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return -1;
  __Pyx_GOTREF(__pyx_v_kwargs);
  __Pyx_INCREF(__pyx_args);
  __pyx_v_args = __pyx_args;
  __pyx_r = __pyx_pf_7nghttp2_17_HTTP2SessionCore___cinit__(((struct __pyx_obj_7nghttp2__HTTP2SessionCore *)__pyx_v_self), __pyx_v_args, __pyx_v_kwargs);

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

static int __pyx_pf_7nghttp2_17_HTTP2SessionCore___cinit__(struct __pyx_obj_7nghttp2__HTTP2SessionCore *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) {
  nghttp2_session_callbacks *__pyx_v_callbacks;
  nghttp2_settings_entry __pyx_v_iv[2];
  int __pyx_v_rv;
  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;
  size_t __pyx_t_6;
  size_t __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "nghttp2.pyx":821
 *         cdef int rv
 * 
 *         super(_HTTP2SessionCore, self).__init__(*args, **kwargs)             # <<<<<<<<<<<<<<
 * 
 *         rv = cnghttp2.nghttp2_session_callbacks_new(&callbacks)
 */
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 821, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_ptype_7nghttp2__HTTP2SessionCore));
  __Pyx_GIVEREF(((PyObject *)__pyx_ptype_7nghttp2__HTTP2SessionCore));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_ptype_7nghttp2__HTTP2SessionCore));
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_self));
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 821, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_init); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 821, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyDict_Copy(__pyx_v_kwargs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 821, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_v_args, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 821, __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_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "nghttp2.pyx":823
 *         super(_HTTP2SessionCore, self).__init__(*args, **kwargs)
 * 
 *         rv = cnghttp2.nghttp2_session_callbacks_new(&callbacks)             # <<<<<<<<<<<<<<
 * 
 *         if rv != 0:
 */
  __pyx_v_rv = nghttp2_session_callbacks_new((&__pyx_v_callbacks));

  /* "nghttp2.pyx":825
 *         rv = cnghttp2.nghttp2_session_callbacks_new(&callbacks)
 * 
 *         if rv != 0:             # <<<<<<<<<<<<<<
 *             raise Exception('nghttp2_session_callbacks_new failed: {}'.format\
 *                             (_strerror(rv)))
 */
  __pyx_t_4 = ((__pyx_v_rv != 0) != 0);
  if (unlikely(__pyx_t_4)) {

    /* "nghttp2.pyx":826
 * 
 *         if rv != 0:
 *             raise Exception('nghttp2_session_callbacks_new failed: {}'.format\             # <<<<<<<<<<<<<<
 *                             (_strerror(rv)))
 * 
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_nghttp2_session_callbacks_new_fa, __pyx_n_s_format); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 826, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);

    /* "nghttp2.pyx":827
 *         if rv != 0:
 *             raise Exception('nghttp2_session_callbacks_new failed: {}'.format\
 *                             (_strerror(rv)))             # <<<<<<<<<<<<<<
 * 
 *         cnghttp2.nghttp2_session_callbacks_set_on_header_callback(
 */
    __pyx_t_1 = __pyx_f_7nghttp2__strerror(__pyx_v_rv); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 827, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = NULL;
    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_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_1);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 827, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "nghttp2.pyx":826
 * 
 *         if rv != 0:
 *             raise Exception('nghttp2_session_callbacks_new failed: {}'.format\             # <<<<<<<<<<<<<<
 *                             (_strerror(rv)))
 * 
 */
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 826, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(0, 826, __pyx_L1_error)

    /* "nghttp2.pyx":825
 *         rv = cnghttp2.nghttp2_session_callbacks_new(&callbacks)
 * 
 *         if rv != 0:             # <<<<<<<<<<<<<<
 *             raise Exception('nghttp2_session_callbacks_new failed: {}'.format\
 *                             (_strerror(rv)))
 */
  }

  /* "nghttp2.pyx":829
 *                             (_strerror(rv)))
 * 
 *         cnghttp2.nghttp2_session_callbacks_set_on_header_callback(             # <<<<<<<<<<<<<<
 *             callbacks, server_on_header)
 *         cnghttp2.nghttp2_session_callbacks_set_on_begin_headers_callback(
 */
  nghttp2_session_callbacks_set_on_header_callback(__pyx_v_callbacks, __pyx_f_7nghttp2_server_on_header);

  /* "nghttp2.pyx":831
 *         cnghttp2.nghttp2_session_callbacks_set_on_header_callback(
 *             callbacks, server_on_header)
 *         cnghttp2.nghttp2_session_callbacks_set_on_begin_headers_callback(             # <<<<<<<<<<<<<<
 *             callbacks, server_on_begin_headers)
 *         cnghttp2.nghttp2_session_callbacks_set_on_frame_recv_callback(
 */
  nghttp2_session_callbacks_set_on_begin_headers_callback(__pyx_v_callbacks, __pyx_f_7nghttp2_server_on_begin_headers);

  /* "nghttp2.pyx":833
 *         cnghttp2.nghttp2_session_callbacks_set_on_begin_headers_callback(
 *             callbacks, server_on_begin_headers)
 *         cnghttp2.nghttp2_session_callbacks_set_on_frame_recv_callback(             # <<<<<<<<<<<<<<
 *             callbacks, server_on_frame_recv)
 *         cnghttp2.nghttp2_session_callbacks_set_on_stream_close_callback(
 */
  nghttp2_session_callbacks_set_on_frame_recv_callback(__pyx_v_callbacks, __pyx_f_7nghttp2_server_on_frame_recv);

  /* "nghttp2.pyx":835
 *         cnghttp2.nghttp2_session_callbacks_set_on_frame_recv_callback(
 *             callbacks, server_on_frame_recv)
 *         cnghttp2.nghttp2_session_callbacks_set_on_stream_close_callback(             # <<<<<<<<<<<<<<
 *             callbacks, on_stream_close)
 *         cnghttp2.nghttp2_session_callbacks_set_on_frame_send_callback(
 */
  nghttp2_session_callbacks_set_on_stream_close_callback(__pyx_v_callbacks, __pyx_f_7nghttp2_on_stream_close);

  /* "nghttp2.pyx":837
 *         cnghttp2.nghttp2_session_callbacks_set_on_stream_close_callback(
 *             callbacks, on_stream_close)
 *         cnghttp2.nghttp2_session_callbacks_set_on_frame_send_callback(             # <<<<<<<<<<<<<<
 *             callbacks, server_on_frame_send)
 *         cnghttp2.nghttp2_session_callbacks_set_on_frame_not_send_callback(
 */
  nghttp2_session_callbacks_set_on_frame_send_callback(__pyx_v_callbacks, __pyx_f_7nghttp2_server_on_frame_send);

  /* "nghttp2.pyx":839
 *         cnghttp2.nghttp2_session_callbacks_set_on_frame_send_callback(
 *             callbacks, server_on_frame_send)
 *         cnghttp2.nghttp2_session_callbacks_set_on_frame_not_send_callback(             # <<<<<<<<<<<<<<
 *             callbacks, server_on_frame_not_send)
 *         cnghttp2.nghttp2_session_callbacks_set_on_data_chunk_recv_callback(
 */
  nghttp2_session_callbacks_set_on_frame_not_send_callback(__pyx_v_callbacks, __pyx_f_7nghttp2_server_on_frame_not_send);

  /* "nghttp2.pyx":841
 *         cnghttp2.nghttp2_session_callbacks_set_on_frame_not_send_callback(
 *             callbacks, server_on_frame_not_send)
 *         cnghttp2.nghttp2_session_callbacks_set_on_data_chunk_recv_callback(             # <<<<<<<<<<<<<<
 *             callbacks, on_data_chunk_recv)
 * 
 */
  nghttp2_session_callbacks_set_on_data_chunk_recv_callback(__pyx_v_callbacks, __pyx_f_7nghttp2_on_data_chunk_recv);

  /* "nghttp2.pyx":844
 *             callbacks, on_data_chunk_recv)
 * 
 *         rv = cnghttp2.nghttp2_session_server_new(&self.session, callbacks,             # <<<<<<<<<<<<<<
 *                                                  <void*>self)
 * 
 */
  __pyx_v_rv = nghttp2_session_server_new((&__pyx_v_self->__pyx_base.session), __pyx_v_callbacks, ((void *)__pyx_v_self));

  /* "nghttp2.pyx":847
 *                                                  <void*>self)
 * 
 *         cnghttp2.nghttp2_session_callbacks_del(callbacks)             # <<<<<<<<<<<<<<
 * 
 *         if rv != 0:
 */
  nghttp2_session_callbacks_del(__pyx_v_callbacks);

  /* "nghttp2.pyx":849
 *         cnghttp2.nghttp2_session_callbacks_del(callbacks)
 * 
 *         if rv != 0:             # <<<<<<<<<<<<<<
 *             raise Exception('nghttp2_session_server_new failed: {}'.format\
 *                             (_strerror(rv)))
 */
  __pyx_t_4 = ((__pyx_v_rv != 0) != 0);
  if (unlikely(__pyx_t_4)) {

    /* "nghttp2.pyx":850
 * 
 *         if rv != 0:
 *             raise Exception('nghttp2_session_server_new failed: {}'.format\             # <<<<<<<<<<<<<<
 *                             (_strerror(rv)))
 * 
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_nghttp2_session_server_new_faile, __pyx_n_s_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 850, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);

    /* "nghttp2.pyx":851
 *         if rv != 0:
 *             raise Exception('nghttp2_session_server_new failed: {}'.format\
 *                             (_strerror(rv)))             # <<<<<<<<<<<<<<
 * 
 *         iv[0].settings_id = cnghttp2.NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS
 */
    __pyx_t_1 = __pyx_f_7nghttp2__strerror(__pyx_v_rv); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 851, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = NULL;
    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_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_1);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 851, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "nghttp2.pyx":850
 * 
 *         if rv != 0:
 *             raise Exception('nghttp2_session_server_new failed: {}'.format\             # <<<<<<<<<<<<<<
 *                             (_strerror(rv)))
 * 
 */
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 850, __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(0, 850, __pyx_L1_error)

    /* "nghttp2.pyx":849
 *         cnghttp2.nghttp2_session_callbacks_del(callbacks)
 * 
 *         if rv != 0:             # <<<<<<<<<<<<<<
 *             raise Exception('nghttp2_session_server_new failed: {}'.format\
 *                             (_strerror(rv)))
 */
  }

  /* "nghttp2.pyx":853
 *                             (_strerror(rv)))
 * 
 *         iv[0].settings_id = cnghttp2.NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS             # <<<<<<<<<<<<<<
 *         iv[0].value = 100
 *         iv[1].settings_id = cnghttp2.NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE
 */
  (__pyx_v_iv[0]).settings_id = NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS;

  /* "nghttp2.pyx":854
 * 
 *         iv[0].settings_id = cnghttp2.NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS
 *         iv[0].value = 100             # <<<<<<<<<<<<<<
 *         iv[1].settings_id = cnghttp2.NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE
 *         iv[1].value = cnghttp2.NGHTTP2_INITIAL_WINDOW_SIZE
 */
  (__pyx_v_iv[0]).value = 0x64;

  /* "nghttp2.pyx":855
 *         iv[0].settings_id = cnghttp2.NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS
 *         iv[0].value = 100
 *         iv[1].settings_id = cnghttp2.NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE             # <<<<<<<<<<<<<<
 *         iv[1].value = cnghttp2.NGHTTP2_INITIAL_WINDOW_SIZE
 * 
 */
  (__pyx_v_iv[1]).settings_id = NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE;

  /* "nghttp2.pyx":856
 *         iv[0].value = 100
 *         iv[1].settings_id = cnghttp2.NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE
 *         iv[1].value = cnghttp2.NGHTTP2_INITIAL_WINDOW_SIZE             # <<<<<<<<<<<<<<
 * 
 *         rv = cnghttp2.nghttp2_submit_settings(self.session,
 */
  (__pyx_v_iv[1]).value = NGHTTP2_INITIAL_WINDOW_SIZE;

  /* "nghttp2.pyx":860
 *         rv = cnghttp2.nghttp2_submit_settings(self.session,
 *                                               cnghttp2.NGHTTP2_FLAG_NONE,
 *                                               iv, sizeof(iv) // sizeof(iv[0]))             # <<<<<<<<<<<<<<
 * 
 *         if rv != 0:
 */
  __pyx_t_6 = (sizeof(__pyx_v_iv));
  __pyx_t_7 = (sizeof((__pyx_v_iv[0])));
  if (unlikely(__pyx_t_7 == 0)) {
    PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
    __PYX_ERR(0, 860, __pyx_L1_error)
  }

  /* "nghttp2.pyx":858
 *         iv[1].value = cnghttp2.NGHTTP2_INITIAL_WINDOW_SIZE
 * 
 *         rv = cnghttp2.nghttp2_submit_settings(self.session,             # <<<<<<<<<<<<<<
 *                                               cnghttp2.NGHTTP2_FLAG_NONE,
 *                                               iv, sizeof(iv) // sizeof(iv[0]))
 */
  __pyx_v_rv = nghttp2_submit_settings(__pyx_v_self->__pyx_base.session, NGHTTP2_FLAG_NONE, __pyx_v_iv, (__pyx_t_6 / __pyx_t_7));

  /* "nghttp2.pyx":862
 *                                               iv, sizeof(iv) // sizeof(iv[0]))
 * 
 *         if rv != 0:             # <<<<<<<<<<<<<<
 *             raise Exception('nghttp2_submit_settings failed: {}'.format\
 *                             (_strerror(rv)))
 */
  __pyx_t_4 = ((__pyx_v_rv != 0) != 0);
  if (unlikely(__pyx_t_4)) {

    /* "nghttp2.pyx":863
 * 
 *         if rv != 0:
 *             raise Exception('nghttp2_submit_settings failed: {}'.format\             # <<<<<<<<<<<<<<
 *                             (_strerror(rv)))
 * 
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_nghttp2_submit_settings_failed, __pyx_n_s_format); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 863, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);

    /* "nghttp2.pyx":864
 *         if rv != 0:
 *             raise Exception('nghttp2_submit_settings failed: {}'.format\
 *                             (_strerror(rv)))             # <<<<<<<<<<<<<<
 * 
 *     def send_response(self, handler):
 */
    __pyx_t_1 = __pyx_f_7nghttp2__strerror(__pyx_v_rv); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 864, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = NULL;
    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_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_1);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 864, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "nghttp2.pyx":863
 * 
 *         if rv != 0:
 *             raise Exception('nghttp2_submit_settings failed: {}'.format\             # <<<<<<<<<<<<<<
 *                             (_strerror(rv)))
 * 
 */
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 863, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(0, 863, __pyx_L1_error)

    /* "nghttp2.pyx":862
 *                                               iv, sizeof(iv) // sizeof(iv[0]))
 * 
 *         if rv != 0:             # <<<<<<<<<<<<<<
 *             raise Exception('nghttp2_submit_settings failed: {}'.format\
 *                             (_strerror(rv)))
 */
  }

  /* "nghttp2.pyx":816
 * 
 * cdef class _HTTP2SessionCore(_HTTP2SessionCoreBase):
 *     def __cinit__(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         cdef cnghttp2.nghttp2_session_callbacks *callbacks
 *         cdef cnghttp2.nghttp2_settings_entry iv[2]
 */

  /* 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("nghttp2._HTTP2SessionCore.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":866
 *                             (_strerror(rv)))
 * 
 *     def send_response(self, handler):             # <<<<<<<<<<<<<<
 *         cdef cnghttp2.nghttp2_data_provider prd
 *         cdef cnghttp2.nghttp2_data_provider *prd_ptr
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_17_HTTP2SessionCore_3send_response(PyObject *__pyx_v_self, PyObject *__pyx_v_handler); /*proto*/
static PyObject *__pyx_pw_7nghttp2_17_HTTP2SessionCore_3send_response(PyObject *__pyx_v_self, PyObject *__pyx_v_handler) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("send_response (wrapper)", 0);
  __pyx_r = __pyx_pf_7nghttp2_17_HTTP2SessionCore_2send_response(((struct __pyx_obj_7nghttp2__HTTP2SessionCore *)__pyx_v_self), ((PyObject *)__pyx_v_handler));

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

static PyObject *__pyx_pf_7nghttp2_17_HTTP2SessionCore_2send_response(struct __pyx_obj_7nghttp2__HTTP2SessionCore *__pyx_v_self, PyObject *__pyx_v_handler) {
  nghttp2_data_provider __pyx_v_prd;
  nghttp2_data_provider *__pyx_v_prd_ptr;
  nghttp2_nv *__pyx_v_nva;
  size_t __pyx_v_nvlen;
  int __pyx_v_rv;
  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;
  int __pyx_t_7;
  int32_t __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("send_response", 0);

  /* "nghttp2.pyx":873
 *         cdef int rv
 * 
 *         logging.debug('send_response, stream_id:%s', handler.stream_id)             # <<<<<<<<<<<<<<
 * 
 *         nva = NULL
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_logging); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 873, __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(0, 873, __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_handler, __pyx_n_s_stream_id); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 873, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __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_kp_s_send_response_stream_id_s, __pyx_t_2};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 873, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 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_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_kp_s_send_response_stream_id_s, __pyx_t_2};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 873, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else
  #endif
  {
    __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 873, __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_kp_s_send_response_stream_id_s);
    __Pyx_GIVEREF(__pyx_kp_s_send_response_stream_id_s);
    PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_kp_s_send_response_stream_id_s);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 873, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "nghttp2.pyx":875
 *         logging.debug('send_response, stream_id:%s', handler.stream_id)
 * 
 *         nva = NULL             # <<<<<<<<<<<<<<
 *         nvlen = _make_nva(&nva, handler.response_headers)
 * 
 */
  __pyx_v_nva = NULL;

  /* "nghttp2.pyx":876
 * 
 *         nva = NULL
 *         nvlen = _make_nva(&nva, handler.response_headers)             # <<<<<<<<<<<<<<
 * 
 *         if handler.response_body:
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_handler, __pyx_n_s_response_headers); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 876, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_nvlen = __pyx_f_7nghttp2__make_nva((&__pyx_v_nva), __pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "nghttp2.pyx":878
 *         nvlen = _make_nva(&nva, handler.response_headers)
 * 
 *         if handler.response_body:             # <<<<<<<<<<<<<<
 *             prd.source.ptr = <void*>handler.response_body
 *             prd.read_callback = data_source_read
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_handler, __pyx_n_s_response_body); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 878, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 878, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_7) {

    /* "nghttp2.pyx":879
 * 
 *         if handler.response_body:
 *             prd.source.ptr = <void*>handler.response_body             # <<<<<<<<<<<<<<
 *             prd.read_callback = data_source_read
 *             prd_ptr = &prd
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_handler, __pyx_n_s_response_body); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 879, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_prd.source.ptr = ((void *)__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "nghttp2.pyx":880
 *         if handler.response_body:
 *             prd.source.ptr = <void*>handler.response_body
 *             prd.read_callback = data_source_read             # <<<<<<<<<<<<<<
 *             prd_ptr = &prd
 *         else:
 */
    __pyx_v_prd.read_callback = __pyx_f_7nghttp2_data_source_read;

    /* "nghttp2.pyx":881
 *             prd.source.ptr = <void*>handler.response_body
 *             prd.read_callback = data_source_read
 *             prd_ptr = &prd             # <<<<<<<<<<<<<<
 *         else:
 *             prd_ptr = NULL
 */
    __pyx_v_prd_ptr = (&__pyx_v_prd);

    /* "nghttp2.pyx":878
 *         nvlen = _make_nva(&nva, handler.response_headers)
 * 
 *         if handler.response_body:             # <<<<<<<<<<<<<<
 *             prd.source.ptr = <void*>handler.response_body
 *             prd.read_callback = data_source_read
 */
    goto __pyx_L3;
  }

  /* "nghttp2.pyx":883
 *             prd_ptr = &prd
 *         else:
 *             prd_ptr = NULL             # <<<<<<<<<<<<<<
 * 
 *         rv = cnghttp2.nghttp2_submit_response(self.session, handler.stream_id,
 */
  /*else*/ {
    __pyx_v_prd_ptr = NULL;
  }
  __pyx_L3:;

  /* "nghttp2.pyx":885
 *             prd_ptr = NULL
 * 
 *         rv = cnghttp2.nghttp2_submit_response(self.session, handler.stream_id,             # <<<<<<<<<<<<<<
 *                                               nva, nvlen, prd_ptr)
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_handler, __pyx_n_s_stream_id); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 885, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_8 = __Pyx_PyInt_As_int32_t(__pyx_t_1); if (unlikely((__pyx_t_8 == ((int32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 885, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "nghttp2.pyx":886
 * 
 *         rv = cnghttp2.nghttp2_submit_response(self.session, handler.stream_id,
 *                                               nva, nvlen, prd_ptr)             # <<<<<<<<<<<<<<
 * 
 *         free(nva)
 */
  __pyx_v_rv = nghttp2_submit_response(__pyx_v_self->__pyx_base.session, __pyx_t_8, __pyx_v_nva, __pyx_v_nvlen, __pyx_v_prd_ptr);

  /* "nghttp2.pyx":888
 *                                               nva, nvlen, prd_ptr)
 * 
 *         free(nva)             # <<<<<<<<<<<<<<
 * 
 *         if rv != 0:
 */
  free(__pyx_v_nva);

  /* "nghttp2.pyx":890
 *         free(nva)
 * 
 *         if rv != 0:             # <<<<<<<<<<<<<<
 *             # TODO Ignore return value
 *             self._rst_stream(handler.stream_id)
 */
  __pyx_t_7 = ((__pyx_v_rv != 0) != 0);
  if (unlikely(__pyx_t_7)) {

    /* "nghttp2.pyx":892
 *         if rv != 0:
 *             # TODO Ignore return value
 *             self._rst_stream(handler.stream_id)             # <<<<<<<<<<<<<<
 *             raise Exception('nghttp2_submit_response failed: {}'.format\
 *                             (_strerror(rv)))
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_rst_stream); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 892, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_handler, __pyx_n_s_stream_id); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 892, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __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);
      }
    }
    __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_6);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 892, __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;

    /* "nghttp2.pyx":893
 *             # TODO Ignore return value
 *             self._rst_stream(handler.stream_id)
 *             raise Exception('nghttp2_submit_response failed: {}'.format\             # <<<<<<<<<<<<<<
 *                             (_strerror(rv)))
 * 
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_nghttp2_submit_response_failed, __pyx_n_s_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 893, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);

    /* "nghttp2.pyx":894
 *             self._rst_stream(handler.stream_id)
 *             raise Exception('nghttp2_submit_response failed: {}'.format\
 *                             (_strerror(rv)))             # <<<<<<<<<<<<<<
 * 
 *         self._log_request(handler)
 */
    __pyx_t_6 = __pyx_f_7nghttp2__strerror(__pyx_v_rv); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 894, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __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);
      }
    }
    __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_6);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 894, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "nghttp2.pyx":893
 *             # TODO Ignore return value
 *             self._rst_stream(handler.stream_id)
 *             raise Exception('nghttp2_submit_response failed: {}'.format\             # <<<<<<<<<<<<<<
 *                             (_strerror(rv)))
 * 
 */
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 893, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(0, 893, __pyx_L1_error)

    /* "nghttp2.pyx":890
 *         free(nva)
 * 
 *         if rv != 0:             # <<<<<<<<<<<<<<
 *             # TODO Ignore return value
 *             self._rst_stream(handler.stream_id)
 */
  }

  /* "nghttp2.pyx":896
 *                             (_strerror(rv)))
 * 
 *         self._log_request(handler)             # <<<<<<<<<<<<<<
 * 
 *     def push(self, handler, promised_handler):
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_log_request); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 896, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  __pyx_t_3 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_6, __pyx_v_handler) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_handler);
  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 896, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "nghttp2.pyx":866
 *                             (_strerror(rv)))
 * 
 *     def send_response(self, handler):             # <<<<<<<<<<<<<<
 *         cdef cnghttp2.nghttp2_data_provider prd
 *         cdef cnghttp2.nghttp2_data_provider *prd_ptr
 */

  /* 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_6);
  __Pyx_AddTraceback("nghttp2._HTTP2SessionCore.send_response", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":898
 *         self._log_request(handler)
 * 
 *     def push(self, handler, promised_handler):             # <<<<<<<<<<<<<<
 *         cdef cnghttp2.nghttp2_nv *nva
 *         cdef size_t nvlen
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_17_HTTP2SessionCore_5push(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_7nghttp2_17_HTTP2SessionCore_5push(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_handler = 0;
  PyObject *__pyx_v_promised_handler = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("push (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_handler,&__pyx_n_s_promised_handler,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);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_handler)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_promised_handler)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("push", 1, 2, 2, 1); __PYX_ERR(0, 898, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "push") < 0)) __PYX_ERR(0, 898, __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_handler = values[0];
    __pyx_v_promised_handler = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("push", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 898, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("nghttp2._HTTP2SessionCore.push", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7nghttp2_17_HTTP2SessionCore_4push(((struct __pyx_obj_7nghttp2__HTTP2SessionCore *)__pyx_v_self), __pyx_v_handler, __pyx_v_promised_handler);

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

static PyObject *__pyx_pf_7nghttp2_17_HTTP2SessionCore_4push(struct __pyx_obj_7nghttp2__HTTP2SessionCore *__pyx_v_self, PyObject *__pyx_v_handler, PyObject *__pyx_v_promised_handler) {
  nghttp2_nv *__pyx_v_nva;
  size_t __pyx_v_nvlen;
  int32_t __pyx_v_promised_stream_id;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int32_t __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("push", 0);

  /* "nghttp2.pyx":903
 *         cdef int32_t promised_stream_id
 * 
 *         self.handlers.add(promised_handler)             # <<<<<<<<<<<<<<
 * 
 *         nva = NULL
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.handlers, __pyx_n_s_add); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 903, __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);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_promised_handler) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_promised_handler);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 903, __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;

  /* "nghttp2.pyx":905
 *         self.handlers.add(promised_handler)
 * 
 *         nva = NULL             # <<<<<<<<<<<<<<
 *         nvlen = _make_nva(&nva, promised_handler.headers)
 * 
 */
  __pyx_v_nva = NULL;

  /* "nghttp2.pyx":906
 * 
 *         nva = NULL
 *         nvlen = _make_nva(&nva, promised_handler.headers)             # <<<<<<<<<<<<<<
 * 
 *         promised_stream_id = cnghttp2.nghttp2_submit_push_promise\
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_promised_handler, __pyx_n_s_headers); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 906, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_nvlen = __pyx_f_7nghttp2__make_nva((&__pyx_v_nva), __pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "nghttp2.pyx":911
 *                              (self.session,
 *                               cnghttp2.NGHTTP2_FLAG_NONE,
 *                               handler.stream_id,             # <<<<<<<<<<<<<<
 *                               nva, nvlen,
 *                               <void*>promised_handler)
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_handler, __pyx_n_s_stream_id); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 911, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyInt_As_int32_t(__pyx_t_1); if (unlikely((__pyx_t_4 == ((int32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 911, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "nghttp2.pyx":909
 * 
 *         promised_stream_id = cnghttp2.nghttp2_submit_push_promise\
 *                              (self.session,             # <<<<<<<<<<<<<<
 *                               cnghttp2.NGHTTP2_FLAG_NONE,
 *                               handler.stream_id,
 */
  __pyx_v_promised_stream_id = nghttp2_submit_push_promise(__pyx_v_self->__pyx_base.session, NGHTTP2_FLAG_NONE, __pyx_t_4, __pyx_v_nva, __pyx_v_nvlen, ((void *)__pyx_v_promised_handler));

  /* "nghttp2.pyx":914
 *                               nva, nvlen,
 *                               <void*>promised_handler)
 *         if promised_stream_id < 0:             # <<<<<<<<<<<<<<
 *             raise Exception('nghttp2_submit_push_promise failed: {}'.format\
 *                             (_strerror(promised_stream_id)))
 */
  __pyx_t_5 = ((__pyx_v_promised_stream_id < 0) != 0);
  if (unlikely(__pyx_t_5)) {

    /* "nghttp2.pyx":915
 *                               <void*>promised_handler)
 *         if promised_stream_id < 0:
 *             raise Exception('nghttp2_submit_push_promise failed: {}'.format\             # <<<<<<<<<<<<<<
 *                             (_strerror(promised_stream_id)))
 * 
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_nghttp2_submit_push_promise_fail, __pyx_n_s_format); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 915, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);

    /* "nghttp2.pyx":916
 *         if promised_stream_id < 0:
 *             raise Exception('nghttp2_submit_push_promise failed: {}'.format\
 *                             (_strerror(promised_stream_id)))             # <<<<<<<<<<<<<<
 * 
 *         promised_handler.stream_id = promised_stream_id
 */
    __pyx_t_3 = __pyx_f_7nghttp2__strerror(__pyx_v_promised_stream_id); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 916, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __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);
      }
    }
    __pyx_t_1 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_6, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 916, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "nghttp2.pyx":915
 *                               <void*>promised_handler)
 *         if promised_stream_id < 0:
 *             raise Exception('nghttp2_submit_push_promise failed: {}'.format\             # <<<<<<<<<<<<<<
 *                             (_strerror(promised_stream_id)))
 * 
 */
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 915, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(0, 915, __pyx_L1_error)

    /* "nghttp2.pyx":914
 *                               nva, nvlen,
 *                               <void*>promised_handler)
 *         if promised_stream_id < 0:             # <<<<<<<<<<<<<<
 *             raise Exception('nghttp2_submit_push_promise failed: {}'.format\
 *                             (_strerror(promised_stream_id)))
 */
  }

  /* "nghttp2.pyx":918
 *                             (_strerror(promised_stream_id)))
 * 
 *         promised_handler.stream_id = promised_stream_id             # <<<<<<<<<<<<<<
 * 
 *         logging.debug('push, stream_id:%s', promised_stream_id)
 */
  __pyx_t_2 = __Pyx_PyInt_From_int32_t(__pyx_v_promised_stream_id); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 918, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_promised_handler, __pyx_n_s_stream_id, __pyx_t_2) < 0) __PYX_ERR(0, 918, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "nghttp2.pyx":920
 *         promised_handler.stream_id = promised_stream_id
 * 
 *         logging.debug('push, stream_id:%s', promised_stream_id)             # <<<<<<<<<<<<<<
 * 
 *         return promised_handler
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_logging); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 920, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_debug); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 920, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyInt_From_int32_t(__pyx_v_promised_stream_id); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 920, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_6 = NULL;
  __pyx_t_7 = 0;
  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);
      __pyx_t_7 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_kp_s_push_stream_id_s, __pyx_t_1};
    __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(0, 920, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_kp_s_push_stream_id_s, __pyx_t_1};
    __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(0, 920, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else
  #endif
  {
    __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 920, __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_INCREF(__pyx_kp_s_push_stream_id_s);
    __Pyx_GIVEREF(__pyx_kp_s_push_stream_id_s);
    PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_kp_s_push_stream_id_s);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 920, __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_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "nghttp2.pyx":922
 *         logging.debug('push, stream_id:%s', promised_stream_id)
 * 
 *         return promised_handler             # <<<<<<<<<<<<<<
 * 
 *     def connection_lost(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_promised_handler);
  __pyx_r = __pyx_v_promised_handler;
  goto __pyx_L0;

  /* "nghttp2.pyx":898
 *         self._log_request(handler)
 * 
 *     def push(self, handler, promised_handler):             # <<<<<<<<<<<<<<
 *         cdef cnghttp2.nghttp2_nv *nva
 *         cdef size_t nvlen
 */

  /* 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_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("nghttp2._HTTP2SessionCore.push", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":924
 *         return promised_handler
 * 
 *     def connection_lost(self):             # <<<<<<<<<<<<<<
 *         self._stop_settings_timer()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_17_HTTP2SessionCore_7connection_lost(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_7nghttp2_17_HTTP2SessionCore_7connection_lost(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("connection_lost (wrapper)", 0);
  __pyx_r = __pyx_pf_7nghttp2_17_HTTP2SessionCore_6connection_lost(((struct __pyx_obj_7nghttp2__HTTP2SessionCore *)__pyx_v_self));

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

static PyObject *__pyx_pf_7nghttp2_17_HTTP2SessionCore_6connection_lost(struct __pyx_obj_7nghttp2__HTTP2SessionCore *__pyx_v_self) {
  PyObject *__pyx_v_handler = 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;
  PyObject *(*__pyx_t_5)(PyObject *);
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("connection_lost", 0);

  /* "nghttp2.pyx":925
 * 
 *     def connection_lost(self):
 *         self._stop_settings_timer()             # <<<<<<<<<<<<<<
 * 
 *         for handler in self.handlers:
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_stop_settings_timer); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 925, __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);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 925, __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;

  /* "nghttp2.pyx":927
 *         self._stop_settings_timer()
 * 
 *         for handler in self.handlers:             # <<<<<<<<<<<<<<
 *             handler.on_close(cnghttp2.NGHTTP2_INTERNAL_ERROR)
 *         self.handlers = set()
 */
  if (likely(PyList_CheckExact(__pyx_v_self->__pyx_base.handlers)) || PyTuple_CheckExact(__pyx_v_self->__pyx_base.handlers)) {
    __pyx_t_1 = __pyx_v_self->__pyx_base.handlers; __Pyx_INCREF(__pyx_t_1); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
  } else {
    __pyx_t_4 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_self->__pyx_base.handlers); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 927, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 927, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_5)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_4 >= 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_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 927, __pyx_L1_error)
        #else
        __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 927, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        #endif
      } else {
        if (__pyx_t_4 >= 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_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 927, __pyx_L1_error)
        #else
        __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 927, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        #endif
      }
    } else {
      __pyx_t_2 = __pyx_t_5(__pyx_t_1);
      if (unlikely(!__pyx_t_2)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 927, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_XDECREF_SET(__pyx_v_handler, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "nghttp2.pyx":928
 * 
 *         for handler in self.handlers:
 *             handler.on_close(cnghttp2.NGHTTP2_INTERNAL_ERROR)             # <<<<<<<<<<<<<<
 *         self.handlers = set()
 * 
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_handler, __pyx_n_s_on_close); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 928, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_6 = __Pyx_PyInt_From_nghttp2_error_code(NGHTTP2_INTERNAL_ERROR); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 928, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = NULL;
    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_2 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_7, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_6);
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 928, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "nghttp2.pyx":927
 *         self._stop_settings_timer()
 * 
 *         for handler in self.handlers:             # <<<<<<<<<<<<<<
 *             handler.on_close(cnghttp2.NGHTTP2_INTERNAL_ERROR)
 *         self.handlers = set()
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "nghttp2.pyx":929
 *         for handler in self.handlers:
 *             handler.on_close(cnghttp2.NGHTTP2_INTERNAL_ERROR)
 *         self.handlers = set()             # <<<<<<<<<<<<<<
 * 
 * cdef class _HTTP2ClientSessionCore(_HTTP2SessionCoreBase):
 */
  __pyx_t_1 = PySet_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 929, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->__pyx_base.handlers);
  __Pyx_DECREF(__pyx_v_self->__pyx_base.handlers);
  __pyx_v_self->__pyx_base.handlers = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "nghttp2.pyx":924
 *         return promised_handler
 * 
 *     def connection_lost(self):             # <<<<<<<<<<<<<<
 *         self._stop_settings_timer()
 * 
 */

  /* 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_7);
  __Pyx_AddTraceback("nghttp2._HTTP2SessionCore.connection_lost", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_handler);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_17_HTTP2SessionCore_9__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_7nghttp2_17_HTTP2SessionCore_9__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7nghttp2_17_HTTP2SessionCore_8__reduce_cython__(((struct __pyx_obj_7nghttp2__HTTP2SessionCore *)__pyx_v_self));

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

static PyObject *__pyx_pf_7nghttp2_17_HTTP2SessionCore_8__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7nghttp2__HTTP2SessionCore *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __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(1, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("nghttp2._HTTP2SessionCore.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_17_HTTP2SessionCore_11__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static PyObject *__pyx_pw_7nghttp2_17_HTTP2SessionCore_11__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7nghttp2_17_HTTP2SessionCore_10__setstate_cython__(((struct __pyx_obj_7nghttp2__HTTP2SessionCore *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_7nghttp2_17_HTTP2SessionCore_10__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7nghttp2__HTTP2SessionCore *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __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(1, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("nghttp2._HTTP2SessionCore.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":932
 * 
 * cdef class _HTTP2ClientSessionCore(_HTTP2SessionCoreBase):
 *     def __cinit__(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         cdef cnghttp2.nghttp2_session_callbacks *callbacks
 *         cdef cnghttp2.nghttp2_settings_entry iv[2]
 */

/* Python wrapper */
static int __pyx_pw_7nghttp2_23_HTTP2ClientSessionCore_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_7nghttp2_23_HTTP2ClientSessionCore_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_kwargs = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  if (unlikely(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 1))) return -1;
  __pyx_v_kwargs = (__pyx_kwds) ? PyDict_Copy(__pyx_kwds) : PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return -1;
  __Pyx_GOTREF(__pyx_v_kwargs);
  __Pyx_INCREF(__pyx_args);
  __pyx_v_args = __pyx_args;
  __pyx_r = __pyx_pf_7nghttp2_23_HTTP2ClientSessionCore___cinit__(((struct __pyx_obj_7nghttp2__HTTP2ClientSessionCore *)__pyx_v_self), __pyx_v_args, __pyx_v_kwargs);

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

static int __pyx_pf_7nghttp2_23_HTTP2ClientSessionCore___cinit__(struct __pyx_obj_7nghttp2__HTTP2ClientSessionCore *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) {
  nghttp2_session_callbacks *__pyx_v_callbacks;
  nghttp2_settings_entry __pyx_v_iv[2];
  int __pyx_v_rv;
  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;
  size_t __pyx_t_6;
  size_t __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "nghttp2.pyx":937
 *         cdef int rv
 * 
 *         super(_HTTP2ClientSessionCore, self).__init__(*args, **kwargs)             # <<<<<<<<<<<<<<
 * 
 *         rv = cnghttp2.nghttp2_session_callbacks_new(&callbacks)
 */
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 937, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_ptype_7nghttp2__HTTP2ClientSessionCore));
  __Pyx_GIVEREF(((PyObject *)__pyx_ptype_7nghttp2__HTTP2ClientSessionCore));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_ptype_7nghttp2__HTTP2ClientSessionCore));
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_self));
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 937, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_init); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 937, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyDict_Copy(__pyx_v_kwargs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 937, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_v_args, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 937, __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_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "nghttp2.pyx":939
 *         super(_HTTP2ClientSessionCore, self).__init__(*args, **kwargs)
 * 
 *         rv = cnghttp2.nghttp2_session_callbacks_new(&callbacks)             # <<<<<<<<<<<<<<
 * 
 *         if rv != 0:
 */
  __pyx_v_rv = nghttp2_session_callbacks_new((&__pyx_v_callbacks));

  /* "nghttp2.pyx":941
 *         rv = cnghttp2.nghttp2_session_callbacks_new(&callbacks)
 * 
 *         if rv != 0:             # <<<<<<<<<<<<<<
 *             raise Exception('nghttp2_session_callbacks_new failed: {}'.format\
 *                             (_strerror(rv)))
 */
  __pyx_t_4 = ((__pyx_v_rv != 0) != 0);
  if (unlikely(__pyx_t_4)) {

    /* "nghttp2.pyx":942
 * 
 *         if rv != 0:
 *             raise Exception('nghttp2_session_callbacks_new failed: {}'.format\             # <<<<<<<<<<<<<<
 *                             (_strerror(rv)))
 * 
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_nghttp2_session_callbacks_new_fa, __pyx_n_s_format); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 942, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);

    /* "nghttp2.pyx":943
 *         if rv != 0:
 *             raise Exception('nghttp2_session_callbacks_new failed: {}'.format\
 *                             (_strerror(rv)))             # <<<<<<<<<<<<<<
 * 
 *         cnghttp2.nghttp2_session_callbacks_set_on_header_callback(
 */
    __pyx_t_1 = __pyx_f_7nghttp2__strerror(__pyx_v_rv); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 943, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = NULL;
    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_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_1);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 943, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "nghttp2.pyx":942
 * 
 *         if rv != 0:
 *             raise Exception('nghttp2_session_callbacks_new failed: {}'.format\             # <<<<<<<<<<<<<<
 *                             (_strerror(rv)))
 * 
 */
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 942, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(0, 942, __pyx_L1_error)

    /* "nghttp2.pyx":941
 *         rv = cnghttp2.nghttp2_session_callbacks_new(&callbacks)
 * 
 *         if rv != 0:             # <<<<<<<<<<<<<<
 *             raise Exception('nghttp2_session_callbacks_new failed: {}'.format\
 *                             (_strerror(rv)))
 */
  }

  /* "nghttp2.pyx":945
 *                             (_strerror(rv)))
 * 
 *         cnghttp2.nghttp2_session_callbacks_set_on_header_callback(             # <<<<<<<<<<<<<<
 *             callbacks, client_on_header)
 *         cnghttp2.nghttp2_session_callbacks_set_on_begin_headers_callback(
 */
  nghttp2_session_callbacks_set_on_header_callback(__pyx_v_callbacks, __pyx_f_7nghttp2_client_on_header);

  /* "nghttp2.pyx":947
 *         cnghttp2.nghttp2_session_callbacks_set_on_header_callback(
 *             callbacks, client_on_header)
 *         cnghttp2.nghttp2_session_callbacks_set_on_begin_headers_callback(             # <<<<<<<<<<<<<<
 *             callbacks, client_on_begin_headers)
 *         cnghttp2.nghttp2_session_callbacks_set_on_frame_recv_callback(
 */
  nghttp2_session_callbacks_set_on_begin_headers_callback(__pyx_v_callbacks, __pyx_f_7nghttp2_client_on_begin_headers);

  /* "nghttp2.pyx":949
 *         cnghttp2.nghttp2_session_callbacks_set_on_begin_headers_callback(
 *             callbacks, client_on_begin_headers)
 *         cnghttp2.nghttp2_session_callbacks_set_on_frame_recv_callback(             # <<<<<<<<<<<<<<
 *             callbacks, client_on_frame_recv)
 *         cnghttp2.nghttp2_session_callbacks_set_on_stream_close_callback(
 */
  nghttp2_session_callbacks_set_on_frame_recv_callback(__pyx_v_callbacks, __pyx_f_7nghttp2_client_on_frame_recv);

  /* "nghttp2.pyx":951
 *         cnghttp2.nghttp2_session_callbacks_set_on_frame_recv_callback(
 *             callbacks, client_on_frame_recv)
 *         cnghttp2.nghttp2_session_callbacks_set_on_stream_close_callback(             # <<<<<<<<<<<<<<
 *             callbacks, on_stream_close)
 *         cnghttp2.nghttp2_session_callbacks_set_on_frame_send_callback(
 */
  nghttp2_session_callbacks_set_on_stream_close_callback(__pyx_v_callbacks, __pyx_f_7nghttp2_on_stream_close);

  /* "nghttp2.pyx":953
 *         cnghttp2.nghttp2_session_callbacks_set_on_stream_close_callback(
 *             callbacks, on_stream_close)
 *         cnghttp2.nghttp2_session_callbacks_set_on_frame_send_callback(             # <<<<<<<<<<<<<<
 *             callbacks, client_on_frame_send)
 *         cnghttp2.nghttp2_session_callbacks_set_on_data_chunk_recv_callback(
 */
  nghttp2_session_callbacks_set_on_frame_send_callback(__pyx_v_callbacks, __pyx_f_7nghttp2_client_on_frame_send);

  /* "nghttp2.pyx":955
 *         cnghttp2.nghttp2_session_callbacks_set_on_frame_send_callback(
 *             callbacks, client_on_frame_send)
 *         cnghttp2.nghttp2_session_callbacks_set_on_data_chunk_recv_callback(             # <<<<<<<<<<<<<<
 *             callbacks, on_data_chunk_recv)
 * 
 */
  nghttp2_session_callbacks_set_on_data_chunk_recv_callback(__pyx_v_callbacks, __pyx_f_7nghttp2_on_data_chunk_recv);

  /* "nghttp2.pyx":958
 *             callbacks, on_data_chunk_recv)
 * 
 *         rv = cnghttp2.nghttp2_session_client_new(&self.session, callbacks,             # <<<<<<<<<<<<<<
 *                                                  <void*>self)
 * 
 */
  __pyx_v_rv = nghttp2_session_client_new((&__pyx_v_self->__pyx_base.session), __pyx_v_callbacks, ((void *)__pyx_v_self));

  /* "nghttp2.pyx":961
 *                                                  <void*>self)
 * 
 *         cnghttp2.nghttp2_session_callbacks_del(callbacks)             # <<<<<<<<<<<<<<
 * 
 *         if rv != 0:
 */
  nghttp2_session_callbacks_del(__pyx_v_callbacks);

  /* "nghttp2.pyx":963
 *         cnghttp2.nghttp2_session_callbacks_del(callbacks)
 * 
 *         if rv != 0:             # <<<<<<<<<<<<<<
 *             raise Exception('nghttp2_session_client_new failed: {}'.format\
 *                             (_strerror(rv)))
 */
  __pyx_t_4 = ((__pyx_v_rv != 0) != 0);
  if (unlikely(__pyx_t_4)) {

    /* "nghttp2.pyx":964
 * 
 *         if rv != 0:
 *             raise Exception('nghttp2_session_client_new failed: {}'.format\             # <<<<<<<<<<<<<<
 *                             (_strerror(rv)))
 * 
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_nghttp2_session_client_new_faile, __pyx_n_s_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 964, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);

    /* "nghttp2.pyx":965
 *         if rv != 0:
 *             raise Exception('nghttp2_session_client_new failed: {}'.format\
 *                             (_strerror(rv)))             # <<<<<<<<<<<<<<
 * 
 *         iv[0].settings_id = cnghttp2.NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS
 */
    __pyx_t_1 = __pyx_f_7nghttp2__strerror(__pyx_v_rv); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 965, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = NULL;
    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_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_1);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 965, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "nghttp2.pyx":964
 * 
 *         if rv != 0:
 *             raise Exception('nghttp2_session_client_new failed: {}'.format\             # <<<<<<<<<<<<<<
 *                             (_strerror(rv)))
 * 
 */
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 964, __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(0, 964, __pyx_L1_error)

    /* "nghttp2.pyx":963
 *         cnghttp2.nghttp2_session_callbacks_del(callbacks)
 * 
 *         if rv != 0:             # <<<<<<<<<<<<<<
 *             raise Exception('nghttp2_session_client_new failed: {}'.format\
 *                             (_strerror(rv)))
 */
  }

  /* "nghttp2.pyx":967
 *                             (_strerror(rv)))
 * 
 *         iv[0].settings_id = cnghttp2.NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS             # <<<<<<<<<<<<<<
 *         iv[0].value = 100
 *         iv[1].settings_id = cnghttp2.NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE
 */
  (__pyx_v_iv[0]).settings_id = NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS;

  /* "nghttp2.pyx":968
 * 
 *         iv[0].settings_id = cnghttp2.NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS
 *         iv[0].value = 100             # <<<<<<<<<<<<<<
 *         iv[1].settings_id = cnghttp2.NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE
 *         iv[1].value = cnghttp2.NGHTTP2_INITIAL_WINDOW_SIZE
 */
  (__pyx_v_iv[0]).value = 0x64;

  /* "nghttp2.pyx":969
 *         iv[0].settings_id = cnghttp2.NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS
 *         iv[0].value = 100
 *         iv[1].settings_id = cnghttp2.NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE             # <<<<<<<<<<<<<<
 *         iv[1].value = cnghttp2.NGHTTP2_INITIAL_WINDOW_SIZE
 * 
 */
  (__pyx_v_iv[1]).settings_id = NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE;

  /* "nghttp2.pyx":970
 *         iv[0].value = 100
 *         iv[1].settings_id = cnghttp2.NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE
 *         iv[1].value = cnghttp2.NGHTTP2_INITIAL_WINDOW_SIZE             # <<<<<<<<<<<<<<
 * 
 *         rv = cnghttp2.nghttp2_submit_settings(self.session,
 */
  (__pyx_v_iv[1]).value = NGHTTP2_INITIAL_WINDOW_SIZE;

  /* "nghttp2.pyx":974
 *         rv = cnghttp2.nghttp2_submit_settings(self.session,
 *                                               cnghttp2.NGHTTP2_FLAG_NONE,
 *                                               iv, sizeof(iv) // sizeof(iv[0]))             # <<<<<<<<<<<<<<
 * 
 *         if rv != 0:
 */
  __pyx_t_6 = (sizeof(__pyx_v_iv));
  __pyx_t_7 = (sizeof((__pyx_v_iv[0])));
  if (unlikely(__pyx_t_7 == 0)) {
    PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
    __PYX_ERR(0, 974, __pyx_L1_error)
  }

  /* "nghttp2.pyx":972
 *         iv[1].value = cnghttp2.NGHTTP2_INITIAL_WINDOW_SIZE
 * 
 *         rv = cnghttp2.nghttp2_submit_settings(self.session,             # <<<<<<<<<<<<<<
 *                                               cnghttp2.NGHTTP2_FLAG_NONE,
 *                                               iv, sizeof(iv) // sizeof(iv[0]))
 */
  __pyx_v_rv = nghttp2_submit_settings(__pyx_v_self->__pyx_base.session, NGHTTP2_FLAG_NONE, __pyx_v_iv, (__pyx_t_6 / __pyx_t_7));

  /* "nghttp2.pyx":976
 *                                               iv, sizeof(iv) // sizeof(iv[0]))
 * 
 *         if rv != 0:             # <<<<<<<<<<<<<<
 *             raise Exception('nghttp2_submit_settings failed: {}'.format\
 *                             (_strerror(rv)))
 */
  __pyx_t_4 = ((__pyx_v_rv != 0) != 0);
  if (unlikely(__pyx_t_4)) {

    /* "nghttp2.pyx":977
 * 
 *         if rv != 0:
 *             raise Exception('nghttp2_submit_settings failed: {}'.format\             # <<<<<<<<<<<<<<
 *                             (_strerror(rv)))
 * 
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_nghttp2_submit_settings_failed, __pyx_n_s_format); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 977, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);

    /* "nghttp2.pyx":978
 *         if rv != 0:
 *             raise Exception('nghttp2_submit_settings failed: {}'.format\
 *                             (_strerror(rv)))             # <<<<<<<<<<<<<<
 * 
 *     def send_request(self, method, scheme, host, path, headers, body, handler):
 */
    __pyx_t_1 = __pyx_f_7nghttp2__strerror(__pyx_v_rv); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 978, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = NULL;
    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_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_1);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 978, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "nghttp2.pyx":977
 * 
 *         if rv != 0:
 *             raise Exception('nghttp2_submit_settings failed: {}'.format\             # <<<<<<<<<<<<<<
 *                             (_strerror(rv)))
 * 
 */
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 977, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(0, 977, __pyx_L1_error)

    /* "nghttp2.pyx":976
 *                                               iv, sizeof(iv) // sizeof(iv[0]))
 * 
 *         if rv != 0:             # <<<<<<<<<<<<<<
 *             raise Exception('nghttp2_submit_settings failed: {}'.format\
 *                             (_strerror(rv)))
 */
  }

  /* "nghttp2.pyx":932
 * 
 * cdef class _HTTP2ClientSessionCore(_HTTP2SessionCoreBase):
 *     def __cinit__(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         cdef cnghttp2.nghttp2_session_callbacks *callbacks
 *         cdef cnghttp2.nghttp2_settings_entry iv[2]
 */

  /* 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("nghttp2._HTTP2ClientSessionCore.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":980
 *                             (_strerror(rv)))
 * 
 *     def send_request(self, method, scheme, host, path, headers, body, handler):             # <<<<<<<<<<<<<<
 *         cdef cnghttp2.nghttp2_data_provider prd
 *         cdef cnghttp2.nghttp2_data_provider *prd_ptr
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_23_HTTP2ClientSessionCore_3send_request(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_7nghttp2_23_HTTP2ClientSessionCore_3send_request(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_method = 0;
  PyObject *__pyx_v_scheme = 0;
  PyObject *__pyx_v_host = 0;
  PyObject *__pyx_v_path = 0;
  PyObject *__pyx_v_headers = 0;
  PyObject *__pyx_v_body = 0;
  PyObject *__pyx_v_handler = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("send_request (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_method_2,&__pyx_n_s_scheme_2,&__pyx_n_s_host,&__pyx_n_s_path_2,&__pyx_n_s_headers,&__pyx_n_s_body,&__pyx_n_s_handler,0};
    PyObject* values[7] = {0,0,0,0,0,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  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_method_2)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_scheme_2)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("send_request", 1, 7, 7, 1); __PYX_ERR(0, 980, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_host)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("send_request", 1, 7, 7, 2); __PYX_ERR(0, 980, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_path_2)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("send_request", 1, 7, 7, 3); __PYX_ERR(0, 980, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_headers)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("send_request", 1, 7, 7, 4); __PYX_ERR(0, 980, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_body)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("send_request", 1, 7, 7, 5); __PYX_ERR(0, 980, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_handler)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("send_request", 1, 7, 7, 6); __PYX_ERR(0, 980, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "send_request") < 0)) __PYX_ERR(0, 980, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 7) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
      values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
    }
    __pyx_v_method = values[0];
    __pyx_v_scheme = values[1];
    __pyx_v_host = values[2];
    __pyx_v_path = values[3];
    __pyx_v_headers = values[4];
    __pyx_v_body = values[5];
    __pyx_v_handler = values[6];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("send_request", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 980, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("nghttp2._HTTP2ClientSessionCore.send_request", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7nghttp2_23_HTTP2ClientSessionCore_2send_request(((struct __pyx_obj_7nghttp2__HTTP2ClientSessionCore *)__pyx_v_self), __pyx_v_method, __pyx_v_scheme, __pyx_v_host, __pyx_v_path, __pyx_v_headers, __pyx_v_body, __pyx_v_handler);

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

static PyObject *__pyx_pf_7nghttp2_23_HTTP2ClientSessionCore_2send_request(struct __pyx_obj_7nghttp2__HTTP2ClientSessionCore *__pyx_v_self, PyObject *__pyx_v_method, PyObject *__pyx_v_scheme, PyObject *__pyx_v_host, PyObject *__pyx_v_path, PyObject *__pyx_v_headers, PyObject *__pyx_v_body, PyObject *__pyx_v_handler) {
  nghttp2_data_provider __pyx_v_prd;
  nghttp2_data_provider *__pyx_v_prd_ptr;
  nghttp2_priority_spec *__pyx_v_pri_ptr;
  nghttp2_nv *__pyx_v_nva;
  size_t __pyx_v_nvlen;
  int32_t __pyx_v_stream_id;
  PyObject *__pyx_v_custom_headers = 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;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("send_request", 0);
  __Pyx_INCREF(__pyx_v_headers);
  __Pyx_INCREF(__pyx_v_body);

  /* "nghttp2.pyx":988
 *         cdef int32_t stream_id
 * 
 *         body = wrap_body(body)             # <<<<<<<<<<<<<<
 * 
 *         custom_headers = _encode_headers(headers)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_wrap_body); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 988, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(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_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_body) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_body);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 988, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF_SET(__pyx_v_body, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "nghttp2.pyx":990
 *         body = wrap_body(body)
 * 
 *         custom_headers = _encode_headers(headers)             # <<<<<<<<<<<<<<
 *         headers = [
 *             (b':method', method.encode('utf-8')),
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_encode_headers); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 990, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(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_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_headers) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_headers);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 990, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_custom_headers = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "nghttp2.pyx":992
 *         custom_headers = _encode_headers(headers)
 *         headers = [
 *             (b':method', method.encode('utf-8')),             # <<<<<<<<<<<<<<
 *             (b':scheme', scheme.encode('utf-8')),
 *             (b':authority', host.encode('utf-8')),
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_method, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 992, __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);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_s_utf_8) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_s_utf_8);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 992, __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(0, 992, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_kp_b_method);
  __Pyx_GIVEREF(__pyx_kp_b_method);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_b_method);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "nghttp2.pyx":993
 *         headers = [
 *             (b':method', method.encode('utf-8')),
 *             (b':scheme', scheme.encode('utf-8')),             # <<<<<<<<<<<<<<
 *             (b':authority', host.encode('utf-8')),
 *             (b':path', path.encode('utf-8'))
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_scheme, __pyx_n_s_encode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 993, __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);
    }
  }
  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_kp_s_utf_8) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_s_utf_8);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 993, __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(0, 993, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_kp_b_scheme);
  __Pyx_GIVEREF(__pyx_kp_b_scheme);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_b_scheme);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "nghttp2.pyx":994
 *             (b':method', method.encode('utf-8')),
 *             (b':scheme', scheme.encode('utf-8')),
 *             (b':authority', host.encode('utf-8')),             # <<<<<<<<<<<<<<
 *             (b':path', path.encode('utf-8'))
 *         ]
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_host, __pyx_n_s_encode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 994, __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);
    }
  }
  __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_kp_s_utf_8) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_s_utf_8);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 994, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 994, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_kp_b_authority);
  __Pyx_GIVEREF(__pyx_kp_b_authority);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_kp_b_authority);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "nghttp2.pyx":995
 *             (b':scheme', scheme.encode('utf-8')),
 *             (b':authority', host.encode('utf-8')),
 *             (b':path', path.encode('utf-8'))             # <<<<<<<<<<<<<<
 *         ]
 *         headers.extend(custom_headers)
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_path, __pyx_n_s_encode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 995, __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);
    }
  }
  __pyx_t_1 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_kp_s_utf_8) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_kp_s_utf_8);
  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 995, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 995, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_kp_b_path);
  __Pyx_GIVEREF(__pyx_kp_b_path);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_kp_b_path);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "nghttp2.pyx":991
 * 
 *         custom_headers = _encode_headers(headers)
 *         headers = [             # <<<<<<<<<<<<<<
 *             (b':method', method.encode('utf-8')),
 *             (b':scheme', scheme.encode('utf-8')),
 */
  __pyx_t_1 = PyList_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 991, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_3);
  PyList_SET_ITEM(__pyx_t_1, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_4);
  PyList_SET_ITEM(__pyx_t_1, 2, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_5);
  PyList_SET_ITEM(__pyx_t_1, 3, __pyx_t_5);
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_5 = 0;
  __Pyx_DECREF_SET(__pyx_v_headers, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "nghttp2.pyx":997
 *             (b':path', path.encode('utf-8'))
 *         ]
 *         headers.extend(custom_headers)             # <<<<<<<<<<<<<<
 * 
 *         nva = NULL
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_headers, __pyx_n_s_extend); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 997, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_4, __pyx_v_custom_headers) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_custom_headers);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 997, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "nghttp2.pyx":999
 *         headers.extend(custom_headers)
 * 
 *         nva = NULL             # <<<<<<<<<<<<<<
 *         nvlen = _make_nva(&nva, headers)
 * 
 */
  __pyx_v_nva = NULL;

  /* "nghttp2.pyx":1000
 * 
 *         nva = NULL
 *         nvlen = _make_nva(&nva, headers)             # <<<<<<<<<<<<<<
 * 
 *         if body:
 */
  __pyx_v_nvlen = __pyx_f_7nghttp2__make_nva((&__pyx_v_nva), __pyx_v_headers);

  /* "nghttp2.pyx":1002
 *         nvlen = _make_nva(&nva, headers)
 * 
 *         if body:             # <<<<<<<<<<<<<<
 *             prd.source.ptr = <void*>body
 *             prd.read_callback = data_source_read
 */
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_body); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 1002, __pyx_L1_error)
  if (__pyx_t_7) {

    /* "nghttp2.pyx":1003
 * 
 *         if body:
 *             prd.source.ptr = <void*>body             # <<<<<<<<<<<<<<
 *             prd.read_callback = data_source_read
 *             prd_ptr = &prd
 */
    __pyx_v_prd.source.ptr = ((void *)__pyx_v_body);

    /* "nghttp2.pyx":1004
 *         if body:
 *             prd.source.ptr = <void*>body
 *             prd.read_callback = data_source_read             # <<<<<<<<<<<<<<
 *             prd_ptr = &prd
 *         else:
 */
    __pyx_v_prd.read_callback = __pyx_f_7nghttp2_data_source_read;

    /* "nghttp2.pyx":1005
 *             prd.source.ptr = <void*>body
 *             prd.read_callback = data_source_read
 *             prd_ptr = &prd             # <<<<<<<<<<<<<<
 *         else:
 *             prd_ptr = NULL
 */
    __pyx_v_prd_ptr = (&__pyx_v_prd);

    /* "nghttp2.pyx":1002
 *         nvlen = _make_nva(&nva, headers)
 * 
 *         if body:             # <<<<<<<<<<<<<<
 *             prd.source.ptr = <void*>body
 *             prd.read_callback = data_source_read
 */
    goto __pyx_L3;
  }

  /* "nghttp2.pyx":1007
 *             prd_ptr = &prd
 *         else:
 *             prd_ptr = NULL             # <<<<<<<<<<<<<<
 * 
 *         # TODO: Enable priorities
 */
  /*else*/ {
    __pyx_v_prd_ptr = NULL;
  }
  __pyx_L3:;

  /* "nghttp2.pyx":1010
 * 
 *         # TODO: Enable priorities
 *         pri_ptr = NULL             # <<<<<<<<<<<<<<
 * 
 *         stream_id = cnghttp2.nghttp2_submit_request\
 */
  __pyx_v_pri_ptr = NULL;

  /* "nghttp2.pyx":1013
 * 
 *         stream_id = cnghttp2.nghttp2_submit_request\
 *                              (self.session, pri_ptr,             # <<<<<<<<<<<<<<
 *                               nva, nvlen, prd_ptr,
 *                               <void*>handler)
 */
  __pyx_v_stream_id = nghttp2_submit_request(__pyx_v_self->__pyx_base.session, __pyx_v_pri_ptr, __pyx_v_nva, __pyx_v_nvlen, __pyx_v_prd_ptr, ((void *)__pyx_v_handler));

  /* "nghttp2.pyx":1016
 *                               nva, nvlen, prd_ptr,
 *                               <void*>handler)
 *         free(nva)             # <<<<<<<<<<<<<<
 * 
 *         if stream_id < 0:
 */
  free(__pyx_v_nva);

  /* "nghttp2.pyx":1018
 *         free(nva)
 * 
 *         if stream_id < 0:             # <<<<<<<<<<<<<<
 *             raise Exception('nghttp2_submit_request failed: {}'.format\
 *                             (_strerror(stream_id)))
 */
  __pyx_t_7 = ((__pyx_v_stream_id < 0) != 0);
  if (unlikely(__pyx_t_7)) {

    /* "nghttp2.pyx":1019
 * 
 *         if stream_id < 0:
 *             raise Exception('nghttp2_submit_request failed: {}'.format\             # <<<<<<<<<<<<<<
 *                             (_strerror(stream_id)))
 * 
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_nghttp2_submit_request_failed, __pyx_n_s_format); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1019, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);

    /* "nghttp2.pyx":1020
 *         if stream_id < 0:
 *             raise Exception('nghttp2_submit_request failed: {}'.format\
 *                             (_strerror(stream_id)))             # <<<<<<<<<<<<<<
 * 
 *         logging.debug('request, stream_id:%s', stream_id)
 */
    __pyx_t_4 = __pyx_f_7nghttp2__strerror(__pyx_v_stream_id); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1020, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(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);
      }
    }
    __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1020, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "nghttp2.pyx":1019
 * 
 *         if stream_id < 0:
 *             raise Exception('nghttp2_submit_request failed: {}'.format\             # <<<<<<<<<<<<<<
 *                             (_strerror(stream_id)))
 * 
 */
    __pyx_t_5 = __Pyx_PyObject_CallOneArg(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1019, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_Raise(__pyx_t_5, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __PYX_ERR(0, 1019, __pyx_L1_error)

    /* "nghttp2.pyx":1018
 *         free(nva)
 * 
 *         if stream_id < 0:             # <<<<<<<<<<<<<<
 *             raise Exception('nghttp2_submit_request failed: {}'.format\
 *                             (_strerror(stream_id)))
 */
  }

  /* "nghttp2.pyx":1022
 *                             (_strerror(stream_id)))
 * 
 *         logging.debug('request, stream_id:%s', stream_id)             # <<<<<<<<<<<<<<
 * 
 *         self._add_handler(handler, stream_id)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_logging); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1022, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_debug); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1022, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyInt_From_int32_t(__pyx_v_stream_id); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1022, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = NULL;
  __pyx_t_8 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
      __pyx_t_8 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_4)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_kp_s_request_stream_id_s, __pyx_t_1};
    __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1022, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_kp_s_request_stream_id_s, __pyx_t_1};
    __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1022, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else
  #endif
  {
    __pyx_t_2 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1022, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_INCREF(__pyx_kp_s_request_stream_id_s);
    __Pyx_GIVEREF(__pyx_kp_s_request_stream_id_s);
    PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_8, __pyx_kp_s_request_stream_id_s);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_8, __pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_2, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1022, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "nghttp2.pyx":1024
 *         logging.debug('request, stream_id:%s', stream_id)
 * 
 *         self._add_handler(handler, stream_id)             # <<<<<<<<<<<<<<
 *         cnghttp2.nghttp2_session_set_stream_user_data(self.session, stream_id,
 *                                                   <void*>handler)
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_add_handler); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1024, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = __Pyx_PyInt_From_int32_t(__pyx_v_stream_id); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1024, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = NULL;
  __pyx_t_8 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
      __pyx_t_8 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_4)) {
    PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_v_handler, __pyx_t_2};
    __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1024, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
    PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_v_handler, __pyx_t_2};
    __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1024, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else
  #endif
  {
    __pyx_t_3 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1024, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (__pyx_t_1) {
      __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); __pyx_t_1 = NULL;
    }
    __Pyx_INCREF(__pyx_v_handler);
    __Pyx_GIVEREF(__pyx_v_handler);
    PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_8, __pyx_v_handler);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_8, __pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1024, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __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;

  /* "nghttp2.pyx":1025
 * 
 *         self._add_handler(handler, stream_id)
 *         cnghttp2.nghttp2_session_set_stream_user_data(self.session, stream_id,             # <<<<<<<<<<<<<<
 *                                                   <void*>handler)
 * 
 */
  (void)(nghttp2_session_set_stream_user_data(__pyx_v_self->__pyx_base.session, __pyx_v_stream_id, ((void *)__pyx_v_handler)));

  /* "nghttp2.pyx":1028
 *                                                   <void*>handler)
 * 
 *         return handler             # <<<<<<<<<<<<<<
 * 
 *     def push(self, push_promise, handler):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_handler);
  __pyx_r = __pyx_v_handler;
  goto __pyx_L0;

  /* "nghttp2.pyx":980
 *                             (_strerror(rv)))
 * 
 *     def send_request(self, method, scheme, host, path, headers, body, handler):             # <<<<<<<<<<<<<<
 *         cdef cnghttp2.nghttp2_data_provider prd
 *         cdef cnghttp2.nghttp2_data_provider *prd_ptr
 */

  /* 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_AddTraceback("nghttp2._HTTP2ClientSessionCore.send_request", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_custom_headers);
  __Pyx_XDECREF(__pyx_v_headers);
  __Pyx_XDECREF(__pyx_v_body);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":1030
 *         return handler
 * 
 *     def push(self, push_promise, handler):             # <<<<<<<<<<<<<<
 *         if handler:
 *             # push_promise accepted, fill in the handler with the stored
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_23_HTTP2ClientSessionCore_5push(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_7nghttp2_23_HTTP2ClientSessionCore_5push(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_push_promise = 0;
  PyObject *__pyx_v_handler = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("push (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_push_promise,&__pyx_n_s_handler,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);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_push_promise)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_handler)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("push", 1, 2, 2, 1); __PYX_ERR(0, 1030, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "push") < 0)) __PYX_ERR(0, 1030, __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_push_promise = values[0];
    __pyx_v_handler = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("push", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1030, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("nghttp2._HTTP2ClientSessionCore.push", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7nghttp2_23_HTTP2ClientSessionCore_4push(((struct __pyx_obj_7nghttp2__HTTP2ClientSessionCore *)__pyx_v_self), __pyx_v_push_promise, __pyx_v_handler);

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

static PyObject *__pyx_pf_7nghttp2_23_HTTP2ClientSessionCore_4push(struct __pyx_obj_7nghttp2__HTTP2ClientSessionCore *__pyx_v_self, PyObject *__pyx_v_push_promise, PyObject *__pyx_v_handler) {
  PyObject *__pyx_r = NULL;
  __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;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  uint32_t __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("push", 0);

  /* "nghttp2.pyx":1031
 * 
 *     def push(self, push_promise, handler):
 *         if handler:             # <<<<<<<<<<<<<<
 *             # push_promise accepted, fill in the handler with the stored
 *             # headers from the push_promise
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_handler); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1031, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "nghttp2.pyx":1034
 *             # push_promise accepted, fill in the handler with the stored
 *             # headers from the push_promise
 *             handler.status = push_promise.status             # <<<<<<<<<<<<<<
 *             handler.scheme = push_promise.scheme
 *             handler.method = push_promise.method
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_push_promise, __pyx_n_s_status_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1034, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_handler, __pyx_n_s_status_2, __pyx_t_2) < 0) __PYX_ERR(0, 1034, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "nghttp2.pyx":1035
 *             # headers from the push_promise
 *             handler.status = push_promise.status
 *             handler.scheme = push_promise.scheme             # <<<<<<<<<<<<<<
 *             handler.method = push_promise.method
 *             handler.host = push_promise.host
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_push_promise, __pyx_n_s_scheme_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1035, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_handler, __pyx_n_s_scheme_2, __pyx_t_2) < 0) __PYX_ERR(0, 1035, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "nghttp2.pyx":1036
 *             handler.status = push_promise.status
 *             handler.scheme = push_promise.scheme
 *             handler.method = push_promise.method             # <<<<<<<<<<<<<<
 *             handler.host = push_promise.host
 *             handler.path = push_promise.path
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_push_promise, __pyx_n_s_method_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1036, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_handler, __pyx_n_s_method_2, __pyx_t_2) < 0) __PYX_ERR(0, 1036, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "nghttp2.pyx":1037
 *             handler.scheme = push_promise.scheme
 *             handler.method = push_promise.method
 *             handler.host = push_promise.host             # <<<<<<<<<<<<<<
 *             handler.path = push_promise.path
 *             handler.cookies = push_promise.cookies
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_push_promise, __pyx_n_s_host); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1037, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_handler, __pyx_n_s_host, __pyx_t_2) < 0) __PYX_ERR(0, 1037, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "nghttp2.pyx":1038
 *             handler.method = push_promise.method
 *             handler.host = push_promise.host
 *             handler.path = push_promise.path             # <<<<<<<<<<<<<<
 *             handler.cookies = push_promise.cookies
 *             handler.stream_id = push_promise.stream_id
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_push_promise, __pyx_n_s_path_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1038, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_handler, __pyx_n_s_path_2, __pyx_t_2) < 0) __PYX_ERR(0, 1038, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "nghttp2.pyx":1039
 *             handler.host = push_promise.host
 *             handler.path = push_promise.path
 *             handler.cookies = push_promise.cookies             # <<<<<<<<<<<<<<
 *             handler.stream_id = push_promise.stream_id
 *             handler.http2 = self
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_push_promise, __pyx_n_s_cookies); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1039, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_handler, __pyx_n_s_cookies, __pyx_t_2) < 0) __PYX_ERR(0, 1039, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "nghttp2.pyx":1040
 *             handler.path = push_promise.path
 *             handler.cookies = push_promise.cookies
 *             handler.stream_id = push_promise.stream_id             # <<<<<<<<<<<<<<
 *             handler.http2 = self
 *             handler.pushed = True
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_push_promise, __pyx_n_s_stream_id); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1040, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_handler, __pyx_n_s_stream_id, __pyx_t_2) < 0) __PYX_ERR(0, 1040, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "nghttp2.pyx":1041
 *             handler.cookies = push_promise.cookies
 *             handler.stream_id = push_promise.stream_id
 *             handler.http2 = self             # <<<<<<<<<<<<<<
 *             handler.pushed = True
 * 
 */
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_handler, __pyx_n_s_http2, ((PyObject *)__pyx_v_self)) < 0) __PYX_ERR(0, 1041, __pyx_L1_error)

    /* "nghttp2.pyx":1042
 *             handler.stream_id = push_promise.stream_id
 *             handler.http2 = self
 *             handler.pushed = True             # <<<<<<<<<<<<<<
 * 
 *             self._add_handler(handler, handler.stream_id)
 */
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_handler, __pyx_n_s_pushed, Py_True) < 0) __PYX_ERR(0, 1042, __pyx_L1_error)

    /* "nghttp2.pyx":1044
 *             handler.pushed = True
 * 
 *             self._add_handler(handler, handler.stream_id)             # <<<<<<<<<<<<<<
 * 
 *             cnghttp2.nghttp2_session_set_stream_user_data(self.session, handler.stream_id,
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_add_handler); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1044, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_handler, __pyx_n_s_stream_id); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1044, __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_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_v_handler, __pyx_t_4};
      __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(0, 1044, __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_v_handler, __pyx_t_4};
      __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(0, 1044, __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(0, 1044, __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_INCREF(__pyx_v_handler);
      __Pyx_GIVEREF(__pyx_v_handler);
      PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_v_handler);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1044, __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_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "nghttp2.pyx":1046
 *             self._add_handler(handler, handler.stream_id)
 * 
 *             cnghttp2.nghttp2_session_set_stream_user_data(self.session, handler.stream_id,             # <<<<<<<<<<<<<<
 *                                                       <void*>handler)
 *         else:
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_handler, __pyx_n_s_stream_id); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1046, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_8 = __Pyx_PyInt_As_uint32_t(__pyx_t_2); if (unlikely((__pyx_t_8 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1046, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "nghttp2.pyx":1047
 * 
 *             cnghttp2.nghttp2_session_set_stream_user_data(self.session, handler.stream_id,
 *                                                       <void*>handler)             # <<<<<<<<<<<<<<
 *         else:
 *             # push_promise rejected, reset the stream
 */
    (void)(nghttp2_session_set_stream_user_data(__pyx_v_self->__pyx_base.session, __pyx_t_8, ((void *)__pyx_v_handler)));

    /* "nghttp2.pyx":1031
 * 
 *     def push(self, push_promise, handler):
 *         if handler:             # <<<<<<<<<<<<<<
 *             # push_promise accepted, fill in the handler with the stored
 *             # headers from the push_promise
 */
    goto __pyx_L3;
  }

  /* "nghttp2.pyx":1050
 *         else:
 *             # push_promise rejected, reset the stream
 *             self._rst_stream(push_promise.stream_id,             # <<<<<<<<<<<<<<
 *                               error_code=cnghttp2.NGHTTP2_NO_ERROR)
 * 
 */
  /*else*/ {
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_rst_stream); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1050, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_push_promise, __pyx_n_s_stream_id); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1050, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1050, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "nghttp2.pyx":1051
 *             # push_promise rejected, reset the stream
 *             self._rst_stream(push_promise.stream_id,
 *                               error_code=cnghttp2.NGHTTP2_NO_ERROR)             # <<<<<<<<<<<<<<
 * 
 * if asyncio:
 */
    __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1051, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyInt_From_nghttp2_error_code(NGHTTP2_NO_ERROR); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1051, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_error_code, __pyx_t_4) < 0) __PYX_ERR(0, 1051, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "nghttp2.pyx":1050
 *         else:
 *             # push_promise rejected, reset the stream
 *             self._rst_stream(push_promise.stream_id,             # <<<<<<<<<<<<<<
 *                               error_code=cnghttp2.NGHTTP2_NO_ERROR)
 * 
 */
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_7, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1050, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __pyx_L3:;

  /* "nghttp2.pyx":1030
 *         return handler
 * 
 *     def push(self, push_promise, handler):             # <<<<<<<<<<<<<<
 *         if handler:
 *             # push_promise accepted, fill in the handler with the stored
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  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_7);
  __Pyx_AddTraceback("nghttp2._HTTP2ClientSessionCore.push", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_23_HTTP2ClientSessionCore_7__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_7nghttp2_23_HTTP2ClientSessionCore_7__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7nghttp2_23_HTTP2ClientSessionCore_6__reduce_cython__(((struct __pyx_obj_7nghttp2__HTTP2ClientSessionCore *)__pyx_v_self));

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

static PyObject *__pyx_pf_7nghttp2_23_HTTP2ClientSessionCore_6__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7nghttp2__HTTP2ClientSessionCore *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __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(1, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("nghttp2._HTTP2ClientSessionCore.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_23_HTTP2ClientSessionCore_9__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static PyObject *__pyx_pw_7nghttp2_23_HTTP2ClientSessionCore_9__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7nghttp2_23_HTTP2ClientSessionCore_8__setstate_cython__(((struct __pyx_obj_7nghttp2__HTTP2ClientSessionCore *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_7nghttp2_23_HTTP2ClientSessionCore_8__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7nghttp2__HTTP2ClientSessionCore *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__15, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __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(1, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("nghttp2._HTTP2ClientSessionCore.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":1108
 *         """
 * 
 *         def __init__(self, http2, stream_id):             # <<<<<<<<<<<<<<
 *             self.headers = []
 *             self.cookies = []
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_18BaseRequestHandler_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7nghttp2_18BaseRequestHandler_1__init__ = {"__init__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7nghttp2_18BaseRequestHandler_1__init__, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7nghttp2_18BaseRequestHandler_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_http2 = 0;
  PyObject *__pyx_v_stream_id = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_http2,&__pyx_n_s_stream_id,0};
    PyObject* values[3] = {0,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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_http2)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 1); __PYX_ERR(0, 1108, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_stream_id)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 2); __PYX_ERR(0, 1108, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 1108, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_self = values[0];
    __pyx_v_http2 = values[1];
    __pyx_v_stream_id = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1108, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("nghttp2.BaseRequestHandler.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7nghttp2_18BaseRequestHandler___init__(__pyx_self, __pyx_v_self, __pyx_v_http2, __pyx_v_stream_id);

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

static PyObject *__pyx_pf_7nghttp2_18BaseRequestHandler___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_http2, PyObject *__pyx_v_stream_id) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "nghttp2.pyx":1109
 * 
 *         def __init__(self, http2, stream_id):
 *             self.headers = []             # <<<<<<<<<<<<<<
 *             self.cookies = []
 *             # Stream ID. For promised stream, it is initially -1.
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1109, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_headers, __pyx_t_1) < 0) __PYX_ERR(0, 1109, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "nghttp2.pyx":1110
 *         def __init__(self, http2, stream_id):
 *             self.headers = []
 *             self.cookies = []             # <<<<<<<<<<<<<<
 *             # Stream ID. For promised stream, it is initially -1.
 *             self.stream_id = stream_id
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1110, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_cookies, __pyx_t_1) < 0) __PYX_ERR(0, 1110, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "nghttp2.pyx":1112
 *             self.cookies = []
 *             # Stream ID. For promised stream, it is initially -1.
 *             self.stream_id = stream_id             # <<<<<<<<<<<<<<
 *             self.http2 = http2
 *             # address of the client
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_stream_id, __pyx_v_stream_id) < 0) __PYX_ERR(0, 1112, __pyx_L1_error)

  /* "nghttp2.pyx":1113
 *             # Stream ID. For promised stream, it is initially -1.
 *             self.stream_id = stream_id
 *             self.http2 = http2             # <<<<<<<<<<<<<<
 *             # address of the client
 *             self.remote_address = self.http2._get_remote_address()
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_http2, __pyx_v_http2) < 0) __PYX_ERR(0, 1113, __pyx_L1_error)

  /* "nghttp2.pyx":1115
 *             self.http2 = http2
 *             # address of the client
 *             self.remote_address = self.http2._get_remote_address()             # <<<<<<<<<<<<<<
 *             # certificate of the client
 *             self._client_certificate = self.http2._get_client_certificate()
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_http2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1115, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_get_remote_address); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1115, __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 && 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);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1115, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_remote_address, __pyx_t_1) < 0) __PYX_ERR(0, 1115, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "nghttp2.pyx":1117
 *             self.remote_address = self.http2._get_remote_address()
 *             # certificate of the client
 *             self._client_certificate = self.http2._get_client_certificate()             # <<<<<<<<<<<<<<
 *             # :scheme header field in request
 *             self.scheme = None
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_http2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1117, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_get_client_certificate); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1117, __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);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1117, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_client_certificate_2, __pyx_t_1) < 0) __PYX_ERR(0, 1117, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "nghttp2.pyx":1119
 *             self._client_certificate = self.http2._get_client_certificate()
 *             # :scheme header field in request
 *             self.scheme = None             # <<<<<<<<<<<<<<
 *             # :method header field in request
 *             self.method = None
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_scheme_2, Py_None) < 0) __PYX_ERR(0, 1119, __pyx_L1_error)

  /* "nghttp2.pyx":1121
 *             self.scheme = None
 *             # :method header field in request
 *             self.method = None             # <<<<<<<<<<<<<<
 *             # :authority or host header field in request
 *             self.host = None
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_method_2, Py_None) < 0) __PYX_ERR(0, 1121, __pyx_L1_error)

  /* "nghttp2.pyx":1123
 *             self.method = None
 *             # :authority or host header field in request
 *             self.host = None             # <<<<<<<<<<<<<<
 *             # :path header field in request
 *             self.path = None
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_host, Py_None) < 0) __PYX_ERR(0, 1123, __pyx_L1_error)

  /* "nghttp2.pyx":1125
 *             self.host = None
 *             # :path header field in request
 *             self.path = None             # <<<<<<<<<<<<<<
 *             # HTTP status
 *             self.status = None
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_path_2, Py_None) < 0) __PYX_ERR(0, 1125, __pyx_L1_error)

  /* "nghttp2.pyx":1127
 *             self.path = None
 *             # HTTP status
 *             self.status = None             # <<<<<<<<<<<<<<
 *             # True if this is a handler for pushed resource
 *             self.pushed = False
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_status_2, Py_None) < 0) __PYX_ERR(0, 1127, __pyx_L1_error)

  /* "nghttp2.pyx":1129
 *             self.status = None
 *             # True if this is a handler for pushed resource
 *             self.pushed = False             # <<<<<<<<<<<<<<
 * 
 *         @property
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_pushed, Py_False) < 0) __PYX_ERR(0, 1129, __pyx_L1_error)

  /* "nghttp2.pyx":1108
 *         """
 * 
 *         def __init__(self, http2, stream_id):             # <<<<<<<<<<<<<<
 *             self.headers = []
 *             self.cookies = []
 */

  /* 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_AddTraceback("nghttp2.BaseRequestHandler.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":1132
 * 
 *         @property
 *         def client_address(self):             # <<<<<<<<<<<<<<
 *             return self.remote_address
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_18BaseRequestHandler_3client_address(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7nghttp2_18BaseRequestHandler_3client_address = {"client_address", (PyCFunction)__pyx_pw_7nghttp2_18BaseRequestHandler_3client_address, METH_O, 0};
static PyObject *__pyx_pw_7nghttp2_18BaseRequestHandler_3client_address(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("client_address (wrapper)", 0);
  __pyx_r = __pyx_pf_7nghttp2_18BaseRequestHandler_2client_address(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_7nghttp2_18BaseRequestHandler_2client_address(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("client_address", 0);

  /* "nghttp2.pyx":1133
 *         @property
 *         def client_address(self):
 *             return self.remote_address             # <<<<<<<<<<<<<<
 * 
 *         @property
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_remote_address); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1133, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "nghttp2.pyx":1132
 * 
 *         @property
 *         def client_address(self):             # <<<<<<<<<<<<<<
 *             return self.remote_address
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("nghttp2.BaseRequestHandler.client_address", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":1136
 * 
 *         @property
 *         def client_certificate(self):             # <<<<<<<<<<<<<<
 *             return self._client_certificate
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_18BaseRequestHandler_5client_certificate(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7nghttp2_18BaseRequestHandler_5client_certificate = {"client_certificate", (PyCFunction)__pyx_pw_7nghttp2_18BaseRequestHandler_5client_certificate, METH_O, 0};
static PyObject *__pyx_pw_7nghttp2_18BaseRequestHandler_5client_certificate(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("client_certificate (wrapper)", 0);
  __pyx_r = __pyx_pf_7nghttp2_18BaseRequestHandler_4client_certificate(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_7nghttp2_18BaseRequestHandler_4client_certificate(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("client_certificate", 0);

  /* "nghttp2.pyx":1137
 *         @property
 *         def client_certificate(self):
 *             return self._client_certificate             # <<<<<<<<<<<<<<
 * 
 *         def on_headers(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_client_certificate_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1137, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "nghttp2.pyx":1136
 * 
 *         @property
 *         def client_certificate(self):             # <<<<<<<<<<<<<<
 *             return self._client_certificate
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("nghttp2.BaseRequestHandler.client_certificate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":1139
 *             return self._client_certificate
 * 
 *         def on_headers(self):             # <<<<<<<<<<<<<<
 * 
 *             '''Called when request HEADERS is arrived.
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_18BaseRequestHandler_7on_headers(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_7nghttp2_18BaseRequestHandler_6on_headers[] = "Called when request HEADERS is arrived.\n\n            ";
static PyMethodDef __pyx_mdef_7nghttp2_18BaseRequestHandler_7on_headers = {"on_headers", (PyCFunction)__pyx_pw_7nghttp2_18BaseRequestHandler_7on_headers, METH_O, __pyx_doc_7nghttp2_18BaseRequestHandler_6on_headers};
static PyObject *__pyx_pw_7nghttp2_18BaseRequestHandler_7on_headers(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("on_headers (wrapper)", 0);
  __pyx_r = __pyx_pf_7nghttp2_18BaseRequestHandler_6on_headers(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_7nghttp2_18BaseRequestHandler_6on_headers(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("on_headers", 0);

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":1146
 *             pass
 * 
 *         def on_data(self, data):             # <<<<<<<<<<<<<<
 * 
 *             '''Called when a chunk of request body is arrived. This method
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_18BaseRequestHandler_9on_data(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7nghttp2_18BaseRequestHandler_8on_data[] = "Called when a chunk of request body is arrived. This method\n            will be called multiple times until all data are received.\n\n            ";
static PyMethodDef __pyx_mdef_7nghttp2_18BaseRequestHandler_9on_data = {"on_data", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7nghttp2_18BaseRequestHandler_9on_data, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7nghttp2_18BaseRequestHandler_8on_data};
static PyObject *__pyx_pw_7nghttp2_18BaseRequestHandler_9on_data(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_self = 0;
  CYTHON_UNUSED PyObject *__pyx_v_data = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("on_data (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_data,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);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_data)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("on_data", 1, 2, 2, 1); __PYX_ERR(0, 1146, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "on_data") < 0)) __PYX_ERR(0, 1146, __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_self = values[0];
    __pyx_v_data = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("on_data", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1146, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("nghttp2.BaseRequestHandler.on_data", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7nghttp2_18BaseRequestHandler_8on_data(__pyx_self, __pyx_v_self, __pyx_v_data);

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

static PyObject *__pyx_pf_7nghttp2_18BaseRequestHandler_8on_data(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_data) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("on_data", 0);

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":1154
 *             pass
 * 
 *         def on_request_done(self):             # <<<<<<<<<<<<<<
 * 
 *             '''Called when whole request was received
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_18BaseRequestHandler_11on_request_done(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_7nghttp2_18BaseRequestHandler_10on_request_done[] = "Called when whole request was received\n\n            ";
static PyMethodDef __pyx_mdef_7nghttp2_18BaseRequestHandler_11on_request_done = {"on_request_done", (PyCFunction)__pyx_pw_7nghttp2_18BaseRequestHandler_11on_request_done, METH_O, __pyx_doc_7nghttp2_18BaseRequestHandler_10on_request_done};
static PyObject *__pyx_pw_7nghttp2_18BaseRequestHandler_11on_request_done(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("on_request_done (wrapper)", 0);
  __pyx_r = __pyx_pf_7nghttp2_18BaseRequestHandler_10on_request_done(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_7nghttp2_18BaseRequestHandler_10on_request_done(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("on_request_done", 0);

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":1161
 *             pass
 * 
 *         def on_close(self, error_code):             # <<<<<<<<<<<<<<
 * 
 *             '''Called when stream is about to close.
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_18BaseRequestHandler_13on_close(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7nghttp2_18BaseRequestHandler_12on_close[] = "Called when stream is about to close.\n\n            ";
static PyMethodDef __pyx_mdef_7nghttp2_18BaseRequestHandler_13on_close = {"on_close", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7nghttp2_18BaseRequestHandler_13on_close, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7nghttp2_18BaseRequestHandler_12on_close};
static PyObject *__pyx_pw_7nghttp2_18BaseRequestHandler_13on_close(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_self = 0;
  CYTHON_UNUSED PyObject *__pyx_v_error_code = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("on_close (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_error_code,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);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_error_code)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("on_close", 1, 2, 2, 1); __PYX_ERR(0, 1161, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "on_close") < 0)) __PYX_ERR(0, 1161, __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_self = values[0];
    __pyx_v_error_code = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("on_close", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1161, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("nghttp2.BaseRequestHandler.on_close", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7nghttp2_18BaseRequestHandler_12on_close(__pyx_self, __pyx_v_self, __pyx_v_error_code);

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

static PyObject *__pyx_pf_7nghttp2_18BaseRequestHandler_12on_close(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_error_code) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("on_close", 0);

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":1168
 *             pass
 * 
 *         def send_response(self, status=200, headers=None, body=None):             # <<<<<<<<<<<<<<
 * 
 *             '''Send response. The status is HTTP status code. The headers is
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_18BaseRequestHandler_15send_response(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7nghttp2_18BaseRequestHandler_14send_response[] = "Send response. The status is HTTP status code. The headers is\n            additional response headers. The :status header field is\n            appended by the library. The body is the response body. It\n            could be None if response body is empty. Or it must be\n            instance of either str, bytes, io.IOBase or callable,\n            called body generator, which takes one parameter,\n            size. The body generator generates response body. It can\n            pause generation of response so that it can wait for slow\n            backend data generation. When invoked, it should return\n            tuple, byte string and flag. The flag is either DATA_OK,\n            DATA_EOF and DATA_DEFERRED. For non-empty byte string and\n            it is not the last chunk of response, DATA_OK is returned\n            as flag.  If this is the last chunk of the response (byte\n            string is possibly None), DATA_EOF must be returned as\n            flag.  If there is no data available right now, but\n            additional data are anticipated, return tuple (None,\n            DATA_DEFERRD).  When data arrived, call resume() and\n            restart response body transmission.\n\n            Only the body generator can pause response body\n            generation; instance of io.IOBase must not block.\n\n            If instance of str is specified as body, it is encoded\n            using UTF-8.\n\n            The headers is a list of tuple of the form (name,\n            value). The name and value can be either unicode string or\n            byte string.\n\n            On error, exception will be thrown.\n\n            ";
static PyMethodDef __pyx_mdef_7nghttp2_18BaseRequestHandler_15send_response = {"send_response", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7nghttp2_18BaseRequestHandler_15send_response, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7nghttp2_18BaseRequestHandler_14send_response};
static PyObject *__pyx_pw_7nghttp2_18BaseRequestHandler_15send_response(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_status = 0;
  PyObject *__pyx_v_headers = 0;
  PyObject *__pyx_v_body = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("send_response (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_status_2,&__pyx_n_s_headers,&__pyx_n_s_body,0};
    PyObject* values[4] = {0,0,0,0};
    values[1] = ((PyObject *)((PyObject *)__pyx_int_200));
    values[2] = ((PyObject *)((PyObject *)Py_None));
    values[3] = ((PyObject *)((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);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_status_2);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_headers);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_body);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "send_response") < 0)) __PYX_ERR(0, 1168, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_status = values[1];
    __pyx_v_headers = values[2];
    __pyx_v_body = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("send_response", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1168, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("nghttp2.BaseRequestHandler.send_response", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7nghttp2_18BaseRequestHandler_14send_response(__pyx_self, __pyx_v_self, __pyx_v_status, __pyx_v_headers, __pyx_v_body);

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

static PyObject *__pyx_pf_7nghttp2_18BaseRequestHandler_14send_response(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_status, PyObject *__pyx_v_headers, PyObject *__pyx_v_body) {
  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;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("send_response", 0);
  __Pyx_INCREF(__pyx_v_body);

  /* "nghttp2.pyx":1202
 * 
 *             '''
 *             if self.status is not None:             # <<<<<<<<<<<<<<
 *                 raise Exception('response has already been sent')
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_status_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1202, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = (__pyx_t_1 != Py_None);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (unlikely(__pyx_t_3)) {

    /* "nghttp2.pyx":1203
 *             '''
 *             if self.status is not None:
 *                 raise Exception('response has already been sent')             # <<<<<<<<<<<<<<
 * 
 *             if not status:
 */
    __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1203, __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(0, 1203, __pyx_L1_error)

    /* "nghttp2.pyx":1202
 * 
 *             '''
 *             if self.status is not None:             # <<<<<<<<<<<<<<
 *                 raise Exception('response has already been sent')
 * 
 */
  }

  /* "nghttp2.pyx":1205
 *                 raise Exception('response has already been sent')
 * 
 *             if not status:             # <<<<<<<<<<<<<<
 *                 raise Exception('status must not be empty')
 * 
 */
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_status); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1205, __pyx_L1_error)
  __pyx_t_2 = ((!__pyx_t_3) != 0);
  if (unlikely(__pyx_t_2)) {

    /* "nghttp2.pyx":1206
 * 
 *             if not status:
 *                 raise Exception('status must not be empty')             # <<<<<<<<<<<<<<
 * 
 *             body = wrap_body(body)
 */
    __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1206, __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(0, 1206, __pyx_L1_error)

    /* "nghttp2.pyx":1205
 *                 raise Exception('response has already been sent')
 * 
 *             if not status:             # <<<<<<<<<<<<<<
 *                 raise Exception('status must not be empty')
 * 
 */
  }

  /* "nghttp2.pyx":1208
 *                 raise Exception('status must not be empty')
 * 
 *             body = wrap_body(body)             # <<<<<<<<<<<<<<
 * 
 *             self._set_response_prop(status, headers, body)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_wrap_body); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1208, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(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);
    }
  }
  __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_v_body) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_body);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1208, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF_SET(__pyx_v_body, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "nghttp2.pyx":1210
 *             body = wrap_body(body)
 * 
 *             self._set_response_prop(status, headers, body)             # <<<<<<<<<<<<<<
 *             self.http2.send_response(self)
 * 
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_set_response_prop); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1210, __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_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);
      __pyx_t_6 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_4)) {
    PyObject *__pyx_temp[4] = {__pyx_t_5, __pyx_v_status, __pyx_v_headers, __pyx_v_body};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1210, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
    PyObject *__pyx_temp[4] = {__pyx_t_5, __pyx_v_status, __pyx_v_headers, __pyx_v_body};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1210, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_7 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1210, __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_INCREF(__pyx_v_status);
    __Pyx_GIVEREF(__pyx_v_status);
    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_v_status);
    __Pyx_INCREF(__pyx_v_headers);
    __Pyx_GIVEREF(__pyx_v_headers);
    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_v_headers);
    __Pyx_INCREF(__pyx_v_body);
    __Pyx_GIVEREF(__pyx_v_body);
    PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_6, __pyx_v_body);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1210, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "nghttp2.pyx":1211
 * 
 *             self._set_response_prop(status, headers, body)
 *             self.http2.send_response(self)             # <<<<<<<<<<<<<<
 * 
 *         def push(self, path, method='GET', request_headers=None,
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_http2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1211, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_send_response); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1211, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_7);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_7, function);
    }
  }
  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_4, __pyx_v_self) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_self);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1211, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "nghttp2.pyx":1168
 *             pass
 * 
 *         def send_response(self, status=200, headers=None, body=None):             # <<<<<<<<<<<<<<
 * 
 *             '''Send response. The status is HTTP status code. The headers is
 */

  /* 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_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("nghttp2.BaseRequestHandler.send_response", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_body);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":1213
 *             self.http2.send_response(self)
 * 
 *         def push(self, path, method='GET', request_headers=None,             # <<<<<<<<<<<<<<
 *                  status=200, headers=None, body=None):
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_18BaseRequestHandler_17push(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7nghttp2_18BaseRequestHandler_16push[] = "Push a resource. The path is a path portion of request URI\n            for this\n            resource. The method is a method to access this\n            resource. The request_headers is additional request\n            headers to access this resource. The :scheme, :method,\n            :authority and :path are appended by the library. The\n            :scheme and :authority are inherited from the request (not\n            request_headers parameter).\n\n            The status is HTTP status code. The headers is additional\n            response headers. The :status header field is appended by\n            the library. The body is the response body. It has the\n            same semantics of body parameter of send_response().\n\n            The headers and request_headers are a list of tuple of the\n            form (name, value). The name and value can be either\n            unicode string or byte string.\n\n            On error, exception will be thrown.\n\n            ";
static PyMethodDef __pyx_mdef_7nghttp2_18BaseRequestHandler_17push = {"push", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7nghttp2_18BaseRequestHandler_17push, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7nghttp2_18BaseRequestHandler_16push};
static PyObject *__pyx_pw_7nghttp2_18BaseRequestHandler_17push(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_path = 0;
  PyObject *__pyx_v_method = 0;
  PyObject *__pyx_v_request_headers = 0;
  PyObject *__pyx_v_status = 0;
  PyObject *__pyx_v_headers = 0;
  PyObject *__pyx_v_body = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("push (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_path_2,&__pyx_n_s_method_2,&__pyx_n_s_request_headers,&__pyx_n_s_status_2,&__pyx_n_s_headers,&__pyx_n_s_body,0};
    PyObject* values[7] = {0,0,0,0,0,0,0};
    values[2] = ((PyObject *)((PyObject*)__pyx_n_s_GET));
    values[3] = ((PyObject *)((PyObject *)Py_None));
    values[4] = ((PyObject *)((PyObject *)__pyx_int_200));

    /* "nghttp2.pyx":1214
 * 
 *         def push(self, path, method='GET', request_headers=None,
 *                  status=200, headers=None, body=None):             # <<<<<<<<<<<<<<
 * 
 *             '''Push a resource. The path is a path portion of request URI
 */
    values[5] = ((PyObject *)((PyObject *)Py_None));
    values[6] = ((PyObject *)((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  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_path_2)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("push", 0, 2, 7, 1); __PYX_ERR(0, 1213, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_method_2);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_request_headers);
          if (value) { values[3] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_status_2);
          if (value) { values[4] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_headers);
          if (value) { values[5] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_body);
          if (value) { values[6] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "push") < 0)) __PYX_ERR(0, 1213, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        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_self = values[0];
    __pyx_v_path = values[1];
    __pyx_v_method = values[2];
    __pyx_v_request_headers = values[3];
    __pyx_v_status = values[4];
    __pyx_v_headers = values[5];
    __pyx_v_body = values[6];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("push", 0, 2, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1213, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("nghttp2.BaseRequestHandler.push", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7nghttp2_18BaseRequestHandler_16push(__pyx_self, __pyx_v_self, __pyx_v_path, __pyx_v_method, __pyx_v_request_headers, __pyx_v_status, __pyx_v_headers, __pyx_v_body);

  /* "nghttp2.pyx":1213
 *             self.http2.send_response(self)
 * 
 *         def push(self, path, method='GET', request_headers=None,             # <<<<<<<<<<<<<<
 *                  status=200, headers=None, body=None):
 * 
 */

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

static PyObject *__pyx_pf_7nghttp2_18BaseRequestHandler_16push(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_path, PyObject *__pyx_v_method, PyObject *__pyx_v_request_headers, PyObject *__pyx_v_status, PyObject *__pyx_v_headers, PyObject *__pyx_v_body) {
  PyObject *__pyx_v_promised_handler = NULL;
  PyObject *__pyx_r = NULL;
  __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;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("push", 0);
  __Pyx_INCREF(__pyx_v_headers);
  __Pyx_INCREF(__pyx_v_body);

  /* "nghttp2.pyx":1237
 * 
 *             '''
 *             if not status:             # <<<<<<<<<<<<<<
 *                 raise Exception('status must not be empty')
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_status); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1237, __pyx_L1_error)
  __pyx_t_2 = ((!__pyx_t_1) != 0);
  if (unlikely(__pyx_t_2)) {

    /* "nghttp2.pyx":1238
 *             '''
 *             if not status:
 *                 raise Exception('status must not be empty')             # <<<<<<<<<<<<<<
 * 
 *             if not method:
 */
    __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1238, __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, 1238, __pyx_L1_error)

    /* "nghttp2.pyx":1237
 * 
 *             '''
 *             if not status:             # <<<<<<<<<<<<<<
 *                 raise Exception('status must not be empty')
 * 
 */
  }

  /* "nghttp2.pyx":1240
 *                 raise Exception('status must not be empty')
 * 
 *             if not method:             # <<<<<<<<<<<<<<
 *                 raise Exception('method must not be empty')
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_method); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1240, __pyx_L1_error)
  __pyx_t_1 = ((!__pyx_t_2) != 0);
  if (unlikely(__pyx_t_1)) {

    /* "nghttp2.pyx":1241
 * 
 *             if not method:
 *                 raise Exception('method must not be empty')             # <<<<<<<<<<<<<<
 * 
 *             if not path:
 */
    __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1241, __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, 1241, __pyx_L1_error)

    /* "nghttp2.pyx":1240
 *                 raise Exception('status must not be empty')
 * 
 *             if not method:             # <<<<<<<<<<<<<<
 *                 raise Exception('method must not be empty')
 * 
 */
  }

  /* "nghttp2.pyx":1243
 *                 raise Exception('method must not be empty')
 * 
 *             if not path:             # <<<<<<<<<<<<<<
 *                 raise Exception('path must not be empty')
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_path); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1243, __pyx_L1_error)
  __pyx_t_2 = ((!__pyx_t_1) != 0);
  if (unlikely(__pyx_t_2)) {

    /* "nghttp2.pyx":1244
 * 
 *             if not path:
 *                 raise Exception('path must not be empty')             # <<<<<<<<<<<<<<
 * 
 *             body = wrap_body(body)
 */
    __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1244, __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, 1244, __pyx_L1_error)

    /* "nghttp2.pyx":1243
 *                 raise Exception('method must not be empty')
 * 
 *             if not path:             # <<<<<<<<<<<<<<
 *                 raise Exception('path must not be empty')
 * 
 */
  }

  /* "nghttp2.pyx":1246
 *                 raise Exception('path must not be empty')
 * 
 *             body = wrap_body(body)             # <<<<<<<<<<<<<<
 * 
 *             promised_handler = self.http2._make_handler(-1)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_wrap_body); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1246, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(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);
    }
  }
  __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_v_body) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_body);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1246, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF_SET(__pyx_v_body, __pyx_t_3);
  __pyx_t_3 = 0;

  /* "nghttp2.pyx":1248
 *             body = wrap_body(body)
 * 
 *             promised_handler = self.http2._make_handler(-1)             # <<<<<<<<<<<<<<
 *             promised_handler.pushed = True
 *             promised_handler.scheme = self.scheme
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_http2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1248, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_make_handler); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1248, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_4, __pyx_int_neg_1) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_int_neg_1);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1248, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_promised_handler = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "nghttp2.pyx":1249
 * 
 *             promised_handler = self.http2._make_handler(-1)
 *             promised_handler.pushed = True             # <<<<<<<<<<<<<<
 *             promised_handler.scheme = self.scheme
 *             promised_handler.method = method.encode('utf-8')
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_promised_handler, __pyx_n_s_pushed, Py_True) < 0) __PYX_ERR(0, 1249, __pyx_L1_error)

  /* "nghttp2.pyx":1250
 *             promised_handler = self.http2._make_handler(-1)
 *             promised_handler.pushed = True
 *             promised_handler.scheme = self.scheme             # <<<<<<<<<<<<<<
 *             promised_handler.method = method.encode('utf-8')
 *             promised_handler.host = self.host
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_scheme_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1250, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_promised_handler, __pyx_n_s_scheme_2, __pyx_t_3) < 0) __PYX_ERR(0, 1250, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "nghttp2.pyx":1251
 *             promised_handler.pushed = True
 *             promised_handler.scheme = self.scheme
 *             promised_handler.method = method.encode('utf-8')             # <<<<<<<<<<<<<<
 *             promised_handler.host = self.host
 *             promised_handler.path = path.encode('utf-8')
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_method, __pyx_n_s_encode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1251, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_4, __pyx_kp_s_utf_8) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_kp_s_utf_8);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1251, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_promised_handler, __pyx_n_s_method_2, __pyx_t_3) < 0) __PYX_ERR(0, 1251, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "nghttp2.pyx":1252
 *             promised_handler.scheme = self.scheme
 *             promised_handler.method = method.encode('utf-8')
 *             promised_handler.host = self.host             # <<<<<<<<<<<<<<
 *             promised_handler.path = path.encode('utf-8')
 *             promised_handler._set_response_prop(status, headers, body)
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_host); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1252, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_promised_handler, __pyx_n_s_host, __pyx_t_3) < 0) __PYX_ERR(0, 1252, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "nghttp2.pyx":1253
 *             promised_handler.method = method.encode('utf-8')
 *             promised_handler.host = self.host
 *             promised_handler.path = path.encode('utf-8')             # <<<<<<<<<<<<<<
 *             promised_handler._set_response_prop(status, headers, body)
 * 
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_path, __pyx_n_s_encode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1253, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_4, __pyx_kp_s_utf_8) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_kp_s_utf_8);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1253, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_promised_handler, __pyx_n_s_path_2, __pyx_t_3) < 0) __PYX_ERR(0, 1253, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "nghttp2.pyx":1254
 *             promised_handler.host = self.host
 *             promised_handler.path = path.encode('utf-8')
 *             promised_handler._set_response_prop(status, headers, body)             # <<<<<<<<<<<<<<
 * 
 *             headers = [
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_promised_handler, __pyx_n_s_set_response_prop); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1254, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
      __pyx_t_6 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_5)) {
    PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_status, __pyx_v_headers, __pyx_v_body};
    __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1254, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_3);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
    PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_status, __pyx_v_headers, __pyx_v_body};
    __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1254, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_3);
  } else
  #endif
  {
    __pyx_t_7 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1254, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (__pyx_t_4) {
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4); __pyx_t_4 = NULL;
    }
    __Pyx_INCREF(__pyx_v_status);
    __Pyx_GIVEREF(__pyx_v_status);
    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_v_status);
    __Pyx_INCREF(__pyx_v_headers);
    __Pyx_GIVEREF(__pyx_v_headers);
    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_v_headers);
    __Pyx_INCREF(__pyx_v_body);
    __Pyx_GIVEREF(__pyx_v_body);
    PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_6, __pyx_v_body);
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1254, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "nghttp2.pyx":1257
 * 
 *             headers = [
 *                 (b':method', promised_handler.method),             # <<<<<<<<<<<<<<
 *                 (b':scheme', promised_handler.scheme),
 *                 (b':authority', promised_handler.host),
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_promised_handler, __pyx_n_s_method_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1257, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1257, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_kp_b_method);
  __Pyx_GIVEREF(__pyx_kp_b_method);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_kp_b_method);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3);
  __pyx_t_3 = 0;

  /* "nghttp2.pyx":1258
 *             headers = [
 *                 (b':method', promised_handler.method),
 *                 (b':scheme', promised_handler.scheme),             # <<<<<<<<<<<<<<
 *                 (b':authority', promised_handler.host),
 *                 (b':path', promised_handler.path)
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_promised_handler, __pyx_n_s_scheme_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1258, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1258, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_INCREF(__pyx_kp_b_scheme);
  __Pyx_GIVEREF(__pyx_kp_b_scheme);
  PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_kp_b_scheme);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_3);
  __pyx_t_3 = 0;

  /* "nghttp2.pyx":1259
 *                 (b':method', promised_handler.method),
 *                 (b':scheme', promised_handler.scheme),
 *                 (b':authority', promised_handler.host),             # <<<<<<<<<<<<<<
 *                 (b':path', promised_handler.path)
 *             ]
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_promised_handler, __pyx_n_s_host); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1259, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1259, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_kp_b_authority);
  __Pyx_GIVEREF(__pyx_kp_b_authority);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_kp_b_authority);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
  __pyx_t_3 = 0;

  /* "nghttp2.pyx":1260
 *                 (b':scheme', promised_handler.scheme),
 *                 (b':authority', promised_handler.host),
 *                 (b':path', promised_handler.path)             # <<<<<<<<<<<<<<
 *             ]
 *             headers.extend(_encode_headers(request_headers))
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_promised_handler, __pyx_n_s_path_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1260, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1260, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_INCREF(__pyx_kp_b_path);
  __Pyx_GIVEREF(__pyx_kp_b_path);
  PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_kp_b_path);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_3);
  __pyx_t_3 = 0;

  /* "nghttp2.pyx":1256
 *             promised_handler._set_response_prop(status, headers, body)
 * 
 *             headers = [             # <<<<<<<<<<<<<<
 *                 (b':method', promised_handler.method),
 *                 (b':scheme', promised_handler.scheme),
 */
  __pyx_t_3 = PyList_New(4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1256, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_5);
  PyList_SET_ITEM(__pyx_t_3, 0, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_7);
  PyList_SET_ITEM(__pyx_t_3, 1, __pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_4);
  PyList_SET_ITEM(__pyx_t_3, 2, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_8);
  PyList_SET_ITEM(__pyx_t_3, 3, __pyx_t_8);
  __pyx_t_5 = 0;
  __pyx_t_7 = 0;
  __pyx_t_4 = 0;
  __pyx_t_8 = 0;
  __Pyx_DECREF_SET(__pyx_v_headers, __pyx_t_3);
  __pyx_t_3 = 0;

  /* "nghttp2.pyx":1262
 *                 (b':path', promised_handler.path)
 *             ]
 *             headers.extend(_encode_headers(request_headers))             # <<<<<<<<<<<<<<
 * 
 *             promised_handler.headers = headers
 */
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_headers, __pyx_n_s_extend); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1262, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_encode_headers); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1262, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_7);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_7, function);
    }
  }
  __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_5, __pyx_v_request_headers) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_request_headers);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1262, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_8);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_8, function);
    }
  }
  __pyx_t_3 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_7, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_4);
  __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1262, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "nghttp2.pyx":1264
 *             headers.extend(_encode_headers(request_headers))
 * 
 *             promised_handler.headers = headers             # <<<<<<<<<<<<<<
 * 
 *             return self.http2.push(self, promised_handler)
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_promised_handler, __pyx_n_s_headers, __pyx_v_headers) < 0) __PYX_ERR(0, 1264, __pyx_L1_error)

  /* "nghttp2.pyx":1266
 *             promised_handler.headers = headers
 * 
 *             return self.http2.push(self, promised_handler)             # <<<<<<<<<<<<<<
 * 
 *         def _set_response_prop(self, status, headers, body):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_http2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1266, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_push); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1266, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
      __pyx_t_6 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_4)) {
    PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_v_self, __pyx_v_promised_handler};
    __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1266, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_GOTREF(__pyx_t_3);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
    PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_v_self, __pyx_v_promised_handler};
    __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1266, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_GOTREF(__pyx_t_3);
  } else
  #endif
  {
    __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1266, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (__pyx_t_8) {
      __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_8); __pyx_t_8 = NULL;
    }
    __Pyx_INCREF(__pyx_v_self);
    __Pyx_GIVEREF(__pyx_v_self);
    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_v_self);
    __Pyx_INCREF(__pyx_v_promised_handler);
    __Pyx_GIVEREF(__pyx_v_promised_handler);
    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_v_promised_handler);
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1266, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "nghttp2.pyx":1213
 *             self.http2.send_response(self)
 * 
 *         def push(self, path, method='GET', request_headers=None,             # <<<<<<<<<<<<<<
 *                  status=200, headers=None, body=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_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("nghttp2.BaseRequestHandler.push", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_promised_handler);
  __Pyx_XDECREF(__pyx_v_headers);
  __Pyx_XDECREF(__pyx_v_body);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":1268
 *             return self.http2.push(self, promised_handler)
 * 
 *         def _set_response_prop(self, status, headers, body):             # <<<<<<<<<<<<<<
 *             self.status = status
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_18BaseRequestHandler_19_set_response_prop(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7nghttp2_18BaseRequestHandler_19_set_response_prop = {"_set_response_prop", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7nghttp2_18BaseRequestHandler_19_set_response_prop, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7nghttp2_18BaseRequestHandler_19_set_response_prop(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_status = 0;
  PyObject *__pyx_v_headers = 0;
  PyObject *__pyx_v_body = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_set_response_prop (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_status_2,&__pyx_n_s_headers,&__pyx_n_s_body,0};
    PyObject* values[4] = {0,0,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  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_status_2)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_set_response_prop", 1, 4, 4, 1); __PYX_ERR(0, 1268, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_headers)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_set_response_prop", 1, 4, 4, 2); __PYX_ERR(0, 1268, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_body)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_set_response_prop", 1, 4, 4, 3); __PYX_ERR(0, 1268, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_set_response_prop") < 0)) __PYX_ERR(0, 1268, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
    }
    __pyx_v_self = values[0];
    __pyx_v_status = values[1];
    __pyx_v_headers = values[2];
    __pyx_v_body = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_set_response_prop", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1268, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("nghttp2.BaseRequestHandler._set_response_prop", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7nghttp2_18BaseRequestHandler_18_set_response_prop(__pyx_self, __pyx_v_self, __pyx_v_status, __pyx_v_headers, __pyx_v_body);

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

static PyObject *__pyx_pf_7nghttp2_18BaseRequestHandler_18_set_response_prop(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_status, PyObject *__pyx_v_headers, PyObject *__pyx_v_body) {
  PyObject *__pyx_r = NULL;
  __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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_set_response_prop", 0);
  __Pyx_INCREF(__pyx_v_headers);

  /* "nghttp2.pyx":1269
 * 
 *         def _set_response_prop(self, status, headers, body):
 *             self.status = status             # <<<<<<<<<<<<<<
 * 
 *             if headers is None:
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_status_2, __pyx_v_status) < 0) __PYX_ERR(0, 1269, __pyx_L1_error)

  /* "nghttp2.pyx":1271
 *             self.status = status
 * 
 *             if headers is None:             # <<<<<<<<<<<<<<
 *                 headers = []
 * 
 */
  __pyx_t_1 = (__pyx_v_headers == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "nghttp2.pyx":1272
 * 
 *             if headers is None:
 *                 headers = []             # <<<<<<<<<<<<<<
 * 
 *             self.response_headers = [(b':status', str(status).encode('utf-8'))]
 */
    __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1272, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_headers, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "nghttp2.pyx":1271
 *             self.status = status
 * 
 *             if headers is None:             # <<<<<<<<<<<<<<
 *                 headers = []
 * 
 */
  }

  /* "nghttp2.pyx":1274
 *                 headers = []
 * 
 *             self.response_headers = [(b':status', str(status).encode('utf-8'))]             # <<<<<<<<<<<<<<
 *             self.response_headers.extend(_encode_headers(headers))
 * 
 */
  __pyx_t_4 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_v_status); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1274, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_encode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1274, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_4, __pyx_kp_s_utf_8) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_kp_s_utf_8);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1274, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1274, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_kp_b_status);
  __Pyx_GIVEREF(__pyx_kp_b_status);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_kp_b_status);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1274, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_5);
  PyList_SET_ITEM(__pyx_t_3, 0, __pyx_t_5);
  __pyx_t_5 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_response_headers, __pyx_t_3) < 0) __PYX_ERR(0, 1274, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "nghttp2.pyx":1275
 * 
 *             self.response_headers = [(b':status', str(status).encode('utf-8'))]
 *             self.response_headers.extend(_encode_headers(headers))             # <<<<<<<<<<<<<<
 * 
 *             self.response_body = body
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_response_headers); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1275, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_extend); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1275, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_encode_headers); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1275, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __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);
    }
  }
  __pyx_t_5 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_v_headers) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_headers);
  __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1275, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_3 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_6, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1275, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "nghttp2.pyx":1277
 *             self.response_headers.extend(_encode_headers(headers))
 * 
 *             self.response_body = body             # <<<<<<<<<<<<<<
 * 
 *         def resume(self):
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_response_body, __pyx_v_body) < 0) __PYX_ERR(0, 1277, __pyx_L1_error)

  /* "nghttp2.pyx":1268
 *             return self.http2.push(self, promised_handler)
 * 
 *         def _set_response_prop(self, status, headers, body):             # <<<<<<<<<<<<<<
 *             self.status = status
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __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_AddTraceback("nghttp2.BaseRequestHandler._set_response_prop", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_headers);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":1279
 *             self.response_body = body
 * 
 *         def resume(self):             # <<<<<<<<<<<<<<
 *             self.http2.resume(self.stream_id)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_18BaseRequestHandler_21resume(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7nghttp2_18BaseRequestHandler_21resume = {"resume", (PyCFunction)__pyx_pw_7nghttp2_18BaseRequestHandler_21resume, METH_O, 0};
static PyObject *__pyx_pw_7nghttp2_18BaseRequestHandler_21resume(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("resume (wrapper)", 0);
  __pyx_r = __pyx_pf_7nghttp2_18BaseRequestHandler_20resume(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_7nghttp2_18BaseRequestHandler_20resume(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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("resume", 0);

  /* "nghttp2.pyx":1280
 * 
 *         def resume(self):
 *             self.http2.resume(self.stream_id)             # <<<<<<<<<<<<<<
 * 
 *     def _encode_headers(headers):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_http2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1280, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_resume); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1280, __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_self, __pyx_n_s_stream_id); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1280, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __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);
    }
  }
  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1280, __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;

  /* "nghttp2.pyx":1279
 *             self.response_body = body
 * 
 *         def resume(self):             # <<<<<<<<<<<<<<
 *             self.http2.resume(self.stream_id)
 * 
 */

  /* 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_AddTraceback("nghttp2.BaseRequestHandler.resume", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":1282
 *             self.http2.resume(self.stream_id)
 * 
 *     def _encode_headers(headers):             # <<<<<<<<<<<<<<
 *         if not headers:
 *             return []
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_9_encode_headers(PyObject *__pyx_self, PyObject *__pyx_v_headers); /*proto*/
static PyMethodDef __pyx_mdef_7nghttp2_9_encode_headers = {"_encode_headers", (PyCFunction)__pyx_pw_7nghttp2_9_encode_headers, METH_O, 0};
static PyObject *__pyx_pw_7nghttp2_9_encode_headers(PyObject *__pyx_self, PyObject *__pyx_v_headers) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_encode_headers (wrapper)", 0);
  __pyx_r = __pyx_pf_7nghttp2_8_encode_headers(__pyx_self, ((PyObject *)__pyx_v_headers));

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

static PyObject *__pyx_pf_7nghttp2_8_encode_headers(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_headers) {
  PyObject *__pyx_v_k = NULL;
  PyObject *__pyx_v_v = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  Py_ssize_t __pyx_t_5;
  PyObject *(*__pyx_t_6)(PyObject *);
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *(*__pyx_t_11)(PyObject *);
  PyObject *__pyx_t_12 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_encode_headers", 0);

  /* "nghttp2.pyx":1283
 * 
 *     def _encode_headers(headers):
 *         if not headers:             # <<<<<<<<<<<<<<
 *             return []
 *         return [(k if isinstance(k, bytes) else k.encode('utf-8'),
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_headers); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1283, __pyx_L1_error)
  __pyx_t_2 = ((!__pyx_t_1) != 0);
  if (__pyx_t_2) {

    /* "nghttp2.pyx":1284
 *     def _encode_headers(headers):
 *         if not headers:
 *             return []             # <<<<<<<<<<<<<<
 *         return [(k if isinstance(k, bytes) else k.encode('utf-8'),
 *                  v if isinstance(v, bytes) else v.encode('utf-8')) \
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1284, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "nghttp2.pyx":1283
 * 
 *     def _encode_headers(headers):
 *         if not headers:             # <<<<<<<<<<<<<<
 *             return []
 *         return [(k if isinstance(k, bytes) else k.encode('utf-8'),
 */
  }

  /* "nghttp2.pyx":1285
 *         if not headers:
 *             return []
 *         return [(k if isinstance(k, bytes) else k.encode('utf-8'),             # <<<<<<<<<<<<<<
 *                  v if isinstance(v, bytes) else v.encode('utf-8')) \
 *                 for k, v in headers]
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1285, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "nghttp2.pyx":1287
 *         return [(k if isinstance(k, bytes) else k.encode('utf-8'),
 *                  v if isinstance(v, bytes) else v.encode('utf-8')) \
 *                 for k, v in headers]             # <<<<<<<<<<<<<<
 * 
 *     class _HTTP2Session(asyncio.Protocol):
 */
  if (likely(PyList_CheckExact(__pyx_v_headers)) || PyTuple_CheckExact(__pyx_v_headers)) {
    __pyx_t_4 = __pyx_v_headers; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0;
    __pyx_t_6 = NULL;
  } else {
    __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_headers); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1287, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1287, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_6)) {
      if (likely(PyList_CheckExact(__pyx_t_4))) {
        if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_7 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 1287, __pyx_L1_error)
        #else
        __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1287, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        #endif
      } else {
        if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 1287, __pyx_L1_error)
        #else
        __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1287, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        #endif
      }
    } else {
      __pyx_t_7 = __pyx_t_6(__pyx_t_4);
      if (unlikely(!__pyx_t_7)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 1287, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_7);
    }
    if ((likely(PyTuple_CheckExact(__pyx_t_7))) || (PyList_CheckExact(__pyx_t_7))) {
      PyObject* sequence = __pyx_t_7;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1287, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_8 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_8 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_9 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_9);
      #else
      __pyx_t_8 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1287, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_9 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1287, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      #endif
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_10 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1287, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_11 = Py_TYPE(__pyx_t_10)->tp_iternext;
      index = 0; __pyx_t_8 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_8)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_8);
      index = 1; __pyx_t_9 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_9)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_9);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_10), 2) < 0) __PYX_ERR(0, 1287, __pyx_L1_error)
      __pyx_t_11 = NULL;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      goto __pyx_L7_unpacking_done;
      __pyx_L6_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_11 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 1287, __pyx_L1_error)
      __pyx_L7_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_k, __pyx_t_8);
    __pyx_t_8 = 0;
    __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_9);
    __pyx_t_9 = 0;

    /* "nghttp2.pyx":1285
 *         if not headers:
 *             return []
 *         return [(k if isinstance(k, bytes) else k.encode('utf-8'),             # <<<<<<<<<<<<<<
 *                  v if isinstance(v, bytes) else v.encode('utf-8')) \
 *                 for k, v in headers]
 */
    __pyx_t_2 = PyBytes_Check(__pyx_v_k); 
    if ((__pyx_t_2 != 0)) {
      __Pyx_INCREF(__pyx_v_k);
      __pyx_t_7 = __pyx_v_k;
    } else {
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_k, __pyx_n_s_encode); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1285, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_10 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
        __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_8);
        if (likely(__pyx_t_10)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
          __Pyx_INCREF(__pyx_t_10);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_8, function);
        }
      }
      __pyx_t_9 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_10, __pyx_kp_s_utf_8) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_kp_s_utf_8);
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1285, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_7 = __pyx_t_9;
      __pyx_t_9 = 0;
    }

    /* "nghttp2.pyx":1286
 *             return []
 *         return [(k if isinstance(k, bytes) else k.encode('utf-8'),
 *                  v if isinstance(v, bytes) else v.encode('utf-8')) \             # <<<<<<<<<<<<<<
 *                 for k, v in headers]
 * 
 */
    __pyx_t_2 = PyBytes_Check(__pyx_v_v); 
    if ((__pyx_t_2 != 0)) {
      __Pyx_INCREF(__pyx_v_v);
      __pyx_t_9 = __pyx_v_v;
    } else {
      __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_v, __pyx_n_s_encode); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1286, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_12 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) {
        __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_10);
        if (likely(__pyx_t_12)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
          __Pyx_INCREF(__pyx_t_12);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_10, function);
        }
      }
      __pyx_t_8 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_10, __pyx_t_12, __pyx_kp_s_utf_8) : __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_kp_s_utf_8);
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1286, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_9 = __pyx_t_8;
      __pyx_t_8 = 0;
    }

    /* "nghttp2.pyx":1285
 *         if not headers:
 *             return []
 *         return [(k if isinstance(k, bytes) else k.encode('utf-8'),             # <<<<<<<<<<<<<<
 *                  v if isinstance(v, bytes) else v.encode('utf-8')) \
 *                 for k, v in headers]
 */
    __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1285, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_9);
    PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_9);
    __pyx_t_7 = 0;
    __pyx_t_9 = 0;
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_8))) __PYX_ERR(0, 1285, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

    /* "nghttp2.pyx":1287
 *         return [(k if isinstance(k, bytes) else k.encode('utf-8'),
 *                  v if isinstance(v, bytes) else v.encode('utf-8')) \
 *                 for k, v in headers]             # <<<<<<<<<<<<<<
 * 
 *     class _HTTP2Session(asyncio.Protocol):
 */
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "nghttp2.pyx":1282
 *             self.http2.resume(self.stream_id)
 * 
 *     def _encode_headers(headers):             # <<<<<<<<<<<<<<
 *         if not headers:
 *             return []
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("nghttp2._encode_headers", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_k);
  __Pyx_XDECREF(__pyx_v_v);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":1291
 *     class _HTTP2Session(asyncio.Protocol):
 * 
 *         def __init__(self, RequestHandlerClass):             # <<<<<<<<<<<<<<
 *             asyncio.Protocol.__init__(self)
 *             self.RequestHandlerClass = RequestHandlerClass
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_13_HTTP2Session_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7nghttp2_13_HTTP2Session_1__init__ = {"__init__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7nghttp2_13_HTTP2Session_1__init__, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7nghttp2_13_HTTP2Session_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_RequestHandlerClass = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_RequestHandlerClass,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);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_RequestHandlerClass)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); __PYX_ERR(0, 1291, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 1291, __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_self = values[0];
    __pyx_v_RequestHandlerClass = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1291, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("nghttp2._HTTP2Session.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7nghttp2_13_HTTP2Session___init__(__pyx_self, __pyx_v_self, __pyx_v_RequestHandlerClass);

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

static PyObject *__pyx_pf_7nghttp2_13_HTTP2Session___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_RequestHandlerClass) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "nghttp2.pyx":1292
 * 
 *         def __init__(self, RequestHandlerClass):
 *             asyncio.Protocol.__init__(self)             # <<<<<<<<<<<<<<
 *             self.RequestHandlerClass = RequestHandlerClass
 *             self.http2 = None
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_asyncio); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1292, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_Protocol); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1292, __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_init); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1292, __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);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_self) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_self);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1292, __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;

  /* "nghttp2.pyx":1293
 *         def __init__(self, RequestHandlerClass):
 *             asyncio.Protocol.__init__(self)
 *             self.RequestHandlerClass = RequestHandlerClass             # <<<<<<<<<<<<<<
 *             self.http2 = None
 * 
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_RequestHandlerClass, __pyx_v_RequestHandlerClass) < 0) __PYX_ERR(0, 1293, __pyx_L1_error)

  /* "nghttp2.pyx":1294
 *             asyncio.Protocol.__init__(self)
 *             self.RequestHandlerClass = RequestHandlerClass
 *             self.http2 = None             # <<<<<<<<<<<<<<
 * 
 *         def connection_made(self, transport):
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_http2, Py_None) < 0) __PYX_ERR(0, 1294, __pyx_L1_error)

  /* "nghttp2.pyx":1291
 *     class _HTTP2Session(asyncio.Protocol):
 * 
 *         def __init__(self, RequestHandlerClass):             # <<<<<<<<<<<<<<
 *             asyncio.Protocol.__init__(self)
 *             self.RequestHandlerClass = RequestHandlerClass
 */

  /* 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_AddTraceback("nghttp2._HTTP2Session.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":1296
 *             self.http2 = None
 * 
 *         def connection_made(self, transport):             # <<<<<<<<<<<<<<
 *             address = transport.get_extra_info('peername')
 *             logging.info('connection_made, address:%s, port:%s', address[0], address[1])
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_13_HTTP2Session_3connection_made(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7nghttp2_13_HTTP2Session_3connection_made = {"connection_made", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7nghttp2_13_HTTP2Session_3connection_made, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7nghttp2_13_HTTP2Session_3connection_made(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_transport = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("connection_made (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_transport,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);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_transport)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("connection_made", 1, 2, 2, 1); __PYX_ERR(0, 1296, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "connection_made") < 0)) __PYX_ERR(0, 1296, __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_self = values[0];
    __pyx_v_transport = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("connection_made", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1296, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("nghttp2._HTTP2Session.connection_made", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7nghttp2_13_HTTP2Session_2connection_made(__pyx_self, __pyx_v_self, __pyx_v_transport);

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

static PyObject *__pyx_pf_7nghttp2_13_HTTP2Session_2connection_made(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_transport) {
  PyObject *__pyx_v_address = NULL;
  PyObject *__pyx_v_sock = NULL;
  PyObject *__pyx_v_e = NULL;
  PyObject *__pyx_v_ssl_ctx = NULL;
  PyObject *__pyx_v_ssl_obj = NULL;
  PyObject *__pyx_v_protocol = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_err = 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;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_t_13;
  int __pyx_t_14;
  int __pyx_t_15;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("connection_made", 0);

  /* "nghttp2.pyx":1297
 * 
 *         def connection_made(self, transport):
 *             address = transport.get_extra_info('peername')             # <<<<<<<<<<<<<<
 *             logging.info('connection_made, address:%s, port:%s', address[0], address[1])
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_transport, __pyx_n_s_get_extra_info); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1297, __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);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_n_s_peername) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_n_s_peername);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1297, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_address = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "nghttp2.pyx":1298
 *         def connection_made(self, transport):
 *             address = transport.get_extra_info('peername')
 *             logging.info('connection_made, address:%s, port:%s', address[0], address[1])             # <<<<<<<<<<<<<<
 * 
 *             self.transport = transport
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_logging); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1298, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_info); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1298, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_address, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1298, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_address, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1298, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(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[4] = {__pyx_t_5, __pyx_kp_s_connection_made_address_s_port_s, __pyx_t_2, __pyx_t_4};
    __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(0, 1298, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __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[4] = {__pyx_t_5, __pyx_kp_s_connection_made_address_s_port_s, __pyx_t_2, __pyx_t_4};
    __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(0, 1298, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 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(0, 1298, __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_INCREF(__pyx_kp_s_connection_made_address_s_port_s);
    __Pyx_GIVEREF(__pyx_kp_s_connection_made_address_s_port_s);
    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_kp_s_connection_made_address_s_port_s);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_6, __pyx_t_4);
    __pyx_t_2 = 0;
    __pyx_t_4 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1298, __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;

  /* "nghttp2.pyx":1300
 *             logging.info('connection_made, address:%s, port:%s', address[0], address[1])
 * 
 *             self.transport = transport             # <<<<<<<<<<<<<<
 *             sock = self.transport.get_extra_info('socket')
 *             try:
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_transport, __pyx_v_transport) < 0) __PYX_ERR(0, 1300, __pyx_L1_error)

  /* "nghttp2.pyx":1301
 * 
 *             self.transport = transport
 *             sock = self.transport.get_extra_info('socket')             # <<<<<<<<<<<<<<
 *             try:
 *                 sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_transport); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1301, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_get_extra_info); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1301, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(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_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_3, __pyx_n_s_socket) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_n_s_socket);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1301, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_v_sock = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "nghttp2.pyx":1302
 *             self.transport = transport
 *             sock = self.transport.get_extra_info('socket')
 *             try:             # <<<<<<<<<<<<<<
 *                 sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
 *             except OSError as e:
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
    __Pyx_XGOTREF(__pyx_t_8);
    __Pyx_XGOTREF(__pyx_t_9);
    __Pyx_XGOTREF(__pyx_t_10);
    /*try:*/ {

      /* "nghttp2.pyx":1303
 *             sock = self.transport.get_extra_info('socket')
 *             try:
 *                 sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)             # <<<<<<<<<<<<<<
 *             except OSError as e:
 *                 logging.info('failed to set tcp-nodelay: %s', str(e))
 */
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_sock, __pyx_n_s_setsockopt); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1303, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_socket); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1303, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_IPPROTO_TCP); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1303, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_socket); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1303, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_TCP_NODELAY); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1303, __pyx_L3_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 && likely(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[4] = {__pyx_t_3, __pyx_t_4, __pyx_t_2, __pyx_int_1};
        __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1303, __pyx_L3_error)
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __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[4] = {__pyx_t_3, __pyx_t_4, __pyx_t_2, __pyx_int_1};
        __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1303, __pyx_L3_error)
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      } else
      #endif
      {
        __pyx_t_5 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1303, __pyx_L3_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_GIVEREF(__pyx_t_4);
        PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_6, __pyx_t_4);
        __Pyx_GIVEREF(__pyx_t_2);
        PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_6, __pyx_t_2);
        __Pyx_INCREF(__pyx_int_1);
        __Pyx_GIVEREF(__pyx_int_1);
        PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_6, __pyx_int_1);
        __pyx_t_4 = 0;
        __pyx_t_2 = 0;
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1303, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      }
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "nghttp2.pyx":1302
 *             self.transport = transport
 *             sock = self.transport.get_extra_info('socket')
 *             try:             # <<<<<<<<<<<<<<
 *                 sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
 *             except OSError as e:
 */
    }
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    goto __pyx_L8_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "nghttp2.pyx":1304
 *             try:
 *                 sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
 *             except OSError as e:             # <<<<<<<<<<<<<<
 *                 logging.info('failed to set tcp-nodelay: %s', str(e))
 *             ssl_ctx = self.transport.get_extra_info('sslcontext')
 */
    __pyx_t_6 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_OSError);
    if (__pyx_t_6) {
      __Pyx_AddTraceback("nghttp2._HTTP2Session.connection_made", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_7, &__pyx_t_5) < 0) __PYX_ERR(0, 1304, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_7);
      __pyx_v_e = __pyx_t_7;

      /* "nghttp2.pyx":1305
 *                 sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
 *             except OSError as e:
 *                 logging.info('failed to set tcp-nodelay: %s', str(e))             # <<<<<<<<<<<<<<
 *             ssl_ctx = self.transport.get_extra_info('sslcontext')
 *             if ssl_ctx:
 */
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_logging); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1305, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_info); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1305, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_v_e); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1305, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_11 = NULL;
      __pyx_t_6 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_11)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_11);
          __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_11, __pyx_kp_s_failed_to_set_tcp_nodelay_s, __pyx_t_4};
        __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(0, 1305, __pyx_L5_except_error)
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 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_11, __pyx_kp_s_failed_to_set_tcp_nodelay_s, __pyx_t_4};
        __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(0, 1305, __pyx_L5_except_error)
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      } else
      #endif
      {
        __pyx_t_12 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1305, __pyx_L5_except_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_INCREF(__pyx_kp_s_failed_to_set_tcp_nodelay_s);
        __Pyx_GIVEREF(__pyx_kp_s_failed_to_set_tcp_nodelay_s);
        PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_6, __pyx_kp_s_failed_to_set_tcp_nodelay_s);
        __Pyx_GIVEREF(__pyx_t_4);
        PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_6, __pyx_t_4);
        __pyx_t_4 = 0;
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_12, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1305, __pyx_L5_except_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L4_exception_handled;
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "nghttp2.pyx":1302
 *             self.transport = transport
 *             sock = self.transport.get_extra_info('socket')
 *             try:             # <<<<<<<<<<<<<<
 *                 sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
 *             except OSError as e:
 */
    __Pyx_XGIVEREF(__pyx_t_8);
    __Pyx_XGIVEREF(__pyx_t_9);
    __Pyx_XGIVEREF(__pyx_t_10);
    __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10);
    goto __pyx_L1_error;
    __pyx_L4_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_8);
    __Pyx_XGIVEREF(__pyx_t_9);
    __Pyx_XGIVEREF(__pyx_t_10);
    __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10);
    __pyx_L8_try_end:;
  }

  /* "nghttp2.pyx":1306
 *             except OSError as e:
 *                 logging.info('failed to set tcp-nodelay: %s', str(e))
 *             ssl_ctx = self.transport.get_extra_info('sslcontext')             # <<<<<<<<<<<<<<
 *             if ssl_ctx:
 *                 ssl_obj = self.transport.get_extra_info('ssl_object')
 */
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_transport); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1306, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_get_extra_info); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1306, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  __pyx_t_5 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_7, __pyx_n_s_sslcontext) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_n_s_sslcontext);
  __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1306, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_ssl_ctx = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "nghttp2.pyx":1307
 *                 logging.info('failed to set tcp-nodelay: %s', str(e))
 *             ssl_ctx = self.transport.get_extra_info('sslcontext')
 *             if ssl_ctx:             # <<<<<<<<<<<<<<
 *                 ssl_obj = self.transport.get_extra_info('ssl_object')
 *                 protocol = negotiated_protocol(ssl_obj)
 */
  __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_v_ssl_ctx); if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 1307, __pyx_L1_error)
  if (__pyx_t_13) {

    /* "nghttp2.pyx":1308
 *             ssl_ctx = self.transport.get_extra_info('sslcontext')
 *             if ssl_ctx:
 *                 ssl_obj = self.transport.get_extra_info('ssl_object')             # <<<<<<<<<<<<<<
 *                 protocol = negotiated_protocol(ssl_obj)
 *                 if protocol is None or protocol.encode('utf-8') != \
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_transport); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1308, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_get_extra_info); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1308, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    __pyx_t_5 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_1, __pyx_n_s_ssl_object) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_n_s_ssl_object);
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1308, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_v_ssl_obj = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "nghttp2.pyx":1309
 *             if ssl_ctx:
 *                 ssl_obj = self.transport.get_extra_info('ssl_object')
 *                 protocol = negotiated_protocol(ssl_obj)             # <<<<<<<<<<<<<<
 *                 if protocol is None or protocol.encode('utf-8') != \
 *                    cnghttp2.NGHTTP2_PROTO_VERSION_ID:
 */
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_negotiated_protocol); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1309, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_1 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    __pyx_t_5 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_1, __pyx_v_ssl_obj) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_ssl_obj);
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1309, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_v_protocol = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "nghttp2.pyx":1310
 *                 ssl_obj = self.transport.get_extra_info('ssl_object')
 *                 protocol = negotiated_protocol(ssl_obj)
 *                 if protocol is None or protocol.encode('utf-8') != \             # <<<<<<<<<<<<<<
 *                    cnghttp2.NGHTTP2_PROTO_VERSION_ID:
 *                     self.transport.abort()
 */
    __pyx_t_14 = (__pyx_v_protocol == Py_None);
    __pyx_t_15 = (__pyx_t_14 != 0);
    if (!__pyx_t_15) {
    } else {
      __pyx_t_13 = __pyx_t_15;
      goto __pyx_L13_bool_binop_done;
    }
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_protocol, __pyx_n_s_encode); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1310, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_1 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    __pyx_t_5 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_1, __pyx_kp_s_utf_8) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_kp_s_utf_8);
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1310, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "nghttp2.pyx":1311
 *                 protocol = negotiated_protocol(ssl_obj)
 *                 if protocol is None or protocol.encode('utf-8') != \
 *                    cnghttp2.NGHTTP2_PROTO_VERSION_ID:             # <<<<<<<<<<<<<<
 *                     self.transport.abort()
 *                     return
 */
    __pyx_t_7 = __Pyx_PyObject_FromString(NGHTTP2_PROTO_VERSION_ID); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1311, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_15 = (__Pyx_PyBytes_Equals(__pyx_t_5, __pyx_t_7, Py_NE)); if (unlikely(__pyx_t_15 < 0)) __PYX_ERR(0, 1310, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_13 = __pyx_t_15;
    __pyx_L13_bool_binop_done:;

    /* "nghttp2.pyx":1310
 *                 ssl_obj = self.transport.get_extra_info('ssl_object')
 *                 protocol = negotiated_protocol(ssl_obj)
 *                 if protocol is None or protocol.encode('utf-8') != \             # <<<<<<<<<<<<<<
 *                    cnghttp2.NGHTTP2_PROTO_VERSION_ID:
 *                     self.transport.abort()
 */
    if (__pyx_t_13) {

      /* "nghttp2.pyx":1312
 *                 if protocol is None or protocol.encode('utf-8') != \
 *                    cnghttp2.NGHTTP2_PROTO_VERSION_ID:
 *                     self.transport.abort()             # <<<<<<<<<<<<<<
 *                     return
 *             try:
 */
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_transport); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1312, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_abort); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1312, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
        }
      }
      __pyx_t_7 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1312, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "nghttp2.pyx":1313
 *                    cnghttp2.NGHTTP2_PROTO_VERSION_ID:
 *                     self.transport.abort()
 *                     return             # <<<<<<<<<<<<<<
 *             try:
 *                 self.http2 = _HTTP2SessionCore\
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;

      /* "nghttp2.pyx":1310
 *                 ssl_obj = self.transport.get_extra_info('ssl_object')
 *                 protocol = negotiated_protocol(ssl_obj)
 *                 if protocol is None or protocol.encode('utf-8') != \             # <<<<<<<<<<<<<<
 *                    cnghttp2.NGHTTP2_PROTO_VERSION_ID:
 *                     self.transport.abort()
 */
    }

    /* "nghttp2.pyx":1307
 *                 logging.info('failed to set tcp-nodelay: %s', str(e))
 *             ssl_ctx = self.transport.get_extra_info('sslcontext')
 *             if ssl_ctx:             # <<<<<<<<<<<<<<
 *                 ssl_obj = self.transport.get_extra_info('ssl_object')
 *                 protocol = negotiated_protocol(ssl_obj)
 */
  }

  /* "nghttp2.pyx":1314
 *                     self.transport.abort()
 *                     return
 *             try:             # <<<<<<<<<<<<<<
 *                 self.http2 = _HTTP2SessionCore\
 *                              (self.transport,
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_10, &__pyx_t_9, &__pyx_t_8);
    __Pyx_XGOTREF(__pyx_t_10);
    __Pyx_XGOTREF(__pyx_t_9);
    __Pyx_XGOTREF(__pyx_t_8);
    /*try:*/ {

      /* "nghttp2.pyx":1316
 *             try:
 *                 self.http2 = _HTTP2SessionCore\
 *                              (self.transport,             # <<<<<<<<<<<<<<
 *                               self.RequestHandlerClass)
 *             except Exception as err:
 */
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_transport); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1316, __pyx_L15_error)
      __Pyx_GOTREF(__pyx_t_7);

      /* "nghttp2.pyx":1317
 *                 self.http2 = _HTTP2SessionCore\
 *                              (self.transport,
 *                               self.RequestHandlerClass)             # <<<<<<<<<<<<<<
 *             except Exception as err:
 *                 sys.stderr.write(traceback.format_exc())
 */
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_RequestHandlerClass); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1317, __pyx_L15_error)
      __Pyx_GOTREF(__pyx_t_1);

      /* "nghttp2.pyx":1316
 *             try:
 *                 self.http2 = _HTTP2SessionCore\
 *                              (self.transport,             # <<<<<<<<<<<<<<
 *                               self.RequestHandlerClass)
 *             except Exception as err:
 */
      __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1316, __pyx_L15_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
      __pyx_t_7 = 0;
      __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_7nghttp2__HTTP2SessionCore), __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1316, __pyx_L15_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "nghttp2.pyx":1315
 *                     return
 *             try:
 *                 self.http2 = _HTTP2SessionCore\             # <<<<<<<<<<<<<<
 *                              (self.transport,
 *                               self.RequestHandlerClass)
 */
      if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_http2, __pyx_t_1) < 0) __PYX_ERR(0, 1315, __pyx_L15_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "nghttp2.pyx":1314
 *                     self.transport.abort()
 *                     return
 *             try:             # <<<<<<<<<<<<<<
 *                 self.http2 = _HTTP2SessionCore\
 *                              (self.transport,
 */
    }
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    goto __pyx_L20_try_end;
    __pyx_L15_error:;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "nghttp2.pyx":1318
 *                              (self.transport,
 *                               self.RequestHandlerClass)
 *             except Exception as err:             # <<<<<<<<<<<<<<
 *                 sys.stderr.write(traceback.format_exc())
 *                 self.transport.abort()
 */
    __pyx_t_6 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
    if (__pyx_t_6) {
      __Pyx_AddTraceback("nghttp2._HTTP2Session.connection_made", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_5, &__pyx_t_7) < 0) __PYX_ERR(0, 1318, __pyx_L17_except_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_5);
      __pyx_v_err = __pyx_t_5;

      /* "nghttp2.pyx":1319
 *                               self.RequestHandlerClass)
 *             except Exception as err:
 *                 sys.stderr.write(traceback.format_exc())             # <<<<<<<<<<<<<<
 *                 self.transport.abort()
 *                 return
 */
      __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_sys); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1319, __pyx_L17_except_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_stderr); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1319, __pyx_L17_except_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_write); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1319, __pyx_L17_except_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_traceback); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1319, __pyx_L17_except_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_format_exc); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1319, __pyx_L17_except_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_11))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_11);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_11, function);
        }
      }
      __pyx_t_12 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_11);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1319, __pyx_L17_except_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __pyx_t_11 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_11)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_11);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
        }
      }
      __pyx_t_2 = (__pyx_t_11) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_11, __pyx_t_12) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_12);
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1319, __pyx_L17_except_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "nghttp2.pyx":1320
 *             except Exception as err:
 *                 sys.stderr.write(traceback.format_exc())
 *                 self.transport.abort()             # <<<<<<<<<<<<<<
 *                 return
 * 
 */
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_transport); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1320, __pyx_L17_except_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_abort); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1320, __pyx_L17_except_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_12))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_12);
        if (likely(__pyx_t_3)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_12, function);
        }
      }
      __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_12);
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1320, __pyx_L17_except_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "nghttp2.pyx":1321
 *                 sys.stderr.write(traceback.format_exc())
 *                 self.transport.abort()
 *                 return             # <<<<<<<<<<<<<<
 * 
 * 
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L18_except_return;
    }
    goto __pyx_L17_except_error;
    __pyx_L17_except_error:;

    /* "nghttp2.pyx":1314
 *                     self.transport.abort()
 *                     return
 *             try:             # <<<<<<<<<<<<<<
 *                 self.http2 = _HTTP2SessionCore\
 *                              (self.transport,
 */
    __Pyx_XGIVEREF(__pyx_t_10);
    __Pyx_XGIVEREF(__pyx_t_9);
    __Pyx_XGIVEREF(__pyx_t_8);
    __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_9, __pyx_t_8);
    goto __pyx_L1_error;
    __pyx_L18_except_return:;
    __Pyx_XGIVEREF(__pyx_t_10);
    __Pyx_XGIVEREF(__pyx_t_9);
    __Pyx_XGIVEREF(__pyx_t_8);
    __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_9, __pyx_t_8);
    goto __pyx_L0;
    __pyx_L20_try_end:;
  }

  /* "nghttp2.pyx":1296
 *             self.http2 = None
 * 
 *         def connection_made(self, transport):             # <<<<<<<<<<<<<<
 *             address = transport.get_extra_info('peername')
 *             logging.info('connection_made, address:%s, port:%s', address[0], address[1])
 */

  /* 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_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("nghttp2._HTTP2Session.connection_made", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_address);
  __Pyx_XDECREF(__pyx_v_sock);
  __Pyx_XDECREF(__pyx_v_e);
  __Pyx_XDECREF(__pyx_v_ssl_ctx);
  __Pyx_XDECREF(__pyx_v_ssl_obj);
  __Pyx_XDECREF(__pyx_v_protocol);
  __Pyx_XDECREF(__pyx_v_err);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":1324
 * 
 * 
 *         def connection_lost(self, exc):             # <<<<<<<<<<<<<<
 *             logging.info('connection_lost')
 *             if self.http2:
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_13_HTTP2Session_5connection_lost(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7nghttp2_13_HTTP2Session_5connection_lost = {"connection_lost", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7nghttp2_13_HTTP2Session_5connection_lost, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7nghttp2_13_HTTP2Session_5connection_lost(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  CYTHON_UNUSED PyObject *__pyx_v_exc = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("connection_lost (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_exc,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);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_exc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("connection_lost", 1, 2, 2, 1); __PYX_ERR(0, 1324, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "connection_lost") < 0)) __PYX_ERR(0, 1324, __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_self = values[0];
    __pyx_v_exc = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("connection_lost", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1324, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("nghttp2._HTTP2Session.connection_lost", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7nghttp2_13_HTTP2Session_4connection_lost(__pyx_self, __pyx_v_self, __pyx_v_exc);

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

static PyObject *__pyx_pf_7nghttp2_13_HTTP2Session_4connection_lost(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_exc) {
  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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("connection_lost", 0);

  /* "nghttp2.pyx":1325
 * 
 *         def connection_lost(self, exc):
 *             logging.info('connection_lost')             # <<<<<<<<<<<<<<
 *             if self.http2:
 *                 self.http2.connection_lost()
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_logging); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1325, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_info); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1325, __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);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_n_s_connection_lost) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_n_s_connection_lost);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1325, __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;

  /* "nghttp2.pyx":1326
 *         def connection_lost(self, exc):
 *             logging.info('connection_lost')
 *             if self.http2:             # <<<<<<<<<<<<<<
 *                 self.http2.connection_lost()
 *                 self.http2 = None
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_http2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1326, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 1326, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_4) {

    /* "nghttp2.pyx":1327
 *             logging.info('connection_lost')
 *             if self.http2:
 *                 self.http2.connection_lost()             # <<<<<<<<<<<<<<
 *                 self.http2 = None
 * 
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_http2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1327, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_connection_lost); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1327, __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);
      }
    }
    __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1327, __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;

    /* "nghttp2.pyx":1328
 *             if self.http2:
 *                 self.http2.connection_lost()
 *                 self.http2 = None             # <<<<<<<<<<<<<<
 * 
 *         def data_received(self, data):
 */
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_http2, Py_None) < 0) __PYX_ERR(0, 1328, __pyx_L1_error)

    /* "nghttp2.pyx":1326
 *         def connection_lost(self, exc):
 *             logging.info('connection_lost')
 *             if self.http2:             # <<<<<<<<<<<<<<
 *                 self.http2.connection_lost()
 *                 self.http2 = None
 */
  }

  /* "nghttp2.pyx":1324
 * 
 * 
 *         def connection_lost(self, exc):             # <<<<<<<<<<<<<<
 *             logging.info('connection_lost')
 *             if self.http2:
 */

  /* 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_AddTraceback("nghttp2._HTTP2Session.connection_lost", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":1330
 *                 self.http2 = None
 * 
 *         def data_received(self, data):             # <<<<<<<<<<<<<<
 *             try:
 *                 self.http2.data_received(data)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_13_HTTP2Session_7data_received(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7nghttp2_13_HTTP2Session_7data_received = {"data_received", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7nghttp2_13_HTTP2Session_7data_received, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7nghttp2_13_HTTP2Session_7data_received(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_data = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("data_received (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_data,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);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_data)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("data_received", 1, 2, 2, 1); __PYX_ERR(0, 1330, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "data_received") < 0)) __PYX_ERR(0, 1330, __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_self = values[0];
    __pyx_v_data = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("data_received", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1330, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("nghttp2._HTTP2Session.data_received", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7nghttp2_13_HTTP2Session_6data_received(__pyx_self, __pyx_v_self, __pyx_v_data);

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

static PyObject *__pyx_pf_7nghttp2_13_HTTP2Session_6data_received(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_data) {
  CYTHON_UNUSED PyObject *__pyx_v_err = 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;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("data_received", 0);

  /* "nghttp2.pyx":1331
 * 
 *         def data_received(self, data):
 *             try:             # <<<<<<<<<<<<<<
 *                 self.http2.data_received(data)
 *             except Exception as err:
 */
  {
    __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:*/ {

      /* "nghttp2.pyx":1332
 *         def data_received(self, data):
 *             try:
 *                 self.http2.data_received(data)             # <<<<<<<<<<<<<<
 *             except Exception as err:
 *                 sys.stderr.write(traceback.format_exc())
 */
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_http2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1332, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_data_received); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1332, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_6);
      __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);
        }
      }
      __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_5, __pyx_v_data) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_data);
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1332, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "nghttp2.pyx":1331
 * 
 *         def data_received(self, data):
 *             try:             # <<<<<<<<<<<<<<
 *                 self.http2.data_received(data)
 *             except Exception as err:
 */
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L8_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "nghttp2.pyx":1333
 *             try:
 *                 self.http2.data_received(data)
 *             except Exception as err:             # <<<<<<<<<<<<<<
 *                 sys.stderr.write(traceback.format_exc())
 *                 self.transport.close()
 */
    __pyx_t_7 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
    if (__pyx_t_7) {
      __Pyx_AddTraceback("nghttp2._HTTP2Session.data_received", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_6, &__pyx_t_5) < 0) __PYX_ERR(0, 1333, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      __pyx_v_err = __pyx_t_6;

      /* "nghttp2.pyx":1334
 *                 self.http2.data_received(data)
 *             except Exception as err:
 *                 sys.stderr.write(traceback.format_exc())             # <<<<<<<<<<<<<<
 *                 self.transport.close()
 *                 return
 */
      __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_sys); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1334, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_stderr); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1334, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_write); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1334, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_traceback); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1334, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_format_exc); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1334, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __pyx_t_11 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_12))) {
        __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_12);
        if (likely(__pyx_t_11)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
          __Pyx_INCREF(__pyx_t_11);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_12, function);
        }
      }
      __pyx_t_10 = (__pyx_t_11) ? __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_t_11) : __Pyx_PyObject_CallNoArg(__pyx_t_12);
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1334, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_t_12 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) {
        __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_9);
        if (likely(__pyx_t_12)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
          __Pyx_INCREF(__pyx_t_12);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_9, function);
        }
      }
      __pyx_t_8 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_12, __pyx_t_10) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_10);
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1334, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

      /* "nghttp2.pyx":1335
 *             except Exception as err:
 *                 sys.stderr.write(traceback.format_exc())
 *                 self.transport.close()             # <<<<<<<<<<<<<<
 *                 return
 * 
 */
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_transport); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1335, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_close); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1335, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_9 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) {
        __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_10);
        if (likely(__pyx_t_9)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
          __Pyx_INCREF(__pyx_t_9);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_10, function);
        }
      }
      __pyx_t_8 = (__pyx_t_9) ? __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_9) : __Pyx_PyObject_CallNoArg(__pyx_t_10);
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1335, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

      /* "nghttp2.pyx":1336
 *                 sys.stderr.write(traceback.format_exc())
 *                 self.transport.close()
 *                 return             # <<<<<<<<<<<<<<
 * 
 *         def resume_writing(self):
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      __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;
      goto __pyx_L6_except_return;
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "nghttp2.pyx":1331
 * 
 *         def data_received(self, data):
 *             try:             # <<<<<<<<<<<<<<
 *                 self.http2.data_received(data)
 *             except Exception as err:
 */
    __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_L6_except_return:;
    __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_L8_try_end:;
  }

  /* "nghttp2.pyx":1330
 *                 self.http2 = None
 * 
 *         def data_received(self, data):             # <<<<<<<<<<<<<<
 *             try:
 *                 self.http2.data_received(data)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("nghttp2._HTTP2Session.data_received", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_err);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":1338
 *                 return
 * 
 *         def resume_writing(self):             # <<<<<<<<<<<<<<
 *             try:
 *                 self.http2.send_data()
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_13_HTTP2Session_9resume_writing(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7nghttp2_13_HTTP2Session_9resume_writing = {"resume_writing", (PyCFunction)__pyx_pw_7nghttp2_13_HTTP2Session_9resume_writing, METH_O, 0};
static PyObject *__pyx_pw_7nghttp2_13_HTTP2Session_9resume_writing(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("resume_writing (wrapper)", 0);
  __pyx_r = __pyx_pf_7nghttp2_13_HTTP2Session_8resume_writing(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_7nghttp2_13_HTTP2Session_8resume_writing(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *__pyx_v_err = 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;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("resume_writing", 0);

  /* "nghttp2.pyx":1339
 * 
 *         def resume_writing(self):
 *             try:             # <<<<<<<<<<<<<<
 *                 self.http2.send_data()
 *             except Exception as err:
 */
  {
    __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:*/ {

      /* "nghttp2.pyx":1340
 *         def resume_writing(self):
 *             try:
 *                 self.http2.send_data()             # <<<<<<<<<<<<<<
 *             except Exception as err:
 *                 sys.stderr.write(traceback.format_exc())
 */
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_http2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1340, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_send_data); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1340, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_6);
      __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);
        }
      }
      __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_6);
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1340, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "nghttp2.pyx":1339
 * 
 *         def resume_writing(self):
 *             try:             # <<<<<<<<<<<<<<
 *                 self.http2.send_data()
 *             except Exception as err:
 */
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L8_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "nghttp2.pyx":1341
 *             try:
 *                 self.http2.send_data()
 *             except Exception as err:             # <<<<<<<<<<<<<<
 *                 sys.stderr.write(traceback.format_exc())
 *                 self.transport.close()
 */
    __pyx_t_7 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
    if (__pyx_t_7) {
      __Pyx_AddTraceback("nghttp2._HTTP2Session.resume_writing", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_6, &__pyx_t_5) < 0) __PYX_ERR(0, 1341, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      __pyx_v_err = __pyx_t_6;

      /* "nghttp2.pyx":1342
 *                 self.http2.send_data()
 *             except Exception as err:
 *                 sys.stderr.write(traceback.format_exc())             # <<<<<<<<<<<<<<
 *                 self.transport.close()
 *                 return
 */
      __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_sys); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1342, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_stderr); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1342, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_write); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1342, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_traceback); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1342, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_format_exc); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1342, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __pyx_t_11 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_12))) {
        __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_12);
        if (likely(__pyx_t_11)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
          __Pyx_INCREF(__pyx_t_11);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_12, function);
        }
      }
      __pyx_t_10 = (__pyx_t_11) ? __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_t_11) : __Pyx_PyObject_CallNoArg(__pyx_t_12);
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1342, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_t_12 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) {
        __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_9);
        if (likely(__pyx_t_12)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
          __Pyx_INCREF(__pyx_t_12);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_9, function);
        }
      }
      __pyx_t_8 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_12, __pyx_t_10) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_10);
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1342, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

      /* "nghttp2.pyx":1343
 *             except Exception as err:
 *                 sys.stderr.write(traceback.format_exc())
 *                 self.transport.close()             # <<<<<<<<<<<<<<
 *                 return
 * 
 */
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_transport); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1343, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_close); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1343, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_9 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) {
        __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_10);
        if (likely(__pyx_t_9)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
          __Pyx_INCREF(__pyx_t_9);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_10, function);
        }
      }
      __pyx_t_8 = (__pyx_t_9) ? __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_9) : __Pyx_PyObject_CallNoArg(__pyx_t_10);
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1343, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

      /* "nghttp2.pyx":1344
 *                 sys.stderr.write(traceback.format_exc())
 *                 self.transport.close()
 *                 return             # <<<<<<<<<<<<<<
 * 
 *     class HTTP2Server:
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      __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;
      goto __pyx_L6_except_return;
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "nghttp2.pyx":1339
 * 
 *         def resume_writing(self):
 *             try:             # <<<<<<<<<<<<<<
 *                 self.http2.send_data()
 *             except Exception as err:
 */
    __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_L6_except_return:;
    __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_L8_try_end:;
  }

  /* "nghttp2.pyx":1338
 *                 return
 * 
 *         def resume_writing(self):             # <<<<<<<<<<<<<<
 *             try:
 *                 self.http2.send_data()
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("nghttp2._HTTP2Session.resume_writing", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_err);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":1355
 * 
 *         '''
 *         def __init__(self, address, RequestHandlerClass, ssl=None):             # <<<<<<<<<<<<<<
 * 
 *             '''address is a tuple of the listening address and port (e.g.,
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_11HTTP2Server_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7nghttp2_11HTTP2Server___init__[] = "address is a tuple of the listening address and port (e.g.,\n            ('127.0.0.1', 8080)). RequestHandlerClass must be a subclass\n            of BaseRequestHandler class to handle a HTTP/2 stream.  The\n            ssl can be ssl.SSLContext instance. If it is not None, the\n            resulting server is SSL/TLS capable.\n\n            ";
static PyMethodDef __pyx_mdef_7nghttp2_11HTTP2Server_1__init__ = {"__init__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7nghttp2_11HTTP2Server_1__init__, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7nghttp2_11HTTP2Server___init__};
static PyObject *__pyx_pw_7nghttp2_11HTTP2Server_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_address = 0;
  PyObject *__pyx_v_RequestHandlerClass = 0;
  PyObject *__pyx_v_ssl = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_address,&__pyx_n_s_RequestHandlerClass,&__pyx_n_s_ssl,0};
    PyObject* values[4] = {0,0,0,0};
    values[3] = ((PyObject *)((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);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_address)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 3, 4, 1); __PYX_ERR(0, 1355, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_RequestHandlerClass)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 3, 4, 2); __PYX_ERR(0, 1355, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ssl);
          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(0, 1355, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        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_self = values[0];
    __pyx_v_address = values[1];
    __pyx_v_RequestHandlerClass = values[2];
    __pyx_v_ssl = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1355, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("nghttp2.HTTP2Server.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7nghttp2_11HTTP2Server___init__(__pyx_self, __pyx_v_self, __pyx_v_address, __pyx_v_RequestHandlerClass, __pyx_v_ssl);

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

/* "nghttp2.pyx":1364
 * 
 *             '''
 *             def session_factory():             # <<<<<<<<<<<<<<
 *                 return _HTTP2Session(RequestHandlerClass)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_11HTTP2Server_8__init___1session_factory(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyMethodDef __pyx_mdef_7nghttp2_11HTTP2Server_8__init___1session_factory = {"session_factory", (PyCFunction)__pyx_pw_7nghttp2_11HTTP2Server_8__init___1session_factory, METH_NOARGS, 0};
static PyObject *__pyx_pw_7nghttp2_11HTTP2Server_8__init___1session_factory(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("session_factory (wrapper)", 0);
  __pyx_r = __pyx_pf_7nghttp2_11HTTP2Server_8__init___session_factory(__pyx_self);

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

static PyObject *__pyx_pf_7nghttp2_11HTTP2Server_8__init___session_factory(PyObject *__pyx_self) {
  struct __pyx_obj_7nghttp2___pyx_scope_struct____init__ *__pyx_cur_scope;
  struct __pyx_obj_7nghttp2___pyx_scope_struct____init__ *__pyx_outer_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("session_factory", 0);
  __pyx_outer_scope = (struct __pyx_obj_7nghttp2___pyx_scope_struct____init__ *) __Pyx_CyFunction_GetClosure(__pyx_self);
  __pyx_cur_scope = __pyx_outer_scope;

  /* "nghttp2.pyx":1365
 *             '''
 *             def session_factory():
 *                 return _HTTP2Session(RequestHandlerClass)             # <<<<<<<<<<<<<<
 * 
 *             self.loop = asyncio.get_event_loop()
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_HTTP2Session); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1365, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (unlikely(!__pyx_cur_scope->__pyx_v_RequestHandlerClass)) { __Pyx_RaiseClosureNameError("RequestHandlerClass"); __PYX_ERR(0, 1365, __pyx_L1_error) }
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(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_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_cur_scope->__pyx_v_RequestHandlerClass) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_cur_scope->__pyx_v_RequestHandlerClass);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1365, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "nghttp2.pyx":1364
 * 
 *             '''
 *             def session_factory():             # <<<<<<<<<<<<<<
 *                 return _HTTP2Session(RequestHandlerClass)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("nghttp2.HTTP2Server.__init__.session_factory", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":1355
 * 
 *         '''
 *         def __init__(self, address, RequestHandlerClass, ssl=None):             # <<<<<<<<<<<<<<
 * 
 *             '''address is a tuple of the listening address and port (e.g.,
 */

static PyObject *__pyx_pf_7nghttp2_11HTTP2Server___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_address, PyObject *__pyx_v_RequestHandlerClass, PyObject *__pyx_v_ssl) {
  struct __pyx_obj_7nghttp2___pyx_scope_struct____init__ *__pyx_cur_scope;
  PyObject *__pyx_v_session_factory = 0;
  PyObject *__pyx_v_coro = 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;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);
  __pyx_cur_scope = (struct __pyx_obj_7nghttp2___pyx_scope_struct____init__ *)__pyx_tp_new_7nghttp2___pyx_scope_struct____init__(__pyx_ptype_7nghttp2___pyx_scope_struct____init__, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_7nghttp2___pyx_scope_struct____init__ *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 1355, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_RequestHandlerClass = __pyx_v_RequestHandlerClass;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_RequestHandlerClass);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_RequestHandlerClass);

  /* "nghttp2.pyx":1364
 * 
 *             '''
 *             def session_factory():             # <<<<<<<<<<<<<<
 *                 return _HTTP2Session(RequestHandlerClass)
 * 
 */
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7nghttp2_11HTTP2Server_8__init___1session_factory, 0, __pyx_n_s_HTTP2Server___init___locals_sess, ((PyObject*)__pyx_cur_scope), __pyx_n_s_nghttp2, __pyx_d, ((PyObject *)__pyx_codeobj__20)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1364, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_session_factory = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "nghttp2.pyx":1367
 *                 return _HTTP2Session(RequestHandlerClass)
 * 
 *             self.loop = asyncio.get_event_loop()             # <<<<<<<<<<<<<<
 * 
 *             if ssl:
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_asyncio); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1367, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_get_event_loop); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1367, __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);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1367, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_loop, __pyx_t_1) < 0) __PYX_ERR(0, 1367, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "nghttp2.pyx":1369
 *             self.loop = asyncio.get_event_loop()
 * 
 *             if ssl:             # <<<<<<<<<<<<<<
 *                 set_application_protocol(ssl)
 * 
 */
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_ssl); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 1369, __pyx_L1_error)
  if (__pyx_t_4) {

    /* "nghttp2.pyx":1370
 * 
 *             if ssl:
 *                 set_application_protocol(ssl)             # <<<<<<<<<<<<<<
 * 
 *             coro = self.loop.create_server(session_factory,
 */
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_set_application_protocol); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1370, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __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);
      }
    }
    __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_v_ssl) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_ssl);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1370, __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;

    /* "nghttp2.pyx":1369
 *             self.loop = asyncio.get_event_loop()
 * 
 *             if ssl:             # <<<<<<<<<<<<<<
 *                 set_application_protocol(ssl)
 * 
 */
  }

  /* "nghttp2.pyx":1372
 *                 set_application_protocol(ssl)
 * 
 *             coro = self.loop.create_server(session_factory,             # <<<<<<<<<<<<<<
 *                                            host=address[0], port=address[1],
 *                                            ssl=ssl)
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_loop); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1372, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_create_server); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1372, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1372, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_session_factory);
  __Pyx_GIVEREF(__pyx_v_session_factory);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_session_factory);

  /* "nghttp2.pyx":1373
 * 
 *             coro = self.loop.create_server(session_factory,
 *                                            host=address[0], port=address[1],             # <<<<<<<<<<<<<<
 *                                            ssl=ssl)
 *             self.server = self.loop.run_until_complete(coro)
 */
  __pyx_t_2 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1373, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_address, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1373, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_host, __pyx_t_5) < 0) __PYX_ERR(0, 1373, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_address, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1373, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_port, __pyx_t_5) < 0) __PYX_ERR(0, 1373, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "nghttp2.pyx":1374
 *             coro = self.loop.create_server(session_factory,
 *                                            host=address[0], port=address[1],
 *                                            ssl=ssl)             # <<<<<<<<<<<<<<
 *             self.server = self.loop.run_until_complete(coro)
 *             logging.info('listen, address:%s, port:%s', address[0], address[1])
 */
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_ssl, __pyx_v_ssl) < 0) __PYX_ERR(0, 1373, __pyx_L1_error)

  /* "nghttp2.pyx":1372
 *                 set_application_protocol(ssl)
 * 
 *             coro = self.loop.create_server(session_factory,             # <<<<<<<<<<<<<<
 *                                            host=address[0], port=address[1],
 *                                            ssl=ssl)
 */
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1372, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __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_v_coro = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "nghttp2.pyx":1375
 *                                            host=address[0], port=address[1],
 *                                            ssl=ssl)
 *             self.server = self.loop.run_until_complete(coro)             # <<<<<<<<<<<<<<
 *             logging.info('listen, address:%s, port:%s', address[0], address[1])
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_loop); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1375, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_run_until_complete); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1375, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  __pyx_t_5 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_2, __pyx_v_coro) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_coro);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1375, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_server, __pyx_t_5) < 0) __PYX_ERR(0, 1375, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "nghttp2.pyx":1376
 *                                            ssl=ssl)
 *             self.server = self.loop.run_until_complete(coro)
 *             logging.info('listen, address:%s, port:%s', address[0], address[1])             # <<<<<<<<<<<<<<
 * 
 *         def serve_forever(self):
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_logging); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1376, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_info); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1376, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_address, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1376, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_address, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1376, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_6 = NULL;
  __pyx_t_7 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(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);
      __pyx_t_7 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_kp_s_listen_address_s_port_s, __pyx_t_1, __pyx_t_3};
    __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1376, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __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_6, __pyx_kp_s_listen_address_s_port_s, __pyx_t_1, __pyx_t_3};
    __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1376, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else
  #endif
  {
    __pyx_t_8 = PyTuple_New(3+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1376, __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_INCREF(__pyx_kp_s_listen_address_s_port_s);
    __Pyx_GIVEREF(__pyx_kp_s_listen_address_s_port_s);
    PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_kp_s_listen_address_s_port_s);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_7, __pyx_t_3);
    __pyx_t_1 = 0;
    __pyx_t_3 = 0;
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_8, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1376, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "nghttp2.pyx":1355
 * 
 *         '''
 *         def __init__(self, address, RequestHandlerClass, ssl=None):             # <<<<<<<<<<<<<<
 * 
 *             '''address is a tuple of the listening address and port (e.g.,
 */

  /* 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_8);
  __Pyx_AddTraceback("nghttp2.HTTP2Server.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_session_factory);
  __Pyx_XDECREF(__pyx_v_coro);
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":1378
 *             logging.info('listen, address:%s, port:%s', address[0], address[1])
 * 
 *         def serve_forever(self):             # <<<<<<<<<<<<<<
 *             try:
 *                 self.loop.run_forever()
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_11HTTP2Server_3serve_forever(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7nghttp2_11HTTP2Server_3serve_forever = {"serve_forever", (PyCFunction)__pyx_pw_7nghttp2_11HTTP2Server_3serve_forever, METH_O, 0};
static PyObject *__pyx_pw_7nghttp2_11HTTP2Server_3serve_forever(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("serve_forever (wrapper)", 0);
  __pyx_r = __pyx_pf_7nghttp2_11HTTP2Server_2serve_forever(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_7nghttp2_11HTTP2Server_2serve_forever(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;
  int __pyx_t_4;
  int __pyx_t_5;
  char const *__pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("serve_forever", 0);

  /* "nghttp2.pyx":1379
 * 
 *         def serve_forever(self):
 *             try:             # <<<<<<<<<<<<<<
 *                 self.loop.run_forever()
 *             finally:
 */
  /*try:*/ {

    /* "nghttp2.pyx":1380
 *         def serve_forever(self):
 *             try:
 *                 self.loop.run_forever()             # <<<<<<<<<<<<<<
 *             finally:
 *                 self.server.close()
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_loop); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1380, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_run_forever); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1380, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_3);
    __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);
      }
    }
    __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1380, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "nghttp2.pyx":1382
 *                 self.loop.run_forever()
 *             finally:
 *                 self.server.close()             # <<<<<<<<<<<<<<
 *                 self.loop.close()
 * 
 */
  /*finally:*/ {
    /*normal exit:*/{
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_server); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1382, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_close); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1382, __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);
        }
      }
      __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1382, __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;

      /* "nghttp2.pyx":1383
 *             finally:
 *                 self.server.close()
 *                 self.loop.close()             # <<<<<<<<<<<<<<
 * 
 * 
 */
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_loop); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1383, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_close); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1383, __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 && 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);
        }
      }
      __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1383, __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;
      goto __pyx_L5;
    }
    __pyx_L4_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9) < 0)) __Pyx_ErrFetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_12);
      __pyx_t_4 = __pyx_lineno; __pyx_t_5 = __pyx_clineno; __pyx_t_6 = __pyx_filename;
      {

        /* "nghttp2.pyx":1382
 *                 self.loop.run_forever()
 *             finally:
 *                 self.server.close()             # <<<<<<<<<<<<<<
 *                 self.loop.close()
 * 
 */
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_server); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1382, __pyx_L7_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_close); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1382, __pyx_L7_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);
          }
        }
        __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1382, __pyx_L7_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

        /* "nghttp2.pyx":1383
 *             finally:
 *                 self.server.close()
 *                 self.loop.close()             # <<<<<<<<<<<<<<
 * 
 * 
 */
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_loop); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1383, __pyx_L7_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_close); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1383, __pyx_L7_error)
        __Pyx_GOTREF(__pyx_t_3);
        __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);
          }
        }
        __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1383, __pyx_L7_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      }
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      }
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_ErrRestore(__pyx_t_7, __pyx_t_8, __pyx_t_9);
      __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
      __pyx_lineno = __pyx_t_4; __pyx_clineno = __pyx_t_5; __pyx_filename = __pyx_t_6;
      goto __pyx_L1_error;
      __pyx_L7_error:;
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      }
      __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;
      __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
      goto __pyx_L1_error;
    }
    __pyx_L5:;
  }

  /* "nghttp2.pyx":1378
 *             logging.info('listen, address:%s, port:%s', address[0], address[1])
 * 
 *         def serve_forever(self):             # <<<<<<<<<<<<<<
 *             try:
 *                 self.loop.run_forever()
 */

  /* 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_AddTraceback("nghttp2.HTTP2Server.serve_forever", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":1439
 *         """
 * 
 *         def __init__(self, http2=None, stream_id=-1):             # <<<<<<<<<<<<<<
 *             self.headers = []
 *             self.cookies = []
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_19BaseResponseHandler_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7nghttp2_19BaseResponseHandler_1__init__ = {"__init__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7nghttp2_19BaseResponseHandler_1__init__, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7nghttp2_19BaseResponseHandler_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_http2 = 0;
  PyObject *__pyx_v_stream_id = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_http2,&__pyx_n_s_stream_id,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)((PyObject *)Py_None));
    values[2] = ((PyObject *)((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);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_http2);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_stream_id);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 1439, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_http2 = values[1];
    __pyx_v_stream_id = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1439, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("nghttp2.BaseResponseHandler.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7nghttp2_19BaseResponseHandler___init__(__pyx_self, __pyx_v_self, __pyx_v_http2, __pyx_v_stream_id);

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

static PyObject *__pyx_pf_7nghttp2_19BaseResponseHandler___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_http2, PyObject *__pyx_v_stream_id) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "nghttp2.pyx":1440
 * 
 *         def __init__(self, http2=None, stream_id=-1):
 *             self.headers = []             # <<<<<<<<<<<<<<
 *             self.cookies = []
 *             # Stream ID. For promised stream, it is initially -1.
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1440, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_headers, __pyx_t_1) < 0) __PYX_ERR(0, 1440, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "nghttp2.pyx":1441
 *         def __init__(self, http2=None, stream_id=-1):
 *             self.headers = []
 *             self.cookies = []             # <<<<<<<<<<<<<<
 *             # Stream ID. For promised stream, it is initially -1.
 *             self.stream_id = stream_id
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1441, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_cookies, __pyx_t_1) < 0) __PYX_ERR(0, 1441, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "nghttp2.pyx":1443
 *             self.cookies = []
 *             # Stream ID. For promised stream, it is initially -1.
 *             self.stream_id = stream_id             # <<<<<<<<<<<<<<
 *             self.http2 = http2
 *             # address of the server
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_stream_id, __pyx_v_stream_id) < 0) __PYX_ERR(0, 1443, __pyx_L1_error)

  /* "nghttp2.pyx":1444
 *             # Stream ID. For promised stream, it is initially -1.
 *             self.stream_id = stream_id
 *             self.http2 = http2             # <<<<<<<<<<<<<<
 *             # address of the server
 *             self.remote_address = None
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_http2, __pyx_v_http2) < 0) __PYX_ERR(0, 1444, __pyx_L1_error)

  /* "nghttp2.pyx":1446
 *             self.http2 = http2
 *             # address of the server
 *             self.remote_address = None             # <<<<<<<<<<<<<<
 *             # :scheme header field in request
 *             self.scheme = None
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_remote_address, Py_None) < 0) __PYX_ERR(0, 1446, __pyx_L1_error)

  /* "nghttp2.pyx":1448
 *             self.remote_address = None
 *             # :scheme header field in request
 *             self.scheme = None             # <<<<<<<<<<<<<<
 *             # :method header field in request
 *             self.method = None
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_scheme_2, Py_None) < 0) __PYX_ERR(0, 1448, __pyx_L1_error)

  /* "nghttp2.pyx":1450
 *             self.scheme = None
 *             # :method header field in request
 *             self.method = None             # <<<<<<<<<<<<<<
 *             # :authority or host header field in request
 *             self.host = None
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_method_2, Py_None) < 0) __PYX_ERR(0, 1450, __pyx_L1_error)

  /* "nghttp2.pyx":1452
 *             self.method = None
 *             # :authority or host header field in request
 *             self.host = None             # <<<<<<<<<<<<<<
 *             # :path header field in request
 *             self.path = None
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_host, Py_None) < 0) __PYX_ERR(0, 1452, __pyx_L1_error)

  /* "nghttp2.pyx":1454
 *             self.host = None
 *             # :path header field in request
 *             self.path = None             # <<<<<<<<<<<<<<
 *             # HTTP status
 *             self.status = None
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_path_2, Py_None) < 0) __PYX_ERR(0, 1454, __pyx_L1_error)

  /* "nghttp2.pyx":1456
 *             self.path = None
 *             # HTTP status
 *             self.status = None             # <<<<<<<<<<<<<<
 *             # True if this is a handler for pushed resource
 *             self.pushed = False
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_status_2, Py_None) < 0) __PYX_ERR(0, 1456, __pyx_L1_error)

  /* "nghttp2.pyx":1458
 *             self.status = None
 *             # True if this is a handler for pushed resource
 *             self.pushed = False             # <<<<<<<<<<<<<<
 * 
 *         @property
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_pushed, Py_False) < 0) __PYX_ERR(0, 1458, __pyx_L1_error)

  /* "nghttp2.pyx":1439
 *         """
 * 
 *         def __init__(self, http2=None, stream_id=-1):             # <<<<<<<<<<<<<<
 *             self.headers = []
 *             self.cookies = []
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("nghttp2.BaseResponseHandler.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":1461
 * 
 *         @property
 *         def server_address(self):             # <<<<<<<<<<<<<<
 *             return self.remote_address
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_19BaseResponseHandler_3server_address(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7nghttp2_19BaseResponseHandler_3server_address = {"server_address", (PyCFunction)__pyx_pw_7nghttp2_19BaseResponseHandler_3server_address, METH_O, 0};
static PyObject *__pyx_pw_7nghttp2_19BaseResponseHandler_3server_address(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("server_address (wrapper)", 0);
  __pyx_r = __pyx_pf_7nghttp2_19BaseResponseHandler_2server_address(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_7nghttp2_19BaseResponseHandler_2server_address(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("server_address", 0);

  /* "nghttp2.pyx":1462
 *         @property
 *         def server_address(self):
 *             return self.remote_address             # <<<<<<<<<<<<<<
 * 
 *         def on_headers(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_remote_address); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1462, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "nghttp2.pyx":1461
 * 
 *         @property
 *         def server_address(self):             # <<<<<<<<<<<<<<
 *             return self.remote_address
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("nghttp2.BaseResponseHandler.server_address", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":1464
 *             return self.remote_address
 * 
 *         def on_headers(self):             # <<<<<<<<<<<<<<
 * 
 *             '''Called when response HEADERS is arrived.
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_19BaseResponseHandler_5on_headers(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_7nghttp2_19BaseResponseHandler_4on_headers[] = "Called when response HEADERS is arrived.\n\n            ";
static PyMethodDef __pyx_mdef_7nghttp2_19BaseResponseHandler_5on_headers = {"on_headers", (PyCFunction)__pyx_pw_7nghttp2_19BaseResponseHandler_5on_headers, METH_O, __pyx_doc_7nghttp2_19BaseResponseHandler_4on_headers};
static PyObject *__pyx_pw_7nghttp2_19BaseResponseHandler_5on_headers(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("on_headers (wrapper)", 0);
  __pyx_r = __pyx_pf_7nghttp2_19BaseResponseHandler_4on_headers(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_7nghttp2_19BaseResponseHandler_4on_headers(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("on_headers", 0);

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":1471
 *             pass
 * 
 *         def on_data(self, data):             # <<<<<<<<<<<<<<
 * 
 *             '''Called when a chunk of response body is arrived. This method
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_19BaseResponseHandler_7on_data(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7nghttp2_19BaseResponseHandler_6on_data[] = "Called when a chunk of response body is arrived. This method\n            will be called multiple times until all data are received.\n\n            ";
static PyMethodDef __pyx_mdef_7nghttp2_19BaseResponseHandler_7on_data = {"on_data", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7nghttp2_19BaseResponseHandler_7on_data, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7nghttp2_19BaseResponseHandler_6on_data};
static PyObject *__pyx_pw_7nghttp2_19BaseResponseHandler_7on_data(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_self = 0;
  CYTHON_UNUSED PyObject *__pyx_v_data = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("on_data (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_data,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);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_data)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("on_data", 1, 2, 2, 1); __PYX_ERR(0, 1471, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "on_data") < 0)) __PYX_ERR(0, 1471, __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_self = values[0];
    __pyx_v_data = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("on_data", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1471, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("nghttp2.BaseResponseHandler.on_data", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7nghttp2_19BaseResponseHandler_6on_data(__pyx_self, __pyx_v_self, __pyx_v_data);

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

static PyObject *__pyx_pf_7nghttp2_19BaseResponseHandler_6on_data(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_data) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("on_data", 0);

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":1479
 *             pass
 * 
 *         def on_response_done(self):             # <<<<<<<<<<<<<<
 * 
 *             '''Called when whole response was received
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_19BaseResponseHandler_9on_response_done(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_7nghttp2_19BaseResponseHandler_8on_response_done[] = "Called when whole response was received\n\n            ";
static PyMethodDef __pyx_mdef_7nghttp2_19BaseResponseHandler_9on_response_done = {"on_response_done", (PyCFunction)__pyx_pw_7nghttp2_19BaseResponseHandler_9on_response_done, METH_O, __pyx_doc_7nghttp2_19BaseResponseHandler_8on_response_done};
static PyObject *__pyx_pw_7nghttp2_19BaseResponseHandler_9on_response_done(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("on_response_done (wrapper)", 0);
  __pyx_r = __pyx_pf_7nghttp2_19BaseResponseHandler_8on_response_done(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_7nghttp2_19BaseResponseHandler_8on_response_done(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("on_response_done", 0);

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":1486
 *             pass
 * 
 *         def on_close(self, error_code):             # <<<<<<<<<<<<<<
 * 
 *             '''Called when stream is about to close.
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_19BaseResponseHandler_11on_close(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7nghttp2_19BaseResponseHandler_10on_close[] = "Called when stream is about to close.\n\n            ";
static PyMethodDef __pyx_mdef_7nghttp2_19BaseResponseHandler_11on_close = {"on_close", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7nghttp2_19BaseResponseHandler_11on_close, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7nghttp2_19BaseResponseHandler_10on_close};
static PyObject *__pyx_pw_7nghttp2_19BaseResponseHandler_11on_close(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_self = 0;
  CYTHON_UNUSED PyObject *__pyx_v_error_code = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("on_close (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_error_code,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);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_error_code)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("on_close", 1, 2, 2, 1); __PYX_ERR(0, 1486, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "on_close") < 0)) __PYX_ERR(0, 1486, __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_self = values[0];
    __pyx_v_error_code = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("on_close", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1486, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("nghttp2.BaseResponseHandler.on_close", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7nghttp2_19BaseResponseHandler_10on_close(__pyx_self, __pyx_v_self, __pyx_v_error_code);

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

static PyObject *__pyx_pf_7nghttp2_19BaseResponseHandler_10on_close(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_error_code) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("on_close", 0);

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":1493
 *             pass
 * 
 *         def on_push_promise(self, push_promise):             # <<<<<<<<<<<<<<
 * 
 *             '''Called when a push is promised. Default behavior is to
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_19BaseResponseHandler_13on_push_promise(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7nghttp2_19BaseResponseHandler_12on_push_promise[] = "Called when a push is promised. Default behavior is to\n            cancel the push. If application overrides this method,\n            it should call either accept_push or reject_push.\n\n            ";
static PyMethodDef __pyx_mdef_7nghttp2_19BaseResponseHandler_13on_push_promise = {"on_push_promise", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7nghttp2_19BaseResponseHandler_13on_push_promise, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7nghttp2_19BaseResponseHandler_12on_push_promise};
static PyObject *__pyx_pw_7nghttp2_19BaseResponseHandler_13on_push_promise(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_push_promise = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("on_push_promise (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_push_promise,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);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_push_promise)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("on_push_promise", 1, 2, 2, 1); __PYX_ERR(0, 1493, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "on_push_promise") < 0)) __PYX_ERR(0, 1493, __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_self = values[0];
    __pyx_v_push_promise = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("on_push_promise", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1493, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("nghttp2.BaseResponseHandler.on_push_promise", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7nghttp2_19BaseResponseHandler_12on_push_promise(__pyx_self, __pyx_v_self, __pyx_v_push_promise);

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

static PyObject *__pyx_pf_7nghttp2_19BaseResponseHandler_12on_push_promise(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_push_promise) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("on_push_promise", 0);

  /* "nghttp2.pyx":1500
 * 
 *             '''
 *             self.reject_push(push_promise)             # <<<<<<<<<<<<<<
 * 
 *         def reject_push(self, push_promise):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_reject_push); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1500, __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);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_push_promise) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_push_promise);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1500, __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;

  /* "nghttp2.pyx":1493
 *             pass
 * 
 *         def on_push_promise(self, push_promise):             # <<<<<<<<<<<<<<
 * 
 *             '''Called when a push is promised. Default behavior is to
 */

  /* 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_AddTraceback("nghttp2.BaseResponseHandler.on_push_promise", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":1502
 *             self.reject_push(push_promise)
 * 
 *         def reject_push(self, push_promise):             # <<<<<<<<<<<<<<
 * 
 *             '''Convenience method equivalent to calling accept_push
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_19BaseResponseHandler_15reject_push(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7nghttp2_19BaseResponseHandler_14reject_push[] = "Convenience method equivalent to calling accept_push\n            with a falsy value.\n\n            ";
static PyMethodDef __pyx_mdef_7nghttp2_19BaseResponseHandler_15reject_push = {"reject_push", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7nghttp2_19BaseResponseHandler_15reject_push, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7nghttp2_19BaseResponseHandler_14reject_push};
static PyObject *__pyx_pw_7nghttp2_19BaseResponseHandler_15reject_push(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_push_promise = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("reject_push (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_push_promise,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);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_push_promise)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("reject_push", 1, 2, 2, 1); __PYX_ERR(0, 1502, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "reject_push") < 0)) __PYX_ERR(0, 1502, __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_self = values[0];
    __pyx_v_push_promise = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("reject_push", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1502, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("nghttp2.BaseResponseHandler.reject_push", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7nghttp2_19BaseResponseHandler_14reject_push(__pyx_self, __pyx_v_self, __pyx_v_push_promise);

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

static PyObject *__pyx_pf_7nghttp2_19BaseResponseHandler_14reject_push(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_push_promise) {
  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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("reject_push", 0);

  /* "nghttp2.pyx":1508
 * 
 *             '''
 *             self.http2.push(push_promise, None)             # <<<<<<<<<<<<<<
 * 
 *         def accept_push(self, push_promise, handler=None):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_http2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1508, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_push); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1508, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  __pyx_t_4 = 0;
  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);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_push_promise, Py_None};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1508, __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[3] = {__pyx_t_2, __pyx_v_push_promise, Py_None};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1508, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1508, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_2) {
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); __pyx_t_2 = NULL;
    }
    __Pyx_INCREF(__pyx_v_push_promise);
    __Pyx_GIVEREF(__pyx_v_push_promise);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_push_promise);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, Py_None);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1508, __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;

  /* "nghttp2.pyx":1502
 *             self.reject_push(push_promise)
 * 
 *         def reject_push(self, push_promise):             # <<<<<<<<<<<<<<
 * 
 *             '''Convenience method equivalent to calling accept_push
 */

  /* 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_AddTraceback("nghttp2.BaseResponseHandler.reject_push", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":1510
 *             self.http2.push(push_promise, None)
 * 
 *         def accept_push(self, push_promise, handler=None):             # <<<<<<<<<<<<<<
 * 
 *             '''Accept a push_promise and provider a handler for the
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_19BaseResponseHandler_17accept_push(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7nghttp2_19BaseResponseHandler_16accept_push[] = "Accept a push_promise and provider a handler for the\n            new stream. If a falsy value is supplied for the handler,\n            the push is rejected.\n\n            ";
static PyMethodDef __pyx_mdef_7nghttp2_19BaseResponseHandler_17accept_push = {"accept_push", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7nghttp2_19BaseResponseHandler_17accept_push, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7nghttp2_19BaseResponseHandler_16accept_push};
static PyObject *__pyx_pw_7nghttp2_19BaseResponseHandler_17accept_push(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_push_promise = 0;
  PyObject *__pyx_v_handler = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("accept_push (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_push_promise,&__pyx_n_s_handler,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((PyObject *)((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_push_promise)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("accept_push", 0, 2, 3, 1); __PYX_ERR(0, 1510, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_handler);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "accept_push") < 0)) __PYX_ERR(0, 1510, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        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_self = values[0];
    __pyx_v_push_promise = values[1];
    __pyx_v_handler = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("accept_push", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1510, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("nghttp2.BaseResponseHandler.accept_push", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7nghttp2_19BaseResponseHandler_16accept_push(__pyx_self, __pyx_v_self, __pyx_v_push_promise, __pyx_v_handler);

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

static PyObject *__pyx_pf_7nghttp2_19BaseResponseHandler_16accept_push(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_push_promise, PyObject *__pyx_v_handler) {
  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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("accept_push", 0);

  /* "nghttp2.pyx":1517
 * 
 *             '''
 *             self.http2.push(push_promise, handler)             # <<<<<<<<<<<<<<
 * 
 *         def resume(self):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_http2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1517, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_push); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1517, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  __pyx_t_4 = 0;
  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);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_push_promise, __pyx_v_handler};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1517, __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[3] = {__pyx_t_2, __pyx_v_push_promise, __pyx_v_handler};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1517, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1517, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_2) {
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); __pyx_t_2 = NULL;
    }
    __Pyx_INCREF(__pyx_v_push_promise);
    __Pyx_GIVEREF(__pyx_v_push_promise);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_push_promise);
    __Pyx_INCREF(__pyx_v_handler);
    __Pyx_GIVEREF(__pyx_v_handler);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_handler);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1517, __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;

  /* "nghttp2.pyx":1510
 *             self.http2.push(push_promise, None)
 * 
 *         def accept_push(self, push_promise, handler=None):             # <<<<<<<<<<<<<<
 * 
 *             '''Accept a push_promise and provider a handler for the
 */

  /* 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_AddTraceback("nghttp2.BaseResponseHandler.accept_push", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":1519
 *             self.http2.push(push_promise, handler)
 * 
 *         def resume(self):             # <<<<<<<<<<<<<<
 *             self.http2.resume(self.stream_id)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_19BaseResponseHandler_19resume(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7nghttp2_19BaseResponseHandler_19resume = {"resume", (PyCFunction)__pyx_pw_7nghttp2_19BaseResponseHandler_19resume, METH_O, 0};
static PyObject *__pyx_pw_7nghttp2_19BaseResponseHandler_19resume(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("resume (wrapper)", 0);
  __pyx_r = __pyx_pf_7nghttp2_19BaseResponseHandler_18resume(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_7nghttp2_19BaseResponseHandler_18resume(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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("resume", 0);

  /* "nghttp2.pyx":1520
 * 
 *         def resume(self):
 *             self.http2.resume(self.stream_id)             # <<<<<<<<<<<<<<
 * 
 *     class _HTTP2ClientSession(asyncio.Protocol):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_http2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1520, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_resume); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1520, __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_self, __pyx_n_s_stream_id); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1520, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __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);
    }
  }
  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1520, __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;

  /* "nghttp2.pyx":1519
 *             self.http2.push(push_promise, handler)
 * 
 *         def resume(self):             # <<<<<<<<<<<<<<
 *             self.http2.resume(self.stream_id)
 * 
 */

  /* 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_AddTraceback("nghttp2.BaseResponseHandler.resume", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":1524
 *     class _HTTP2ClientSession(asyncio.Protocol):
 * 
 *         def __init__(self, client):             # <<<<<<<<<<<<<<
 *             asyncio.Protocol.__init__(self)
 *             self.http2 = None
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_19_HTTP2ClientSession_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7nghttp2_19_HTTP2ClientSession_1__init__ = {"__init__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7nghttp2_19_HTTP2ClientSession_1__init__, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7nghttp2_19_HTTP2ClientSession_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_client = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_client,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);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_client)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); __PYX_ERR(0, 1524, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 1524, __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_self = values[0];
    __pyx_v_client = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1524, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("nghttp2._HTTP2ClientSession.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7nghttp2_19_HTTP2ClientSession___init__(__pyx_self, __pyx_v_self, __pyx_v_client);

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

static PyObject *__pyx_pf_7nghttp2_19_HTTP2ClientSession___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_client) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "nghttp2.pyx":1525
 * 
 *         def __init__(self, client):
 *             asyncio.Protocol.__init__(self)             # <<<<<<<<<<<<<<
 *             self.http2 = None
 *             self.pending = []
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_asyncio); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1525, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_Protocol); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1525, __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_init); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1525, __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);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_self) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_self);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1525, __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;

  /* "nghttp2.pyx":1526
 *         def __init__(self, client):
 *             asyncio.Protocol.__init__(self)
 *             self.http2 = None             # <<<<<<<<<<<<<<
 *             self.pending = []
 *             self.client = client
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_http2, Py_None) < 0) __PYX_ERR(0, 1526, __pyx_L1_error)

  /* "nghttp2.pyx":1527
 *             asyncio.Protocol.__init__(self)
 *             self.http2 = None
 *             self.pending = []             # <<<<<<<<<<<<<<
 *             self.client = client
 * 
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1527, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_pending, __pyx_t_1) < 0) __PYX_ERR(0, 1527, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "nghttp2.pyx":1528
 *             self.http2 = None
 *             self.pending = []
 *             self.client = client             # <<<<<<<<<<<<<<
 * 
 *         def connection_made(self, transport):
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_client, __pyx_v_client) < 0) __PYX_ERR(0, 1528, __pyx_L1_error)

  /* "nghttp2.pyx":1524
 *     class _HTTP2ClientSession(asyncio.Protocol):
 * 
 *         def __init__(self, client):             # <<<<<<<<<<<<<<
 *             asyncio.Protocol.__init__(self)
 *             self.http2 = 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_AddTraceback("nghttp2._HTTP2ClientSession.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":1530
 *             self.client = client
 * 
 *         def connection_made(self, transport):             # <<<<<<<<<<<<<<
 *             address = transport.get_extra_info('peername')
 *             logging.info('connection_made, address:%s, port:%s', address[0], address[1])
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_19_HTTP2ClientSession_3connection_made(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7nghttp2_19_HTTP2ClientSession_3connection_made = {"connection_made", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7nghttp2_19_HTTP2ClientSession_3connection_made, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7nghttp2_19_HTTP2ClientSession_3connection_made(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_transport = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("connection_made (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_transport,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);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_transport)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("connection_made", 1, 2, 2, 1); __PYX_ERR(0, 1530, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "connection_made") < 0)) __PYX_ERR(0, 1530, __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_self = values[0];
    __pyx_v_transport = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("connection_made", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1530, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("nghttp2._HTTP2ClientSession.connection_made", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7nghttp2_19_HTTP2ClientSession_2connection_made(__pyx_self, __pyx_v_self, __pyx_v_transport);

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

static PyObject *__pyx_pf_7nghttp2_19_HTTP2ClientSession_2connection_made(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_transport) {
  PyObject *__pyx_v_address = NULL;
  PyObject *__pyx_v_sock = NULL;
  PyObject *__pyx_v_ssl_ctx = NULL;
  PyObject *__pyx_v_ssl_obj = NULL;
  PyObject *__pyx_v_protocol = NULL;
  PyObject *__pyx_v_send_pending = NULL;
  PyObject *__pyx_v_method = NULL;
  PyObject *__pyx_v_scheme = NULL;
  PyObject *__pyx_v_host = NULL;
  PyObject *__pyx_v_path = NULL;
  PyObject *__pyx_v_headers = NULL;
  PyObject *__pyx_v_body = NULL;
  PyObject *__pyx_v_handler = 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;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  int __pyx_t_9;
  int __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  PyObject *(*__pyx_t_12)(PyObject *);
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  PyObject *(*__pyx_t_17)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("connection_made", 0);

  /* "nghttp2.pyx":1531
 * 
 *         def connection_made(self, transport):
 *             address = transport.get_extra_info('peername')             # <<<<<<<<<<<<<<
 *             logging.info('connection_made, address:%s, port:%s', address[0], address[1])
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_transport, __pyx_n_s_get_extra_info); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1531, __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);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_n_s_peername) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_n_s_peername);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1531, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_address = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "nghttp2.pyx":1532
 *         def connection_made(self, transport):
 *             address = transport.get_extra_info('peername')
 *             logging.info('connection_made, address:%s, port:%s', address[0], address[1])             # <<<<<<<<<<<<<<
 * 
 *             self.transport = transport
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_logging); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1532, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_info); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1532, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_address, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1532, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_address, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1532, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(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[4] = {__pyx_t_5, __pyx_kp_s_connection_made_address_s_port_s, __pyx_t_2, __pyx_t_4};
    __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(0, 1532, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __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[4] = {__pyx_t_5, __pyx_kp_s_connection_made_address_s_port_s, __pyx_t_2, __pyx_t_4};
    __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(0, 1532, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 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(0, 1532, __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_INCREF(__pyx_kp_s_connection_made_address_s_port_s);
    __Pyx_GIVEREF(__pyx_kp_s_connection_made_address_s_port_s);
    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_kp_s_connection_made_address_s_port_s);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_6, __pyx_t_4);
    __pyx_t_2 = 0;
    __pyx_t_4 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1532, __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;

  /* "nghttp2.pyx":1534
 *             logging.info('connection_made, address:%s, port:%s', address[0], address[1])
 * 
 *             self.transport = transport             # <<<<<<<<<<<<<<
 *             sock = self.transport.get_extra_info('socket')
 *             sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_transport, __pyx_v_transport) < 0) __PYX_ERR(0, 1534, __pyx_L1_error)

  /* "nghttp2.pyx":1535
 * 
 *             self.transport = transport
 *             sock = self.transport.get_extra_info('socket')             # <<<<<<<<<<<<<<
 *             sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
 *             ssl_ctx = self.transport.get_extra_info('sslcontext')
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_transport); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1535, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_get_extra_info); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1535, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(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_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_3, __pyx_n_s_socket) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_n_s_socket);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1535, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_v_sock = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "nghttp2.pyx":1536
 *             self.transport = transport
 *             sock = self.transport.get_extra_info('socket')
 *             sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)             # <<<<<<<<<<<<<<
 *             ssl_ctx = self.transport.get_extra_info('sslcontext')
 *             if ssl_ctx:
 */
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_sock, __pyx_n_s_setsockopt); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1536, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_socket); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1536, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_IPPROTO_TCP); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1536, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_socket); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1536, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_TCP_NODELAY); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1536, __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 && likely(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[4] = {__pyx_t_3, __pyx_t_4, __pyx_t_2, __pyx_int_1};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1536, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __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[4] = {__pyx_t_3, __pyx_t_4, __pyx_t_2, __pyx_int_1};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1536, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1536, __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_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_6, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_6, __pyx_t_2);
    __Pyx_INCREF(__pyx_int_1);
    __Pyx_GIVEREF(__pyx_int_1);
    PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_6, __pyx_int_1);
    __pyx_t_4 = 0;
    __pyx_t_2 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1536, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "nghttp2.pyx":1537
 *             sock = self.transport.get_extra_info('socket')
 *             sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
 *             ssl_ctx = self.transport.get_extra_info('sslcontext')             # <<<<<<<<<<<<<<
 *             if ssl_ctx:
 *                 ssl_obj = self.transport.get_extra_info('ssl_object')
 */
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_transport); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1537, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_get_extra_info); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1537, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_1 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_7, __pyx_n_s_sslcontext) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_n_s_sslcontext);
  __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1537, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_ssl_ctx = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "nghttp2.pyx":1538
 *             sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
 *             ssl_ctx = self.transport.get_extra_info('sslcontext')
 *             if ssl_ctx:             # <<<<<<<<<<<<<<
 *                 ssl_obj = self.transport.get_extra_info('ssl_object')
 *                 protocol = negotiated_protocol(ssl_obj)
 */
  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_ssl_ctx); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 1538, __pyx_L1_error)
  if (__pyx_t_8) {

    /* "nghttp2.pyx":1539
 *             ssl_ctx = self.transport.get_extra_info('sslcontext')
 *             if ssl_ctx:
 *                 ssl_obj = self.transport.get_extra_info('ssl_object')             # <<<<<<<<<<<<<<
 *                 protocol = negotiated_protocol(ssl_obj)
 *                 if protocol is None or protocol.encode('utf-8') != \
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_transport); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1539, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_get_extra_info); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1539, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_5, __pyx_n_s_ssl_object) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_n_s_ssl_object);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1539, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_v_ssl_obj = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "nghttp2.pyx":1540
 *             if ssl_ctx:
 *                 ssl_obj = self.transport.get_extra_info('ssl_object')
 *                 protocol = negotiated_protocol(ssl_obj)             # <<<<<<<<<<<<<<
 *                 if protocol is None or protocol.encode('utf-8') != \
 *                    cnghttp2.NGHTTP2_PROTO_VERSION_ID:
 */
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_negotiated_protocol); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1540, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_5, __pyx_v_ssl_obj) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_ssl_obj);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1540, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_v_protocol = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "nghttp2.pyx":1541
 *                 ssl_obj = self.transport.get_extra_info('ssl_object')
 *                 protocol = negotiated_protocol(ssl_obj)
 *                 if protocol is None or protocol.encode('utf-8') != \             # <<<<<<<<<<<<<<
 *                    cnghttp2.NGHTTP2_PROTO_VERSION_ID:
 *                     self.transport.abort()
 */
    __pyx_t_9 = (__pyx_v_protocol == Py_None);
    __pyx_t_10 = (__pyx_t_9 != 0);
    if (!__pyx_t_10) {
    } else {
      __pyx_t_8 = __pyx_t_10;
      goto __pyx_L5_bool_binop_done;
    }
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_protocol, __pyx_n_s_encode); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1541, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_5, __pyx_kp_s_utf_8) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_kp_s_utf_8);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1541, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "nghttp2.pyx":1542
 *                 protocol = negotiated_protocol(ssl_obj)
 *                 if protocol is None or protocol.encode('utf-8') != \
 *                    cnghttp2.NGHTTP2_PROTO_VERSION_ID:             # <<<<<<<<<<<<<<
 *                     self.transport.abort()
 * 
 */
    __pyx_t_7 = __Pyx_PyObject_FromString(NGHTTP2_PROTO_VERSION_ID); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1542, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_10 = (__Pyx_PyBytes_Equals(__pyx_t_1, __pyx_t_7, Py_NE)); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 1541, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_8 = __pyx_t_10;
    __pyx_L5_bool_binop_done:;

    /* "nghttp2.pyx":1541
 *                 ssl_obj = self.transport.get_extra_info('ssl_object')
 *                 protocol = negotiated_protocol(ssl_obj)
 *                 if protocol is None or protocol.encode('utf-8') != \             # <<<<<<<<<<<<<<
 *                    cnghttp2.NGHTTP2_PROTO_VERSION_ID:
 *                     self.transport.abort()
 */
    if (__pyx_t_8) {

      /* "nghttp2.pyx":1543
 *                 if protocol is None or protocol.encode('utf-8') != \
 *                    cnghttp2.NGHTTP2_PROTO_VERSION_ID:
 *                     self.transport.abort()             # <<<<<<<<<<<<<<
 * 
 *             self.http2 = _HTTP2ClientSessionCore(self.transport)
 */
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_transport); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1543, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_abort); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1543, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_1)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_1);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
        }
      }
      __pyx_t_7 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1543, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "nghttp2.pyx":1541
 *                 ssl_obj = self.transport.get_extra_info('ssl_object')
 *                 protocol = negotiated_protocol(ssl_obj)
 *                 if protocol is None or protocol.encode('utf-8') != \             # <<<<<<<<<<<<<<
 *                    cnghttp2.NGHTTP2_PROTO_VERSION_ID:
 *                     self.transport.abort()
 */
    }

    /* "nghttp2.pyx":1538
 *             sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
 *             ssl_ctx = self.transport.get_extra_info('sslcontext')
 *             if ssl_ctx:             # <<<<<<<<<<<<<<
 *                 ssl_obj = self.transport.get_extra_info('ssl_object')
 *                 protocol = negotiated_protocol(ssl_obj)
 */
  }

  /* "nghttp2.pyx":1545
 *                     self.transport.abort()
 * 
 *             self.http2 = _HTTP2ClientSessionCore(self.transport)             # <<<<<<<<<<<<<<
 * 
 * 	    # Clear pending requests
 */
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_transport); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1545, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_5 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_7nghttp2__HTTP2ClientSessionCore), __pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1545, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_http2, __pyx_t_5) < 0) __PYX_ERR(0, 1545, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "nghttp2.pyx":1548
 * 
 * 	    # Clear pending requests
 *             send_pending = self.pending             # <<<<<<<<<<<<<<
 *             self.pending = []
 *             for method,scheme,host,path,headers,body,handler in send_pending:
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_pending); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1548, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_v_send_pending = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "nghttp2.pyx":1549
 * 	    # Clear pending requests
 *             send_pending = self.pending
 *             self.pending = []             # <<<<<<<<<<<<<<
 *             for method,scheme,host,path,headers,body,handler in send_pending:
 *                 self.send_request(method=method, scheme=scheme, host=host, path=path,\
 */
  __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1549, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_pending, __pyx_t_5) < 0) __PYX_ERR(0, 1549, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "nghttp2.pyx":1550
 *             send_pending = self.pending
 *             self.pending = []
 *             for method,scheme,host,path,headers,body,handler in send_pending:             # <<<<<<<<<<<<<<
 *                 self.send_request(method=method, scheme=scheme, host=host, path=path,\
 *                                   headers=headers, body=body, handler=handler)
 */
  if (likely(PyList_CheckExact(__pyx_v_send_pending)) || PyTuple_CheckExact(__pyx_v_send_pending)) {
    __pyx_t_5 = __pyx_v_send_pending; __Pyx_INCREF(__pyx_t_5); __pyx_t_11 = 0;
    __pyx_t_12 = NULL;
  } else {
    __pyx_t_11 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_v_send_pending); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1550, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_12 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1550, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_12)) {
      if (likely(PyList_CheckExact(__pyx_t_5))) {
        if (__pyx_t_11 >= PyList_GET_SIZE(__pyx_t_5)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_7 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_11); __Pyx_INCREF(__pyx_t_7); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 1550, __pyx_L1_error)
        #else
        __pyx_t_7 = PySequence_ITEM(__pyx_t_5, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1550, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        #endif
      } else {
        if (__pyx_t_11 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_11); __Pyx_INCREF(__pyx_t_7); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 1550, __pyx_L1_error)
        #else
        __pyx_t_7 = PySequence_ITEM(__pyx_t_5, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1550, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        #endif
      }
    } else {
      __pyx_t_7 = __pyx_t_12(__pyx_t_5);
      if (unlikely(!__pyx_t_7)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 1550, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_7);
    }
    if ((likely(PyTuple_CheckExact(__pyx_t_7))) || (PyList_CheckExact(__pyx_t_7))) {
      PyObject* sequence = __pyx_t_7;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 7)) {
        if (size > 7) __Pyx_RaiseTooManyValuesError(7);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1550, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); 
        __pyx_t_4 = PyTuple_GET_ITEM(sequence, 2); 
        __pyx_t_3 = PyTuple_GET_ITEM(sequence, 3); 
        __pyx_t_13 = PyTuple_GET_ITEM(sequence, 4); 
        __pyx_t_14 = PyTuple_GET_ITEM(sequence, 5); 
        __pyx_t_15 = PyTuple_GET_ITEM(sequence, 6); 
      } else {
        __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_2 = PyList_GET_ITEM(sequence, 1); 
        __pyx_t_4 = PyList_GET_ITEM(sequence, 2); 
        __pyx_t_3 = PyList_GET_ITEM(sequence, 3); 
        __pyx_t_13 = PyList_GET_ITEM(sequence, 4); 
        __pyx_t_14 = PyList_GET_ITEM(sequence, 5); 
        __pyx_t_15 = PyList_GET_ITEM(sequence, 6); 
      }
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_13);
      __Pyx_INCREF(__pyx_t_14);
      __Pyx_INCREF(__pyx_t_15);
      #else
      {
        Py_ssize_t i;
        PyObject** temps[7] = {&__pyx_t_1,&__pyx_t_2,&__pyx_t_4,&__pyx_t_3,&__pyx_t_13,&__pyx_t_14,&__pyx_t_15};
        for (i=0; i < 7; i++) {
          PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 1550, __pyx_L1_error)
          __Pyx_GOTREF(item);
          *(temps[i]) = item;
        }
      }
      #endif
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    } else {
      Py_ssize_t index = -1;
      PyObject** temps[7] = {&__pyx_t_1,&__pyx_t_2,&__pyx_t_4,&__pyx_t_3,&__pyx_t_13,&__pyx_t_14,&__pyx_t_15};
      __pyx_t_16 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 1550, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_16);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_17 = Py_TYPE(__pyx_t_16)->tp_iternext;
      for (index=0; index < 7; index++) {
        PyObject* item = __pyx_t_17(__pyx_t_16); if (unlikely(!item)) goto __pyx_L9_unpacking_failed;
        __Pyx_GOTREF(item);
        *(temps[index]) = item;
      }
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_17(__pyx_t_16), 7) < 0) __PYX_ERR(0, 1550, __pyx_L1_error)
      __pyx_t_17 = NULL;
      __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
      goto __pyx_L10_unpacking_done;
      __pyx_L9_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
      __pyx_t_17 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 1550, __pyx_L1_error)
      __pyx_L10_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_method, __pyx_t_1);
    __pyx_t_1 = 0;
    __Pyx_XDECREF_SET(__pyx_v_scheme, __pyx_t_2);
    __pyx_t_2 = 0;
    __Pyx_XDECREF_SET(__pyx_v_host, __pyx_t_4);
    __pyx_t_4 = 0;
    __Pyx_XDECREF_SET(__pyx_v_path, __pyx_t_3);
    __pyx_t_3 = 0;
    __Pyx_XDECREF_SET(__pyx_v_headers, __pyx_t_13);
    __pyx_t_13 = 0;
    __Pyx_XDECREF_SET(__pyx_v_body, __pyx_t_14);
    __pyx_t_14 = 0;
    __Pyx_XDECREF_SET(__pyx_v_handler, __pyx_t_15);
    __pyx_t_15 = 0;

    /* "nghttp2.pyx":1551
 *             self.pending = []
 *             for method,scheme,host,path,headers,body,handler in send_pending:
 *                 self.send_request(method=method, scheme=scheme, host=host, path=path,\             # <<<<<<<<<<<<<<
 *                                   headers=headers, body=body, handler=handler)
 *             self.http2.send_data()
 */
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_send_request); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1551, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_15 = __Pyx_PyDict_NewPresized(7); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1551, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    if (PyDict_SetItem(__pyx_t_15, __pyx_n_s_method_2, __pyx_v_method) < 0) __PYX_ERR(0, 1551, __pyx_L1_error)
    if (PyDict_SetItem(__pyx_t_15, __pyx_n_s_scheme_2, __pyx_v_scheme) < 0) __PYX_ERR(0, 1551, __pyx_L1_error)
    if (PyDict_SetItem(__pyx_t_15, __pyx_n_s_host, __pyx_v_host) < 0) __PYX_ERR(0, 1551, __pyx_L1_error)
    if (PyDict_SetItem(__pyx_t_15, __pyx_n_s_path_2, __pyx_v_path) < 0) __PYX_ERR(0, 1551, __pyx_L1_error)

    /* "nghttp2.pyx":1552
 *             for method,scheme,host,path,headers,body,handler in send_pending:
 *                 self.send_request(method=method, scheme=scheme, host=host, path=path,\
 *                                   headers=headers, body=body, handler=handler)             # <<<<<<<<<<<<<<
 *             self.http2.send_data()
 * 
 */
    if (PyDict_SetItem(__pyx_t_15, __pyx_n_s_headers, __pyx_v_headers) < 0) __PYX_ERR(0, 1551, __pyx_L1_error)
    if (PyDict_SetItem(__pyx_t_15, __pyx_n_s_body, __pyx_v_body) < 0) __PYX_ERR(0, 1551, __pyx_L1_error)
    if (PyDict_SetItem(__pyx_t_15, __pyx_n_s_handler, __pyx_v_handler) < 0) __PYX_ERR(0, 1551, __pyx_L1_error)

    /* "nghttp2.pyx":1551
 *             self.pending = []
 *             for method,scheme,host,path,headers,body,handler in send_pending:
 *                 self.send_request(method=method, scheme=scheme, host=host, path=path,\             # <<<<<<<<<<<<<<
 *                                   headers=headers, body=body, handler=handler)
 *             self.http2.send_data()
 */
    __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_empty_tuple, __pyx_t_15); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1551, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;

    /* "nghttp2.pyx":1550
 *             send_pending = self.pending
 *             self.pending = []
 *             for method,scheme,host,path,headers,body,handler in send_pending:             # <<<<<<<<<<<<<<
 *                 self.send_request(method=method, scheme=scheme, host=host, path=path,\
 *                                   headers=headers, body=body, handler=handler)
 */
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "nghttp2.pyx":1553
 *                 self.send_request(method=method, scheme=scheme, host=host, path=path,\
 *                                   headers=headers, body=body, handler=handler)
 *             self.http2.send_data()             # <<<<<<<<<<<<<<
 * 
 *         def connection_lost(self, exc):
 */
  __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_http2); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1553, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_send_data); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1553, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  __pyx_t_14 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_15))) {
    __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_15);
    if (likely(__pyx_t_14)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15);
      __Pyx_INCREF(__pyx_t_14);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_15, function);
    }
  }
  __pyx_t_5 = (__pyx_t_14) ? __Pyx_PyObject_CallOneArg(__pyx_t_15, __pyx_t_14) : __Pyx_PyObject_CallNoArg(__pyx_t_15);
  __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1553, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "nghttp2.pyx":1530
 *             self.client = client
 * 
 *         def connection_made(self, transport):             # <<<<<<<<<<<<<<
 *             address = transport.get_extra_info('peername')
 *             logging.info('connection_made, address:%s, port:%s', address[0], address[1])
 */

  /* 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_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_XDECREF(__pyx_t_16);
  __Pyx_AddTraceback("nghttp2._HTTP2ClientSession.connection_made", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_address);
  __Pyx_XDECREF(__pyx_v_sock);
  __Pyx_XDECREF(__pyx_v_ssl_ctx);
  __Pyx_XDECREF(__pyx_v_ssl_obj);
  __Pyx_XDECREF(__pyx_v_protocol);
  __Pyx_XDECREF(__pyx_v_send_pending);
  __Pyx_XDECREF(__pyx_v_method);
  __Pyx_XDECREF(__pyx_v_scheme);
  __Pyx_XDECREF(__pyx_v_host);
  __Pyx_XDECREF(__pyx_v_path);
  __Pyx_XDECREF(__pyx_v_headers);
  __Pyx_XDECREF(__pyx_v_body);
  __Pyx_XDECREF(__pyx_v_handler);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":1555
 *             self.http2.send_data()
 * 
 *         def connection_lost(self, exc):             # <<<<<<<<<<<<<<
 *             logging.info('connection_lost')
 *             if self.http2:
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_19_HTTP2ClientSession_5connection_lost(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7nghttp2_19_HTTP2ClientSession_5connection_lost = {"connection_lost", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7nghttp2_19_HTTP2ClientSession_5connection_lost, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7nghttp2_19_HTTP2ClientSession_5connection_lost(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  CYTHON_UNUSED PyObject *__pyx_v_exc = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("connection_lost (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_exc,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);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_exc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("connection_lost", 1, 2, 2, 1); __PYX_ERR(0, 1555, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "connection_lost") < 0)) __PYX_ERR(0, 1555, __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_self = values[0];
    __pyx_v_exc = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("connection_lost", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1555, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("nghttp2._HTTP2ClientSession.connection_lost", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7nghttp2_19_HTTP2ClientSession_4connection_lost(__pyx_self, __pyx_v_self, __pyx_v_exc);

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

static PyObject *__pyx_pf_7nghttp2_19_HTTP2ClientSession_4connection_lost(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_exc) {
  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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("connection_lost", 0);

  /* "nghttp2.pyx":1556
 * 
 *         def connection_lost(self, exc):
 *             logging.info('connection_lost')             # <<<<<<<<<<<<<<
 *             if self.http2:
 *                 self.http2 = None
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_logging); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1556, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_info); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1556, __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);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_n_s_connection_lost) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_n_s_connection_lost);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1556, __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;

  /* "nghttp2.pyx":1557
 *         def connection_lost(self, exc):
 *             logging.info('connection_lost')
 *             if self.http2:             # <<<<<<<<<<<<<<
 *                 self.http2 = None
 *             self.client.close()
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_http2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1557, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 1557, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_4) {

    /* "nghttp2.pyx":1558
 *             logging.info('connection_lost')
 *             if self.http2:
 *                 self.http2 = None             # <<<<<<<<<<<<<<
 *             self.client.close()
 * 
 */
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_http2, Py_None) < 0) __PYX_ERR(0, 1558, __pyx_L1_error)

    /* "nghttp2.pyx":1557
 *         def connection_lost(self, exc):
 *             logging.info('connection_lost')
 *             if self.http2:             # <<<<<<<<<<<<<<
 *                 self.http2 = None
 *             self.client.close()
 */
  }

  /* "nghttp2.pyx":1559
 *             if self.http2:
 *                 self.http2 = None
 *             self.client.close()             # <<<<<<<<<<<<<<
 * 
 *         def data_received(self, data):
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_client); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1559, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_close); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1559, __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);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1559, __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;

  /* "nghttp2.pyx":1555
 *             self.http2.send_data()
 * 
 *         def connection_lost(self, exc):             # <<<<<<<<<<<<<<
 *             logging.info('connection_lost')
 *             if self.http2:
 */

  /* 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_AddTraceback("nghttp2._HTTP2ClientSession.connection_lost", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":1561
 *             self.client.close()
 * 
 *         def data_received(self, data):             # <<<<<<<<<<<<<<
 *             try:
 *                 self.http2.data_received(data)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_19_HTTP2ClientSession_7data_received(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7nghttp2_19_HTTP2ClientSession_7data_received = {"data_received", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7nghttp2_19_HTTP2ClientSession_7data_received, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7nghttp2_19_HTTP2ClientSession_7data_received(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_data = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("data_received (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_data,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);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_data)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("data_received", 1, 2, 2, 1); __PYX_ERR(0, 1561, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "data_received") < 0)) __PYX_ERR(0, 1561, __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_self = values[0];
    __pyx_v_data = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("data_received", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1561, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("nghttp2._HTTP2ClientSession.data_received", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7nghttp2_19_HTTP2ClientSession_6data_received(__pyx_self, __pyx_v_self, __pyx_v_data);

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

static PyObject *__pyx_pf_7nghttp2_19_HTTP2ClientSession_6data_received(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_data) {
  CYTHON_UNUSED PyObject *__pyx_v_err = 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;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("data_received", 0);

  /* "nghttp2.pyx":1562
 * 
 *         def data_received(self, data):
 *             try:             # <<<<<<<<<<<<<<
 *                 self.http2.data_received(data)
 *             except Exception as err:
 */
  {
    __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:*/ {

      /* "nghttp2.pyx":1563
 *         def data_received(self, data):
 *             try:
 *                 self.http2.data_received(data)             # <<<<<<<<<<<<<<
 *             except Exception as err:
 *                 sys.stderr.write(traceback.format_exc())
 */
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_http2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1563, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_data_received); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1563, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_6);
      __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);
        }
      }
      __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_5, __pyx_v_data) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_data);
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1563, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "nghttp2.pyx":1562
 * 
 *         def data_received(self, data):
 *             try:             # <<<<<<<<<<<<<<
 *                 self.http2.data_received(data)
 *             except Exception as err:
 */
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L8_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "nghttp2.pyx":1564
 *             try:
 *                 self.http2.data_received(data)
 *             except Exception as err:             # <<<<<<<<<<<<<<
 *                 sys.stderr.write(traceback.format_exc())
 *                 self.transport.close()
 */
    __pyx_t_7 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
    if (__pyx_t_7) {
      __Pyx_AddTraceback("nghttp2._HTTP2ClientSession.data_received", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_6, &__pyx_t_5) < 0) __PYX_ERR(0, 1564, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      __pyx_v_err = __pyx_t_6;

      /* "nghttp2.pyx":1565
 *                 self.http2.data_received(data)
 *             except Exception as err:
 *                 sys.stderr.write(traceback.format_exc())             # <<<<<<<<<<<<<<
 *                 self.transport.close()
 *                 return
 */
      __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_sys); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1565, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_stderr); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1565, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_write); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1565, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_traceback); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1565, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_format_exc); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1565, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __pyx_t_11 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_12))) {
        __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_12);
        if (likely(__pyx_t_11)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
          __Pyx_INCREF(__pyx_t_11);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_12, function);
        }
      }
      __pyx_t_10 = (__pyx_t_11) ? __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_t_11) : __Pyx_PyObject_CallNoArg(__pyx_t_12);
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1565, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_t_12 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) {
        __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_9);
        if (likely(__pyx_t_12)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
          __Pyx_INCREF(__pyx_t_12);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_9, function);
        }
      }
      __pyx_t_8 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_12, __pyx_t_10) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_10);
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1565, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

      /* "nghttp2.pyx":1566
 *             except Exception as err:
 *                 sys.stderr.write(traceback.format_exc())
 *                 self.transport.close()             # <<<<<<<<<<<<<<
 *                 return
 * 
 */
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_transport); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1566, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_close); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1566, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_9 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) {
        __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_10);
        if (likely(__pyx_t_9)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
          __Pyx_INCREF(__pyx_t_9);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_10, function);
        }
      }
      __pyx_t_8 = (__pyx_t_9) ? __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_9) : __Pyx_PyObject_CallNoArg(__pyx_t_10);
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1566, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

      /* "nghttp2.pyx":1567
 *                 sys.stderr.write(traceback.format_exc())
 *                 self.transport.close()
 *                 return             # <<<<<<<<<<<<<<
 * 
 *         def resume_writing(self):
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      __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;
      goto __pyx_L6_except_return;
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "nghttp2.pyx":1562
 * 
 *         def data_received(self, data):
 *             try:             # <<<<<<<<<<<<<<
 *                 self.http2.data_received(data)
 *             except Exception as err:
 */
    __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_L6_except_return:;
    __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_L8_try_end:;
  }

  /* "nghttp2.pyx":1561
 *             self.client.close()
 * 
 *         def data_received(self, data):             # <<<<<<<<<<<<<<
 *             try:
 *                 self.http2.data_received(data)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("nghttp2._HTTP2ClientSession.data_received", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_err);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":1569
 *                 return
 * 
 *         def resume_writing(self):             # <<<<<<<<<<<<<<
 *             try:
 *                 self.http2.send_data()
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_19_HTTP2ClientSession_9resume_writing(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7nghttp2_19_HTTP2ClientSession_9resume_writing = {"resume_writing", (PyCFunction)__pyx_pw_7nghttp2_19_HTTP2ClientSession_9resume_writing, METH_O, 0};
static PyObject *__pyx_pw_7nghttp2_19_HTTP2ClientSession_9resume_writing(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("resume_writing (wrapper)", 0);
  __pyx_r = __pyx_pf_7nghttp2_19_HTTP2ClientSession_8resume_writing(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_7nghttp2_19_HTTP2ClientSession_8resume_writing(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *__pyx_v_err = 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;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("resume_writing", 0);

  /* "nghttp2.pyx":1570
 * 
 *         def resume_writing(self):
 *             try:             # <<<<<<<<<<<<<<
 *                 self.http2.send_data()
 *             except Exception as err:
 */
  {
    __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:*/ {

      /* "nghttp2.pyx":1571
 *         def resume_writing(self):
 *             try:
 *                 self.http2.send_data()             # <<<<<<<<<<<<<<
 *             except Exception as err:
 *                 sys.stderr.write(traceback.format_exc())
 */
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_http2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1571, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_send_data); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1571, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_6);
      __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);
        }
      }
      __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_6);
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1571, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "nghttp2.pyx":1570
 * 
 *         def resume_writing(self):
 *             try:             # <<<<<<<<<<<<<<
 *                 self.http2.send_data()
 *             except Exception as err:
 */
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L8_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "nghttp2.pyx":1572
 *             try:
 *                 self.http2.send_data()
 *             except Exception as err:             # <<<<<<<<<<<<<<
 *                 sys.stderr.write(traceback.format_exc())
 *                 self.transport.close()
 */
    __pyx_t_7 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
    if (__pyx_t_7) {
      __Pyx_AddTraceback("nghttp2._HTTP2ClientSession.resume_writing", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_6, &__pyx_t_5) < 0) __PYX_ERR(0, 1572, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      __pyx_v_err = __pyx_t_6;

      /* "nghttp2.pyx":1573
 *                 self.http2.send_data()
 *             except Exception as err:
 *                 sys.stderr.write(traceback.format_exc())             # <<<<<<<<<<<<<<
 *                 self.transport.close()
 *                 return
 */
      __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_sys); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1573, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_stderr); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1573, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_write); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1573, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_traceback); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1573, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_format_exc); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1573, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __pyx_t_11 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_12))) {
        __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_12);
        if (likely(__pyx_t_11)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
          __Pyx_INCREF(__pyx_t_11);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_12, function);
        }
      }
      __pyx_t_10 = (__pyx_t_11) ? __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_t_11) : __Pyx_PyObject_CallNoArg(__pyx_t_12);
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1573, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_t_12 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) {
        __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_9);
        if (likely(__pyx_t_12)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
          __Pyx_INCREF(__pyx_t_12);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_9, function);
        }
      }
      __pyx_t_8 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_12, __pyx_t_10) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_10);
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1573, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

      /* "nghttp2.pyx":1574
 *             except Exception as err:
 *                 sys.stderr.write(traceback.format_exc())
 *                 self.transport.close()             # <<<<<<<<<<<<<<
 *                 return
 * 
 */
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_transport); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1574, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_close); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1574, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_9 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) {
        __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_10);
        if (likely(__pyx_t_9)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
          __Pyx_INCREF(__pyx_t_9);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_10, function);
        }
      }
      __pyx_t_8 = (__pyx_t_9) ? __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_9) : __Pyx_PyObject_CallNoArg(__pyx_t_10);
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1574, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

      /* "nghttp2.pyx":1575
 *                 sys.stderr.write(traceback.format_exc())
 *                 self.transport.close()
 *                 return             # <<<<<<<<<<<<<<
 * 
 *         def send_request(self, method, scheme, host, path, headers, body, handler):
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      __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;
      goto __pyx_L6_except_return;
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "nghttp2.pyx":1570
 * 
 *         def resume_writing(self):
 *             try:             # <<<<<<<<<<<<<<
 *                 self.http2.send_data()
 *             except Exception as err:
 */
    __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_L6_except_return:;
    __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_L8_try_end:;
  }

  /* "nghttp2.pyx":1569
 *                 return
 * 
 *         def resume_writing(self):             # <<<<<<<<<<<<<<
 *             try:
 *                 self.http2.send_data()
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("nghttp2._HTTP2ClientSession.resume_writing", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_err);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":1577
 *                 return
 * 
 *         def send_request(self, method, scheme, host, path, headers, body, handler):             # <<<<<<<<<<<<<<
 *             try:
 * 		# Waiting until connection established
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_19_HTTP2ClientSession_11send_request(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7nghttp2_19_HTTP2ClientSession_11send_request = {"send_request", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7nghttp2_19_HTTP2ClientSession_11send_request, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7nghttp2_19_HTTP2ClientSession_11send_request(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_method = 0;
  PyObject *__pyx_v_scheme = 0;
  PyObject *__pyx_v_host = 0;
  PyObject *__pyx_v_path = 0;
  PyObject *__pyx_v_headers = 0;
  PyObject *__pyx_v_body = 0;
  PyObject *__pyx_v_handler = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("send_request (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_method_2,&__pyx_n_s_scheme_2,&__pyx_n_s_host,&__pyx_n_s_path_2,&__pyx_n_s_headers,&__pyx_n_s_body,&__pyx_n_s_handler,0};
    PyObject* values[8] = {0,0,0,0,0,0,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  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_method_2)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("send_request", 1, 8, 8, 1); __PYX_ERR(0, 1577, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_scheme_2)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("send_request", 1, 8, 8, 2); __PYX_ERR(0, 1577, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_host)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("send_request", 1, 8, 8, 3); __PYX_ERR(0, 1577, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_path_2)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("send_request", 1, 8, 8, 4); __PYX_ERR(0, 1577, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_headers)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("send_request", 1, 8, 8, 5); __PYX_ERR(0, 1577, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_body)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("send_request", 1, 8, 8, 6); __PYX_ERR(0, 1577, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_handler)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("send_request", 1, 8, 8, 7); __PYX_ERR(0, 1577, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "send_request") < 0)) __PYX_ERR(0, 1577, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 8) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
      values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
      values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
    }
    __pyx_v_self = values[0];
    __pyx_v_method = values[1];
    __pyx_v_scheme = values[2];
    __pyx_v_host = values[3];
    __pyx_v_path = values[4];
    __pyx_v_headers = values[5];
    __pyx_v_body = values[6];
    __pyx_v_handler = values[7];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("send_request", 1, 8, 8, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1577, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("nghttp2._HTTP2ClientSession.send_request", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7nghttp2_19_HTTP2ClientSession_10send_request(__pyx_self, __pyx_v_self, __pyx_v_method, __pyx_v_scheme, __pyx_v_host, __pyx_v_path, __pyx_v_headers, __pyx_v_body, __pyx_v_handler);

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

static PyObject *__pyx_pf_7nghttp2_19_HTTP2ClientSession_10send_request(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_method, PyObject *__pyx_v_scheme, PyObject *__pyx_v_host, PyObject *__pyx_v_path, PyObject *__pyx_v_headers, PyObject *__pyx_v_body, PyObject *__pyx_v_handler) {
  CYTHON_UNUSED PyObject *__pyx_v_err = 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;
  int __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("send_request", 0);

  /* "nghttp2.pyx":1578
 * 
 *         def send_request(self, method, scheme, host, path, headers, body, handler):
 *             try:             # <<<<<<<<<<<<<<
 * 		# Waiting until connection established
 *                 if not self.http2:
 */
  {
    __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:*/ {

      /* "nghttp2.pyx":1580
 *             try:
 * 		# Waiting until connection established
 *                 if not self.http2:             # <<<<<<<<<<<<<<
 *                     self.pending.append([method, scheme, host, path, headers, body, handler])
 *                     return
 */
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_http2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1580, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 1580, __pyx_L3_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_6 = ((!__pyx_t_5) != 0);
      if (__pyx_t_6) {

        /* "nghttp2.pyx":1581
 * 		# Waiting until connection established
 *                 if not self.http2:
 *                     self.pending.append([method, scheme, host, path, headers, body, handler])             # <<<<<<<<<<<<<<
 *                     return
 * 
 */
        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_pending); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1581, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_7 = PyList_New(7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1581, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_INCREF(__pyx_v_method);
        __Pyx_GIVEREF(__pyx_v_method);
        PyList_SET_ITEM(__pyx_t_7, 0, __pyx_v_method);
        __Pyx_INCREF(__pyx_v_scheme);
        __Pyx_GIVEREF(__pyx_v_scheme);
        PyList_SET_ITEM(__pyx_t_7, 1, __pyx_v_scheme);
        __Pyx_INCREF(__pyx_v_host);
        __Pyx_GIVEREF(__pyx_v_host);
        PyList_SET_ITEM(__pyx_t_7, 2, __pyx_v_host);
        __Pyx_INCREF(__pyx_v_path);
        __Pyx_GIVEREF(__pyx_v_path);
        PyList_SET_ITEM(__pyx_t_7, 3, __pyx_v_path);
        __Pyx_INCREF(__pyx_v_headers);
        __Pyx_GIVEREF(__pyx_v_headers);
        PyList_SET_ITEM(__pyx_t_7, 4, __pyx_v_headers);
        __Pyx_INCREF(__pyx_v_body);
        __Pyx_GIVEREF(__pyx_v_body);
        PyList_SET_ITEM(__pyx_t_7, 5, __pyx_v_body);
        __Pyx_INCREF(__pyx_v_handler);
        __Pyx_GIVEREF(__pyx_v_handler);
        PyList_SET_ITEM(__pyx_t_7, 6, __pyx_v_handler);
        __pyx_t_8 = __Pyx_PyObject_Append(__pyx_t_4, __pyx_t_7); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 1581, __pyx_L3_error)
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

        /* "nghttp2.pyx":1582
 *                 if not self.http2:
 *                     self.pending.append([method, scheme, host, path, headers, body, handler])
 *                     return             # <<<<<<<<<<<<<<
 * 
 *                 self.http2.send_request(method=method, scheme=scheme, host=host, path=path,\
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_r = Py_None; __Pyx_INCREF(Py_None);
        goto __pyx_L7_try_return;

        /* "nghttp2.pyx":1580
 *             try:
 * 		# Waiting until connection established
 *                 if not self.http2:             # <<<<<<<<<<<<<<
 *                     self.pending.append([method, scheme, host, path, headers, body, handler])
 *                     return
 */
      }

      /* "nghttp2.pyx":1584
 *                     return
 * 
 *                 self.http2.send_request(method=method, scheme=scheme, host=host, path=path,\             # <<<<<<<<<<<<<<
 *                                         headers=headers, body=body, handler=handler)
 *                 self.http2.send_data()
 */
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_http2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1584, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_send_request); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1584, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = __Pyx_PyDict_NewPresized(7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1584, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_7);
      if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_method_2, __pyx_v_method) < 0) __PYX_ERR(0, 1584, __pyx_L3_error)
      if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_scheme_2, __pyx_v_scheme) < 0) __PYX_ERR(0, 1584, __pyx_L3_error)
      if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_host, __pyx_v_host) < 0) __PYX_ERR(0, 1584, __pyx_L3_error)
      if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_path_2, __pyx_v_path) < 0) __PYX_ERR(0, 1584, __pyx_L3_error)

      /* "nghttp2.pyx":1585
 * 
 *                 self.http2.send_request(method=method, scheme=scheme, host=host, path=path,\
 *                                         headers=headers, body=body, handler=handler)             # <<<<<<<<<<<<<<
 *                 self.http2.send_data()
 *             except Exception as err:
 */
      if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_headers, __pyx_v_headers) < 0) __PYX_ERR(0, 1584, __pyx_L3_error)
      if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_body, __pyx_v_body) < 0) __PYX_ERR(0, 1584, __pyx_L3_error)
      if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_handler, __pyx_v_handler) < 0) __PYX_ERR(0, 1584, __pyx_L3_error)

      /* "nghttp2.pyx":1584
 *                     return
 * 
 *                 self.http2.send_request(method=method, scheme=scheme, host=host, path=path,\             # <<<<<<<<<<<<<<
 *                                         headers=headers, body=body, handler=handler)
 *                 self.http2.send_data()
 */
      __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_empty_tuple, __pyx_t_7); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1584, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

      /* "nghttp2.pyx":1586
 *                 self.http2.send_request(method=method, scheme=scheme, host=host, path=path,\
 *                                         headers=headers, body=body, handler=handler)
 *                 self.http2.send_data()             # <<<<<<<<<<<<<<
 *             except Exception as err:
 *                 sys.stderr.write(traceback.format_exc())
 */
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_http2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1586, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_send_data); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1586, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_7)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_7);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
        }
      }
      __pyx_t_9 = (__pyx_t_7) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_7) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1586, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

      /* "nghttp2.pyx":1578
 * 
 *         def send_request(self, method, scheme, host, path, headers, body, handler):
 *             try:             # <<<<<<<<<<<<<<
 * 		# Waiting until connection established
 *                 if not self.http2:
 */
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L8_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "nghttp2.pyx":1587
 *                                         headers=headers, body=body, handler=handler)
 *                 self.http2.send_data()
 *             except Exception as err:             # <<<<<<<<<<<<<<
 *                 sys.stderr.write(traceback.format_exc())
 *                 self.transport.close()
 */
    __pyx_t_10 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
    if (__pyx_t_10) {
      __Pyx_AddTraceback("nghttp2._HTTP2ClientSession.send_request", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_9, &__pyx_t_4, &__pyx_t_7) < 0) __PYX_ERR(0, 1587, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_4);
      __pyx_v_err = __pyx_t_4;

      /* "nghttp2.pyx":1588
 *                 self.http2.send_data()
 *             except Exception as err:
 *                 sys.stderr.write(traceback.format_exc())             # <<<<<<<<<<<<<<
 *                 self.transport.close()
 *                 return
 */
      __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_sys); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1588, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_12);
      __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_stderr); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1588, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_write); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1588, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_n_s_traceback); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1588, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_14);
      __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_format_exc); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1588, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_15);
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      __pyx_t_14 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_15))) {
        __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_15);
        if (likely(__pyx_t_14)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15);
          __Pyx_INCREF(__pyx_t_14);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_15, function);
        }
      }
      __pyx_t_13 = (__pyx_t_14) ? __Pyx_PyObject_CallOneArg(__pyx_t_15, __pyx_t_14) : __Pyx_PyObject_CallNoArg(__pyx_t_15);
      __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
      if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1588, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      __pyx_t_15 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_12))) {
        __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_12);
        if (likely(__pyx_t_15)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
          __Pyx_INCREF(__pyx_t_15);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_12, function);
        }
      }
      __pyx_t_11 = (__pyx_t_15) ? __Pyx_PyObject_Call2Args(__pyx_t_12, __pyx_t_15, __pyx_t_13) : __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_t_13);
      __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1588, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

      /* "nghttp2.pyx":1589
 *             except Exception as err:
 *                 sys.stderr.write(traceback.format_exc())
 *                 self.transport.close()             # <<<<<<<<<<<<<<
 *                 return
 * 
 */
      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_transport); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1589, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_12);
      __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_close); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1589, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_t_12 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_13))) {
        __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_13);
        if (likely(__pyx_t_12)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13);
          __Pyx_INCREF(__pyx_t_12);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_13, function);
        }
      }
      __pyx_t_11 = (__pyx_t_12) ? __Pyx_PyObject_CallOneArg(__pyx_t_13, __pyx_t_12) : __Pyx_PyObject_CallNoArg(__pyx_t_13);
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1589, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

      /* "nghttp2.pyx":1590
 *                 sys.stderr.write(traceback.format_exc())
 *                 self.transport.close()
 *                 return             # <<<<<<<<<<<<<<
 * 
 *         def close(self):
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      goto __pyx_L6_except_return;
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "nghttp2.pyx":1578
 * 
 *         def send_request(self, method, scheme, host, path, headers, body, handler):
 *             try:             # <<<<<<<<<<<<<<
 * 		# Waiting until connection established
 *                 if not self.http2:
 */
    __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_L7_try_return:;
    __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_L6_except_return:;
    __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_L8_try_end:;
  }

  /* "nghttp2.pyx":1577
 *                 return
 * 
 *         def send_request(self, method, scheme, host, path, headers, body, handler):             # <<<<<<<<<<<<<<
 *             try:
 * 		# Waiting until connection established
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_AddTraceback("nghttp2._HTTP2ClientSession.send_request", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_err);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":1592
 *                 return
 * 
 *         def close(self):             # <<<<<<<<<<<<<<
 *             if self.http2:
 *                 self.http2.close()
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_19_HTTP2ClientSession_13close(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7nghttp2_19_HTTP2ClientSession_13close = {"close", (PyCFunction)__pyx_pw_7nghttp2_19_HTTP2ClientSession_13close, METH_O, 0};
static PyObject *__pyx_pw_7nghttp2_19_HTTP2ClientSession_13close(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("close (wrapper)", 0);
  __pyx_r = __pyx_pf_7nghttp2_19_HTTP2ClientSession_12close(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_7nghttp2_19_HTTP2ClientSession_12close(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("close", 0);

  /* "nghttp2.pyx":1593
 * 
 *         def close(self):
 *             if self.http2:             # <<<<<<<<<<<<<<
 *                 self.http2.close()
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_http2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1593, __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(0, 1593, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "nghttp2.pyx":1594
 *         def close(self):
 *             if self.http2:
 *                 self.http2.close()             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_http2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1594, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_close); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1594, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1594, __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;

    /* "nghttp2.pyx":1593
 * 
 *         def close(self):
 *             if self.http2:             # <<<<<<<<<<<<<<
 *                 self.http2.close()
 * 
 */
  }

  /* "nghttp2.pyx":1592
 *                 return
 * 
 *         def close(self):             # <<<<<<<<<<<<<<
 *             if self.http2:
 *                 self.http2.close()
 */

  /* 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_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("nghttp2._HTTP2ClientSession.close", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":1604
 * 
 *         '''
 *         def __init__(self, address, loop=None, ssl=None):             # <<<<<<<<<<<<<<
 * 
 *             '''address is a tuple of the connect address and port (e.g.,
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_11HTTP2Client_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7nghttp2_11HTTP2Client___init__[] = "address is a tuple of the connect address and port (e.g.,\n            ('127.0.0.1', 8080)). The ssl can be ssl.SSLContext instance.\n            If it is not None, the resulting client is SSL/TLS capable.\n            ";
static PyMethodDef __pyx_mdef_7nghttp2_11HTTP2Client_1__init__ = {"__init__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7nghttp2_11HTTP2Client_1__init__, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7nghttp2_11HTTP2Client___init__};
static PyObject *__pyx_pw_7nghttp2_11HTTP2Client_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_address = 0;
  PyObject *__pyx_v_loop = 0;
  PyObject *__pyx_v_ssl = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_address,&__pyx_n_s_loop,&__pyx_n_s_ssl,0};
    PyObject* values[4] = {0,0,0,0};
    values[2] = ((PyObject *)((PyObject *)Py_None));
    values[3] = ((PyObject *)((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);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_address)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 4, 1); __PYX_ERR(0, 1604, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_loop);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ssl);
          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(0, 1604, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        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_self = values[0];
    __pyx_v_address = values[1];
    __pyx_v_loop = values[2];
    __pyx_v_ssl = 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(0, 1604, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("nghttp2.HTTP2Client.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7nghttp2_11HTTP2Client___init__(__pyx_self, __pyx_v_self, __pyx_v_address, __pyx_v_loop, __pyx_v_ssl);

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

/* "nghttp2.pyx":1613
 *             self.address = address
 *             self.session = _HTTP2ClientSession(self)
 *             def session_factory():             # <<<<<<<<<<<<<<
 *                 return self.session
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_11HTTP2Client_8__init___1session_factory(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyMethodDef __pyx_mdef_7nghttp2_11HTTP2Client_8__init___1session_factory = {"session_factory", (PyCFunction)__pyx_pw_7nghttp2_11HTTP2Client_8__init___1session_factory, METH_NOARGS, 0};
static PyObject *__pyx_pw_7nghttp2_11HTTP2Client_8__init___1session_factory(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("session_factory (wrapper)", 0);
  __pyx_r = __pyx_pf_7nghttp2_11HTTP2Client_8__init___session_factory(__pyx_self);

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

static PyObject *__pyx_pf_7nghttp2_11HTTP2Client_8__init___session_factory(PyObject *__pyx_self) {
  struct __pyx_obj_7nghttp2___pyx_scope_struct_1___init__ *__pyx_cur_scope;
  struct __pyx_obj_7nghttp2___pyx_scope_struct_1___init__ *__pyx_outer_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("session_factory", 0);
  __pyx_outer_scope = (struct __pyx_obj_7nghttp2___pyx_scope_struct_1___init__ *) __Pyx_CyFunction_GetClosure(__pyx_self);
  __pyx_cur_scope = __pyx_outer_scope;

  /* "nghttp2.pyx":1614
 *             self.session = _HTTP2ClientSession(self)
 *             def session_factory():
 *                 return self.session             # <<<<<<<<<<<<<<
 * 
 *             if ssl:
 */
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 1614, __pyx_L1_error) }
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_session); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1614, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "nghttp2.pyx":1613
 *             self.address = address
 *             self.session = _HTTP2ClientSession(self)
 *             def session_factory():             # <<<<<<<<<<<<<<
 *                 return self.session
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("nghttp2.HTTP2Client.__init__.session_factory", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":1604
 * 
 *         '''
 *         def __init__(self, address, loop=None, ssl=None):             # <<<<<<<<<<<<<<
 * 
 *             '''address is a tuple of the connect address and port (e.g.,
 */

static PyObject *__pyx_pf_7nghttp2_11HTTP2Client___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_address, PyObject *__pyx_v_loop, PyObject *__pyx_v_ssl) {
  struct __pyx_obj_7nghttp2___pyx_scope_struct_1___init__ *__pyx_cur_scope;
  PyObject *__pyx_v_session_factory = 0;
  PyObject *__pyx_v_coro = NULL;
  CYTHON_UNUSED PyObject *__pyx_v__ = 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 *);
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);
  __pyx_cur_scope = (struct __pyx_obj_7nghttp2___pyx_scope_struct_1___init__ *)__pyx_tp_new_7nghttp2___pyx_scope_struct_1___init__(__pyx_ptype_7nghttp2___pyx_scope_struct_1___init__, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_7nghttp2___pyx_scope_struct_1___init__ *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 1604, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_self);

  /* "nghttp2.pyx":1611
 *             '''
 * 
 *             self.address = address             # <<<<<<<<<<<<<<
 *             self.session = _HTTP2ClientSession(self)
 *             def session_factory():
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_address, __pyx_v_address) < 0) __PYX_ERR(0, 1611, __pyx_L1_error)

  /* "nghttp2.pyx":1612
 * 
 *             self.address = address
 *             self.session = _HTTP2ClientSession(self)             # <<<<<<<<<<<<<<
 *             def session_factory():
 *                 return self.session
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_HTTP2ClientSession); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1612, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(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_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_cur_scope->__pyx_v_self) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_cur_scope->__pyx_v_self);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1612, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_session, __pyx_t_1) < 0) __PYX_ERR(0, 1612, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "nghttp2.pyx":1613
 *             self.address = address
 *             self.session = _HTTP2ClientSession(self)
 *             def session_factory():             # <<<<<<<<<<<<<<
 *                 return self.session
 * 
 */
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7nghttp2_11HTTP2Client_8__init___1session_factory, 0, __pyx_n_s_HTTP2Client___init___locals_sess, ((PyObject*)__pyx_cur_scope), __pyx_n_s_nghttp2, __pyx_d, ((PyObject *)__pyx_codeobj__21)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1613, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_session_factory = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "nghttp2.pyx":1616
 *                 return self.session
 * 
 *             if ssl:             # <<<<<<<<<<<<<<
 *                 set_application_protocol(ssl)
 * 
 */
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_ssl); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 1616, __pyx_L1_error)
  if (__pyx_t_4) {

    /* "nghttp2.pyx":1617
 * 
 *             if ssl:
 *                 set_application_protocol(ssl)             # <<<<<<<<<<<<<<
 * 
 *             self.loop = loop
 */
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_set_application_protocol); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1617, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(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_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_ssl) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_ssl);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1617, __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;

    /* "nghttp2.pyx":1616
 *                 return self.session
 * 
 *             if ssl:             # <<<<<<<<<<<<<<
 *                 set_application_protocol(ssl)
 * 
 */
  }

  /* "nghttp2.pyx":1619
 *                 set_application_protocol(ssl)
 * 
 *             self.loop = loop             # <<<<<<<<<<<<<<
 *             if not self.loop:
 *                 self.loop = asyncio.get_event_loop()
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_loop, __pyx_v_loop) < 0) __PYX_ERR(0, 1619, __pyx_L1_error)

  /* "nghttp2.pyx":1620
 * 
 *             self.loop = loop
 *             if not self.loop:             # <<<<<<<<<<<<<<
 *                 self.loop = asyncio.get_event_loop()
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_loop); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1620, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 1620, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_5 = ((!__pyx_t_4) != 0);
  if (__pyx_t_5) {

    /* "nghttp2.pyx":1621
 *             self.loop = loop
 *             if not self.loop:
 *                 self.loop = asyncio.get_event_loop()             # <<<<<<<<<<<<<<
 * 
 *             coro = self.loop.create_connection(session_factory,
 */
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_asyncio); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1621, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_get_event_loop); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1621, __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);
      }
    }
    __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1621, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__Pyx_PyObject_SetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_loop, __pyx_t_1) < 0) __PYX_ERR(0, 1621, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "nghttp2.pyx":1620
 * 
 *             self.loop = loop
 *             if not self.loop:             # <<<<<<<<<<<<<<
 *                 self.loop = asyncio.get_event_loop()
 * 
 */
  }

  /* "nghttp2.pyx":1623
 *                 self.loop = asyncio.get_event_loop()
 * 
 *             coro = self.loop.create_connection(session_factory,             # <<<<<<<<<<<<<<
 *                                            host=address[0], port=address[1],
 *                                            ssl=ssl)
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_loop); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1623, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_create_connection); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1623, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1623, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_session_factory);
  __Pyx_GIVEREF(__pyx_v_session_factory);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_session_factory);

  /* "nghttp2.pyx":1624
 * 
 *             coro = self.loop.create_connection(session_factory,
 *                                            host=address[0], port=address[1],             # <<<<<<<<<<<<<<
 *                                            ssl=ssl)
 * 
 */
  __pyx_t_2 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1624, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_address, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1624, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_host, __pyx_t_6) < 0) __PYX_ERR(0, 1624, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_address, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1624, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_port, __pyx_t_6) < 0) __PYX_ERR(0, 1624, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "nghttp2.pyx":1625
 *             coro = self.loop.create_connection(session_factory,
 *                                            host=address[0], port=address[1],
 *                                            ssl=ssl)             # <<<<<<<<<<<<<<
 * 
 *             if ssl:
 */
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_ssl, __pyx_v_ssl) < 0) __PYX_ERR(0, 1624, __pyx_L1_error)

  /* "nghttp2.pyx":1623
 *                 self.loop = asyncio.get_event_loop()
 * 
 *             coro = self.loop.create_connection(session_factory,             # <<<<<<<<<<<<<<
 *                                            host=address[0], port=address[1],
 *                                            ssl=ssl)
 */
  __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1623, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __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_v_coro = __pyx_t_6;
  __pyx_t_6 = 0;

  /* "nghttp2.pyx":1627
 *                                            ssl=ssl)
 * 
 *             if ssl:             # <<<<<<<<<<<<<<
 *                 self.scheme = 'https'
 *             else:
 */
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_ssl); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 1627, __pyx_L1_error)
  if (__pyx_t_5) {

    /* "nghttp2.pyx":1628
 * 
 *             if ssl:
 *                 self.scheme = 'https'             # <<<<<<<<<<<<<<
 *             else:
 *                 self.scheme = 'http'
 */
    if (__Pyx_PyObject_SetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_scheme_2, __pyx_n_s_https) < 0) __PYX_ERR(0, 1628, __pyx_L1_error)

    /* "nghttp2.pyx":1627
 *                                            ssl=ssl)
 * 
 *             if ssl:             # <<<<<<<<<<<<<<
 *                 self.scheme = 'https'
 *             else:
 */
    goto __pyx_L5;
  }

  /* "nghttp2.pyx":1630
 *                 self.scheme = 'https'
 *             else:
 *                 self.scheme = 'http'             # <<<<<<<<<<<<<<
 * 
 *             self.transport,_ = self.loop.run_until_complete(coro)
 */
  /*else*/ {
    if (__Pyx_PyObject_SetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_scheme_2, __pyx_n_s_http) < 0) __PYX_ERR(0, 1630, __pyx_L1_error)
  }
  __pyx_L5:;

  /* "nghttp2.pyx":1632
 *                 self.scheme = 'http'
 * 
 *             self.transport,_ = self.loop.run_until_complete(coro)             # <<<<<<<<<<<<<<
 *             logging.info('connect, address:%s, port:%s', self.address[0], self.address[1])
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_loop); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1632, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_run_until_complete); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1632, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  __pyx_t_6 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_2, __pyx_v_coro) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_coro);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1632, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_6))) || (PyList_CheckExact(__pyx_t_6))) {
    PyObject* sequence = __pyx_t_6;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 1632, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_2 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_2);
    #else
    __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1632, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1632, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    #endif
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_3 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1632, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_7 = Py_TYPE(__pyx_t_3)->tp_iternext;
    index = 0; __pyx_t_1 = __pyx_t_7(__pyx_t_3); if (unlikely(!__pyx_t_1)) goto __pyx_L6_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_1);
    index = 1; __pyx_t_2 = __pyx_t_7(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L6_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_3), 2) < 0) __PYX_ERR(0, 1632, __pyx_L1_error)
    __pyx_t_7 = NULL;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L7_unpacking_done;
    __pyx_L6_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_7 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 1632, __pyx_L1_error)
    __pyx_L7_unpacking_done:;
  }
  if (__Pyx_PyObject_SetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_transport, __pyx_t_1) < 0) __PYX_ERR(0, 1632, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v__ = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "nghttp2.pyx":1633
 * 
 *             self.transport,_ = self.loop.run_until_complete(coro)
 *             logging.info('connect, address:%s, port:%s', self.address[0], self.address[1])             # <<<<<<<<<<<<<<
 * 
 *         @property
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_logging); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1633, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_info); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1633, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_address); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1633, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_2, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1633, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_address); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1633, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_2, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1633, __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 && unlikely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
      __pyx_t_9 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_1)) {
    PyObject *__pyx_temp[4] = {__pyx_t_2, __pyx_kp_s_connect_address_s_port_s, __pyx_t_3, __pyx_t_8};
    __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_9, 3+__pyx_t_9); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1633, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
    PyObject *__pyx_temp[4] = {__pyx_t_2, __pyx_kp_s_connect_address_s_port_s, __pyx_t_3, __pyx_t_8};
    __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_9, 3+__pyx_t_9); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1633, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 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(0, 1633, __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_INCREF(__pyx_kp_s_connect_address_s_port_s);
    __Pyx_GIVEREF(__pyx_kp_s_connect_address_s_port_s);
    PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_9, __pyx_kp_s_connect_address_s_port_s);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_9, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_10, 2+__pyx_t_9, __pyx_t_8);
    __pyx_t_3 = 0;
    __pyx_t_8 = 0;
    __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_10, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1633, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "nghttp2.pyx":1604
 * 
 *         '''
 *         def __init__(self, address, loop=None, ssl=None):             # <<<<<<<<<<<<<<
 * 
 *             '''address is a tuple of the connect address and port (e.g.,
 */

  /* 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_8);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("nghttp2.HTTP2Client.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_session_factory);
  __Pyx_XDECREF(__pyx_v_coro);
  __Pyx_XDECREF(__pyx_v__);
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":1636
 * 
 *         @property
 *         def io_loop(self):             # <<<<<<<<<<<<<<
 *             return self.loop
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_11HTTP2Client_3io_loop(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7nghttp2_11HTTP2Client_3io_loop = {"io_loop", (PyCFunction)__pyx_pw_7nghttp2_11HTTP2Client_3io_loop, METH_O, 0};
static PyObject *__pyx_pw_7nghttp2_11HTTP2Client_3io_loop(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("io_loop (wrapper)", 0);
  __pyx_r = __pyx_pf_7nghttp2_11HTTP2Client_2io_loop(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_7nghttp2_11HTTP2Client_2io_loop(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("io_loop", 0);

  /* "nghttp2.pyx":1637
 *         @property
 *         def io_loop(self):
 *             return self.loop             # <<<<<<<<<<<<<<
 * 
 *         def close(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_loop); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1637, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "nghttp2.pyx":1636
 * 
 *         @property
 *         def io_loop(self):             # <<<<<<<<<<<<<<
 *             return self.loop
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("nghttp2.HTTP2Client.io_loop", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":1639
 *             return self.loop
 * 
 *         def close(self):             # <<<<<<<<<<<<<<
 *             self.session.close()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_11HTTP2Client_5close(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7nghttp2_11HTTP2Client_5close = {"close", (PyCFunction)__pyx_pw_7nghttp2_11HTTP2Client_5close, METH_O, 0};
static PyObject *__pyx_pw_7nghttp2_11HTTP2Client_5close(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("close (wrapper)", 0);
  __pyx_r = __pyx_pf_7nghttp2_11HTTP2Client_4close(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_7nghttp2_11HTTP2Client_4close(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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("close", 0);

  /* "nghttp2.pyx":1640
 * 
 *         def close(self):
 *             self.session.close()             # <<<<<<<<<<<<<<
 * 
 *         def send_request(self, method='GET', url='/', headers=None, body=None, handler=None):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_session); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1640, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_close); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1640, __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 && 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);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1640, __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;

  /* "nghttp2.pyx":1639
 *             return self.loop
 * 
 *         def close(self):             # <<<<<<<<<<<<<<
 *             self.session.close()
 * 
 */

  /* 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_AddTraceback("nghttp2.HTTP2Client.close", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":1642
 *             self.session.close()
 * 
 *         def send_request(self, method='GET', url='/', headers=None, body=None, handler=None):             # <<<<<<<<<<<<<<
 *             url = urlparse(url)
 *             scheme = url.scheme if url.scheme else self.scheme
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_11HTTP2Client_7send_request(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7nghttp2_11HTTP2Client_7send_request = {"send_request", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7nghttp2_11HTTP2Client_7send_request, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7nghttp2_11HTTP2Client_7send_request(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_method = 0;
  PyObject *__pyx_v_url = 0;
  PyObject *__pyx_v_headers = 0;
  PyObject *__pyx_v_body = 0;
  PyObject *__pyx_v_handler = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("send_request (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_method_2,&__pyx_n_s_url,&__pyx_n_s_headers,&__pyx_n_s_body,&__pyx_n_s_handler,0};
    PyObject* values[6] = {0,0,0,0,0,0};
    values[1] = ((PyObject *)((PyObject*)__pyx_n_s_GET));
    values[2] = ((PyObject *)((PyObject*)__pyx_kp_s__22));
    values[3] = ((PyObject *)((PyObject *)Py_None));
    values[4] = ((PyObject *)((PyObject *)Py_None));
    values[5] = ((PyObject *)((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  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_method_2);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_url);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_headers);
          if (value) { values[3] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_body);
          if (value) { values[4] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_handler);
          if (value) { values[5] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "send_request") < 0)) __PYX_ERR(0, 1642, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_method = values[1];
    __pyx_v_url = values[2];
    __pyx_v_headers = values[3];
    __pyx_v_body = values[4];
    __pyx_v_handler = values[5];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("send_request", 0, 1, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1642, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("nghttp2.HTTP2Client.send_request", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7nghttp2_11HTTP2Client_6send_request(__pyx_self, __pyx_v_self, __pyx_v_method, __pyx_v_url, __pyx_v_headers, __pyx_v_body, __pyx_v_handler);

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

static PyObject *__pyx_pf_7nghttp2_11HTTP2Client_6send_request(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_method, PyObject *__pyx_v_url, PyObject *__pyx_v_headers, PyObject *__pyx_v_body, PyObject *__pyx_v_handler) {
  PyObject *__pyx_v_scheme = NULL;
  PyObject *__pyx_v_host = NULL;
  PyObject *__pyx_v_path = 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;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("send_request", 0);
  __Pyx_INCREF(__pyx_v_url);

  /* "nghttp2.pyx":1643
 * 
 *         def send_request(self, method='GET', url='/', headers=None, body=None, handler=None):
 *             url = urlparse(url)             # <<<<<<<<<<<<<<
 *             scheme = url.scheme if url.scheme else self.scheme
 *             host = url.netloc if url.netloc else self.address[0]+':'+str(self.address[1])
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_urlparse); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1643, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(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_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_url) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_url);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1643, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF_SET(__pyx_v_url, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "nghttp2.pyx":1644
 *         def send_request(self, method='GET', url='/', headers=None, body=None, handler=None):
 *             url = urlparse(url)
 *             scheme = url.scheme if url.scheme else self.scheme             # <<<<<<<<<<<<<<
 *             host = url.netloc if url.netloc else self.address[0]+':'+str(self.address[1])
 *             path = url.path
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_url, __pyx_n_s_scheme_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1644, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 1644, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_4) {
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_url, __pyx_n_s_scheme_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1644, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __pyx_t_2;
    __pyx_t_2 = 0;
  } else {
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_scheme_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1644, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __pyx_t_2;
    __pyx_t_2 = 0;
  }
  __pyx_v_scheme = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "nghttp2.pyx":1645
 *             url = urlparse(url)
 *             scheme = url.scheme if url.scheme else self.scheme
 *             host = url.netloc if url.netloc else self.address[0]+':'+str(self.address[1])             # <<<<<<<<<<<<<<
 *             path = url.path
 *             if url.params:
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_url, __pyx_n_s_netloc); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1645, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 1645, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_4) {
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_url, __pyx_n_s_netloc); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1645, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __pyx_t_2;
    __pyx_t_2 = 0;
  } else {
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_address); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1645, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_2, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1645, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyNumber_Add(__pyx_t_3, __pyx_kp_s__23); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1645, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_address); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1645, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_3, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1645, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1645, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyNumber_Add(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1645, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_1 = __pyx_t_5;
    __pyx_t_5 = 0;
  }
  __pyx_v_host = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "nghttp2.pyx":1646
 *             scheme = url.scheme if url.scheme else self.scheme
 *             host = url.netloc if url.netloc else self.address[0]+':'+str(self.address[1])
 *             path = url.path             # <<<<<<<<<<<<<<
 *             if url.params:
 *                 path += ';'+url.params
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_url, __pyx_n_s_path_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1646, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_path = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "nghttp2.pyx":1647
 *             host = url.netloc if url.netloc else self.address[0]+':'+str(self.address[1])
 *             path = url.path
 *             if url.params:             # <<<<<<<<<<<<<<
 *                 path += ';'+url.params
 *             if url.query:
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_url, __pyx_n_s_params); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1647, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 1647, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_4) {

    /* "nghttp2.pyx":1648
 *             path = url.path
 *             if url.params:
 *                 path += ';'+url.params             # <<<<<<<<<<<<<<
 *             if url.query:
 *                 path += '?'+url.query
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_url, __pyx_n_s_params); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1648, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = PyNumber_Add(__pyx_kp_s__24, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1648, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_path, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1648, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF_SET(__pyx_v_path, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "nghttp2.pyx":1647
 *             host = url.netloc if url.netloc else self.address[0]+':'+str(self.address[1])
 *             path = url.path
 *             if url.params:             # <<<<<<<<<<<<<<
 *                 path += ';'+url.params
 *             if url.query:
 */
  }

  /* "nghttp2.pyx":1649
 *             if url.params:
 *                 path += ';'+url.params
 *             if url.query:             # <<<<<<<<<<<<<<
 *                 path += '?'+url.query
 *             if url.fragment:
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_url, __pyx_n_s_query); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1649, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 1649, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_4) {

    /* "nghttp2.pyx":1650
 *                 path += ';'+url.params
 *             if url.query:
 *                 path += '?'+url.query             # <<<<<<<<<<<<<<
 *             if url.fragment:
 *                 path += '#'+url.fragment
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_url, __pyx_n_s_query); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1650, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = PyNumber_Add(__pyx_kp_s__25, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1650, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_path, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1650, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF_SET(__pyx_v_path, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "nghttp2.pyx":1649
 *             if url.params:
 *                 path += ';'+url.params
 *             if url.query:             # <<<<<<<<<<<<<<
 *                 path += '?'+url.query
 *             if url.fragment:
 */
  }

  /* "nghttp2.pyx":1651
 *             if url.query:
 *                 path += '?'+url.query
 *             if url.fragment:             # <<<<<<<<<<<<<<
 *                 path += '#'+url.fragment
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_url, __pyx_n_s_fragment); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1651, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 1651, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_4) {

    /* "nghttp2.pyx":1652
 *                 path += '?'+url.query
 *             if url.fragment:
 *                 path += '#'+url.fragment             # <<<<<<<<<<<<<<
 * 
 *             self.session.send_request(method=method, scheme=scheme, host=host, path=path,\
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_url, __pyx_n_s_fragment); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1652, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = PyNumber_Add(__pyx_kp_s__26, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1652, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_path, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1652, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF_SET(__pyx_v_path, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "nghttp2.pyx":1651
 *             if url.query:
 *                 path += '?'+url.query
 *             if url.fragment:             # <<<<<<<<<<<<<<
 *                 path += '#'+url.fragment
 * 
 */
  }

  /* "nghttp2.pyx":1654
 *                 path += '#'+url.fragment
 * 
 *             self.session.send_request(method=method, scheme=scheme, host=host, path=path,\             # <<<<<<<<<<<<<<
 *                                       headers=headers, body=body, handler=handler)
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_session); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1654, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_send_request); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1654, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyDict_NewPresized(7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1654, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_method_2, __pyx_v_method) < 0) __PYX_ERR(0, 1654, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_scheme_2, __pyx_v_scheme) < 0) __PYX_ERR(0, 1654, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_host, __pyx_v_host) < 0) __PYX_ERR(0, 1654, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_path_2, __pyx_v_path) < 0) __PYX_ERR(0, 1654, __pyx_L1_error)

  /* "nghttp2.pyx":1655
 * 
 *             self.session.send_request(method=method, scheme=scheme, host=host, path=path,\
 *                                       headers=headers, body=body, handler=handler)             # <<<<<<<<<<<<<<
 */
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_headers, __pyx_v_headers) < 0) __PYX_ERR(0, 1654, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_body, __pyx_v_body) < 0) __PYX_ERR(0, 1654, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_handler, __pyx_v_handler) < 0) __PYX_ERR(0, 1654, __pyx_L1_error)

  /* "nghttp2.pyx":1654
 *                 path += '#'+url.fragment
 * 
 *             self.session.send_request(method=method, scheme=scheme, host=host, path=path,\             # <<<<<<<<<<<<<<
 *                                       headers=headers, body=body, handler=handler)
 */
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_empty_tuple, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1654, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "nghttp2.pyx":1642
 *             self.session.close()
 * 
 *         def send_request(self, method='GET', url='/', headers=None, body=None, handler=None):             # <<<<<<<<<<<<<<
 *             url = urlparse(url)
 *             scheme = url.scheme if url.scheme else self.scheme
 */

  /* 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_AddTraceback("nghttp2.HTTP2Client.send_request", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_scheme);
  __Pyx_XDECREF(__pyx_v_host);
  __Pyx_XDECREF(__pyx_v_path);
  __Pyx_XDECREF(__pyx_v_url);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_tp_new_7nghttp2_HDDeflater(PyTypeObject *t, PyObject *a, PyObject *k) {
  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;
  if (unlikely(__pyx_pw_7nghttp2_10HDDeflater_1__cinit__(o, a, k) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_7nghttp2_HDDeflater(PyObject *o) {
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
    __pyx_pw_7nghttp2_10HDDeflater_3__dealloc__(o);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
    PyErr_Restore(etype, eval, etb);
  }
  (*Py_TYPE(o)->tp_free)(o);
}

static PyMethodDef __pyx_methods_7nghttp2_HDDeflater[] = {
  {"deflate", (PyCFunction)__pyx_pw_7nghttp2_10HDDeflater_5deflate, METH_O, __pyx_doc_7nghttp2_10HDDeflater_4deflate},
  {"change_table_size", (PyCFunction)__pyx_pw_7nghttp2_10HDDeflater_7change_table_size, METH_O, __pyx_doc_7nghttp2_10HDDeflater_6change_table_size},
  {"get_hd_table", (PyCFunction)__pyx_pw_7nghttp2_10HDDeflater_9get_hd_table, METH_NOARGS, __pyx_doc_7nghttp2_10HDDeflater_8get_hd_table},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_7nghttp2_10HDDeflater_11__reduce_cython__, METH_NOARGS, 0},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_7nghttp2_10HDDeflater_13__setstate_cython__, METH_O, 0},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_7nghttp2_HDDeflater = {
  PyVarObject_HEAD_INIT(0, 0)
  "nghttp2.HDDeflater", /*tp_name*/
  sizeof(struct __pyx_obj_7nghttp2_HDDeflater), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7nghttp2_HDDeflater, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  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, /*tp_flags*/
  "Performs header compression. The constructor takes\n    |hd_table_bufsize_max| parameter, which limits the usage of header\n    table in the given amount of bytes. This is necessary because the\n    header compressor and decompressor share the same amount of\n    header table and the decompressor decides that number. The\n    compressor may not want to use all header table size because of\n    limited memory availability. In that case, the\n    |hd_table_bufsize_max| can be used to cap the upper limit of table\n    size whatever the header table size is chosen by the decompressor.\n    The default value of |hd_table_bufsize_max| is 4096 bytes.\n\n    The following example shows how to compress request header sets:\n\n        import binascii, nghttp2\n\n        deflater = nghttp2.HDDeflater()\n        res = deflater.deflate([(b'foo', b'bar'),\n                              (b'baz', b'buz')])\n        print(binascii.b2a_hex(res))\n\n    ", /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_7nghttp2_HDDeflater, /*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_7nghttp2_HDDeflater, /*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
  #if PY_VERSION_HEX >= 0x030800b1
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030B00A2
  0, /*tp_inline_values_offset*/
  #endif
};

static PyObject *__pyx_tp_new_7nghttp2_HDInflater(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  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;
  if (unlikely(__pyx_pw_7nghttp2_10HDInflater_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_7nghttp2_HDInflater(PyObject *o) {
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
    __pyx_pw_7nghttp2_10HDInflater_3__dealloc__(o);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
    PyErr_Restore(etype, eval, etb);
  }
  (*Py_TYPE(o)->tp_free)(o);
}

static PyMethodDef __pyx_methods_7nghttp2_HDInflater[] = {
  {"inflate", (PyCFunction)__pyx_pw_7nghttp2_10HDInflater_5inflate, METH_O, __pyx_doc_7nghttp2_10HDInflater_4inflate},
  {"change_table_size", (PyCFunction)__pyx_pw_7nghttp2_10HDInflater_7change_table_size, METH_O, __pyx_doc_7nghttp2_10HDInflater_6change_table_size},
  {"get_hd_table", (PyCFunction)__pyx_pw_7nghttp2_10HDInflater_9get_hd_table, METH_NOARGS, __pyx_doc_7nghttp2_10HDInflater_8get_hd_table},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_7nghttp2_10HDInflater_11__reduce_cython__, METH_NOARGS, 0},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_7nghttp2_10HDInflater_13__setstate_cython__, METH_O, 0},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_7nghttp2_HDInflater = {
  PyVarObject_HEAD_INIT(0, 0)
  "nghttp2.HDInflater", /*tp_name*/
  sizeof(struct __pyx_obj_7nghttp2_HDInflater), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7nghttp2_HDInflater, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  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, /*tp_flags*/
  "Performs header decompression.\n\n    The following example shows how to compress request header sets:\n\n        data = b'0082c5ad82bd0f000362617a0362757a'\n        inflater = nghttp2.HDInflater()\n        hdrs = inflater.inflate(data)\n        print(hdrs)\n\n    ", /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_7nghttp2_HDInflater, /*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_7nghttp2_HDInflater, /*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
  #if PY_VERSION_HEX >= 0x030800b1
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030B00A2
  0, /*tp_inline_values_offset*/
  #endif
};

static PyObject *__pyx_tp_new_7nghttp2__HTTP2SessionCoreBase(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *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_7nghttp2__HTTP2SessionCoreBase *)o);
  p->transport = Py_None; Py_INCREF(Py_None);
  p->handler_class = Py_None; Py_INCREF(Py_None);
  p->handlers = Py_None; Py_INCREF(Py_None);
  p->settings_timer = Py_None; Py_INCREF(Py_None);
  p->inside_callback = Py_None; Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_1__cinit__(o, a, k) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_7nghttp2__HTTP2SessionCoreBase(PyObject *o) {
  struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *p = (struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
    __pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_3__dealloc__(o);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->transport);
  Py_CLEAR(p->handler_class);
  Py_CLEAR(p->handlers);
  Py_CLEAR(p->settings_timer);
  Py_CLEAR(p->inside_callback);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_7nghttp2__HTTP2SessionCoreBase(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *p = (struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *)o;
  if (p->transport) {
    e = (*v)(p->transport, a); if (e) return e;
  }
  if (p->handler_class) {
    e = (*v)(p->handler_class, a); if (e) return e;
  }
  if (p->handlers) {
    e = (*v)(p->handlers, a); if (e) return e;
  }
  if (p->settings_timer) {
    e = (*v)(p->settings_timer, a); if (e) return e;
  }
  if (p->inside_callback) {
    e = (*v)(p->inside_callback, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_7nghttp2__HTTP2SessionCoreBase(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *p = (struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *)o;
  tmp = ((PyObject*)p->transport);
  p->transport = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->handler_class);
  p->handler_class = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->handlers);
  p->handlers = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->settings_timer);
  p->settings_timer = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->inside_callback);
  p->inside_callback = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_7nghttp2__HTTP2SessionCoreBase[] = {
  {"data_received", (PyCFunction)__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_5data_received, METH_O, 0},
  {"send_data", (PyCFunction)__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_7send_data, METH_NOARGS, 0},
  {"resume", (PyCFunction)__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_9resume, METH_O, 0},
  {"enter_callback", (PyCFunction)__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_11enter_callback, METH_NOARGS, 0},
  {"leave_callback", (PyCFunction)__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_13leave_callback, METH_NOARGS, 0},
  {"_make_handler", (PyCFunction)__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_15_make_handler, METH_O, 0},
  {"_remove_handler", (PyCFunction)__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_17_remove_handler, METH_O, 0},
  {"_add_handler", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_19_add_handler, METH_VARARGS|METH_KEYWORDS, 0},
  {"_rst_stream", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_21_rst_stream, METH_VARARGS|METH_KEYWORDS, 0},
  {"_get_remote_address", (PyCFunction)__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_23_get_remote_address, METH_NOARGS, 0},
  {"_get_client_certificate", (PyCFunction)__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_25_get_client_certificate, METH_NOARGS, 0},
  {"_start_settings_timer", (PyCFunction)__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_27_start_settings_timer, METH_NOARGS, 0},
  {"_stop_settings_timer", (PyCFunction)__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_29_stop_settings_timer, METH_NOARGS, 0},
  {"_settings_timeout", (PyCFunction)__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_31_settings_timeout, METH_NOARGS, 0},
  {"_log_request", (PyCFunction)__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_33_log_request, METH_O, 0},
  {"close", (PyCFunction)__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_35close, METH_NOARGS, 0},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_37__reduce_cython__, METH_NOARGS, 0},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_39__setstate_cython__, METH_O, 0},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_7nghttp2__HTTP2SessionCoreBase = {
  PyVarObject_HEAD_INIT(0, 0)
  "nghttp2._HTTP2SessionCoreBase", /*tp_name*/
  sizeof(struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7nghttp2__HTTP2SessionCoreBase, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  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_7nghttp2__HTTP2SessionCoreBase, /*tp_traverse*/
  __pyx_tp_clear_7nghttp2__HTTP2SessionCoreBase, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_7nghttp2__HTTP2SessionCoreBase, /*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_7nghttp2__HTTP2SessionCoreBase, /*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
  #if PY_VERSION_HEX >= 0x030800b1
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030B00A2
  0, /*tp_inline_values_offset*/
  #endif
};

static PyObject *__pyx_tp_new_7nghttp2__HTTP2SessionCore(PyTypeObject *t, PyObject *a, PyObject *k) {
  PyObject *o = __pyx_tp_new_7nghttp2__HTTP2SessionCoreBase(t, a, k);
  if (unlikely(!o)) return 0;
  if (unlikely(__pyx_pw_7nghttp2_17_HTTP2SessionCore_1__cinit__(o, a, k) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static PyMethodDef __pyx_methods_7nghttp2__HTTP2SessionCore[] = {
  {"send_response", (PyCFunction)__pyx_pw_7nghttp2_17_HTTP2SessionCore_3send_response, METH_O, 0},
  {"push", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7nghttp2_17_HTTP2SessionCore_5push, METH_VARARGS|METH_KEYWORDS, 0},
  {"connection_lost", (PyCFunction)__pyx_pw_7nghttp2_17_HTTP2SessionCore_7connection_lost, METH_NOARGS, 0},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_7nghttp2_17_HTTP2SessionCore_9__reduce_cython__, METH_NOARGS, 0},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_7nghttp2_17_HTTP2SessionCore_11__setstate_cython__, METH_O, 0},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_7nghttp2__HTTP2SessionCore = {
  PyVarObject_HEAD_INIT(0, 0)
  "nghttp2._HTTP2SessionCore", /*tp_name*/
  sizeof(struct __pyx_obj_7nghttp2__HTTP2SessionCore), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7nghttp2__HTTP2SessionCoreBase, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  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_7nghttp2__HTTP2SessionCoreBase, /*tp_traverse*/
  __pyx_tp_clear_7nghttp2__HTTP2SessionCoreBase, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_7nghttp2__HTTP2SessionCore, /*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_7nghttp2__HTTP2SessionCore, /*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
  #if PY_VERSION_HEX >= 0x030800b1
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030B00A2
  0, /*tp_inline_values_offset*/
  #endif
};

static PyObject *__pyx_tp_new_7nghttp2__HTTP2ClientSessionCore(PyTypeObject *t, PyObject *a, PyObject *k) {
  PyObject *o = __pyx_tp_new_7nghttp2__HTTP2SessionCoreBase(t, a, k);
  if (unlikely(!o)) return 0;
  if (unlikely(__pyx_pw_7nghttp2_23_HTTP2ClientSessionCore_1__cinit__(o, a, k) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static PyMethodDef __pyx_methods_7nghttp2__HTTP2ClientSessionCore[] = {
  {"send_request", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7nghttp2_23_HTTP2ClientSessionCore_3send_request, METH_VARARGS|METH_KEYWORDS, 0},
  {"push", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7nghttp2_23_HTTP2ClientSessionCore_5push, METH_VARARGS|METH_KEYWORDS, 0},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_7nghttp2_23_HTTP2ClientSessionCore_7__reduce_cython__, METH_NOARGS, 0},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_7nghttp2_23_HTTP2ClientSessionCore_9__setstate_cython__, METH_O, 0},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_7nghttp2__HTTP2ClientSessionCore = {
  PyVarObject_HEAD_INIT(0, 0)
  "nghttp2._HTTP2ClientSessionCore", /*tp_name*/
  sizeof(struct __pyx_obj_7nghttp2__HTTP2ClientSessionCore), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7nghttp2__HTTP2SessionCoreBase, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  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_7nghttp2__HTTP2SessionCoreBase, /*tp_traverse*/
  __pyx_tp_clear_7nghttp2__HTTP2SessionCoreBase, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_7nghttp2__HTTP2ClientSessionCore, /*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_7nghttp2__HTTP2ClientSessionCore, /*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
  #if PY_VERSION_HEX >= 0x030800b1
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030B00A2
  0, /*tp_inline_values_offset*/
  #endif
};

static struct __pyx_obj_7nghttp2___pyx_scope_struct____init__ *__pyx_freelist_7nghttp2___pyx_scope_struct____init__[8];
static int __pyx_freecount_7nghttp2___pyx_scope_struct____init__ = 0;

static PyObject *__pyx_tp_new_7nghttp2___pyx_scope_struct____init__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7nghttp2___pyx_scope_struct____init__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7nghttp2___pyx_scope_struct____init__)))) {
    o = (PyObject*)__pyx_freelist_7nghttp2___pyx_scope_struct____init__[--__pyx_freecount_7nghttp2___pyx_scope_struct____init__];
    memset(o, 0, sizeof(struct __pyx_obj_7nghttp2___pyx_scope_struct____init__));
    (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_7nghttp2___pyx_scope_struct____init__(PyObject *o) {
  struct __pyx_obj_7nghttp2___pyx_scope_struct____init__ *p = (struct __pyx_obj_7nghttp2___pyx_scope_struct____init__ *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_RequestHandlerClass);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7nghttp2___pyx_scope_struct____init__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7nghttp2___pyx_scope_struct____init__)))) {
    __pyx_freelist_7nghttp2___pyx_scope_struct____init__[__pyx_freecount_7nghttp2___pyx_scope_struct____init__++] = ((struct __pyx_obj_7nghttp2___pyx_scope_struct____init__ *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_7nghttp2___pyx_scope_struct____init__(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7nghttp2___pyx_scope_struct____init__ *p = (struct __pyx_obj_7nghttp2___pyx_scope_struct____init__ *)o;
  if (p->__pyx_v_RequestHandlerClass) {
    e = (*v)(p->__pyx_v_RequestHandlerClass, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_7nghttp2___pyx_scope_struct____init__(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_7nghttp2___pyx_scope_struct____init__ *p = (struct __pyx_obj_7nghttp2___pyx_scope_struct____init__ *)o;
  tmp = ((PyObject*)p->__pyx_v_RequestHandlerClass);
  p->__pyx_v_RequestHandlerClass = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_7nghttp2___pyx_scope_struct____init__ = {
  PyVarObject_HEAD_INIT(0, 0)
  "nghttp2.__pyx_scope_struct____init__", /*tp_name*/
  sizeof(struct __pyx_obj_7nghttp2___pyx_scope_struct____init__), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7nghttp2___pyx_scope_struct____init__, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  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_7nghttp2___pyx_scope_struct____init__, /*tp_traverse*/
  __pyx_tp_clear_7nghttp2___pyx_scope_struct____init__, /*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_7nghttp2___pyx_scope_struct____init__, /*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
  #if PY_VERSION_HEX >= 0x030800b1
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030B00A2
  0, /*tp_inline_values_offset*/
  #endif
};

static struct __pyx_obj_7nghttp2___pyx_scope_struct_1___init__ *__pyx_freelist_7nghttp2___pyx_scope_struct_1___init__[8];
static int __pyx_freecount_7nghttp2___pyx_scope_struct_1___init__ = 0;

static PyObject *__pyx_tp_new_7nghttp2___pyx_scope_struct_1___init__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7nghttp2___pyx_scope_struct_1___init__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7nghttp2___pyx_scope_struct_1___init__)))) {
    o = (PyObject*)__pyx_freelist_7nghttp2___pyx_scope_struct_1___init__[--__pyx_freecount_7nghttp2___pyx_scope_struct_1___init__];
    memset(o, 0, sizeof(struct __pyx_obj_7nghttp2___pyx_scope_struct_1___init__));
    (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_7nghttp2___pyx_scope_struct_1___init__(PyObject *o) {
  struct __pyx_obj_7nghttp2___pyx_scope_struct_1___init__ *p = (struct __pyx_obj_7nghttp2___pyx_scope_struct_1___init__ *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7nghttp2___pyx_scope_struct_1___init__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7nghttp2___pyx_scope_struct_1___init__)))) {
    __pyx_freelist_7nghttp2___pyx_scope_struct_1___init__[__pyx_freecount_7nghttp2___pyx_scope_struct_1___init__++] = ((struct __pyx_obj_7nghttp2___pyx_scope_struct_1___init__ *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_7nghttp2___pyx_scope_struct_1___init__(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7nghttp2___pyx_scope_struct_1___init__ *p = (struct __pyx_obj_7nghttp2___pyx_scope_struct_1___init__ *)o;
  if (p->__pyx_v_self) {
    e = (*v)(p->__pyx_v_self, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_7nghttp2___pyx_scope_struct_1___init__(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_7nghttp2___pyx_scope_struct_1___init__ *p = (struct __pyx_obj_7nghttp2___pyx_scope_struct_1___init__ *)o;
  tmp = ((PyObject*)p->__pyx_v_self);
  p->__pyx_v_self = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_7nghttp2___pyx_scope_struct_1___init__ = {
  PyVarObject_HEAD_INIT(0, 0)
  "nghttp2.__pyx_scope_struct_1___init__", /*tp_name*/
  sizeof(struct __pyx_obj_7nghttp2___pyx_scope_struct_1___init__), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7nghttp2___pyx_scope_struct_1___init__, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  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_7nghttp2___pyx_scope_struct_1___init__, /*tp_traverse*/
  __pyx_tp_clear_7nghttp2___pyx_scope_struct_1___init__, /*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_7nghttp2___pyx_scope_struct_1___init__, /*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
  #if PY_VERSION_HEX >= 0x030800b1
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030B00A2
  0, /*tp_inline_values_offset*/
  #endif
};

static PyMethodDef __pyx_methods[] = {
  {0, 0, 0, 0}
};

#if PY_MAJOR_VERSION >= 3
#if CYTHON_PEP489_MULTI_PHASE_INIT
static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
static int __pyx_pymod_exec_nghttp2(PyObject* module); /*proto*/
static PyModuleDef_Slot __pyx_moduledef_slots[] = {
  {Py_mod_create, (void*)__pyx_pymod_create},
  {Py_mod_exec, (void*)__pyx_pymod_exec_nghttp2},
  {0, NULL}
};
#endif

static struct PyModuleDef __pyx_moduledef = {
    PyModuleDef_HEAD_INIT,
    "nghttp2",
    0, /* m_doc */
  #if CYTHON_PEP489_MULTI_PHASE_INIT
    0, /* m_size */
  #else
    -1, /* m_size */
  #endif
    __pyx_methods /* m_methods */,
  #if CYTHON_PEP489_MULTI_PHASE_INIT
    __pyx_moduledef_slots, /* m_slots */
  #else
    NULL, /* m_reload */
  #endif
    NULL, /* m_traverse */
    NULL, /* m_clear */
    NULL /* m_free */
};
#endif
#ifndef CYTHON_SMALL_CODE
#if defined(__clang__)
    #define CYTHON_SMALL_CODE
#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
    #define CYTHON_SMALL_CODE __attribute__((cold))
#else
    #define CYTHON_SMALL_CODE
#endif
#endif

static __Pyx_StringTabEntry __pyx_string_tab[] = {
  {&__pyx_n_s_AttributeError, __pyx_k_AttributeError, sizeof(__pyx_k_AttributeError), 0, 0, 1, 1},
  {&__pyx_n_s_BaseRequestHandler, __pyx_k_BaseRequestHandler, sizeof(__pyx_k_BaseRequestHandler), 0, 0, 1, 1},
  {&__pyx_n_s_BaseRequestHandler___init, __pyx_k_BaseRequestHandler___init, sizeof(__pyx_k_BaseRequestHandler___init), 0, 0, 1, 1},
  {&__pyx_n_s_BaseRequestHandler__set_response, __pyx_k_BaseRequestHandler__set_response, sizeof(__pyx_k_BaseRequestHandler__set_response), 0, 0, 1, 1},
  {&__pyx_n_s_BaseRequestHandler_client_addres, __pyx_k_BaseRequestHandler_client_addres, sizeof(__pyx_k_BaseRequestHandler_client_addres), 0, 0, 1, 1},
  {&__pyx_n_s_BaseRequestHandler_client_certif, __pyx_k_BaseRequestHandler_client_certif, sizeof(__pyx_k_BaseRequestHandler_client_certif), 0, 0, 1, 1},
  {&__pyx_n_s_BaseRequestHandler_on_close, __pyx_k_BaseRequestHandler_on_close, sizeof(__pyx_k_BaseRequestHandler_on_close), 0, 0, 1, 1},
  {&__pyx_n_s_BaseRequestHandler_on_data, __pyx_k_BaseRequestHandler_on_data, sizeof(__pyx_k_BaseRequestHandler_on_data), 0, 0, 1, 1},
  {&__pyx_n_s_BaseRequestHandler_on_headers, __pyx_k_BaseRequestHandler_on_headers, sizeof(__pyx_k_BaseRequestHandler_on_headers), 0, 0, 1, 1},
  {&__pyx_n_s_BaseRequestHandler_on_request_do, __pyx_k_BaseRequestHandler_on_request_do, sizeof(__pyx_k_BaseRequestHandler_on_request_do), 0, 0, 1, 1},
  {&__pyx_n_s_BaseRequestHandler_push, __pyx_k_BaseRequestHandler_push, sizeof(__pyx_k_BaseRequestHandler_push), 0, 0, 1, 1},
  {&__pyx_n_s_BaseRequestHandler_resume, __pyx_k_BaseRequestHandler_resume, sizeof(__pyx_k_BaseRequestHandler_resume), 0, 0, 1, 1},
  {&__pyx_n_s_BaseRequestHandler_send_response, __pyx_k_BaseRequestHandler_send_response, sizeof(__pyx_k_BaseRequestHandler_send_response), 0, 0, 1, 1},
  {&__pyx_n_s_BaseResponseHandler, __pyx_k_BaseResponseHandler, sizeof(__pyx_k_BaseResponseHandler), 0, 0, 1, 1},
  {&__pyx_n_s_BaseResponseHandler___init, __pyx_k_BaseResponseHandler___init, sizeof(__pyx_k_BaseResponseHandler___init), 0, 0, 1, 1},
  {&__pyx_n_s_BaseResponseHandler_accept_push, __pyx_k_BaseResponseHandler_accept_push, sizeof(__pyx_k_BaseResponseHandler_accept_push), 0, 0, 1, 1},
  {&__pyx_n_s_BaseResponseHandler_on_close, __pyx_k_BaseResponseHandler_on_close, sizeof(__pyx_k_BaseResponseHandler_on_close), 0, 0, 1, 1},
  {&__pyx_n_s_BaseResponseHandler_on_data, __pyx_k_BaseResponseHandler_on_data, sizeof(__pyx_k_BaseResponseHandler_on_data), 0, 0, 1, 1},
  {&__pyx_n_s_BaseResponseHandler_on_headers, __pyx_k_BaseResponseHandler_on_headers, sizeof(__pyx_k_BaseResponseHandler_on_headers), 0, 0, 1, 1},
  {&__pyx_n_s_BaseResponseHandler_on_push_prom, __pyx_k_BaseResponseHandler_on_push_prom, sizeof(__pyx_k_BaseResponseHandler_on_push_prom), 0, 0, 1, 1},
  {&__pyx_n_s_BaseResponseHandler_on_response, __pyx_k_BaseResponseHandler_on_response, sizeof(__pyx_k_BaseResponseHandler_on_response), 0, 0, 1, 1},
  {&__pyx_n_s_BaseResponseHandler_reject_push, __pyx_k_BaseResponseHandler_reject_push, sizeof(__pyx_k_BaseResponseHandler_reject_push), 0, 0, 1, 1},
  {&__pyx_n_s_BaseResponseHandler_resume, __pyx_k_BaseResponseHandler_resume, sizeof(__pyx_k_BaseResponseHandler_resume), 0, 0, 1, 1},
  {&__pyx_n_s_BaseResponseHandler_server_addre, __pyx_k_BaseResponseHandler_server_addre, sizeof(__pyx_k_BaseResponseHandler_server_addre), 0, 0, 1, 1},
  {&__pyx_n_s_ByteIOWrapper, __pyx_k_ByteIOWrapper, sizeof(__pyx_k_ByteIOWrapper), 0, 0, 1, 1},
  {&__pyx_n_s_ByteIOWrapper___init, __pyx_k_ByteIOWrapper___init, sizeof(__pyx_k_ByteIOWrapper___init), 0, 0, 1, 1},
  {&__pyx_n_s_ByteIOWrapper_generate, __pyx_k_ByteIOWrapper_generate, sizeof(__pyx_k_ByteIOWrapper_generate), 0, 0, 1, 1},
  {&__pyx_n_s_BytesIO, __pyx_k_BytesIO, sizeof(__pyx_k_BytesIO), 0, 0, 1, 1},
  {&__pyx_n_s_DATA_DEFERRED, __pyx_k_DATA_DEFERRED, sizeof(__pyx_k_DATA_DEFERRED), 0, 0, 1, 1},
  {&__pyx_n_s_DATA_EOF, __pyx_k_DATA_EOF, sizeof(__pyx_k_DATA_EOF), 0, 0, 1, 1},
  {&__pyx_n_s_DATA_OK, __pyx_k_DATA_OK, sizeof(__pyx_k_DATA_OK), 0, 0, 1, 1},
  {&__pyx_n_s_DEFAULT_HEADER_TABLE_SIZE, __pyx_k_DEFAULT_HEADER_TABLE_SIZE, sizeof(__pyx_k_DEFAULT_HEADER_TABLE_SIZE), 0, 0, 1, 1},
  {&__pyx_n_s_DEFLATE_MAX_HEADER_TABLE_SIZE, __pyx_k_DEFLATE_MAX_HEADER_TABLE_SIZE, sizeof(__pyx_k_DEFLATE_MAX_HEADER_TABLE_SIZE), 0, 0, 1, 1},
  {&__pyx_n_s_GET, __pyx_k_GET, sizeof(__pyx_k_GET), 0, 0, 1, 1},
  {&__pyx_n_s_HAS_ALPN, __pyx_k_HAS_ALPN, sizeof(__pyx_k_HAS_ALPN), 0, 0, 1, 1},
  {&__pyx_n_s_HDDeflater, __pyx_k_HDDeflater, sizeof(__pyx_k_HDDeflater), 0, 0, 1, 1},
  {&__pyx_n_s_HDInflater, __pyx_k_HDInflater, sizeof(__pyx_k_HDInflater), 0, 0, 1, 1},
  {&__pyx_n_s_HDTableEntry, __pyx_k_HDTableEntry, sizeof(__pyx_k_HDTableEntry), 0, 0, 1, 1},
  {&__pyx_n_s_HDTableEntry___init, __pyx_k_HDTableEntry___init, sizeof(__pyx_k_HDTableEntry___init), 0, 0, 1, 1},
  {&__pyx_n_s_HDTableEntry_space, __pyx_k_HDTableEntry_space, sizeof(__pyx_k_HDTableEntry_space), 0, 0, 1, 1},
  {&__pyx_n_s_HD_ENTRY_OVERHEAD, __pyx_k_HD_ENTRY_OVERHEAD, sizeof(__pyx_k_HD_ENTRY_OVERHEAD), 0, 0, 1, 1},
  {&__pyx_n_s_HTTP2Client, __pyx_k_HTTP2Client, sizeof(__pyx_k_HTTP2Client), 0, 0, 1, 1},
  {&__pyx_n_s_HTTP2ClientSession, __pyx_k_HTTP2ClientSession, sizeof(__pyx_k_HTTP2ClientSession), 0, 0, 1, 1},
  {&__pyx_n_s_HTTP2ClientSessionCore, __pyx_k_HTTP2ClientSessionCore, sizeof(__pyx_k_HTTP2ClientSessionCore), 0, 0, 1, 1},
  {&__pyx_n_s_HTTP2ClientSession___init, __pyx_k_HTTP2ClientSession___init, sizeof(__pyx_k_HTTP2ClientSession___init), 0, 0, 1, 1},
  {&__pyx_n_s_HTTP2ClientSession_close, __pyx_k_HTTP2ClientSession_close, sizeof(__pyx_k_HTTP2ClientSession_close), 0, 0, 1, 1},
  {&__pyx_n_s_HTTP2ClientSession_connection_l, __pyx_k_HTTP2ClientSession_connection_l, sizeof(__pyx_k_HTTP2ClientSession_connection_l), 0, 0, 1, 1},
  {&__pyx_n_s_HTTP2ClientSession_connection_m, __pyx_k_HTTP2ClientSession_connection_m, sizeof(__pyx_k_HTTP2ClientSession_connection_m), 0, 0, 1, 1},
  {&__pyx_n_s_HTTP2ClientSession_data_receive, __pyx_k_HTTP2ClientSession_data_receive, sizeof(__pyx_k_HTTP2ClientSession_data_receive), 0, 0, 1, 1},
  {&__pyx_n_s_HTTP2ClientSession_resume_writi, __pyx_k_HTTP2ClientSession_resume_writi, sizeof(__pyx_k_HTTP2ClientSession_resume_writi), 0, 0, 1, 1},
  {&__pyx_n_s_HTTP2ClientSession_send_request, __pyx_k_HTTP2ClientSession_send_request, sizeof(__pyx_k_HTTP2ClientSession_send_request), 0, 0, 1, 1},
  {&__pyx_n_s_HTTP2Client___init, __pyx_k_HTTP2Client___init, sizeof(__pyx_k_HTTP2Client___init), 0, 0, 1, 1},
  {&__pyx_n_s_HTTP2Client___init___locals_sess, __pyx_k_HTTP2Client___init___locals_sess, sizeof(__pyx_k_HTTP2Client___init___locals_sess), 0, 0, 1, 1},
  {&__pyx_n_s_HTTP2Client_close, __pyx_k_HTTP2Client_close, sizeof(__pyx_k_HTTP2Client_close), 0, 0, 1, 1},
  {&__pyx_n_s_HTTP2Client_io_loop, __pyx_k_HTTP2Client_io_loop, sizeof(__pyx_k_HTTP2Client_io_loop), 0, 0, 1, 1},
  {&__pyx_n_s_HTTP2Client_send_request, __pyx_k_HTTP2Client_send_request, sizeof(__pyx_k_HTTP2Client_send_request), 0, 0, 1, 1},
  {&__pyx_n_s_HTTP2Server, __pyx_k_HTTP2Server, sizeof(__pyx_k_HTTP2Server), 0, 0, 1, 1},
  {&__pyx_n_s_HTTP2Server___init, __pyx_k_HTTP2Server___init, sizeof(__pyx_k_HTTP2Server___init), 0, 0, 1, 1},
  {&__pyx_n_s_HTTP2Server___init___locals_sess, __pyx_k_HTTP2Server___init___locals_sess, sizeof(__pyx_k_HTTP2Server___init___locals_sess), 0, 0, 1, 1},
  {&__pyx_n_s_HTTP2Server_serve_forever, __pyx_k_HTTP2Server_serve_forever, sizeof(__pyx_k_HTTP2Server_serve_forever), 0, 0, 1, 1},
  {&__pyx_n_s_HTTP2Session, __pyx_k_HTTP2Session, sizeof(__pyx_k_HTTP2Session), 0, 0, 1, 1},
  {&__pyx_n_s_HTTP2SessionCore, __pyx_k_HTTP2SessionCore, sizeof(__pyx_k_HTTP2SessionCore), 0, 0, 1, 1},
  {&__pyx_n_s_HTTP2SessionCoreBase, __pyx_k_HTTP2SessionCoreBase, sizeof(__pyx_k_HTTP2SessionCoreBase), 0, 0, 1, 1},
  {&__pyx_n_s_HTTP2Session___init, __pyx_k_HTTP2Session___init, sizeof(__pyx_k_HTTP2Session___init), 0, 0, 1, 1},
  {&__pyx_n_s_HTTP2Session_connection_lost, __pyx_k_HTTP2Session_connection_lost, sizeof(__pyx_k_HTTP2Session_connection_lost), 0, 0, 1, 1},
  {&__pyx_n_s_HTTP2Session_connection_made, __pyx_k_HTTP2Session_connection_made, sizeof(__pyx_k_HTTP2Session_connection_made), 0, 0, 1, 1},
  {&__pyx_n_s_HTTP2Session_data_received, __pyx_k_HTTP2Session_data_received, sizeof(__pyx_k_HTTP2Session_data_received), 0, 0, 1, 1},
  {&__pyx_n_s_HTTP2Session_resume_writing, __pyx_k_HTTP2Session_resume_writing, sizeof(__pyx_k_HTTP2Session_resume_writing), 0, 0, 1, 1},
  {&__pyx_kp_s_HTTP_2_client_This_class_builds, __pyx_k_HTTP_2_client_This_class_builds, sizeof(__pyx_k_HTTP_2_client_This_class_builds), 0, 0, 1, 0},
  {&__pyx_kp_s_HTTP_2_request_stream_handler_ba, __pyx_k_HTTP_2_request_stream_handler_ba, sizeof(__pyx_k_HTTP_2_request_stream_handler_ba), 0, 0, 1, 0},
  {&__pyx_kp_s_HTTP_2_response_stream_handler_b, __pyx_k_HTTP_2_response_stream_handler_b, sizeof(__pyx_k_HTTP_2_response_stream_handler_b), 0, 0, 1, 0},
  {&__pyx_kp_s_HTTP_2_server_This_class_builds, __pyx_k_HTTP_2_server_This_class_builds, sizeof(__pyx_k_HTTP_2_server_This_class_builds), 0, 0, 1, 0},
  {&__pyx_n_s_IOBase, __pyx_k_IOBase, sizeof(__pyx_k_IOBase), 0, 0, 1, 1},
  {&__pyx_n_s_IPPROTO_TCP, __pyx_k_IPPROTO_TCP, sizeof(__pyx_k_IPPROTO_TCP), 0, 0, 1, 1},
  {&__pyx_n_s_ImportError, __pyx_k_ImportError, sizeof(__pyx_k_ImportError), 0, 0, 1, 1},
  {&__pyx_n_s_OSError, __pyx_k_OSError, sizeof(__pyx_k_OSError), 0, 0, 1, 1},
  {&__pyx_n_s_OUTBUF_MAX, __pyx_k_OUTBUF_MAX, sizeof(__pyx_k_OUTBUF_MAX), 0, 0, 1, 1},
  {&__pyx_n_s_P, __pyx_k_P, sizeof(__pyx_k_P), 0, 0, 1, 1},
  {&__pyx_n_s_Protocol, __pyx_k_Protocol, sizeof(__pyx_k_Protocol), 0, 0, 1, 1},
  {&__pyx_n_s_RequestHandlerClass, __pyx_k_RequestHandlerClass, sizeof(__pyx_k_RequestHandlerClass), 0, 0, 1, 1},
  {&__pyx_n_s_SETTINGS_TIMEOUT, __pyx_k_SETTINGS_TIMEOUT, sizeof(__pyx_k_SETTINGS_TIMEOUT), 0, 0, 1, 1},
  {&__pyx_n_s_TCP_NODELAY, __pyx_k_TCP_NODELAY, sizeof(__pyx_k_TCP_NODELAY), 0, 0, 1, 1},
  {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1},
  {&__pyx_n_s__120, __pyx_k__120, sizeof(__pyx_k__120), 0, 0, 1, 1},
  {&__pyx_kp_s__22, __pyx_k__22, sizeof(__pyx_k__22), 0, 0, 1, 0},
  {&__pyx_kp_s__23, __pyx_k__23, sizeof(__pyx_k__23), 0, 0, 1, 0},
  {&__pyx_kp_s__24, __pyx_k__24, sizeof(__pyx_k__24), 0, 0, 1, 0},
  {&__pyx_kp_s__25, __pyx_k__25, sizeof(__pyx_k__25), 0, 0, 1, 0},
  {&__pyx_kp_s__26, __pyx_k__26, sizeof(__pyx_k__26), 0, 0, 1, 0},
  {&__pyx_kp_b__6, __pyx_k__6, sizeof(__pyx_k__6), 0, 0, 0, 0},
  {&__pyx_kp_b__7, __pyx_k__7, sizeof(__pyx_k__7), 0, 0, 0, 0},
  {&__pyx_kp_s__9, __pyx_k__9, sizeof(__pyx_k__9), 0, 0, 1, 0},
  {&__pyx_n_s_abort, __pyx_k_abort, sizeof(__pyx_k_abort), 0, 0, 1, 1},
  {&__pyx_n_s_accept_push, __pyx_k_accept_push, sizeof(__pyx_k_accept_push), 0, 0, 1, 1},
  {&__pyx_n_s_add, __pyx_k_add, sizeof(__pyx_k_add), 0, 0, 1, 1},
  {&__pyx_n_s_add_handler, __pyx_k_add_handler, sizeof(__pyx_k_add_handler), 0, 0, 1, 1},
  {&__pyx_kp_s_add_handler_stream_id_s, __pyx_k_add_handler_stream_id_s, sizeof(__pyx_k_add_handler_stream_id_s), 0, 0, 1, 0},
  {&__pyx_n_s_address, __pyx_k_address, sizeof(__pyx_k_address), 0, 0, 1, 1},
  {&__pyx_kp_s_alpn_protocol_s, __pyx_k_alpn_protocol_s, sizeof(__pyx_k_alpn_protocol_s), 0, 0, 1, 0},
  {&__pyx_n_s_app_protos, __pyx_k_app_protos, sizeof(__pyx_k_app_protos), 0, 0, 1, 1},
  {&__pyx_n_s_append, __pyx_k_append, sizeof(__pyx_k_append), 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_kp_b_authority, __pyx_k_authority, sizeof(__pyx_k_authority), 0, 0, 0, 0},
  {&__pyx_n_s_b, __pyx_k_b, sizeof(__pyx_k_b), 0, 0, 1, 1},
  {&__pyx_n_s_body, __pyx_k_body, sizeof(__pyx_k_body), 0, 0, 1, 1},
  {&__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_client, __pyx_k_client, sizeof(__pyx_k_client), 0, 0, 1, 1},
  {&__pyx_n_s_client_address, __pyx_k_client_address, sizeof(__pyx_k_client_address), 0, 0, 1, 1},
  {&__pyx_n_s_client_certificate, __pyx_k_client_certificate, sizeof(__pyx_k_client_certificate), 0, 0, 1, 1},
  {&__pyx_n_s_client_certificate_2, __pyx_k_client_certificate_2, sizeof(__pyx_k_client_certificate_2), 0, 0, 1, 1},
  {&__pyx_kp_s_client_on_frame_recv_type_s_stre, __pyx_k_client_on_frame_recv_type_s_stre, sizeof(__pyx_k_client_on_frame_recv_type_s_stre), 0, 0, 1, 0},
  {&__pyx_kp_s_client_on_frame_send_type_s_stre, __pyx_k_client_on_frame_send_type_s_stre, sizeof(__pyx_k_client_on_frame_send_type_s_stre), 0, 0, 1, 0},
  {&__pyx_kp_s_client_on_header_type_s_stream_i, __pyx_k_client_on_header_type_s_stream_i, sizeof(__pyx_k_client_on_header_type_s_stream_i), 0, 0, 1, 0},
  {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
  {&__pyx_n_s_close, __pyx_k_close, sizeof(__pyx_k_close), 0, 0, 1, 1},
  {&__pyx_kp_s_connect_address_s_port_s, __pyx_k_connect_address_s_port_s, sizeof(__pyx_k_connect_address_s_port_s), 0, 0, 1, 0},
  {&__pyx_n_s_connection_lost, __pyx_k_connection_lost, sizeof(__pyx_k_connection_lost), 0, 0, 1, 1},
  {&__pyx_n_s_connection_made, __pyx_k_connection_made, sizeof(__pyx_k_connection_made), 0, 0, 1, 1},
  {&__pyx_kp_s_connection_made_address_s_port_s, __pyx_k_connection_made_address_s_port_s, sizeof(__pyx_k_connection_made_address_s_port_s), 0, 0, 1, 0},
  {&__pyx_n_b_cookie, __pyx_k_cookie, sizeof(__pyx_k_cookie), 0, 0, 0, 1},
  {&__pyx_n_s_cookies, __pyx_k_cookies, sizeof(__pyx_k_cookies), 0, 0, 1, 1},
  {&__pyx_n_s_coro, __pyx_k_coro, sizeof(__pyx_k_coro), 0, 0, 1, 1},
  {&__pyx_n_s_create_connection, __pyx_k_create_connection, sizeof(__pyx_k_create_connection), 0, 0, 1, 1},
  {&__pyx_n_s_create_server, __pyx_k_create_server, sizeof(__pyx_k_create_server), 0, 0, 1, 1},
  {&__pyx_n_s_data, __pyx_k_data, sizeof(__pyx_k_data), 0, 0, 1, 1},
  {&__pyx_n_s_data_received, __pyx_k_data_received, sizeof(__pyx_k_data_received), 0, 0, 1, 1},
  {&__pyx_n_s_datetime, __pyx_k_datetime, sizeof(__pyx_k_datetime), 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_doc, __pyx_k_doc, sizeof(__pyx_k_doc), 0, 0, 1, 1},
  {&__pyx_n_s_e, __pyx_k_e, sizeof(__pyx_k_e), 0, 0, 1, 1},
  {&__pyx_n_s_email, __pyx_k_email, sizeof(__pyx_k_email), 0, 0, 1, 1},
  {&__pyx_n_s_email_utils, __pyx_k_email_utils, sizeof(__pyx_k_email_utils), 0, 0, 1, 1},
  {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1},
  {&__pyx_n_s_encode_headers, __pyx_k_encode_headers, sizeof(__pyx_k_encode_headers), 0, 0, 1, 1},
  {&__pyx_n_s_end, __pyx_k_end, sizeof(__pyx_k_end), 0, 0, 1, 1},
  {&__pyx_n_s_enter_callback, __pyx_k_enter_callback, sizeof(__pyx_k_enter_callback), 0, 0, 1, 1},
  {&__pyx_n_s_entry, __pyx_k_entry, sizeof(__pyx_k_entry), 0, 0, 1, 1},
  {&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1},
  {&__pyx_n_s_err, __pyx_k_err, sizeof(__pyx_k_err), 0, 0, 1, 1},
  {&__pyx_n_s_error_code, __pyx_k_error_code, sizeof(__pyx_k_error_code), 0, 0, 1, 1},
  {&__pyx_n_s_exc, __pyx_k_exc, sizeof(__pyx_k_exc), 0, 0, 1, 1},
  {&__pyx_n_s_extend, __pyx_k_extend, sizeof(__pyx_k_extend), 0, 0, 1, 1},
  {&__pyx_kp_s_failed_to_set_tcp_nodelay_s, __pyx_k_failed_to_set_tcp_nodelay_s, sizeof(__pyx_k_failed_to_set_tcp_nodelay_s), 0, 0, 1, 0},
  {&__pyx_n_s_file, __pyx_k_file, sizeof(__pyx_k_file), 0, 0, 1, 1},
  {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1},
  {&__pyx_n_s_format_exc, __pyx_k_format_exc, sizeof(__pyx_k_format_exc), 0, 0, 1, 1},
  {&__pyx_n_s_formatdate, __pyx_k_formatdate, sizeof(__pyx_k_formatdate), 0, 0, 1, 1},
  {&__pyx_n_s_fragment, __pyx_k_fragment, sizeof(__pyx_k_fragment), 0, 0, 1, 1},
  {&__pyx_n_s_generate, __pyx_k_generate, sizeof(__pyx_k_generate), 0, 0, 1, 1},
  {&__pyx_n_s_get_client_certificate, __pyx_k_get_client_certificate, sizeof(__pyx_k_get_client_certificate), 0, 0, 1, 1},
  {&__pyx_n_s_get_event_loop, __pyx_k_get_event_loop, sizeof(__pyx_k_get_event_loop), 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_remote_address, __pyx_k_get_remote_address, sizeof(__pyx_k_get_remote_address), 0, 0, 1, 1},
  {&__pyx_n_s_get_write_buffer_size, __pyx_k_get_write_buffer_size, sizeof(__pyx_k_get_write_buffer_size), 0, 0, 1, 1},
  {&__pyx_n_s_getpeercert, __pyx_k_getpeercert, sizeof(__pyx_k_getpeercert), 0, 0, 1, 1},
  {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1},
  {&__pyx_n_s_handler, __pyx_k_handler, sizeof(__pyx_k_handler), 0, 0, 1, 1},
  {&__pyx_n_s_handler_class, __pyx_k_handler_class, sizeof(__pyx_k_handler_class), 0, 0, 1, 1},
  {&__pyx_n_s_hd_table_bufsize_max, __pyx_k_hd_table_bufsize_max, sizeof(__pyx_k_hd_table_bufsize_max), 0, 0, 1, 1},
  {&__pyx_n_s_hdtable, __pyx_k_hdtable, sizeof(__pyx_k_hdtable), 0, 0, 1, 1},
  {&__pyx_n_s_headers, __pyx_k_headers, sizeof(__pyx_k_headers), 0, 0, 1, 1},
  {&__pyx_kp_s_home_BWI_src_cygwin_nghttp2_ngh, __pyx_k_home_BWI_src_cygwin_nghttp2_ngh, sizeof(__pyx_k_home_BWI_src_cygwin_nghttp2_ngh), 0, 0, 1, 0},
  {&__pyx_n_b_host, __pyx_k_host, sizeof(__pyx_k_host), 0, 0, 0, 1},
  {&__pyx_n_s_host, __pyx_k_host, sizeof(__pyx_k_host), 0, 0, 1, 1},
  {&__pyx_n_s_http, __pyx_k_http, sizeof(__pyx_k_http), 0, 0, 1, 1},
  {&__pyx_n_s_http2, __pyx_k_http2, sizeof(__pyx_k_http2), 0, 0, 1, 1},
  {&__pyx_n_s_https, __pyx_k_https, sizeof(__pyx_k_https), 0, 0, 1, 1},
  {&__pyx_n_s_idx, __pyx_k_idx, sizeof(__pyx_k_idx), 0, 0, 1, 1},
  {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
  {&__pyx_n_s_info, __pyx_k_info, sizeof(__pyx_k_info), 0, 0, 1, 1},
  {&__pyx_n_s_init, __pyx_k_init, sizeof(__pyx_k_init), 0, 0, 1, 1},
  {&__pyx_n_s_inspect, __pyx_k_inspect, sizeof(__pyx_k_inspect), 0, 0, 1, 1},
  {&__pyx_n_s_io, __pyx_k_io, sizeof(__pyx_k_io), 0, 0, 1, 1},
  {&__pyx_n_s_io_loop, __pyx_k_io_loop, sizeof(__pyx_k_io_loop), 0, 0, 1, 1},
  {&__pyx_n_s_join, __pyx_k_join, sizeof(__pyx_k_join), 0, 0, 1, 1},
  {&__pyx_n_s_k, __pyx_k_k, sizeof(__pyx_k_k), 0, 0, 1, 1},
  {&__pyx_n_s_leave_callback, __pyx_k_leave_callback, sizeof(__pyx_k_leave_callback), 0, 0, 1, 1},
  {&__pyx_kp_s_listen_address_s_port_s, __pyx_k_listen_address_s_port_s, sizeof(__pyx_k_listen_address_s_port_s), 0, 0, 1, 0},
  {&__pyx_n_s_localtime, __pyx_k_localtime, sizeof(__pyx_k_localtime), 0, 0, 1, 1},
  {&__pyx_n_s_log_request, __pyx_k_log_request, sizeof(__pyx_k_log_request), 0, 0, 1, 1},
  {&__pyx_n_s_logging, __pyx_k_logging, sizeof(__pyx_k_logging), 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_make_handler, __pyx_k_make_handler, sizeof(__pyx_k_make_handler), 0, 0, 1, 1},
  {&__pyx_kp_s_make_handler_stream_id_s, __pyx_k_make_handler_stream_id_s, sizeof(__pyx_k_make_handler_stream_id_s), 0, 0, 1, 0},
  {&__pyx_n_s_metaclass, __pyx_k_metaclass, sizeof(__pyx_k_metaclass), 0, 0, 1, 1},
  {&__pyx_kp_b_method, __pyx_k_method, sizeof(__pyx_k_method), 0, 0, 0, 0},
  {&__pyx_n_s_method_2, __pyx_k_method_2, sizeof(__pyx_k_method_2), 0, 0, 1, 1},
  {&__pyx_kp_s_method_must_not_be_empty, __pyx_k_method_must_not_be_empty, sizeof(__pyx_k_method_must_not_be_empty), 0, 0, 1, 0},
  {&__pyx_n_s_mktime, __pyx_k_mktime, sizeof(__pyx_k_mktime), 0, 0, 1, 1},
  {&__pyx_n_s_module, __pyx_k_module, sizeof(__pyx_k_module), 0, 0, 1, 1},
  {&__pyx_n_s_n, __pyx_k_n, sizeof(__pyx_k_n), 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_namelen, __pyx_k_namelen, sizeof(__pyx_k_namelen), 0, 0, 1, 1},
  {&__pyx_n_s_negotiated_protocol, __pyx_k_negotiated_protocol, sizeof(__pyx_k_negotiated_protocol), 0, 0, 1, 1},
  {&__pyx_n_s_netloc, __pyx_k_netloc, sizeof(__pyx_k_netloc), 0, 0, 1, 1},
  {&__pyx_n_s_nghttp2, __pyx_k_nghttp2, sizeof(__pyx_k_nghttp2), 0, 0, 1, 1},
  {&__pyx_kp_s_nghttp2_session_callbacks_new_fa, __pyx_k_nghttp2_session_callbacks_new_fa, sizeof(__pyx_k_nghttp2_session_callbacks_new_fa), 0, 0, 1, 0},
  {&__pyx_kp_s_nghttp2_session_client_new_faile, __pyx_k_nghttp2_session_client_new_faile, sizeof(__pyx_k_nghttp2_session_client_new_faile), 0, 0, 1, 0},
  {&__pyx_kp_s_nghttp2_session_mem_recv_failed, __pyx_k_nghttp2_session_mem_recv_failed, sizeof(__pyx_k_nghttp2_session_mem_recv_failed), 0, 0, 1, 0},
  {&__pyx_kp_s_nghttp2_session_mem_send_failed, __pyx_k_nghttp2_session_mem_send_failed, sizeof(__pyx_k_nghttp2_session_mem_send_failed), 0, 0, 1, 0},
  {&__pyx_kp_s_nghttp2_session_server_new_faile, __pyx_k_nghttp2_session_server_new_faile, sizeof(__pyx_k_nghttp2_session_server_new_faile), 0, 0, 1, 0},
  {&__pyx_kp_s_nghttp2_submit_push_promise_fail, __pyx_k_nghttp2_submit_push_promise_fail, sizeof(__pyx_k_nghttp2_submit_push_promise_fail), 0, 0, 1, 0},
  {&__pyx_kp_s_nghttp2_submit_request_failed, __pyx_k_nghttp2_submit_request_failed, sizeof(__pyx_k_nghttp2_submit_request_failed), 0, 0, 1, 0},
  {&__pyx_kp_s_nghttp2_submit_response_failed, __pyx_k_nghttp2_submit_response_failed, sizeof(__pyx_k_nghttp2_submit_response_failed), 0, 0, 1, 0},
  {&__pyx_kp_s_nghttp2_submit_settings_failed, __pyx_k_nghttp2_submit_settings_failed, sizeof(__pyx_k_nghttp2_submit_settings_failed), 0, 0, 1, 0},
  {&__pyx_kp_s_no_default___reduce___due_to_non, __pyx_k_no_default___reduce___due_to_non, sizeof(__pyx_k_no_default___reduce___due_to_non), 0, 0, 1, 0},
  {&__pyx_n_s_now, __pyx_k_now, sizeof(__pyx_k_now), 0, 0, 1, 1},
  {&__pyx_kp_s_npn_protocol_s, __pyx_k_npn_protocol_s, sizeof(__pyx_k_npn_protocol_s), 0, 0, 1, 0},
  {&__pyx_n_s_on_close, __pyx_k_on_close, sizeof(__pyx_k_on_close), 0, 0, 1, 1},
  {&__pyx_n_s_on_data, __pyx_k_on_data, sizeof(__pyx_k_on_data), 0, 0, 1, 1},
  {&__pyx_n_s_on_headers, __pyx_k_on_headers, sizeof(__pyx_k_on_headers), 0, 0, 1, 1},
  {&__pyx_n_s_on_push_promise, __pyx_k_on_push_promise, sizeof(__pyx_k_on_push_promise), 0, 0, 1, 1},
  {&__pyx_n_s_on_request_done, __pyx_k_on_request_done, sizeof(__pyx_k_on_request_done), 0, 0, 1, 1},
  {&__pyx_n_s_on_response_done, __pyx_k_on_response_done, sizeof(__pyx_k_on_response_done), 0, 0, 1, 1},
  {&__pyx_kp_s_on_stream_close_stream_id_s, __pyx_k_on_stream_close_stream_id_s, sizeof(__pyx_k_on_stream_close_stream_id_s), 0, 0, 1, 0},
  {&__pyx_n_s_params, __pyx_k_params, sizeof(__pyx_k_params), 0, 0, 1, 1},
  {&__pyx_kp_b_path, __pyx_k_path, sizeof(__pyx_k_path), 0, 0, 0, 0},
  {&__pyx_n_s_path_2, __pyx_k_path_2, sizeof(__pyx_k_path_2), 0, 0, 1, 1},
  {&__pyx_kp_s_path_must_not_be_empty, __pyx_k_path_must_not_be_empty, sizeof(__pyx_k_path_must_not_be_empty), 0, 0, 1, 0},
  {&__pyx_n_s_peername, __pyx_k_peername, sizeof(__pyx_k_peername), 0, 0, 1, 1},
  {&__pyx_n_s_pending, __pyx_k_pending, sizeof(__pyx_k_pending), 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_print, __pyx_k_print, sizeof(__pyx_k_print), 0, 0, 1, 1},
  {&__pyx_n_s_print_hd_table, __pyx_k_print_hd_table, sizeof(__pyx_k_print_hd_table), 0, 0, 1, 1},
  {&__pyx_n_s_promised_handler, __pyx_k_promised_handler, sizeof(__pyx_k_promised_handler), 0, 0, 1, 1},
  {&__pyx_n_s_property, __pyx_k_property, sizeof(__pyx_k_property), 0, 0, 1, 1},
  {&__pyx_n_s_protocol, __pyx_k_protocol, sizeof(__pyx_k_protocol), 0, 0, 1, 1},
  {&__pyx_n_s_push, __pyx_k_push, sizeof(__pyx_k_push), 0, 0, 1, 1},
  {&__pyx_n_s_push_promise, __pyx_k_push_promise, sizeof(__pyx_k_push_promise), 0, 0, 1, 1},
  {&__pyx_kp_s_push_stream_id_s, __pyx_k_push_stream_id_s, sizeof(__pyx_k_push_stream_id_s), 0, 0, 1, 0},
  {&__pyx_n_s_pushed, __pyx_k_pushed, sizeof(__pyx_k_pushed), 0, 0, 1, 1},
  {&__pyx_n_s_qualname, __pyx_k_qualname, sizeof(__pyx_k_qualname), 0, 0, 1, 1},
  {&__pyx_n_s_query, __pyx_k_query, sizeof(__pyx_k_query), 0, 0, 1, 1},
  {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
  {&__pyx_n_s_read1, __pyx_k_read1, sizeof(__pyx_k_read1), 0, 0, 1, 1},
  {&__pyx_n_s_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1},
  {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1},
  {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1},
  {&__pyx_n_s_reject_push, __pyx_k_reject_push, sizeof(__pyx_k_reject_push), 0, 0, 1, 1},
  {&__pyx_n_s_remote_address, __pyx_k_remote_address, sizeof(__pyx_k_remote_address), 0, 0, 1, 1},
  {&__pyx_n_s_remove, __pyx_k_remove, sizeof(__pyx_k_remove), 0, 0, 1, 1},
  {&__pyx_n_s_remove_handler, __pyx_k_remove_handler, sizeof(__pyx_k_remove_handler), 0, 0, 1, 1},
  {&__pyx_kp_s_remove_handler_stream_id_s, __pyx_k_remove_handler_stream_id_s, sizeof(__pyx_k_remove_handler_stream_id_s), 0, 0, 1, 0},
  {&__pyx_n_s_request_headers, __pyx_k_request_headers, sizeof(__pyx_k_request_headers), 0, 0, 1, 1},
  {&__pyx_kp_s_request_stream_id_s, __pyx_k_request_stream_id_s, sizeof(__pyx_k_request_stream_id_s), 0, 0, 1, 0},
  {&__pyx_n_s_response_body, __pyx_k_response_body, sizeof(__pyx_k_response_body), 0, 0, 1, 1},
  {&__pyx_kp_s_response_has_already_been_sent, __pyx_k_response_has_already_been_sent, sizeof(__pyx_k_response_has_already_been_sent), 0, 0, 1, 0},
  {&__pyx_n_s_response_headers, __pyx_k_response_headers, sizeof(__pyx_k_response_headers), 0, 0, 1, 1},
  {&__pyx_n_s_resume, __pyx_k_resume, sizeof(__pyx_k_resume), 0, 0, 1, 1},
  {&__pyx_n_s_resume_writing, __pyx_k_resume_writing, sizeof(__pyx_k_resume_writing), 0, 0, 1, 1},
  {&__pyx_n_s_rst_stream, __pyx_k_rst_stream, sizeof(__pyx_k_rst_stream), 0, 0, 1, 1},
  {&__pyx_n_s_run_forever, __pyx_k_run_forever, sizeof(__pyx_k_run_forever), 0, 0, 1, 1},
  {&__pyx_n_s_run_until_complete, __pyx_k_run_until_complete, sizeof(__pyx_k_run_until_complete), 0, 0, 1, 1},
  {&__pyx_kp_s_s, __pyx_k_s, sizeof(__pyx_k_s), 0, 0, 1, 0},
  {&__pyx_kp_s_s_s_s_s_HTTP_2_s_s, __pyx_k_s_s_s_s_HTTP_2_s_s, sizeof(__pyx_k_s_s_s_s_HTTP_2_s_s), 0, 0, 1, 0},
  {&__pyx_kp_b_scheme, __pyx_k_scheme, sizeof(__pyx_k_scheme), 0, 0, 0, 0},
  {&__pyx_n_s_scheme_2, __pyx_k_scheme_2, sizeof(__pyx_k_scheme_2), 0, 0, 1, 1},
  {&__pyx_n_s_selected_alpn_protocol, __pyx_k_selected_alpn_protocol, sizeof(__pyx_k_selected_alpn_protocol), 0, 0, 1, 1},
  {&__pyx_n_s_selected_npn_protocol, __pyx_k_selected_npn_protocol, sizeof(__pyx_k_selected_npn_protocol), 0, 0, 1, 1},
  {&__pyx_n_s_self, __pyx_k_self, sizeof(__pyx_k_self), 0, 0, 1, 1},
  {&__pyx_n_s_send_data, __pyx_k_send_data, sizeof(__pyx_k_send_data), 0, 0, 1, 1},
  {&__pyx_n_s_send_pending, __pyx_k_send_pending, sizeof(__pyx_k_send_pending), 0, 0, 1, 1},
  {&__pyx_n_s_send_request, __pyx_k_send_request, sizeof(__pyx_k_send_request), 0, 0, 1, 1},
  {&__pyx_n_s_send_response, __pyx_k_send_response, sizeof(__pyx_k_send_response), 0, 0, 1, 1},
  {&__pyx_kp_s_send_response_stream_id_s, __pyx_k_send_response_stream_id_s, sizeof(__pyx_k_send_response_stream_id_s), 0, 0, 1, 0},
  {&__pyx_n_s_serve_forever, __pyx_k_serve_forever, sizeof(__pyx_k_serve_forever), 0, 0, 1, 1},
  {&__pyx_n_s_server, __pyx_k_server, sizeof(__pyx_k_server), 0, 0, 1, 1},
  {&__pyx_n_s_server_address, __pyx_k_server_address, sizeof(__pyx_k_server_address), 0, 0, 1, 1},
  {&__pyx_kp_s_server_on_frame_not_send_type_s, __pyx_k_server_on_frame_not_send_type_s, sizeof(__pyx_k_server_on_frame_not_send_type_s), 0, 0, 1, 0},
  {&__pyx_kp_s_server_on_frame_recv_type_s_stre, __pyx_k_server_on_frame_recv_type_s_stre, sizeof(__pyx_k_server_on_frame_recv_type_s_stre), 0, 0, 1, 0},
  {&__pyx_kp_s_server_on_frame_send_type_s_stre, __pyx_k_server_on_frame_send_type_s_stre, sizeof(__pyx_k_server_on_frame_send_type_s_stre), 0, 0, 1, 0},
  {&__pyx_kp_s_server_on_header_type_s_stream_i, __pyx_k_server_on_header_type_s_stream_i, sizeof(__pyx_k_server_on_header_type_s_stream_i), 0, 0, 1, 0},
  {&__pyx_n_s_session, __pyx_k_session, sizeof(__pyx_k_session), 0, 0, 1, 1},
  {&__pyx_n_s_session_factory, __pyx_k_session_factory, sizeof(__pyx_k_session_factory), 0, 0, 1, 1},
  {&__pyx_n_s_set_alpn_protocols, __pyx_k_set_alpn_protocols, sizeof(__pyx_k_set_alpn_protocols), 0, 0, 1, 1},
  {&__pyx_n_s_set_application_protocol, __pyx_k_set_application_protocol, sizeof(__pyx_k_set_application_protocol), 0, 0, 1, 1},
  {&__pyx_n_s_set_npn_protocols, __pyx_k_set_npn_protocols, sizeof(__pyx_k_set_npn_protocols), 0, 0, 1, 1},
  {&__pyx_n_s_set_response_prop, __pyx_k_set_response_prop, sizeof(__pyx_k_set_response_prop), 0, 0, 1, 1},
  {&__pyx_n_s_setsockopt, __pyx_k_setsockopt, sizeof(__pyx_k_setsockopt), 0, 0, 1, 1},
  {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1},
  {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1},
  {&__pyx_n_s_settings_timeout, __pyx_k_settings_timeout, sizeof(__pyx_k_settings_timeout), 0, 0, 1, 1},
  {&__pyx_n_s_sock, __pyx_k_sock, sizeof(__pyx_k_sock), 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_split, __pyx_k_split, sizeof(__pyx_k_split), 0, 0, 1, 1},
  {&__pyx_n_s_ssl, __pyx_k_ssl, sizeof(__pyx_k_ssl), 0, 0, 1, 1},
  {&__pyx_n_s_ssl_ctx, __pyx_k_ssl_ctx, sizeof(__pyx_k_ssl_ctx), 0, 0, 1, 1},
  {&__pyx_n_s_ssl_obj, __pyx_k_ssl_obj, sizeof(__pyx_k_ssl_obj), 0, 0, 1, 1},
  {&__pyx_n_s_ssl_object, __pyx_k_ssl_object, sizeof(__pyx_k_ssl_object), 0, 0, 1, 1},
  {&__pyx_n_s_sslcontext, __pyx_k_sslcontext, sizeof(__pyx_k_sslcontext), 0, 0, 1, 1},
  {&__pyx_n_s_start_settings_timer, __pyx_k_start_settings_timer, sizeof(__pyx_k_start_settings_timer), 0, 0, 1, 1},
  {&__pyx_kp_b_status, __pyx_k_status, sizeof(__pyx_k_status), 0, 0, 0, 0},
  {&__pyx_n_s_status_2, __pyx_k_status_2, sizeof(__pyx_k_status_2), 0, 0, 1, 1},
  {&__pyx_kp_s_status_must_not_be_empty, __pyx_k_status_must_not_be_empty, sizeof(__pyx_k_status_must_not_be_empty), 0, 0, 1, 0},
  {&__pyx_n_s_stderr, __pyx_k_stderr, sizeof(__pyx_k_stderr), 0, 0, 1, 1},
  {&__pyx_n_s_stop_settings_timer, __pyx_k_stop_settings_timer, sizeof(__pyx_k_stop_settings_timer), 0, 0, 1, 1},
  {&__pyx_n_s_stream_id, __pyx_k_stream_id, sizeof(__pyx_k_stream_id), 0, 0, 1, 1},
  {&__pyx_n_s_super, __pyx_k_super, sizeof(__pyx_k_super), 0, 0, 1, 1},
  {&__pyx_n_s_sys, __pyx_k_sys, sizeof(__pyx_k_sys), 0, 0, 1, 1},
  {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
  {&__pyx_n_s_time, __pyx_k_time, sizeof(__pyx_k_time), 0, 0, 1, 1},
  {&__pyx_n_s_timetuple, __pyx_k_timetuple, sizeof(__pyx_k_timetuple), 0, 0, 1, 1},
  {&__pyx_n_s_timeval, __pyx_k_timeval, sizeof(__pyx_k_timeval), 0, 0, 1, 1},
  {&__pyx_n_s_tls, __pyx_k_tls, sizeof(__pyx_k_tls), 0, 0, 1, 1},
  {&__pyx_n_s_traceback, __pyx_k_traceback, sizeof(__pyx_k_traceback), 0, 0, 1, 1},
  {&__pyx_n_s_transport, __pyx_k_transport, sizeof(__pyx_k_transport), 0, 0, 1, 1},
  {&__pyx_n_s_url, __pyx_k_url, sizeof(__pyx_k_url), 0, 0, 1, 1},
  {&__pyx_n_s_urllib_parse, __pyx_k_urllib_parse, sizeof(__pyx_k_urllib_parse), 0, 0, 1, 1},
  {&__pyx_n_s_urlparse, __pyx_k_urlparse, sizeof(__pyx_k_urlparse), 0, 0, 1, 1},
  {&__pyx_n_s_usegmt, __pyx_k_usegmt, sizeof(__pyx_k_usegmt), 0, 0, 1, 1},
  {&__pyx_kp_s_utf_8, __pyx_k_utf_8, sizeof(__pyx_k_utf_8), 0, 0, 1, 0},
  {&__pyx_n_s_utils, __pyx_k_utils, sizeof(__pyx_k_utils), 0, 0, 1, 1},
  {&__pyx_n_s_v, __pyx_k_v, sizeof(__pyx_k_v), 0, 0, 1, 1},
  {&__pyx_n_s_value, __pyx_k_value, sizeof(__pyx_k_value), 0, 0, 1, 1},
  {&__pyx_n_s_valuelen, __pyx_k_valuelen, sizeof(__pyx_k_valuelen), 0, 0, 1, 1},
  {&__pyx_n_s_wrap_body, __pyx_k_wrap_body, sizeof(__pyx_k_wrap_body), 0, 0, 1, 1},
  {&__pyx_n_s_write, __pyx_k_write, sizeof(__pyx_k_write), 0, 0, 1, 1},
  {0, 0, 0, 0, 0, 0, 0}
};
static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
  __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(0, 265, __pyx_L1_error)
  __pyx_builtin_property = __Pyx_GetBuiltinName(__pyx_n_s_property); if (!__pyx_builtin_property) __PYX_ERR(0, 1131, __pyx_L1_error)
  __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 152, __pyx_L1_error)
  __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(1, 2, __pyx_L1_error)
  __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(0, 334, __pyx_L1_error)
  __pyx_builtin_AttributeError = __Pyx_GetBuiltinName(__pyx_n_s_AttributeError); if (!__pyx_builtin_AttributeError) __PYX_ERR(0, 759, __pyx_L1_error)
  __pyx_builtin_super = __Pyx_GetBuiltinName(__pyx_n_s_super); if (!__pyx_builtin_super) __PYX_ERR(0, 821, __pyx_L1_error)
  __pyx_builtin_OSError = __Pyx_GetBuiltinName(__pyx_n_s_OSError); if (!__pyx_builtin_OSError) __PYX_ERR(0, 1304, __pyx_L1_error)
  return 0;
  __pyx_L1_error:;
  return -1;
}

static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */
  __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__2);
  __Pyx_GIVEREF(__pyx_tuple__2);

  /* "(tree fragment)":4
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 */
  __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__3);
  __Pyx_GIVEREF(__pyx_tuple__3);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */
  __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__4);
  __Pyx_GIVEREF(__pyx_tuple__4);

  /* "(tree fragment)":4
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 */
  __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__5);
  __Pyx_GIVEREF(__pyx_tuple__5);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */
  __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__10);
  __Pyx_GIVEREF(__pyx_tuple__10);

  /* "(tree fragment)":4
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 */
  __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__11);
  __Pyx_GIVEREF(__pyx_tuple__11);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */
  __pyx_tuple__12 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__12);
  __Pyx_GIVEREF(__pyx_tuple__12);

  /* "(tree fragment)":4
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 */
  __pyx_tuple__13 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__13);
  __Pyx_GIVEREF(__pyx_tuple__13);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */
  __pyx_tuple__14 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__14);
  __Pyx_GIVEREF(__pyx_tuple__14);

  /* "(tree fragment)":4
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 */
  __pyx_tuple__15 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__15);
  __Pyx_GIVEREF(__pyx_tuple__15);

  /* "nghttp2.pyx":1203
 *             '''
 *             if self.status is not None:
 *                 raise Exception('response has already been sent')             # <<<<<<<<<<<<<<
 * 
 *             if not status:
 */
  __pyx_tuple__16 = PyTuple_Pack(1, __pyx_kp_s_response_has_already_been_sent); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(0, 1203, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__16);
  __Pyx_GIVEREF(__pyx_tuple__16);

  /* "nghttp2.pyx":1206
 * 
 *             if not status:
 *                 raise Exception('status must not be empty')             # <<<<<<<<<<<<<<
 * 
 *             body = wrap_body(body)
 */
  __pyx_tuple__17 = PyTuple_Pack(1, __pyx_kp_s_status_must_not_be_empty); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(0, 1206, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__17);
  __Pyx_GIVEREF(__pyx_tuple__17);

  /* "nghttp2.pyx":1241
 * 
 *             if not method:
 *                 raise Exception('method must not be empty')             # <<<<<<<<<<<<<<
 * 
 *             if not path:
 */
  __pyx_tuple__18 = PyTuple_Pack(1, __pyx_kp_s_method_must_not_be_empty); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(0, 1241, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__18);
  __Pyx_GIVEREF(__pyx_tuple__18);

  /* "nghttp2.pyx":1244
 * 
 *             if not path:
 *                 raise Exception('path must not be empty')             # <<<<<<<<<<<<<<
 * 
 *             body = wrap_body(body)
 */
  __pyx_tuple__19 = PyTuple_Pack(1, __pyx_kp_s_path_must_not_be_empty); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(0, 1244, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__19);
  __Pyx_GIVEREF(__pyx_tuple__19);

  /* "nghttp2.pyx":1364
 * 
 *             '''
 *             def session_factory():             # <<<<<<<<<<<<<<
 *                 return _HTTP2Session(RequestHandlerClass)
 * 
 */
  __pyx_codeobj__20 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_BWI_src_cygwin_nghttp2_ngh, __pyx_n_s_session_factory, 1364, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__20)) __PYX_ERR(0, 1364, __pyx_L1_error)

  /* "nghttp2.pyx":1613
 *             self.address = address
 *             self.session = _HTTP2ClientSession(self)
 *             def session_factory():             # <<<<<<<<<<<<<<
 *                 return self.session
 * 
 */
  __pyx_codeobj__21 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_BWI_src_cygwin_nghttp2_ngh, __pyx_n_s_session_factory, 1613, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__21)) __PYX_ERR(0, 1613, __pyx_L1_error)

  /* "nghttp2.pyx":38
 * class HDTableEntry:
 * 
 *     def __init__(self, name, namelen, value, valuelen):             # <<<<<<<<<<<<<<
 *         self.name = name
 *         self.namelen = namelen
 */
  __pyx_tuple__27 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_name, __pyx_n_s_namelen, __pyx_n_s_value, __pyx_n_s_valuelen); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(0, 38, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__27);
  __Pyx_GIVEREF(__pyx_tuple__27);
  __pyx_codeobj__28 = (PyObject*)__Pyx_PyCode_New(5, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__27, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_BWI_src_cygwin_nghttp2_ngh, __pyx_n_s_init, 38, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__28)) __PYX_ERR(0, 38, __pyx_L1_error)

  /* "nghttp2.pyx":44
 *         self.valuelen = valuelen
 * 
 *     def space(self):             # <<<<<<<<<<<<<<
 *         return self.namelen + self.valuelen + HD_ENTRY_OVERHEAD
 * 
 */
  __pyx_tuple__29 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(0, 44, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__29);
  __Pyx_GIVEREF(__pyx_tuple__29);
  __pyx_codeobj__30 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__29, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_BWI_src_cygwin_nghttp2_ngh, __pyx_n_s_space, 44, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__30)) __PYX_ERR(0, 44, __pyx_L1_error)

  /* "nghttp2.pyx":238
 *     return cnghttp2.nghttp2_strerror(liberror_code).decode('utf-8')
 * 
 * def print_hd_table(hdtable):             # <<<<<<<<<<<<<<
 *     '''Convenient function to print |hdtable| to the standard output. This
 *     function does not work if header name/value cannot be decoded using
 */
  __pyx_tuple__31 = PyTuple_Pack(3, __pyx_n_s_hdtable, __pyx_n_s_idx, __pyx_n_s_entry); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(0, 238, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__31);
  __Pyx_GIVEREF(__pyx_tuple__31);
  __pyx_codeobj__32 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__31, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_BWI_src_cygwin_nghttp2_ngh, __pyx_n_s_print_hd_table, 238, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__32)) __PYX_ERR(0, 238, __pyx_L1_error)

  /* "nghttp2.pyx":275
 * class _ByteIOWrapper:
 * 
 *     def __init__(self, b):             # <<<<<<<<<<<<<<
 *         self.b = b
 * 
 */
  __pyx_tuple__33 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_b); if (unlikely(!__pyx_tuple__33)) __PYX_ERR(0, 275, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__33);
  __Pyx_GIVEREF(__pyx_tuple__33);
  __pyx_codeobj__34 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__33, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_BWI_src_cygwin_nghttp2_ngh, __pyx_n_s_init, 275, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__34)) __PYX_ERR(0, 275, __pyx_L1_error)

  /* "nghttp2.pyx":278
 *         self.b = b
 * 
 *     def generate(self, n):             # <<<<<<<<<<<<<<
 *         data = self.b.read1(n)
 *         if not data:
 */
  __pyx_tuple__35 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_n, __pyx_n_s_data); if (unlikely(!__pyx_tuple__35)) __PYX_ERR(0, 278, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__35);
  __Pyx_GIVEREF(__pyx_tuple__35);
  __pyx_codeobj__36 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__35, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_BWI_src_cygwin_nghttp2_ngh, __pyx_n_s_generate, 278, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__36)) __PYX_ERR(0, 278, __pyx_L1_error)

  /* "nghttp2.pyx":284
 *         return data, DATA_OK
 * 
 * def wrap_body(body):             # <<<<<<<<<<<<<<
 *     if body is None:
 *         return body
 */
  __pyx_tuple__37 = PyTuple_Pack(1, __pyx_n_s_body); if (unlikely(!__pyx_tuple__37)) __PYX_ERR(0, 284, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__37);
  __Pyx_GIVEREF(__pyx_tuple__37);
  __pyx_codeobj__38 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__37, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_BWI_src_cygwin_nghttp2_ngh, __pyx_n_s_wrap_body, 284, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__38)) __PYX_ERR(0, 284, __pyx_L1_error)

  /* "nghttp2.pyx":298
 *         return body
 * 
 * def negotiated_protocol(ssl_obj):             # <<<<<<<<<<<<<<
 *     protocol = ssl_obj.selected_alpn_protocol()
 *     if protocol:
 */
  __pyx_tuple__39 = PyTuple_Pack(2, __pyx_n_s_ssl_obj, __pyx_n_s_protocol); if (unlikely(!__pyx_tuple__39)) __PYX_ERR(0, 298, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__39);
  __Pyx_GIVEREF(__pyx_tuple__39);
  __pyx_codeobj__40 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__39, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_BWI_src_cygwin_nghttp2_ngh, __pyx_n_s_negotiated_protocol, 298, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__40)) __PYX_ERR(0, 298, __pyx_L1_error)

  /* "nghttp2.pyx":311
 *     return None
 * 
 * def set_application_protocol(ssl_ctx):             # <<<<<<<<<<<<<<
 *     app_protos = [cnghttp2.NGHTTP2_PROTO_VERSION_ID.decode('utf-8')]
 *     ssl_ctx.set_npn_protocols(app_protos)
 */
  __pyx_tuple__41 = PyTuple_Pack(2, __pyx_n_s_ssl_ctx, __pyx_n_s_app_protos); if (unlikely(!__pyx_tuple__41)) __PYX_ERR(0, 311, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__41);
  __Pyx_GIVEREF(__pyx_tuple__41);
  __pyx_codeobj__42 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__41, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_BWI_src_cygwin_nghttp2_ngh, __pyx_n_s_set_application_protocol, 311, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__42)) __PYX_ERR(0, 311, __pyx_L1_error)

  /* "nghttp2.pyx":1108
 *         """
 * 
 *         def __init__(self, http2, stream_id):             # <<<<<<<<<<<<<<
 *             self.headers = []
 *             self.cookies = []
 */
  __pyx_tuple__43 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_http2, __pyx_n_s_stream_id); if (unlikely(!__pyx_tuple__43)) __PYX_ERR(0, 1108, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__43);
  __Pyx_GIVEREF(__pyx_tuple__43);
  __pyx_codeobj__44 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__43, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_BWI_src_cygwin_nghttp2_ngh, __pyx_n_s_init, 1108, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__44)) __PYX_ERR(0, 1108, __pyx_L1_error)

  /* "nghttp2.pyx":1132
 * 
 *         @property
 *         def client_address(self):             # <<<<<<<<<<<<<<
 *             return self.remote_address
 * 
 */
  __pyx_tuple__45 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__45)) __PYX_ERR(0, 1132, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__45);
  __Pyx_GIVEREF(__pyx_tuple__45);
  __pyx_codeobj__46 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__45, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_BWI_src_cygwin_nghttp2_ngh, __pyx_n_s_client_address, 1132, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__46)) __PYX_ERR(0, 1132, __pyx_L1_error)

  /* "nghttp2.pyx":1136
 * 
 *         @property
 *         def client_certificate(self):             # <<<<<<<<<<<<<<
 *             return self._client_certificate
 * 
 */
  __pyx_tuple__47 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__47)) __PYX_ERR(0, 1136, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__47);
  __Pyx_GIVEREF(__pyx_tuple__47);
  __pyx_codeobj__48 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__47, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_BWI_src_cygwin_nghttp2_ngh, __pyx_n_s_client_certificate, 1136, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__48)) __PYX_ERR(0, 1136, __pyx_L1_error)

  /* "nghttp2.pyx":1139
 *             return self._client_certificate
 * 
 *         def on_headers(self):             # <<<<<<<<<<<<<<
 * 
 *             '''Called when request HEADERS is arrived.
 */
  __pyx_tuple__49 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__49)) __PYX_ERR(0, 1139, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__49);
  __Pyx_GIVEREF(__pyx_tuple__49);
  __pyx_codeobj__50 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__49, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_BWI_src_cygwin_nghttp2_ngh, __pyx_n_s_on_headers, 1139, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__50)) __PYX_ERR(0, 1139, __pyx_L1_error)

  /* "nghttp2.pyx":1146
 *             pass
 * 
 *         def on_data(self, data):             # <<<<<<<<<<<<<<
 * 
 *             '''Called when a chunk of request body is arrived. This method
 */
  __pyx_tuple__51 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_data); if (unlikely(!__pyx_tuple__51)) __PYX_ERR(0, 1146, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__51);
  __Pyx_GIVEREF(__pyx_tuple__51);
  __pyx_codeobj__52 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__51, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_BWI_src_cygwin_nghttp2_ngh, __pyx_n_s_on_data, 1146, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__52)) __PYX_ERR(0, 1146, __pyx_L1_error)

  /* "nghttp2.pyx":1154
 *             pass
 * 
 *         def on_request_done(self):             # <<<<<<<<<<<<<<
 * 
 *             '''Called when whole request was received
 */
  __pyx_tuple__53 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__53)) __PYX_ERR(0, 1154, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__53);
  __Pyx_GIVEREF(__pyx_tuple__53);
  __pyx_codeobj__54 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__53, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_BWI_src_cygwin_nghttp2_ngh, __pyx_n_s_on_request_done, 1154, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__54)) __PYX_ERR(0, 1154, __pyx_L1_error)

  /* "nghttp2.pyx":1161
 *             pass
 * 
 *         def on_close(self, error_code):             # <<<<<<<<<<<<<<
 * 
 *             '''Called when stream is about to close.
 */
  __pyx_tuple__55 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_error_code); if (unlikely(!__pyx_tuple__55)) __PYX_ERR(0, 1161, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__55);
  __Pyx_GIVEREF(__pyx_tuple__55);
  __pyx_codeobj__56 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__55, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_BWI_src_cygwin_nghttp2_ngh, __pyx_n_s_on_close, 1161, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__56)) __PYX_ERR(0, 1161, __pyx_L1_error)

  /* "nghttp2.pyx":1168
 *             pass
 * 
 *         def send_response(self, status=200, headers=None, body=None):             # <<<<<<<<<<<<<<
 * 
 *             '''Send response. The status is HTTP status code. The headers is
 */
  __pyx_tuple__57 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_status_2, __pyx_n_s_headers, __pyx_n_s_body); if (unlikely(!__pyx_tuple__57)) __PYX_ERR(0, 1168, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__57);
  __Pyx_GIVEREF(__pyx_tuple__57);
  __pyx_codeobj__58 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__57, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_BWI_src_cygwin_nghttp2_ngh, __pyx_n_s_send_response, 1168, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__58)) __PYX_ERR(0, 1168, __pyx_L1_error)
  __pyx_tuple__59 = PyTuple_Pack(3, ((PyObject *)__pyx_int_200), ((PyObject *)Py_None), ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__59)) __PYX_ERR(0, 1168, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__59);
  __Pyx_GIVEREF(__pyx_tuple__59);

  /* "nghttp2.pyx":1213
 *             self.http2.send_response(self)
 * 
 *         def push(self, path, method='GET', request_headers=None,             # <<<<<<<<<<<<<<
 *                  status=200, headers=None, body=None):
 * 
 */
  __pyx_tuple__60 = PyTuple_Pack(8, __pyx_n_s_self, __pyx_n_s_path_2, __pyx_n_s_method_2, __pyx_n_s_request_headers, __pyx_n_s_status_2, __pyx_n_s_headers, __pyx_n_s_body, __pyx_n_s_promised_handler); if (unlikely(!__pyx_tuple__60)) __PYX_ERR(0, 1213, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__60);
  __Pyx_GIVEREF(__pyx_tuple__60);
  __pyx_codeobj__61 = (PyObject*)__Pyx_PyCode_New(7, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__60, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_BWI_src_cygwin_nghttp2_ngh, __pyx_n_s_push, 1213, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__61)) __PYX_ERR(0, 1213, __pyx_L1_error)
  __pyx_tuple__62 = PyTuple_Pack(5, ((PyObject*)__pyx_n_s_GET), ((PyObject *)Py_None), ((PyObject *)__pyx_int_200), ((PyObject *)Py_None), ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__62)) __PYX_ERR(0, 1213, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__62);
  __Pyx_GIVEREF(__pyx_tuple__62);

  /* "nghttp2.pyx":1268
 *             return self.http2.push(self, promised_handler)
 * 
 *         def _set_response_prop(self, status, headers, body):             # <<<<<<<<<<<<<<
 *             self.status = status
 * 
 */
  __pyx_tuple__63 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_status_2, __pyx_n_s_headers, __pyx_n_s_body); if (unlikely(!__pyx_tuple__63)) __PYX_ERR(0, 1268, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__63);
  __Pyx_GIVEREF(__pyx_tuple__63);
  __pyx_codeobj__64 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__63, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_BWI_src_cygwin_nghttp2_ngh, __pyx_n_s_set_response_prop, 1268, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__64)) __PYX_ERR(0, 1268, __pyx_L1_error)

  /* "nghttp2.pyx":1279
 *             self.response_body = body
 * 
 *         def resume(self):             # <<<<<<<<<<<<<<
 *             self.http2.resume(self.stream_id)
 * 
 */
  __pyx_tuple__65 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__65)) __PYX_ERR(0, 1279, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__65);
  __Pyx_GIVEREF(__pyx_tuple__65);
  __pyx_codeobj__66 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__65, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_BWI_src_cygwin_nghttp2_ngh, __pyx_n_s_resume, 1279, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__66)) __PYX_ERR(0, 1279, __pyx_L1_error)

  /* "nghttp2.pyx":1282
 *             self.http2.resume(self.stream_id)
 * 
 *     def _encode_headers(headers):             # <<<<<<<<<<<<<<
 *         if not headers:
 *             return []
 */
  __pyx_tuple__67 = PyTuple_Pack(3, __pyx_n_s_headers, __pyx_n_s_k, __pyx_n_s_v); if (unlikely(!__pyx_tuple__67)) __PYX_ERR(0, 1282, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__67);
  __Pyx_GIVEREF(__pyx_tuple__67);
  __pyx_codeobj__68 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__67, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_BWI_src_cygwin_nghttp2_ngh, __pyx_n_s_encode_headers, 1282, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__68)) __PYX_ERR(0, 1282, __pyx_L1_error)

  /* "nghttp2.pyx":1291
 *     class _HTTP2Session(asyncio.Protocol):
 * 
 *         def __init__(self, RequestHandlerClass):             # <<<<<<<<<<<<<<
 *             asyncio.Protocol.__init__(self)
 *             self.RequestHandlerClass = RequestHandlerClass
 */
  __pyx_tuple__69 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_RequestHandlerClass); if (unlikely(!__pyx_tuple__69)) __PYX_ERR(0, 1291, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__69);
  __Pyx_GIVEREF(__pyx_tuple__69);
  __pyx_codeobj__70 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__69, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_BWI_src_cygwin_nghttp2_ngh, __pyx_n_s_init, 1291, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__70)) __PYX_ERR(0, 1291, __pyx_L1_error)

  /* "nghttp2.pyx":1296
 *             self.http2 = None
 * 
 *         def connection_made(self, transport):             # <<<<<<<<<<<<<<
 *             address = transport.get_extra_info('peername')
 *             logging.info('connection_made, address:%s, port:%s', address[0], address[1])
 */
  __pyx_tuple__71 = PyTuple_Pack(9, __pyx_n_s_self, __pyx_n_s_transport, __pyx_n_s_address, __pyx_n_s_sock, __pyx_n_s_e, __pyx_n_s_ssl_ctx, __pyx_n_s_ssl_obj, __pyx_n_s_protocol, __pyx_n_s_err); if (unlikely(!__pyx_tuple__71)) __PYX_ERR(0, 1296, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__71);
  __Pyx_GIVEREF(__pyx_tuple__71);
  __pyx_codeobj__72 = (PyObject*)__Pyx_PyCode_New(2, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__71, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_BWI_src_cygwin_nghttp2_ngh, __pyx_n_s_connection_made, 1296, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__72)) __PYX_ERR(0, 1296, __pyx_L1_error)

  /* "nghttp2.pyx":1324
 * 
 * 
 *         def connection_lost(self, exc):             # <<<<<<<<<<<<<<
 *             logging.info('connection_lost')
 *             if self.http2:
 */
  __pyx_tuple__73 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_exc); if (unlikely(!__pyx_tuple__73)) __PYX_ERR(0, 1324, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__73);
  __Pyx_GIVEREF(__pyx_tuple__73);
  __pyx_codeobj__74 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__73, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_BWI_src_cygwin_nghttp2_ngh, __pyx_n_s_connection_lost, 1324, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__74)) __PYX_ERR(0, 1324, __pyx_L1_error)

  /* "nghttp2.pyx":1330
 *                 self.http2 = None
 * 
 *         def data_received(self, data):             # <<<<<<<<<<<<<<
 *             try:
 *                 self.http2.data_received(data)
 */
  __pyx_tuple__75 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_data, __pyx_n_s_err); if (unlikely(!__pyx_tuple__75)) __PYX_ERR(0, 1330, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__75);
  __Pyx_GIVEREF(__pyx_tuple__75);
  __pyx_codeobj__76 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__75, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_BWI_src_cygwin_nghttp2_ngh, __pyx_n_s_data_received, 1330, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__76)) __PYX_ERR(0, 1330, __pyx_L1_error)

  /* "nghttp2.pyx":1338
 *                 return
 * 
 *         def resume_writing(self):             # <<<<<<<<<<<<<<
 *             try:
 *                 self.http2.send_data()
 */
  __pyx_tuple__77 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_err); if (unlikely(!__pyx_tuple__77)) __PYX_ERR(0, 1338, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__77);
  __Pyx_GIVEREF(__pyx_tuple__77);
  __pyx_codeobj__78 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__77, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_BWI_src_cygwin_nghttp2_ngh, __pyx_n_s_resume_writing, 1338, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__78)) __PYX_ERR(0, 1338, __pyx_L1_error)

  /* "nghttp2.pyx":1355
 * 
 *         '''
 *         def __init__(self, address, RequestHandlerClass, ssl=None):             # <<<<<<<<<<<<<<
 * 
 *             '''address is a tuple of the listening address and port (e.g.,
 */
  __pyx_tuple__79 = PyTuple_Pack(7, __pyx_n_s_self, __pyx_n_s_address, __pyx_n_s_RequestHandlerClass, __pyx_n_s_ssl, __pyx_n_s_session_factory, __pyx_n_s_session_factory, __pyx_n_s_coro); if (unlikely(!__pyx_tuple__79)) __PYX_ERR(0, 1355, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__79);
  __Pyx_GIVEREF(__pyx_tuple__79);
  __pyx_codeobj__80 = (PyObject*)__Pyx_PyCode_New(4, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__79, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_BWI_src_cygwin_nghttp2_ngh, __pyx_n_s_init, 1355, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__80)) __PYX_ERR(0, 1355, __pyx_L1_error)
  __pyx_tuple__81 = PyTuple_Pack(1, ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__81)) __PYX_ERR(0, 1355, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__81);
  __Pyx_GIVEREF(__pyx_tuple__81);

  /* "nghttp2.pyx":1378
 *             logging.info('listen, address:%s, port:%s', address[0], address[1])
 * 
 *         def serve_forever(self):             # <<<<<<<<<<<<<<
 *             try:
 *                 self.loop.run_forever()
 */
  __pyx_tuple__82 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__82)) __PYX_ERR(0, 1378, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__82);
  __Pyx_GIVEREF(__pyx_tuple__82);
  __pyx_codeobj__83 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__82, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_BWI_src_cygwin_nghttp2_ngh, __pyx_n_s_serve_forever, 1378, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__83)) __PYX_ERR(0, 1378, __pyx_L1_error)

  /* "nghttp2.pyx":1439
 *         """
 * 
 *         def __init__(self, http2=None, stream_id=-1):             # <<<<<<<<<<<<<<
 *             self.headers = []
 *             self.cookies = []
 */
  __pyx_tuple__84 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_http2, __pyx_n_s_stream_id); if (unlikely(!__pyx_tuple__84)) __PYX_ERR(0, 1439, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__84);
  __Pyx_GIVEREF(__pyx_tuple__84);
  __pyx_codeobj__85 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__84, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_BWI_src_cygwin_nghttp2_ngh, __pyx_n_s_init, 1439, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__85)) __PYX_ERR(0, 1439, __pyx_L1_error)
  __pyx_tuple__86 = PyTuple_Pack(2, ((PyObject *)Py_None), ((PyObject *)__pyx_int_neg_1)); if (unlikely(!__pyx_tuple__86)) __PYX_ERR(0, 1439, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__86);
  __Pyx_GIVEREF(__pyx_tuple__86);

  /* "nghttp2.pyx":1461
 * 
 *         @property
 *         def server_address(self):             # <<<<<<<<<<<<<<
 *             return self.remote_address
 * 
 */
  __pyx_tuple__87 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__87)) __PYX_ERR(0, 1461, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__87);
  __Pyx_GIVEREF(__pyx_tuple__87);
  __pyx_codeobj__88 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__87, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_BWI_src_cygwin_nghttp2_ngh, __pyx_n_s_server_address, 1461, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__88)) __PYX_ERR(0, 1461, __pyx_L1_error)

  /* "nghttp2.pyx":1464
 *             return self.remote_address
 * 
 *         def on_headers(self):             # <<<<<<<<<<<<<<
 * 
 *             '''Called when response HEADERS is arrived.
 */
  __pyx_tuple__89 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__89)) __PYX_ERR(0, 1464, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__89);
  __Pyx_GIVEREF(__pyx_tuple__89);
  __pyx_codeobj__90 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__89, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_BWI_src_cygwin_nghttp2_ngh, __pyx_n_s_on_headers, 1464, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__90)) __PYX_ERR(0, 1464, __pyx_L1_error)

  /* "nghttp2.pyx":1471
 *             pass
 * 
 *         def on_data(self, data):             # <<<<<<<<<<<<<<
 * 
 *             '''Called when a chunk of response body is arrived. This method
 */
  __pyx_tuple__91 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_data); if (unlikely(!__pyx_tuple__91)) __PYX_ERR(0, 1471, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__91);
  __Pyx_GIVEREF(__pyx_tuple__91);
  __pyx_codeobj__92 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__91, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_BWI_src_cygwin_nghttp2_ngh, __pyx_n_s_on_data, 1471, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__92)) __PYX_ERR(0, 1471, __pyx_L1_error)

  /* "nghttp2.pyx":1479
 *             pass
 * 
 *         def on_response_done(self):             # <<<<<<<<<<<<<<
 * 
 *             '''Called when whole response was received
 */
  __pyx_tuple__93 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__93)) __PYX_ERR(0, 1479, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__93);
  __Pyx_GIVEREF(__pyx_tuple__93);
  __pyx_codeobj__94 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__93, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_BWI_src_cygwin_nghttp2_ngh, __pyx_n_s_on_response_done, 1479, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__94)) __PYX_ERR(0, 1479, __pyx_L1_error)

  /* "nghttp2.pyx":1486
 *             pass
 * 
 *         def on_close(self, error_code):             # <<<<<<<<<<<<<<
 * 
 *             '''Called when stream is about to close.
 */
  __pyx_tuple__95 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_error_code); if (unlikely(!__pyx_tuple__95)) __PYX_ERR(0, 1486, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__95);
  __Pyx_GIVEREF(__pyx_tuple__95);
  __pyx_codeobj__96 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__95, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_BWI_src_cygwin_nghttp2_ngh, __pyx_n_s_on_close, 1486, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__96)) __PYX_ERR(0, 1486, __pyx_L1_error)

  /* "nghttp2.pyx":1493
 *             pass
 * 
 *         def on_push_promise(self, push_promise):             # <<<<<<<<<<<<<<
 * 
 *             '''Called when a push is promised. Default behavior is to
 */
  __pyx_tuple__97 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_push_promise); if (unlikely(!__pyx_tuple__97)) __PYX_ERR(0, 1493, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__97);
  __Pyx_GIVEREF(__pyx_tuple__97);
  __pyx_codeobj__98 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__97, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_BWI_src_cygwin_nghttp2_ngh, __pyx_n_s_on_push_promise, 1493, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__98)) __PYX_ERR(0, 1493, __pyx_L1_error)

  /* "nghttp2.pyx":1502
 *             self.reject_push(push_promise)
 * 
 *         def reject_push(self, push_promise):             # <<<<<<<<<<<<<<
 * 
 *             '''Convenience method equivalent to calling accept_push
 */
  __pyx_tuple__99 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_push_promise); if (unlikely(!__pyx_tuple__99)) __PYX_ERR(0, 1502, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__99);
  __Pyx_GIVEREF(__pyx_tuple__99);
  __pyx_codeobj__100 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__99, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_BWI_src_cygwin_nghttp2_ngh, __pyx_n_s_reject_push, 1502, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__100)) __PYX_ERR(0, 1502, __pyx_L1_error)

  /* "nghttp2.pyx":1510
 *             self.http2.push(push_promise, None)
 * 
 *         def accept_push(self, push_promise, handler=None):             # <<<<<<<<<<<<<<
 * 
 *             '''Accept a push_promise and provider a handler for the
 */
  __pyx_tuple__101 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_push_promise, __pyx_n_s_handler); if (unlikely(!__pyx_tuple__101)) __PYX_ERR(0, 1510, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__101);
  __Pyx_GIVEREF(__pyx_tuple__101);
  __pyx_codeobj__102 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__101, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_BWI_src_cygwin_nghttp2_ngh, __pyx_n_s_accept_push, 1510, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__102)) __PYX_ERR(0, 1510, __pyx_L1_error)
  __pyx_tuple__103 = PyTuple_Pack(1, ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__103)) __PYX_ERR(0, 1510, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__103);
  __Pyx_GIVEREF(__pyx_tuple__103);

  /* "nghttp2.pyx":1519
 *             self.http2.push(push_promise, handler)
 * 
 *         def resume(self):             # <<<<<<<<<<<<<<
 *             self.http2.resume(self.stream_id)
 * 
 */
  __pyx_tuple__104 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__104)) __PYX_ERR(0, 1519, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__104);
  __Pyx_GIVEREF(__pyx_tuple__104);
  __pyx_codeobj__105 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__104, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_BWI_src_cygwin_nghttp2_ngh, __pyx_n_s_resume, 1519, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__105)) __PYX_ERR(0, 1519, __pyx_L1_error)

  /* "nghttp2.pyx":1524
 *     class _HTTP2ClientSession(asyncio.Protocol):
 * 
 *         def __init__(self, client):             # <<<<<<<<<<<<<<
 *             asyncio.Protocol.__init__(self)
 *             self.http2 = None
 */
  __pyx_tuple__106 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_client); if (unlikely(!__pyx_tuple__106)) __PYX_ERR(0, 1524, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__106);
  __Pyx_GIVEREF(__pyx_tuple__106);
  __pyx_codeobj__107 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__106, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_BWI_src_cygwin_nghttp2_ngh, __pyx_n_s_init, 1524, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__107)) __PYX_ERR(0, 1524, __pyx_L1_error)

  /* "nghttp2.pyx":1530
 *             self.client = client
 * 
 *         def connection_made(self, transport):             # <<<<<<<<<<<<<<
 *             address = transport.get_extra_info('peername')
 *             logging.info('connection_made, address:%s, port:%s', address[0], address[1])
 */
  __pyx_tuple__108 = PyTuple_Pack(15, __pyx_n_s_self, __pyx_n_s_transport, __pyx_n_s_address, __pyx_n_s_sock, __pyx_n_s_ssl_ctx, __pyx_n_s_ssl_obj, __pyx_n_s_protocol, __pyx_n_s_send_pending, __pyx_n_s_method_2, __pyx_n_s_scheme_2, __pyx_n_s_host, __pyx_n_s_path_2, __pyx_n_s_headers, __pyx_n_s_body, __pyx_n_s_handler); if (unlikely(!__pyx_tuple__108)) __PYX_ERR(0, 1530, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__108);
  __Pyx_GIVEREF(__pyx_tuple__108);
  __pyx_codeobj__109 = (PyObject*)__Pyx_PyCode_New(2, 0, 15, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__108, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_BWI_src_cygwin_nghttp2_ngh, __pyx_n_s_connection_made, 1530, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__109)) __PYX_ERR(0, 1530, __pyx_L1_error)

  /* "nghttp2.pyx":1555
 *             self.http2.send_data()
 * 
 *         def connection_lost(self, exc):             # <<<<<<<<<<<<<<
 *             logging.info('connection_lost')
 *             if self.http2:
 */
  __pyx_tuple__110 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_exc); if (unlikely(!__pyx_tuple__110)) __PYX_ERR(0, 1555, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__110);
  __Pyx_GIVEREF(__pyx_tuple__110);
  __pyx_codeobj__111 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__110, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_BWI_src_cygwin_nghttp2_ngh, __pyx_n_s_connection_lost, 1555, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__111)) __PYX_ERR(0, 1555, __pyx_L1_error)

  /* "nghttp2.pyx":1561
 *             self.client.close()
 * 
 *         def data_received(self, data):             # <<<<<<<<<<<<<<
 *             try:
 *                 self.http2.data_received(data)
 */
  __pyx_tuple__112 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_data, __pyx_n_s_err); if (unlikely(!__pyx_tuple__112)) __PYX_ERR(0, 1561, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__112);
  __Pyx_GIVEREF(__pyx_tuple__112);
  __pyx_codeobj__113 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__112, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_BWI_src_cygwin_nghttp2_ngh, __pyx_n_s_data_received, 1561, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__113)) __PYX_ERR(0, 1561, __pyx_L1_error)

  /* "nghttp2.pyx":1569
 *                 return
 * 
 *         def resume_writing(self):             # <<<<<<<<<<<<<<
 *             try:
 *                 self.http2.send_data()
 */
  __pyx_tuple__114 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_err); if (unlikely(!__pyx_tuple__114)) __PYX_ERR(0, 1569, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__114);
  __Pyx_GIVEREF(__pyx_tuple__114);
  __pyx_codeobj__115 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__114, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_BWI_src_cygwin_nghttp2_ngh, __pyx_n_s_resume_writing, 1569, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__115)) __PYX_ERR(0, 1569, __pyx_L1_error)

  /* "nghttp2.pyx":1577
 *                 return
 * 
 *         def send_request(self, method, scheme, host, path, headers, body, handler):             # <<<<<<<<<<<<<<
 *             try:
 * 		# Waiting until connection established
 */
  __pyx_tuple__116 = PyTuple_Pack(9, __pyx_n_s_self, __pyx_n_s_method_2, __pyx_n_s_scheme_2, __pyx_n_s_host, __pyx_n_s_path_2, __pyx_n_s_headers, __pyx_n_s_body, __pyx_n_s_handler, __pyx_n_s_err); if (unlikely(!__pyx_tuple__116)) __PYX_ERR(0, 1577, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__116);
  __Pyx_GIVEREF(__pyx_tuple__116);
  __pyx_codeobj__117 = (PyObject*)__Pyx_PyCode_New(8, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__116, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_BWI_src_cygwin_nghttp2_ngh, __pyx_n_s_send_request, 1577, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__117)) __PYX_ERR(0, 1577, __pyx_L1_error)

  /* "nghttp2.pyx":1592
 *                 return
 * 
 *         def close(self):             # <<<<<<<<<<<<<<
 *             if self.http2:
 *                 self.http2.close()
 */
  __pyx_tuple__118 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__118)) __PYX_ERR(0, 1592, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__118);
  __Pyx_GIVEREF(__pyx_tuple__118);
  __pyx_codeobj__119 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__118, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_BWI_src_cygwin_nghttp2_ngh, __pyx_n_s_close, 1592, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__119)) __PYX_ERR(0, 1592, __pyx_L1_error)

  /* "nghttp2.pyx":1604
 * 
 *         '''
 *         def __init__(self, address, loop=None, ssl=None):             # <<<<<<<<<<<<<<
 * 
 *             '''address is a tuple of the connect address and port (e.g.,
 */
  __pyx_tuple__121 = PyTuple_Pack(8, __pyx_n_s_self, __pyx_n_s_address, __pyx_n_s_loop, __pyx_n_s_ssl, __pyx_n_s_session_factory, __pyx_n_s_session_factory, __pyx_n_s_coro, __pyx_n_s__120); if (unlikely(!__pyx_tuple__121)) __PYX_ERR(0, 1604, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__121);
  __Pyx_GIVEREF(__pyx_tuple__121);
  __pyx_codeobj__122 = (PyObject*)__Pyx_PyCode_New(4, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__121, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_BWI_src_cygwin_nghttp2_ngh, __pyx_n_s_init, 1604, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__122)) __PYX_ERR(0, 1604, __pyx_L1_error)
  __pyx_tuple__123 = PyTuple_Pack(2, ((PyObject *)Py_None), ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__123)) __PYX_ERR(0, 1604, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__123);
  __Pyx_GIVEREF(__pyx_tuple__123);

  /* "nghttp2.pyx":1636
 * 
 *         @property
 *         def io_loop(self):             # <<<<<<<<<<<<<<
 *             return self.loop
 * 
 */
  __pyx_tuple__124 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__124)) __PYX_ERR(0, 1636, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__124);
  __Pyx_GIVEREF(__pyx_tuple__124);
  __pyx_codeobj__125 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__124, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_BWI_src_cygwin_nghttp2_ngh, __pyx_n_s_io_loop, 1636, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__125)) __PYX_ERR(0, 1636, __pyx_L1_error)

  /* "nghttp2.pyx":1639
 *             return self.loop
 * 
 *         def close(self):             # <<<<<<<<<<<<<<
 *             self.session.close()
 * 
 */
  __pyx_tuple__126 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__126)) __PYX_ERR(0, 1639, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__126);
  __Pyx_GIVEREF(__pyx_tuple__126);
  __pyx_codeobj__127 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__126, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_BWI_src_cygwin_nghttp2_ngh, __pyx_n_s_close, 1639, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__127)) __PYX_ERR(0, 1639, __pyx_L1_error)

  /* "nghttp2.pyx":1642
 *             self.session.close()
 * 
 *         def send_request(self, method='GET', url='/', headers=None, body=None, handler=None):             # <<<<<<<<<<<<<<
 *             url = urlparse(url)
 *             scheme = url.scheme if url.scheme else self.scheme
 */
  __pyx_tuple__128 = PyTuple_Pack(9, __pyx_n_s_self, __pyx_n_s_method_2, __pyx_n_s_url, __pyx_n_s_headers, __pyx_n_s_body, __pyx_n_s_handler, __pyx_n_s_scheme_2, __pyx_n_s_host, __pyx_n_s_path_2); if (unlikely(!__pyx_tuple__128)) __PYX_ERR(0, 1642, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__128);
  __Pyx_GIVEREF(__pyx_tuple__128);
  __pyx_codeobj__129 = (PyObject*)__Pyx_PyCode_New(6, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__128, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_BWI_src_cygwin_nghttp2_ngh, __pyx_n_s_send_request, 1642, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__129)) __PYX_ERR(0, 1642, __pyx_L1_error)
  __pyx_tuple__130 = PyTuple_Pack(5, ((PyObject*)__pyx_n_s_GET), ((PyObject*)__pyx_kp_s__22), ((PyObject *)Py_None), ((PyObject *)Py_None), ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__130)) __PYX_ERR(0, 1642, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__130);
  __Pyx_GIVEREF(__pyx_tuple__130);
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}

static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
  if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
  __pyx_float_5_0 = PyFloat_FromDouble(5.0); if (unlikely(!__pyx_float_5_0)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_32 = PyInt_FromLong(32); if (unlikely(!__pyx_int_32)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_200 = PyInt_FromLong(200); if (unlikely(!__pyx_int_200)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_4096 = PyInt_FromLong(4096); if (unlikely(!__pyx_int_4096)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_65535 = PyInt_FromLong(65535L); if (unlikely(!__pyx_int_65535)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  return 0;
  __pyx_L1_error:;
  return -1;
}

static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/

static int __Pyx_modinit_global_init_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
  /*--- Global init code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_variable_export_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
  /*--- Variable export code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_function_export_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
  /*--- Function export code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_type_init_code(void) {
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
  /*--- Type init code ---*/
  if (PyType_Ready(&__pyx_type_7nghttp2_HDDeflater) < 0) __PYX_ERR(0, 50, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7nghttp2_HDDeflater.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7nghttp2_HDDeflater.tp_dictoffset && __pyx_type_7nghttp2_HDDeflater.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7nghttp2_HDDeflater.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_HDDeflater, (PyObject *)&__pyx_type_7nghttp2_HDDeflater) < 0) __PYX_ERR(0, 50, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_7nghttp2_HDDeflater) < 0) __PYX_ERR(0, 50, __pyx_L1_error)
  __pyx_ptype_7nghttp2_HDDeflater = &__pyx_type_7nghttp2_HDDeflater;
  if (PyType_Ready(&__pyx_type_7nghttp2_HDInflater) < 0) __PYX_ERR(0, 159, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7nghttp2_HDInflater.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7nghttp2_HDInflater.tp_dictoffset && __pyx_type_7nghttp2_HDInflater.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7nghttp2_HDInflater.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_HDInflater, (PyObject *)&__pyx_type_7nghttp2_HDInflater) < 0) __PYX_ERR(0, 159, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_7nghttp2_HDInflater) < 0) __PYX_ERR(0, 159, __pyx_L1_error)
  __pyx_ptype_7nghttp2_HDInflater = &__pyx_type_7nghttp2_HDInflater;
  if (PyType_Ready(&__pyx_type_7nghttp2__HTTP2SessionCoreBase) < 0) __PYX_ERR(0, 662, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7nghttp2__HTTP2SessionCoreBase.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7nghttp2__HTTP2SessionCoreBase.tp_dictoffset && __pyx_type_7nghttp2__HTTP2SessionCoreBase.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7nghttp2__HTTP2SessionCoreBase.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_HTTP2SessionCoreBase, (PyObject *)&__pyx_type_7nghttp2__HTTP2SessionCoreBase) < 0) __PYX_ERR(0, 662, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_7nghttp2__HTTP2SessionCoreBase) < 0) __PYX_ERR(0, 662, __pyx_L1_error)
  __pyx_ptype_7nghttp2__HTTP2SessionCoreBase = &__pyx_type_7nghttp2__HTTP2SessionCoreBase;
  __pyx_type_7nghttp2__HTTP2SessionCore.tp_base = __pyx_ptype_7nghttp2__HTTP2SessionCoreBase;
  if (PyType_Ready(&__pyx_type_7nghttp2__HTTP2SessionCore) < 0) __PYX_ERR(0, 815, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7nghttp2__HTTP2SessionCore.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7nghttp2__HTTP2SessionCore.tp_dictoffset && __pyx_type_7nghttp2__HTTP2SessionCore.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7nghttp2__HTTP2SessionCore.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_HTTP2SessionCore, (PyObject *)&__pyx_type_7nghttp2__HTTP2SessionCore) < 0) __PYX_ERR(0, 815, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_7nghttp2__HTTP2SessionCore) < 0) __PYX_ERR(0, 815, __pyx_L1_error)
  __pyx_ptype_7nghttp2__HTTP2SessionCore = &__pyx_type_7nghttp2__HTTP2SessionCore;
  __pyx_type_7nghttp2__HTTP2ClientSessionCore.tp_base = __pyx_ptype_7nghttp2__HTTP2SessionCoreBase;
  if (PyType_Ready(&__pyx_type_7nghttp2__HTTP2ClientSessionCore) < 0) __PYX_ERR(0, 931, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7nghttp2__HTTP2ClientSessionCore.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7nghttp2__HTTP2ClientSessionCore.tp_dictoffset && __pyx_type_7nghttp2__HTTP2ClientSessionCore.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7nghttp2__HTTP2ClientSessionCore.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_HTTP2ClientSessionCore, (PyObject *)&__pyx_type_7nghttp2__HTTP2ClientSessionCore) < 0) __PYX_ERR(0, 931, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_7nghttp2__HTTP2ClientSessionCore) < 0) __PYX_ERR(0, 931, __pyx_L1_error)
  __pyx_ptype_7nghttp2__HTTP2ClientSessionCore = &__pyx_type_7nghttp2__HTTP2ClientSessionCore;
  if (PyType_Ready(&__pyx_type_7nghttp2___pyx_scope_struct____init__) < 0) __PYX_ERR(0, 1355, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7nghttp2___pyx_scope_struct____init__.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7nghttp2___pyx_scope_struct____init__.tp_dictoffset && __pyx_type_7nghttp2___pyx_scope_struct____init__.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7nghttp2___pyx_scope_struct____init__.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_7nghttp2___pyx_scope_struct____init__ = &__pyx_type_7nghttp2___pyx_scope_struct____init__;
  if (PyType_Ready(&__pyx_type_7nghttp2___pyx_scope_struct_1___init__) < 0) __PYX_ERR(0, 1604, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7nghttp2___pyx_scope_struct_1___init__.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7nghttp2___pyx_scope_struct_1___init__.tp_dictoffset && __pyx_type_7nghttp2___pyx_scope_struct_1___init__.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7nghttp2___pyx_scope_struct_1___init__.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_7nghttp2___pyx_scope_struct_1___init__ = &__pyx_type_7nghttp2___pyx_scope_struct_1___init__;
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_modinit_type_import_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
  /*--- Type import code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_variable_import_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
  /*--- Variable import code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_function_import_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
  /*--- Function import code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}


#ifndef CYTHON_NO_PYINIT_EXPORT
#ifdef __cplusplus
#define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
#else
#define __Pyx_PyMODINIT_FUNC PyObject *
#endif
#elif PY_MAJOR_VERSION < 3
#ifdef __cplusplus
#define __Pyx_PyMODINIT_FUNC extern "C" void
#else
#define __Pyx_PyMODINIT_FUNC void
#endif
#else
#ifdef __cplusplus
#define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
#else
#define __Pyx_PyMODINIT_FUNC PyObject *
#endif
#endif


#if PY_MAJOR_VERSION < 3
__Pyx_PyMODINIT_FUNC initnghttp2(void) CYTHON_SMALL_CODE; /*proto*/
__Pyx_PyMODINIT_FUNC initnghttp2(void)
#else
__Pyx_PyMODINIT_FUNC PyInit_nghttp2(void) CYTHON_SMALL_CODE; /*proto*/
__Pyx_PyMODINIT_FUNC PyInit_nghttp2(void)
#if CYTHON_PEP489_MULTI_PHASE_INIT
{
  return PyModuleDef_Init(&__pyx_moduledef);
}
static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
    #if PY_VERSION_HEX >= 0x030700A1
    static PY_INT64_T main_interpreter_id = -1;
    PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
    if (main_interpreter_id == -1) {
        main_interpreter_id = current_id;
        return (unlikely(current_id == -1)) ? -1 : 0;
    } else if (unlikely(main_interpreter_id != current_id))
    #else
    static PyInterpreterState *main_interpreter = NULL;
    PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
    if (!main_interpreter) {
        main_interpreter = current_interpreter;
    } else if (unlikely(main_interpreter != current_interpreter))
    #endif
    {
        PyErr_SetString(
            PyExc_ImportError,
            "Interpreter change detected - this module can only be loaded into one interpreter per process.");
        return -1;
    }
    return 0;
}
static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) {
    PyObject *value = PyObject_GetAttrString(spec, from_name);
    int result = 0;
    if (likely(value)) {
        if (allow_none || value != Py_None) {
            result = PyDict_SetItemString(moddict, to_name, value);
        }
        Py_DECREF(value);
    } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
        PyErr_Clear();
    } else {
        result = -1;
    }
    return result;
}
static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
    PyObject *module = NULL, *moddict, *modname;
    if (__Pyx_check_single_interpreter())
        return NULL;
    if (__pyx_m)
        return __Pyx_NewRef(__pyx_m);
    modname = PyObject_GetAttrString(spec, "name");
    if (unlikely(!modname)) goto bad;
    module = PyModule_NewObject(modname);
    Py_DECREF(modname);
    if (unlikely(!module)) goto bad;
    moddict = PyModule_GetDict(module);
    if (unlikely(!moddict)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
    return module;
bad:
    Py_XDECREF(module);
    return NULL;
}


static CYTHON_SMALL_CODE int __pyx_pymod_exec_nghttp2(PyObject *__pyx_pyinit_module)
#endif
#endif
{
  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;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  if (__pyx_m) {
    if (__pyx_m == __pyx_pyinit_module) return 0;
    PyErr_SetString(PyExc_RuntimeError, "Module 'nghttp2' has already been imported. Re-initialisation is not supported.");
    return -1;
  }
  #elif PY_MAJOR_VERSION >= 3
  if (__pyx_m) return __Pyx_NewRef(__pyx_m);
  #endif
  #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("__Pyx_PyMODINIT_FUNC PyInit_nghttp2(void)", 0);
  if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #ifdef __Pxy_PyFrame_Initialize_Offsets
  __Pxy_PyFrame_Initialize_Offsets();
  #endif
  __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
  #ifdef __Pyx_CyFunction_USED
  if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_FusedFunction_USED
  if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_Coroutine_USED
  if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_Generator_USED
  if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_AsyncGen_USED
  if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_StopAsyncIteration_USED
  if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  /*--- Library function declarations ---*/
  /*--- Threads initialization code ---*/
  #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 && defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
  PyEval_InitThreads();
  #endif
  /*--- Module creation code ---*/
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  __pyx_m = __pyx_pyinit_module;
  Py_INCREF(__pyx_m);
  #else
  #if PY_MAJOR_VERSION < 3
  __pyx_m = Py_InitModule4("nghttp2", __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(0, 1, __pyx_L1_error)
  #endif
  __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
  Py_INCREF(__pyx_d);
  __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
  Py_INCREF(__pyx_b);
  __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
  Py_INCREF(__pyx_cython_runtime);
  if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
  /*--- Initialize various global constants etc. ---*/
  if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 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(0, 1, __pyx_L1_error)
  #endif
  if (__pyx_module_is_main_nghttp2) {
    if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name_2, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  }
  #if PY_MAJOR_VERSION >= 3
  {
    PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
    if (!PyDict_GetItemString(modules, "nghttp2")) {
      if (unlikely(PyDict_SetItemString(modules, "nghttp2", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
    }
  }
  #endif
  /*--- Builtin init code ---*/
  if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  /*--- Constants init code ---*/
  if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  /*--- Global type/function init code ---*/
  (void)__Pyx_modinit_global_init_code();
  (void)__Pyx_modinit_variable_export_code();
  (void)__Pyx_modinit_function_export_code();
  if (unlikely(__Pyx_modinit_type_init_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
  (void)__Pyx_modinit_type_import_code();
  (void)__Pyx_modinit_variable_import_code();
  (void)__Pyx_modinit_function_import_code();
  /*--- Execution code ---*/
  #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
  if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif

  /* "nghttp2.pyx":28
 * from libc.string cimport memcpy, memset
 * from libc.stdint cimport uint8_t, uint16_t, uint32_t, int32_t
 * import logging             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_logging, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 28, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_logging, __pyx_t_1) < 0) __PYX_ERR(0, 28, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "nghttp2.pyx":31
 * 
 * 
 * DEFAULT_HEADER_TABLE_SIZE = cnghttp2.NGHTTP2_DEFAULT_HEADER_TABLE_SIZE             # <<<<<<<<<<<<<<
 * DEFLATE_MAX_HEADER_TABLE_SIZE = 4096
 * 
 */
  __pyx_t_1 = __Pyx_PyInt_FromSize_t(NGHTTP2_DEFAULT_HEADER_TABLE_SIZE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 31, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_DEFAULT_HEADER_TABLE_SIZE, __pyx_t_1) < 0) __PYX_ERR(0, 31, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "nghttp2.pyx":32
 * 
 * DEFAULT_HEADER_TABLE_SIZE = cnghttp2.NGHTTP2_DEFAULT_HEADER_TABLE_SIZE
 * DEFLATE_MAX_HEADER_TABLE_SIZE = 4096             # <<<<<<<<<<<<<<
 * 
 * HD_ENTRY_OVERHEAD = 32
 */
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_DEFLATE_MAX_HEADER_TABLE_SIZE, __pyx_int_4096) < 0) __PYX_ERR(0, 32, __pyx_L1_error)

  /* "nghttp2.pyx":34
 * DEFLATE_MAX_HEADER_TABLE_SIZE = 4096
 * 
 * HD_ENTRY_OVERHEAD = 32             # <<<<<<<<<<<<<<
 * 
 * class HDTableEntry:
 */
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_HD_ENTRY_OVERHEAD, __pyx_int_32) < 0) __PYX_ERR(0, 34, __pyx_L1_error)

  /* "nghttp2.pyx":36
 * HD_ENTRY_OVERHEAD = 32
 * 
 * class HDTableEntry:             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, name, namelen, value, valuelen):
 */
  __pyx_t_1 = __Pyx_Py3MetaclassPrepare((PyObject *) NULL, __pyx_empty_tuple, __pyx_n_s_HDTableEntry, __pyx_n_s_HDTableEntry, (PyObject *) NULL, __pyx_n_s_nghttp2, (PyObject *) NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 36, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);

  /* "nghttp2.pyx":38
 * class HDTableEntry:
 * 
 *     def __init__(self, name, namelen, value, valuelen):             # <<<<<<<<<<<<<<
 *         self.name = name
 *         self.namelen = namelen
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_7nghttp2_12HDTableEntry_1__init__, 0, __pyx_n_s_HDTableEntry___init, NULL, __pyx_n_s_nghttp2, __pyx_d, ((PyObject *)__pyx_codeobj__28)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 38, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_init, __pyx_t_2) < 0) __PYX_ERR(0, 38, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "nghttp2.pyx":44
 *         self.valuelen = valuelen
 * 
 *     def space(self):             # <<<<<<<<<<<<<<
 *         return self.namelen + self.valuelen + HD_ENTRY_OVERHEAD
 * 
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_7nghttp2_12HDTableEntry_3space, 0, __pyx_n_s_HDTableEntry_space, NULL, __pyx_n_s_nghttp2, __pyx_d, ((PyObject *)__pyx_codeobj__30)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 44, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_space, __pyx_t_2) < 0) __PYX_ERR(0, 44, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "nghttp2.pyx":36
 * HD_ENTRY_OVERHEAD = 32
 * 
 * class HDTableEntry:             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, name, namelen, value, valuelen):
 */
  __pyx_t_2 = __Pyx_Py3ClassCreate(((PyObject*)&__Pyx_DefaultClassType), __pyx_n_s_HDTableEntry, __pyx_empty_tuple, __pyx_t_1, NULL, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 36, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_HDTableEntry, __pyx_t_2) < 0) __PYX_ERR(0, 36, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "nghttp2.pyx":75
 *     cdef cnghttp2.nghttp2_hd_deflater *_deflater
 * 
 *     def __cinit__(self, hd_table_bufsize_max = DEFLATE_MAX_HEADER_TABLE_SIZE):             # <<<<<<<<<<<<<<
 *         rv = cnghttp2.nghttp2_hd_deflate_new(&self._deflater,
 *                                              hd_table_bufsize_max)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_DEFLATE_MAX_HEADER_TABLE_SIZE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 75, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_k_ = __pyx_t_1;
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;

  /* "nghttp2.pyx":238
 *     return cnghttp2.nghttp2_strerror(liberror_code).decode('utf-8')
 * 
 * def print_hd_table(hdtable):             # <<<<<<<<<<<<<<
 *     '''Convenient function to print |hdtable| to the standard output. This
 *     function does not work if header name/value cannot be decoded using
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7nghttp2_1print_hd_table, NULL, __pyx_n_s_nghttp2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 238, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_print_hd_table, __pyx_t_1) < 0) __PYX_ERR(0, 238, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "nghttp2.pyx":254
 *                       entry.value.decode('utf-8')))
 * 
 * try:             # <<<<<<<<<<<<<<
 *     import socket
 *     import io
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_5);
    /*try:*/ {

      /* "nghttp2.pyx":255
 * 
 * try:
 *     import socket             # <<<<<<<<<<<<<<
 *     import io
 *     import asyncio
 */
      __pyx_t_1 = __Pyx_Import(__pyx_n_s_socket, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 255, __pyx_L2_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_socket, __pyx_t_1) < 0) __PYX_ERR(0, 255, __pyx_L2_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "nghttp2.pyx":256
 * try:
 *     import socket
 *     import io             # <<<<<<<<<<<<<<
 *     import asyncio
 *     import traceback
 */
      __pyx_t_1 = __Pyx_Import(__pyx_n_s_io, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 256, __pyx_L2_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_io, __pyx_t_1) < 0) __PYX_ERR(0, 256, __pyx_L2_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "nghttp2.pyx":257
 *     import socket
 *     import io
 *     import asyncio             # <<<<<<<<<<<<<<
 *     import traceback
 *     import sys
 */
      __pyx_t_1 = __Pyx_patch_asyncio(__Pyx_Import(__pyx_n_s_asyncio, 0, -1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 257, __pyx_L2_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_asyncio, __pyx_t_1) < 0) __PYX_ERR(0, 257, __pyx_L2_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "nghttp2.pyx":258
 *     import io
 *     import asyncio
 *     import traceback             # <<<<<<<<<<<<<<
 *     import sys
 *     import email.utils
 */
      __pyx_t_1 = __Pyx_Import(__pyx_n_s_traceback, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 258, __pyx_L2_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_traceback, __pyx_t_1) < 0) __PYX_ERR(0, 258, __pyx_L2_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "nghttp2.pyx":259
 *     import asyncio
 *     import traceback
 *     import sys             # <<<<<<<<<<<<<<
 *     import email.utils
 *     import datetime
 */
      __pyx_t_1 = __Pyx_Import(__pyx_n_s_sys, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 259, __pyx_L2_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_sys, __pyx_t_1) < 0) __PYX_ERR(0, 259, __pyx_L2_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "nghttp2.pyx":260
 *     import traceback
 *     import sys
 *     import email.utils             # <<<<<<<<<<<<<<
 *     import datetime
 *     import time
 */
      __pyx_t_1 = __Pyx_Import(__pyx_n_s_email_utils, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 260, __pyx_L2_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_email, __pyx_t_1) < 0) __PYX_ERR(0, 260, __pyx_L2_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "nghttp2.pyx":261
 *     import sys
 *     import email.utils
 *     import datetime             # <<<<<<<<<<<<<<
 *     import time
 *     import ssl as tls
 */
      __pyx_t_1 = __Pyx_Import(__pyx_n_s_datetime, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 261, __pyx_L2_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_datetime, __pyx_t_1) < 0) __PYX_ERR(0, 261, __pyx_L2_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "nghttp2.pyx":262
 *     import email.utils
 *     import datetime
 *     import time             # <<<<<<<<<<<<<<
 *     import ssl as tls
 *     from urllib.parse import urlparse
 */
      __pyx_t_1 = __Pyx_Import(__pyx_n_s_time, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 262, __pyx_L2_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_time, __pyx_t_1) < 0) __PYX_ERR(0, 262, __pyx_L2_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "nghttp2.pyx":263
 *     import datetime
 *     import time
 *     import ssl as tls             # <<<<<<<<<<<<<<
 *     from urllib.parse import urlparse
 * except ImportError:
 */
      __pyx_t_1 = __Pyx_Import(__pyx_n_s_ssl, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 263, __pyx_L2_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_tls, __pyx_t_1) < 0) __PYX_ERR(0, 263, __pyx_L2_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "nghttp2.pyx":264
 *     import time
 *     import ssl as tls
 *     from urllib.parse import urlparse             # <<<<<<<<<<<<<<
 * except ImportError:
 *     asyncio = None
 */
      __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 264, __pyx_L2_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_n_s_urlparse);
      __Pyx_GIVEREF(__pyx_n_s_urlparse);
      PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_urlparse);
      __pyx_t_2 = __Pyx_Import(__pyx_n_s_urllib_parse, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 264, __pyx_L2_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_urlparse); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 264, __pyx_L2_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_urlparse, __pyx_t_1) < 0) __PYX_ERR(0, 264, __pyx_L2_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "nghttp2.pyx":254
 *                       entry.value.decode('utf-8')))
 * 
 * try:             # <<<<<<<<<<<<<<
 *     import socket
 *     import io
 */
    }
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L7_try_end;
    __pyx_L2_error:;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "nghttp2.pyx":265
 *     import ssl as tls
 *     from urllib.parse import urlparse
 * except ImportError:             # <<<<<<<<<<<<<<
 *     asyncio = None
 * 
 */
    __pyx_t_6 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ImportError);
    if (__pyx_t_6) {
      __Pyx_AddTraceback("nghttp2", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_1, &__pyx_t_7) < 0) __PYX_ERR(0, 265, __pyx_L4_except_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_7);

      /* "nghttp2.pyx":266
 *     from urllib.parse import urlparse
 * except ImportError:
 *     asyncio = None             # <<<<<<<<<<<<<<
 * 
 * # body generator flags
 */
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_asyncio, Py_None) < 0) __PYX_ERR(0, 266, __pyx_L4_except_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L3_exception_handled;
    }
    goto __pyx_L4_except_error;
    __pyx_L4_except_error:;

    /* "nghttp2.pyx":254
 *                       entry.value.decode('utf-8')))
 * 
 * try:             # <<<<<<<<<<<<<<
 *     import socket
 *     import io
 */
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
    goto __pyx_L1_error;
    __pyx_L3_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
    __pyx_L7_try_end:;
  }

  /* "nghttp2.pyx":269
 * 
 * # body generator flags
 * DATA_OK = 0             # <<<<<<<<<<<<<<
 * DATA_EOF = 1
 * DATA_DEFERRED = 2
 */
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_DATA_OK, __pyx_int_0) < 0) __PYX_ERR(0, 269, __pyx_L1_error)

  /* "nghttp2.pyx":270
 * # body generator flags
 * DATA_OK = 0
 * DATA_EOF = 1             # <<<<<<<<<<<<<<
 * DATA_DEFERRED = 2
 * 
 */
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_DATA_EOF, __pyx_int_1) < 0) __PYX_ERR(0, 270, __pyx_L1_error)

  /* "nghttp2.pyx":271
 * DATA_OK = 0
 * DATA_EOF = 1
 * DATA_DEFERRED = 2             # <<<<<<<<<<<<<<
 * 
 * class _ByteIOWrapper:
 */
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_DATA_DEFERRED, __pyx_int_2) < 0) __PYX_ERR(0, 271, __pyx_L1_error)

  /* "nghttp2.pyx":273
 * DATA_DEFERRED = 2
 * 
 * class _ByteIOWrapper:             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, b):
 */
  __pyx_t_7 = __Pyx_Py3MetaclassPrepare((PyObject *) NULL, __pyx_empty_tuple, __pyx_n_s_ByteIOWrapper, __pyx_n_s_ByteIOWrapper, (PyObject *) NULL, __pyx_n_s_nghttp2, (PyObject *) NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 273, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);

  /* "nghttp2.pyx":275
 * class _ByteIOWrapper:
 * 
 *     def __init__(self, b):             # <<<<<<<<<<<<<<
 *         self.b = b
 * 
 */
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7nghttp2_14_ByteIOWrapper_1__init__, 0, __pyx_n_s_ByteIOWrapper___init, NULL, __pyx_n_s_nghttp2, __pyx_d, ((PyObject *)__pyx_codeobj__34)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 275, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_init, __pyx_t_1) < 0) __PYX_ERR(0, 275, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "nghttp2.pyx":278
 *         self.b = b
 * 
 *     def generate(self, n):             # <<<<<<<<<<<<<<
 *         data = self.b.read1(n)
 *         if not data:
 */
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7nghttp2_14_ByteIOWrapper_3generate, 0, __pyx_n_s_ByteIOWrapper_generate, NULL, __pyx_n_s_nghttp2, __pyx_d, ((PyObject *)__pyx_codeobj__36)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 278, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_generate, __pyx_t_1) < 0) __PYX_ERR(0, 278, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "nghttp2.pyx":273
 * DATA_DEFERRED = 2
 * 
 * class _ByteIOWrapper:             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, b):
 */
  __pyx_t_1 = __Pyx_Py3ClassCreate(((PyObject*)&__Pyx_DefaultClassType), __pyx_n_s_ByteIOWrapper, __pyx_empty_tuple, __pyx_t_7, NULL, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 273, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_ByteIOWrapper, __pyx_t_1) < 0) __PYX_ERR(0, 273, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "nghttp2.pyx":284
 *         return data, DATA_OK
 * 
 * def wrap_body(body):             # <<<<<<<<<<<<<<
 *     if body is None:
 *         return body
 */
  __pyx_t_7 = PyCFunction_NewEx(&__pyx_mdef_7nghttp2_3wrap_body, NULL, __pyx_n_s_nghttp2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 284, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_wrap_body, __pyx_t_7) < 0) __PYX_ERR(0, 284, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "nghttp2.pyx":298
 *         return body
 * 
 * def negotiated_protocol(ssl_obj):             # <<<<<<<<<<<<<<
 *     protocol = ssl_obj.selected_alpn_protocol()
 *     if protocol:
 */
  __pyx_t_7 = PyCFunction_NewEx(&__pyx_mdef_7nghttp2_5negotiated_protocol, NULL, __pyx_n_s_nghttp2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 298, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_negotiated_protocol, __pyx_t_7) < 0) __PYX_ERR(0, 298, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "nghttp2.pyx":311
 *     return None
 * 
 * def set_application_protocol(ssl_ctx):             # <<<<<<<<<<<<<<
 *     app_protos = [cnghttp2.NGHTTP2_PROTO_VERSION_ID.decode('utf-8')]
 *     ssl_ctx.set_npn_protocols(app_protos)
 */
  __pyx_t_7 = PyCFunction_NewEx(&__pyx_mdef_7nghttp2_7set_application_protocol, NULL, __pyx_n_s_nghttp2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 311, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_set_application_protocol, __pyx_t_7) < 0) __PYX_ERR(0, 311, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "nghttp2.pyx":690
 *         self.send_data()
 * 
 *     OUTBUF_MAX = 65535             # <<<<<<<<<<<<<<
 *     SETTINGS_TIMEOUT = 5.0
 * 
 */
  if (PyDict_SetItem((PyObject *)__pyx_ptype_7nghttp2__HTTP2SessionCoreBase->tp_dict, __pyx_n_s_OUTBUF_MAX, __pyx_int_65535) < 0) __PYX_ERR(0, 690, __pyx_L1_error)
  PyType_Modified(__pyx_ptype_7nghttp2__HTTP2SessionCoreBase);

  /* "nghttp2.pyx":691
 * 
 *     OUTBUF_MAX = 65535
 *     SETTINGS_TIMEOUT = 5.0             # <<<<<<<<<<<<<<
 * 
 *     def send_data(self):
 */
  if (PyDict_SetItem((PyObject *)__pyx_ptype_7nghttp2__HTTP2SessionCoreBase->tp_dict, __pyx_n_s_SETTINGS_TIMEOUT, __pyx_float_5_0) < 0) __PYX_ERR(0, 691, __pyx_L1_error)
  PyType_Modified(__pyx_ptype_7nghttp2__HTTP2SessionCoreBase);

  /* "nghttp2.pyx":743
 * 
 *     def _rst_stream(self, stream_id,
 *                    error_code=cnghttp2.NGHTTP2_INTERNAL_ERROR):             # <<<<<<<<<<<<<<
 *         cdef int rv
 * 
 */
  __pyx_t_7 = __Pyx_PyInt_From_nghttp2_error_code(NGHTTP2_INTERNAL_ERROR); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 743, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_k__8 = __pyx_t_7;
  __Pyx_GIVEREF(__pyx_t_7);
  __pyx_t_7 = 0;

  /* "nghttp2.pyx":1053
 *                               error_code=cnghttp2.NGHTTP2_NO_ERROR)
 * 
 * if asyncio:             # <<<<<<<<<<<<<<
 * 
 *     class BaseRequestHandler:
 */
  __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_asyncio); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1053, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 1053, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (__pyx_t_8) {

    /* "nghttp2.pyx":1055
 * if asyncio:
 * 
 *     class BaseRequestHandler:             # <<<<<<<<<<<<<<
 * 
 *         """HTTP/2 request (stream) handler base class.
 */
    __pyx_t_7 = __Pyx_Py3MetaclassPrepare((PyObject *) NULL, __pyx_empty_tuple, __pyx_n_s_BaseRequestHandler, __pyx_n_s_BaseRequestHandler, (PyObject *) NULL, __pyx_n_s_nghttp2, __pyx_kp_s_HTTP_2_request_stream_handler_ba); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1055, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);

    /* "nghttp2.pyx":1108
 *         """
 * 
 *         def __init__(self, http2, stream_id):             # <<<<<<<<<<<<<<
 *             self.headers = []
 *             self.cookies = []
 */
    __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7nghttp2_18BaseRequestHandler_1__init__, 0, __pyx_n_s_BaseRequestHandler___init, NULL, __pyx_n_s_nghttp2, __pyx_d, ((PyObject *)__pyx_codeobj__44)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1108, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_init, __pyx_t_1) < 0) __PYX_ERR(0, 1108, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "nghttp2.pyx":1132
 * 
 *         @property
 *         def client_address(self):             # <<<<<<<<<<<<<<
 *             return self.remote_address
 * 
 */
    __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7nghttp2_18BaseRequestHandler_3client_address, 0, __pyx_n_s_BaseRequestHandler_client_addres, NULL, __pyx_n_s_nghttp2, __pyx_d, ((PyObject *)__pyx_codeobj__46)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1132, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);

    /* "nghttp2.pyx":1131
 *             self.pushed = False
 * 
 *         @property             # <<<<<<<<<<<<<<
 *         def client_address(self):
 *             return self.remote_address
 */
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1131, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_client_address, __pyx_t_2) < 0) __PYX_ERR(0, 1132, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "nghttp2.pyx":1136
 * 
 *         @property
 *         def client_certificate(self):             # <<<<<<<<<<<<<<
 *             return self._client_certificate
 * 
 */
    __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_7nghttp2_18BaseRequestHandler_5client_certificate, 0, __pyx_n_s_BaseRequestHandler_client_certif, NULL, __pyx_n_s_nghttp2, __pyx_d, ((PyObject *)__pyx_codeobj__48)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1136, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);

    /* "nghttp2.pyx":1135
 *             return self.remote_address
 * 
 *         @property             # <<<<<<<<<<<<<<
 *         def client_certificate(self):
 *             return self._client_certificate
 */
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1135, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_client_certificate, __pyx_t_1) < 0) __PYX_ERR(0, 1136, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "nghttp2.pyx":1139
 *             return self._client_certificate
 * 
 *         def on_headers(self):             # <<<<<<<<<<<<<<
 * 
 *             '''Called when request HEADERS is arrived.
 */
    __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7nghttp2_18BaseRequestHandler_7on_headers, 0, __pyx_n_s_BaseRequestHandler_on_headers, NULL, __pyx_n_s_nghttp2, __pyx_d, ((PyObject *)__pyx_codeobj__50)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1139, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_on_headers, __pyx_t_1) < 0) __PYX_ERR(0, 1139, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "nghttp2.pyx":1146
 *             pass
 * 
 *         def on_data(self, data):             # <<<<<<<<<<<<<<
 * 
 *             '''Called when a chunk of request body is arrived. This method
 */
    __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7nghttp2_18BaseRequestHandler_9on_data, 0, __pyx_n_s_BaseRequestHandler_on_data, NULL, __pyx_n_s_nghttp2, __pyx_d, ((PyObject *)__pyx_codeobj__52)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1146, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_on_data, __pyx_t_1) < 0) __PYX_ERR(0, 1146, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "nghttp2.pyx":1154
 *             pass
 * 
 *         def on_request_done(self):             # <<<<<<<<<<<<<<
 * 
 *             '''Called when whole request was received
 */
    __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7nghttp2_18BaseRequestHandler_11on_request_done, 0, __pyx_n_s_BaseRequestHandler_on_request_do, NULL, __pyx_n_s_nghttp2, __pyx_d, ((PyObject *)__pyx_codeobj__54)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1154, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_on_request_done, __pyx_t_1) < 0) __PYX_ERR(0, 1154, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "nghttp2.pyx":1161
 *             pass
 * 
 *         def on_close(self, error_code):             # <<<<<<<<<<<<<<
 * 
 *             '''Called when stream is about to close.
 */
    __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7nghttp2_18BaseRequestHandler_13on_close, 0, __pyx_n_s_BaseRequestHandler_on_close, NULL, __pyx_n_s_nghttp2, __pyx_d, ((PyObject *)__pyx_codeobj__56)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1161, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_on_close, __pyx_t_1) < 0) __PYX_ERR(0, 1161, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "nghttp2.pyx":1168
 *             pass
 * 
 *         def send_response(self, status=200, headers=None, body=None):             # <<<<<<<<<<<<<<
 * 
 *             '''Send response. The status is HTTP status code. The headers is
 */
    __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7nghttp2_18BaseRequestHandler_15send_response, 0, __pyx_n_s_BaseRequestHandler_send_response, NULL, __pyx_n_s_nghttp2, __pyx_d, ((PyObject *)__pyx_codeobj__58)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1168, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_1, __pyx_tuple__59);
    if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_send_response, __pyx_t_1) < 0) __PYX_ERR(0, 1168, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "nghttp2.pyx":1213
 *             self.http2.send_response(self)
 * 
 *         def push(self, path, method='GET', request_headers=None,             # <<<<<<<<<<<<<<
 *                  status=200, headers=None, body=None):
 * 
 */
    __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7nghttp2_18BaseRequestHandler_17push, 0, __pyx_n_s_BaseRequestHandler_push, NULL, __pyx_n_s_nghttp2, __pyx_d, ((PyObject *)__pyx_codeobj__61)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1213, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_1, __pyx_tuple__62);
    if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_push, __pyx_t_1) < 0) __PYX_ERR(0, 1213, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "nghttp2.pyx":1268
 *             return self.http2.push(self, promised_handler)
 * 
 *         def _set_response_prop(self, status, headers, body):             # <<<<<<<<<<<<<<
 *             self.status = status
 * 
 */
    __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7nghttp2_18BaseRequestHandler_19_set_response_prop, 0, __pyx_n_s_BaseRequestHandler__set_response, NULL, __pyx_n_s_nghttp2, __pyx_d, ((PyObject *)__pyx_codeobj__64)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1268, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_set_response_prop, __pyx_t_1) < 0) __PYX_ERR(0, 1268, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "nghttp2.pyx":1279
 *             self.response_body = body
 * 
 *         def resume(self):             # <<<<<<<<<<<<<<
 *             self.http2.resume(self.stream_id)
 * 
 */
    __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7nghttp2_18BaseRequestHandler_21resume, 0, __pyx_n_s_BaseRequestHandler_resume, NULL, __pyx_n_s_nghttp2, __pyx_d, ((PyObject *)__pyx_codeobj__66)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1279, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_resume, __pyx_t_1) < 0) __PYX_ERR(0, 1279, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "nghttp2.pyx":1055
 * if asyncio:
 * 
 *     class BaseRequestHandler:             # <<<<<<<<<<<<<<
 * 
 *         """HTTP/2 request (stream) handler base class.
 */
    __pyx_t_1 = __Pyx_Py3ClassCreate(((PyObject*)&__Pyx_DefaultClassType), __pyx_n_s_BaseRequestHandler, __pyx_empty_tuple, __pyx_t_7, NULL, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1055, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (PyDict_SetItem(__pyx_d, __pyx_n_s_BaseRequestHandler, __pyx_t_1) < 0) __PYX_ERR(0, 1055, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "nghttp2.pyx":1282
 *             self.http2.resume(self.stream_id)
 * 
 *     def _encode_headers(headers):             # <<<<<<<<<<<<<<
 *         if not headers:
 *             return []
 */
    __pyx_t_7 = PyCFunction_NewEx(&__pyx_mdef_7nghttp2_9_encode_headers, NULL, __pyx_n_s_nghttp2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1282, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (PyDict_SetItem(__pyx_d, __pyx_n_s_encode_headers, __pyx_t_7) < 0) __PYX_ERR(0, 1282, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "nghttp2.pyx":1289
 *                 for k, v in headers]
 * 
 *     class _HTTP2Session(asyncio.Protocol):             # <<<<<<<<<<<<<<
 * 
 *         def __init__(self, RequestHandlerClass):
 */
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_asyncio); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1289, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_Protocol); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1289, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1289, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1289, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_7, __pyx_n_s_HTTP2Session, __pyx_n_s_HTTP2Session, (PyObject *) NULL, __pyx_n_s_nghttp2, (PyObject *) NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1289, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);

    /* "nghttp2.pyx":1291
 *     class _HTTP2Session(asyncio.Protocol):
 * 
 *         def __init__(self, RequestHandlerClass):             # <<<<<<<<<<<<<<
 *             asyncio.Protocol.__init__(self)
 *             self.RequestHandlerClass = RequestHandlerClass
 */
    __pyx_t_9 = __Pyx_CyFunction_New(&__pyx_mdef_7nghttp2_13_HTTP2Session_1__init__, 0, __pyx_n_s_HTTP2Session___init, NULL, __pyx_n_s_nghttp2, __pyx_d, ((PyObject *)__pyx_codeobj__70)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1291, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_init, __pyx_t_9) < 0) __PYX_ERR(0, 1291, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "nghttp2.pyx":1296
 *             self.http2 = None
 * 
 *         def connection_made(self, transport):             # <<<<<<<<<<<<<<
 *             address = transport.get_extra_info('peername')
 *             logging.info('connection_made, address:%s, port:%s', address[0], address[1])
 */
    __pyx_t_9 = __Pyx_CyFunction_New(&__pyx_mdef_7nghttp2_13_HTTP2Session_3connection_made, 0, __pyx_n_s_HTTP2Session_connection_made, NULL, __pyx_n_s_nghttp2, __pyx_d, ((PyObject *)__pyx_codeobj__72)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1296, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_connection_made, __pyx_t_9) < 0) __PYX_ERR(0, 1296, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "nghttp2.pyx":1324
 * 
 * 
 *         def connection_lost(self, exc):             # <<<<<<<<<<<<<<
 *             logging.info('connection_lost')
 *             if self.http2:
 */
    __pyx_t_9 = __Pyx_CyFunction_New(&__pyx_mdef_7nghttp2_13_HTTP2Session_5connection_lost, 0, __pyx_n_s_HTTP2Session_connection_lost, NULL, __pyx_n_s_nghttp2, __pyx_d, ((PyObject *)__pyx_codeobj__74)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1324, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_connection_lost, __pyx_t_9) < 0) __PYX_ERR(0, 1324, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "nghttp2.pyx":1330
 *                 self.http2 = None
 * 
 *         def data_received(self, data):             # <<<<<<<<<<<<<<
 *             try:
 *                 self.http2.data_received(data)
 */
    __pyx_t_9 = __Pyx_CyFunction_New(&__pyx_mdef_7nghttp2_13_HTTP2Session_7data_received, 0, __pyx_n_s_HTTP2Session_data_received, NULL, __pyx_n_s_nghttp2, __pyx_d, ((PyObject *)__pyx_codeobj__76)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1330, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_data_received, __pyx_t_9) < 0) __PYX_ERR(0, 1330, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "nghttp2.pyx":1338
 *                 return
 * 
 *         def resume_writing(self):             # <<<<<<<<<<<<<<
 *             try:
 *                 self.http2.send_data()
 */
    __pyx_t_9 = __Pyx_CyFunction_New(&__pyx_mdef_7nghttp2_13_HTTP2Session_9resume_writing, 0, __pyx_n_s_HTTP2Session_resume_writing, NULL, __pyx_n_s_nghttp2, __pyx_d, ((PyObject *)__pyx_codeobj__78)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1338, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_resume_writing, __pyx_t_9) < 0) __PYX_ERR(0, 1338, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "nghttp2.pyx":1289
 *                 for k, v in headers]
 * 
 *     class _HTTP2Session(asyncio.Protocol):             # <<<<<<<<<<<<<<
 * 
 *         def __init__(self, RequestHandlerClass):
 */
    __pyx_t_9 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_HTTP2Session, __pyx_t_7, __pyx_t_2, NULL, 0, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1289, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    if (PyDict_SetItem(__pyx_d, __pyx_n_s_HTTP2Session, __pyx_t_9) < 0) __PYX_ERR(0, 1289, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "nghttp2.pyx":1346
 *                 return
 * 
 *     class HTTP2Server:             # <<<<<<<<<<<<<<
 * 
 *         '''HTTP/2 server.
 */
    __pyx_t_7 = __Pyx_Py3MetaclassPrepare((PyObject *) NULL, __pyx_empty_tuple, __pyx_n_s_HTTP2Server, __pyx_n_s_HTTP2Server, (PyObject *) NULL, __pyx_n_s_nghttp2, __pyx_kp_s_HTTP_2_server_This_class_builds); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1346, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);

    /* "nghttp2.pyx":1355
 * 
 *         '''
 *         def __init__(self, address, RequestHandlerClass, ssl=None):             # <<<<<<<<<<<<<<
 * 
 *             '''address is a tuple of the listening address and port (e.g.,
 */
    __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7nghttp2_11HTTP2Server_1__init__, 0, __pyx_n_s_HTTP2Server___init, NULL, __pyx_n_s_nghttp2, __pyx_d, ((PyObject *)__pyx_codeobj__80)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1355, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_1, __pyx_tuple__81);
    if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_init, __pyx_t_1) < 0) __PYX_ERR(0, 1355, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "nghttp2.pyx":1378
 *             logging.info('listen, address:%s, port:%s', address[0], address[1])
 * 
 *         def serve_forever(self):             # <<<<<<<<<<<<<<
 *             try:
 *                 self.loop.run_forever()
 */
    __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7nghttp2_11HTTP2Server_3serve_forever, 0, __pyx_n_s_HTTP2Server_serve_forever, NULL, __pyx_n_s_nghttp2, __pyx_d, ((PyObject *)__pyx_codeobj__83)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1378, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_serve_forever, __pyx_t_1) < 0) __PYX_ERR(0, 1378, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "nghttp2.pyx":1346
 *                 return
 * 
 *     class HTTP2Server:             # <<<<<<<<<<<<<<
 * 
 *         '''HTTP/2 server.
 */
    __pyx_t_1 = __Pyx_Py3ClassCreate(((PyObject*)&__Pyx_DefaultClassType), __pyx_n_s_HTTP2Server, __pyx_empty_tuple, __pyx_t_7, NULL, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1346, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (PyDict_SetItem(__pyx_d, __pyx_n_s_HTTP2Server, __pyx_t_1) < 0) __PYX_ERR(0, 1346, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "nghttp2.pyx":1387
 * 
 * 
 *     class BaseResponseHandler:             # <<<<<<<<<<<<<<
 * 
 *         """HTTP/2 response (stream) handler base class.
 */
    __pyx_t_7 = __Pyx_Py3MetaclassPrepare((PyObject *) NULL, __pyx_empty_tuple, __pyx_n_s_BaseResponseHandler, __pyx_n_s_BaseResponseHandler, (PyObject *) NULL, __pyx_n_s_nghttp2, __pyx_kp_s_HTTP_2_response_stream_handler_b); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1387, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);

    /* "nghttp2.pyx":1439
 *         """
 * 
 *         def __init__(self, http2=None, stream_id=-1):             # <<<<<<<<<<<<<<
 *             self.headers = []
 *             self.cookies = []
 */
    __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7nghttp2_19BaseResponseHandler_1__init__, 0, __pyx_n_s_BaseResponseHandler___init, NULL, __pyx_n_s_nghttp2, __pyx_d, ((PyObject *)__pyx_codeobj__85)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1439, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_1, __pyx_tuple__86);
    if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_init, __pyx_t_1) < 0) __PYX_ERR(0, 1439, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "nghttp2.pyx":1461
 * 
 *         @property
 *         def server_address(self):             # <<<<<<<<<<<<<<
 *             return self.remote_address
 * 
 */
    __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7nghttp2_19BaseResponseHandler_3server_address, 0, __pyx_n_s_BaseResponseHandler_server_addre, NULL, __pyx_n_s_nghttp2, __pyx_d, ((PyObject *)__pyx_codeobj__88)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1461, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);

    /* "nghttp2.pyx":1460
 *             self.pushed = False
 * 
 *         @property             # <<<<<<<<<<<<<<
 *         def server_address(self):
 *             return self.remote_address
 */
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1460, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_server_address, __pyx_t_2) < 0) __PYX_ERR(0, 1461, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "nghttp2.pyx":1464
 *             return self.remote_address
 * 
 *         def on_headers(self):             # <<<<<<<<<<<<<<
 * 
 *             '''Called when response HEADERS is arrived.
 */
    __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_7nghttp2_19BaseResponseHandler_5on_headers, 0, __pyx_n_s_BaseResponseHandler_on_headers, NULL, __pyx_n_s_nghttp2, __pyx_d, ((PyObject *)__pyx_codeobj__90)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1464, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_on_headers, __pyx_t_2) < 0) __PYX_ERR(0, 1464, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "nghttp2.pyx":1471
 *             pass
 * 
 *         def on_data(self, data):             # <<<<<<<<<<<<<<
 * 
 *             '''Called when a chunk of response body is arrived. This method
 */
    __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_7nghttp2_19BaseResponseHandler_7on_data, 0, __pyx_n_s_BaseResponseHandler_on_data, NULL, __pyx_n_s_nghttp2, __pyx_d, ((PyObject *)__pyx_codeobj__92)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1471, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_on_data, __pyx_t_2) < 0) __PYX_ERR(0, 1471, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "nghttp2.pyx":1479
 *             pass
 * 
 *         def on_response_done(self):             # <<<<<<<<<<<<<<
 * 
 *             '''Called when whole response was received
 */
    __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_7nghttp2_19BaseResponseHandler_9on_response_done, 0, __pyx_n_s_BaseResponseHandler_on_response, NULL, __pyx_n_s_nghttp2, __pyx_d, ((PyObject *)__pyx_codeobj__94)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1479, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_on_response_done, __pyx_t_2) < 0) __PYX_ERR(0, 1479, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "nghttp2.pyx":1486
 *             pass
 * 
 *         def on_close(self, error_code):             # <<<<<<<<<<<<<<
 * 
 *             '''Called when stream is about to close.
 */
    __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_7nghttp2_19BaseResponseHandler_11on_close, 0, __pyx_n_s_BaseResponseHandler_on_close, NULL, __pyx_n_s_nghttp2, __pyx_d, ((PyObject *)__pyx_codeobj__96)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1486, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_on_close, __pyx_t_2) < 0) __PYX_ERR(0, 1486, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "nghttp2.pyx":1493
 *             pass
 * 
 *         def on_push_promise(self, push_promise):             # <<<<<<<<<<<<<<
 * 
 *             '''Called when a push is promised. Default behavior is to
 */
    __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_7nghttp2_19BaseResponseHandler_13on_push_promise, 0, __pyx_n_s_BaseResponseHandler_on_push_prom, NULL, __pyx_n_s_nghttp2, __pyx_d, ((PyObject *)__pyx_codeobj__98)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1493, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_on_push_promise, __pyx_t_2) < 0) __PYX_ERR(0, 1493, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "nghttp2.pyx":1502
 *             self.reject_push(push_promise)
 * 
 *         def reject_push(self, push_promise):             # <<<<<<<<<<<<<<
 * 
 *             '''Convenience method equivalent to calling accept_push
 */
    __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_7nghttp2_19BaseResponseHandler_15reject_push, 0, __pyx_n_s_BaseResponseHandler_reject_push, NULL, __pyx_n_s_nghttp2, __pyx_d, ((PyObject *)__pyx_codeobj__100)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1502, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_reject_push, __pyx_t_2) < 0) __PYX_ERR(0, 1502, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "nghttp2.pyx":1510
 *             self.http2.push(push_promise, None)
 * 
 *         def accept_push(self, push_promise, handler=None):             # <<<<<<<<<<<<<<
 * 
 *             '''Accept a push_promise and provider a handler for the
 */
    __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_7nghttp2_19BaseResponseHandler_17accept_push, 0, __pyx_n_s_BaseResponseHandler_accept_push, NULL, __pyx_n_s_nghttp2, __pyx_d, ((PyObject *)__pyx_codeobj__102)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1510, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_tuple__103);
    if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_accept_push, __pyx_t_2) < 0) __PYX_ERR(0, 1510, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "nghttp2.pyx":1519
 *             self.http2.push(push_promise, handler)
 * 
 *         def resume(self):             # <<<<<<<<<<<<<<
 *             self.http2.resume(self.stream_id)
 * 
 */
    __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_7nghttp2_19BaseResponseHandler_19resume, 0, __pyx_n_s_BaseResponseHandler_resume, NULL, __pyx_n_s_nghttp2, __pyx_d, ((PyObject *)__pyx_codeobj__105)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1519, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_resume, __pyx_t_2) < 0) __PYX_ERR(0, 1519, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "nghttp2.pyx":1387
 * 
 * 
 *     class BaseResponseHandler:             # <<<<<<<<<<<<<<
 * 
 *         """HTTP/2 response (stream) handler base class.
 */
    __pyx_t_2 = __Pyx_Py3ClassCreate(((PyObject*)&__Pyx_DefaultClassType), __pyx_n_s_BaseResponseHandler, __pyx_empty_tuple, __pyx_t_7, NULL, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1387, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (PyDict_SetItem(__pyx_d, __pyx_n_s_BaseResponseHandler, __pyx_t_2) < 0) __PYX_ERR(0, 1387, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "nghttp2.pyx":1522
 *             self.http2.resume(self.stream_id)
 * 
 *     class _HTTP2ClientSession(asyncio.Protocol):             # <<<<<<<<<<<<<<
 * 
 *         def __init__(self, client):
 */
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_asyncio); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1522, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_Protocol); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1522, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1522, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1522, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_t_7, __pyx_n_s_HTTP2ClientSession, __pyx_n_s_HTTP2ClientSession, (PyObject *) NULL, __pyx_n_s_nghttp2, (PyObject *) NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1522, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);

    /* "nghttp2.pyx":1524
 *     class _HTTP2ClientSession(asyncio.Protocol):
 * 
 *         def __init__(self, client):             # <<<<<<<<<<<<<<
 *             asyncio.Protocol.__init__(self)
 *             self.http2 = None
 */
    __pyx_t_9 = __Pyx_CyFunction_New(&__pyx_mdef_7nghttp2_19_HTTP2ClientSession_1__init__, 0, __pyx_n_s_HTTP2ClientSession___init, NULL, __pyx_n_s_nghttp2, __pyx_d, ((PyObject *)__pyx_codeobj__107)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1524, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_init, __pyx_t_9) < 0) __PYX_ERR(0, 1524, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "nghttp2.pyx":1530
 *             self.client = client
 * 
 *         def connection_made(self, transport):             # <<<<<<<<<<<<<<
 *             address = transport.get_extra_info('peername')
 *             logging.info('connection_made, address:%s, port:%s', address[0], address[1])
 */
    __pyx_t_9 = __Pyx_CyFunction_New(&__pyx_mdef_7nghttp2_19_HTTP2ClientSession_3connection_made, 0, __pyx_n_s_HTTP2ClientSession_connection_m, NULL, __pyx_n_s_nghttp2, __pyx_d, ((PyObject *)__pyx_codeobj__109)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1530, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_connection_made, __pyx_t_9) < 0) __PYX_ERR(0, 1530, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "nghttp2.pyx":1555
 *             self.http2.send_data()
 * 
 *         def connection_lost(self, exc):             # <<<<<<<<<<<<<<
 *             logging.info('connection_lost')
 *             if self.http2:
 */
    __pyx_t_9 = __Pyx_CyFunction_New(&__pyx_mdef_7nghttp2_19_HTTP2ClientSession_5connection_lost, 0, __pyx_n_s_HTTP2ClientSession_connection_l, NULL, __pyx_n_s_nghttp2, __pyx_d, ((PyObject *)__pyx_codeobj__111)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1555, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_connection_lost, __pyx_t_9) < 0) __PYX_ERR(0, 1555, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "nghttp2.pyx":1561
 *             self.client.close()
 * 
 *         def data_received(self, data):             # <<<<<<<<<<<<<<
 *             try:
 *                 self.http2.data_received(data)
 */
    __pyx_t_9 = __Pyx_CyFunction_New(&__pyx_mdef_7nghttp2_19_HTTP2ClientSession_7data_received, 0, __pyx_n_s_HTTP2ClientSession_data_receive, NULL, __pyx_n_s_nghttp2, __pyx_d, ((PyObject *)__pyx_codeobj__113)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1561, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_data_received, __pyx_t_9) < 0) __PYX_ERR(0, 1561, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "nghttp2.pyx":1569
 *                 return
 * 
 *         def resume_writing(self):             # <<<<<<<<<<<<<<
 *             try:
 *                 self.http2.send_data()
 */
    __pyx_t_9 = __Pyx_CyFunction_New(&__pyx_mdef_7nghttp2_19_HTTP2ClientSession_9resume_writing, 0, __pyx_n_s_HTTP2ClientSession_resume_writi, NULL, __pyx_n_s_nghttp2, __pyx_d, ((PyObject *)__pyx_codeobj__115)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1569, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_resume_writing, __pyx_t_9) < 0) __PYX_ERR(0, 1569, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "nghttp2.pyx":1577
 *                 return
 * 
 *         def send_request(self, method, scheme, host, path, headers, body, handler):             # <<<<<<<<<<<<<<
 *             try:
 * 		# Waiting until connection established
 */
    __pyx_t_9 = __Pyx_CyFunction_New(&__pyx_mdef_7nghttp2_19_HTTP2ClientSession_11send_request, 0, __pyx_n_s_HTTP2ClientSession_send_request, NULL, __pyx_n_s_nghttp2, __pyx_d, ((PyObject *)__pyx_codeobj__117)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1577, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_send_request, __pyx_t_9) < 0) __PYX_ERR(0, 1577, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "nghttp2.pyx":1592
 *                 return
 * 
 *         def close(self):             # <<<<<<<<<<<<<<
 *             if self.http2:
 *                 self.http2.close()
 */
    __pyx_t_9 = __Pyx_CyFunction_New(&__pyx_mdef_7nghttp2_19_HTTP2ClientSession_13close, 0, __pyx_n_s_HTTP2ClientSession_close, NULL, __pyx_n_s_nghttp2, __pyx_d, ((PyObject *)__pyx_codeobj__119)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1592, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_close, __pyx_t_9) < 0) __PYX_ERR(0, 1592, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "nghttp2.pyx":1522
 *             self.http2.resume(self.stream_id)
 * 
 *     class _HTTP2ClientSession(asyncio.Protocol):             # <<<<<<<<<<<<<<
 * 
 *         def __init__(self, client):
 */
    __pyx_t_9 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_HTTP2ClientSession, __pyx_t_7, __pyx_t_1, NULL, 0, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1522, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    if (PyDict_SetItem(__pyx_d, __pyx_n_s_HTTP2ClientSession, __pyx_t_9) < 0) __PYX_ERR(0, 1522, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "nghttp2.pyx":1597
 * 
 * 
 *     class HTTP2Client:             # <<<<<<<<<<<<<<
 * 
 *         '''HTTP/2 client.
 */
    __pyx_t_7 = __Pyx_Py3MetaclassPrepare((PyObject *) NULL, __pyx_empty_tuple, __pyx_n_s_HTTP2Client, __pyx_n_s_HTTP2Client, (PyObject *) NULL, __pyx_n_s_nghttp2, __pyx_kp_s_HTTP_2_client_This_class_builds); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1597, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);

    /* "nghttp2.pyx":1604
 * 
 *         '''
 *         def __init__(self, address, loop=None, ssl=None):             # <<<<<<<<<<<<<<
 * 
 *             '''address is a tuple of the connect address and port (e.g.,
 */
    __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_7nghttp2_11HTTP2Client_1__init__, 0, __pyx_n_s_HTTP2Client___init, NULL, __pyx_n_s_nghttp2, __pyx_d, ((PyObject *)__pyx_codeobj__122)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1604, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_tuple__123);
    if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_init, __pyx_t_2) < 0) __PYX_ERR(0, 1604, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "nghttp2.pyx":1636
 * 
 *         @property
 *         def io_loop(self):             # <<<<<<<<<<<<<<
 *             return self.loop
 * 
 */
    __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_7nghttp2_11HTTP2Client_3io_loop, 0, __pyx_n_s_HTTP2Client_io_loop, NULL, __pyx_n_s_nghttp2, __pyx_d, ((PyObject *)__pyx_codeobj__125)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1636, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);

    /* "nghttp2.pyx":1635
 *             logging.info('connect, address:%s, port:%s', self.address[0], self.address[1])
 * 
 *         @property             # <<<<<<<<<<<<<<
 *         def io_loop(self):
 *             return self.loop
 */
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1635, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_io_loop, __pyx_t_1) < 0) __PYX_ERR(0, 1636, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "nghttp2.pyx":1639
 *             return self.loop
 * 
 *         def close(self):             # <<<<<<<<<<<<<<
 *             self.session.close()
 * 
 */
    __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7nghttp2_11HTTP2Client_5close, 0, __pyx_n_s_HTTP2Client_close, NULL, __pyx_n_s_nghttp2, __pyx_d, ((PyObject *)__pyx_codeobj__127)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1639, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_close, __pyx_t_1) < 0) __PYX_ERR(0, 1639, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "nghttp2.pyx":1642
 *             self.session.close()
 * 
 *         def send_request(self, method='GET', url='/', headers=None, body=None, handler=None):             # <<<<<<<<<<<<<<
 *             url = urlparse(url)
 *             scheme = url.scheme if url.scheme else self.scheme
 */
    __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7nghttp2_11HTTP2Client_7send_request, 0, __pyx_n_s_HTTP2Client_send_request, NULL, __pyx_n_s_nghttp2, __pyx_d, ((PyObject *)__pyx_codeobj__129)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1642, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_1, __pyx_tuple__130);
    if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_send_request, __pyx_t_1) < 0) __PYX_ERR(0, 1642, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "nghttp2.pyx":1597
 * 
 * 
 *     class HTTP2Client:             # <<<<<<<<<<<<<<
 * 
 *         '''HTTP/2 client.
 */
    __pyx_t_1 = __Pyx_Py3ClassCreate(((PyObject*)&__Pyx_DefaultClassType), __pyx_n_s_HTTP2Client, __pyx_empty_tuple, __pyx_t_7, NULL, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1597, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (PyDict_SetItem(__pyx_d, __pyx_n_s_HTTP2Client, __pyx_t_1) < 0) __PYX_ERR(0, 1597, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "nghttp2.pyx":1053
 *                               error_code=cnghttp2.NGHTTP2_NO_ERROR)
 * 
 * if asyncio:             # <<<<<<<<<<<<<<
 * 
 *     class BaseRequestHandler:
 */
  }

  /* "nghttp2.pyx":1
 * # nghttp2 - HTTP/2 C Library             # <<<<<<<<<<<<<<
 * 
 * # Copyright (c) 2013 Tatsuhiro Tsujikawa
 */
  __pyx_t_7 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_7) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /*--- Wrapped vars code ---*/

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  if (__pyx_m) {
    if (__pyx_d) {
      __Pyx_AddTraceback("init nghttp2", __pyx_clineno, __pyx_lineno, __pyx_filename);
    }
    Py_CLEAR(__pyx_m);
  } else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_ImportError, "init nghttp2");
  }
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  return (__pyx_m != NULL) ? 0 : -1;
  #elif PY_MAJOR_VERSION >= 3
  return __pyx_m;
  #else
  return;
  #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(modname);
    if (!m) goto end;
    p = PyObject_GetAttrString(m, "RefNannyAPI");
    if (!p) goto end;
    r = PyLong_AsVoidPtr(p);
end:
    Py_XDECREF(p);
    Py_XDECREF(m);
    return (__Pyx_RefNannyAPIStruct *)r;
}
#endif

/* PyObjectGetAttrStr */
#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);
}
#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);
}

/* 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_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
                    (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(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
                        (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(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;
}

/* PyObjectSetAttrStr */
#if CYTHON_USE_TYPE_SLOTS
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);
}
#endif

/* PyDictVersioning */
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
    PyObject *dict = Py_TYPE(obj)->tp_dict;
    return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
}
static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
    PyObject **dictptr = NULL;
    Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
    if (offset) {
#if CYTHON_COMPILING_IN_CPYTHON
        dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
#else
        dictptr = _PyObject_GetDictPtr(obj);
#endif
    }
    return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
}
static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
    PyObject *dict = Py_TYPE(obj)->tp_dict;
    if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
        return 0;
    return obj_dict_version == __Pyx_get_object_dict_version(obj);
}
#endif

/* GetModuleGlobalName */
#if CYTHON_USE_DICT_VERSIONS
static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
#else
static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
#endif
{
    PyObject *result;
#if !CYTHON_AVOID_BORROWED_REFS
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
    result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
    __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
    if (likely(result)) {
        return __Pyx_NewRef(result);
    } else if (unlikely(PyErr_Occurred())) {
        return NULL;
    }
#else
    result = PyDict_GetItem(__pyx_d, name);
    __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
    if (likely(result)) {
        return __Pyx_NewRef(result);
    }
#endif
#else
    result = PyObject_GetItem(__pyx_d, name);
    __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
    if (likely(result)) {
        return __Pyx_NewRef(result);
    }
    PyErr_Clear();
#endif
    return __Pyx_GetBuiltinName(name);
}

/* 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);
    int flags = PyCFunction_GET_FLAGS(func);
    assert(PyCFunction_Check(func));
    assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)));
    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());
    if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
        return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL);
    } else {
        return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs);
    }
}
#endif

/* PyFunctionFastCall */
#if CYTHON_FAST_PYCALL
static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
                                               PyObject *globals) {
    PyFrameObject *f;
    PyThreadState *tstate = __Pyx_PyThreadState_Current;
    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 = __Pyx_PyFrame_GetLocalsplus(f);
    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, Py_ssize_t 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, (int)nargs,
                               k, (int)nk,
                               d, (int)nd, kwdefs, closure);
#else
    result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
                               args, (int)nargs,
                               k, (int)nk,
                               d, (int)nd, closure);
#endif
    Py_XDECREF(kwtuple);
done:
    Py_LeaveRecursiveCall();
    return result;
}
#endif
#endif

/* PyObjectCall */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
    PyObject *result;
    ternaryfunc call = Py_TYPE(func)->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

/* 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
    if (likely(PyCFunction_Check(func))) {
        if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
            return __Pyx_PyObject_CallMethO(func, arg);
#if CYTHON_FAST_PYCCALL
        } else if (__Pyx_PyFastCFunction_Check(func)) {
            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

/* 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 (cause) {
        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 = __Pyx_PyThreadState_Current;
        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

/* 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 = __Pyx_PyThreadState_Current;
    PyObject* exc_type = tstate->curexc_type;
    if (unlikely(exc_type)) {
        if (likely(__Pyx_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;
}

/* 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
    #if CYTHON_USE_EXC_INFO_STACK
    {
        _PyErr_StackItem *exc_info = tstate->exc_info;
        tmp_type = exc_info->exc_type;
        tmp_value = exc_info->exc_value;
        tmp_tb = exc_info->exc_traceback;
        exc_info->exc_type = local_type;
        exc_info->exc_value = local_value;
        exc_info->exc_traceback = local_tb;
    }
    #else
    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;
    #endif
    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;
}

/* 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;
    #if CYTHON_USE_EXC_INFO_STACK
    _PyErr_StackItem *exc_info = tstate->exc_info;
    tmp_type = exc_info->exc_type;
    tmp_value = exc_info->exc_value;
    tmp_tb = exc_info->exc_traceback;
    exc_info->exc_type = *type;
    exc_info->exc_value = *value;
    exc_info->exc_traceback = *tb;
    #else
    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;
    #endif
    *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

/* GetTopmostException */
#if CYTHON_USE_EXC_INFO_STACK
static _PyErr_StackItem *
__Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
{
    _PyErr_StackItem *exc_info = tstate->exc_info;
    while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) &&
           exc_info->previous_item != NULL)
    {
        exc_info = exc_info->previous_item;
    }
    return exc_info;
}
#endif

/* SaveResetException */
#if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
    #if CYTHON_USE_EXC_INFO_STACK
    _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
    *type = exc_info->exc_type;
    *value = exc_info->exc_value;
    *tb = exc_info->exc_traceback;
    #else
    *type = tstate->exc_type;
    *value = tstate->exc_value;
    *tb = tstate->exc_traceback;
    #endif
    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;
    #if CYTHON_USE_EXC_INFO_STACK
    _PyErr_StackItem *exc_info = tstate->exc_info;
    tmp_type = exc_info->exc_type;
    tmp_value = exc_info->exc_value;
    tmp_tb = exc_info->exc_traceback;
    exc_info->exc_type = type;
    exc_info->exc_value = value;
    exc_info->exc_traceback = tb;
    #else
    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;
    #endif
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
}
#endif

/* KeywordStringCheck */
static 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_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;
}

/* 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;
    }
    if (unlikely(stop <= start))
        return __Pyx_NewRef(__pyx_empty_unicode);
    length = stop - start;
    cstring += start;
    if (decode_func) {
        return decode_func(cstring, length, errors);
    } else {
        return PyUnicode_Decode(cstring, length, encoding, errors);
    }
}

/* PyIntBinop */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) {
    (void)inplace;
    (void)zerodivision_check;
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op1))) {
        const long b = intval;
        long x;
        long a = PyInt_AS_LONG(op1);
            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(op1))) {
        const long b = intval;
        long a, x;
#ifdef HAVE_LONG_LONG
        const PY_LONG_LONG llb = intval;
        PY_LONG_LONG lla, llx;
#endif
        const digit* digits = ((PyLongObject*)op1)->ob_digit;
        const Py_ssize_t size = Py_SIZE(op1);
        if (likely(__Pyx_sst_abs(size) <= 1)) {
            a = likely(size) ? digits[0] : 0;
            if (size == -1) a = -a;
        } else {
            switch (size) {
                case -2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = -(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) {
                        lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = (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) {
                        lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case -3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = -(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) {
                        lla = -(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
                    }
                    CYTHON_FALLTHROUGH;
                case 3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = (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) {
                        lla = (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
                    }
                    CYTHON_FALLTHROUGH;
                case -4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = -(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) {
                        lla = -(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
                    }
                    CYTHON_FALLTHROUGH;
                case 4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = (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) {
                        lla = (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
                    }
                    CYTHON_FALLTHROUGH;
                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(op1)) {
        const long b = intval;
        double a = PyFloat_AS_DOUBLE(op1);
            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

/* 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) || __Pyx_CyFunction_Check(func)))
#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

/* PyObjectCall2Args */
static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) {
    PyObject *args, *result = NULL;
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(function)) {
        PyObject *args[2] = {arg1, arg2};
        return __Pyx_PyFunction_FastCall(function, args, 2);
    }
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(function)) {
        PyObject *args[2] = {arg1, arg2};
        return __Pyx_PyCFunction_FastCall(function, args, 2);
    }
    #endif
    args = PyTuple_New(2);
    if (unlikely(!args)) goto done;
    Py_INCREF(arg1);
    PyTuple_SET_ITEM(args, 0, arg1);
    Py_INCREF(arg2);
    PyTuple_SET_ITEM(args, 1, arg2);
    Py_INCREF(function);
    result = __Pyx_PyObject_Call(function, args, NULL);
    Py_DECREF(args);
    Py_DECREF(function);
done:
    return result;
}

/* 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
}

/* None */
static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) {
    PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname);
}

/* BytesEquals */
static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
#if CYTHON_COMPILING_IN_PYPY
    return PyObject_RichCompareBool(s1, s2, equals);
#else
    if (s1 == s2) {
        return (equals == Py_EQ);
    } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
        const char *ps1, *ps2;
        Py_ssize_t length = PyBytes_GET_SIZE(s1);
        if (length != PyBytes_GET_SIZE(s2))
            return (equals == Py_NE);
        ps1 = PyBytes_AS_STRING(s1);
        ps2 = PyBytes_AS_STRING(s2);
        if (ps1[0] != ps2[0]) {
            return (equals == Py_NE);
        } else if (length == 1) {
            return (equals == Py_EQ);
        } else {
            int result;
#if CYTHON_USE_UNICODE_INTERNALS
            Py_hash_t hash1, hash2;
            hash1 = ((PyBytesObject*)s1)->ob_shash;
            hash2 = ((PyBytesObject*)s2)->ob_shash;
            if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
                return (equals == Py_NE);
            }
#endif
            result = memcmp(ps1, ps2, (size_t)length);
            return (equals == Py_EQ) ? (result == 0) : (result != 0);
        }
    } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
        return (equals == Py_NE);
    } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
        return (equals == Py_NE);
    } else {
        int result;
        PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
        if (!py_result)
            return -1;
        result = __Pyx_PyObject_IsTrue(py_result);
        Py_DECREF(py_result);
        return result;
    }
#endif
}

/* GetItemInt */
static 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
    Py_ssize_t wrapped_i = i;
    if (wraparound & unlikely(i < 0)) {
        wrapped_i += PyList_GET_SIZE(o);
    }
    if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) {
        PyObject *r = PyList_GET_ITEM(o, wrapped_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
    Py_ssize_t wrapped_i = i;
    if (wraparound & unlikely(i < 0)) {
        wrapped_i += PyTuple_GET_SIZE(o);
    }
    if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) {
        PyObject *r = PyTuple_GET_ITEM(o, wrapped_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(__Pyx_is_valid_index(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(__Pyx_is_valid_index(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));
}

/* PyObjectGetMethod */
static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method) {
    PyObject *attr;
#if CYTHON_UNPACK_METHODS && CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_PYTYPE_LOOKUP
    PyTypeObject *tp = Py_TYPE(obj);
    PyObject *descr;
    descrgetfunc f = NULL;
    PyObject **dictptr, *dict;
    int meth_found = 0;
    assert (*method == NULL);
    if (unlikely(tp->tp_getattro != PyObject_GenericGetAttr)) {
        attr = __Pyx_PyObject_GetAttrStr(obj, name);
        goto try_unpack;
    }
    if (unlikely(tp->tp_dict == NULL) && unlikely(PyType_Ready(tp) < 0)) {
        return 0;
    }
    descr = _PyType_Lookup(tp, name);
    if (likely(descr != NULL)) {
        Py_INCREF(descr);
#if PY_MAJOR_VERSION >= 3
        #ifdef __Pyx_CyFunction_USED
        if (likely(PyFunction_Check(descr) || (Py_TYPE(descr) == &PyMethodDescr_Type) || __Pyx_CyFunction_Check(descr)))
        #else
        if (likely(PyFunction_Check(descr) || (Py_TYPE(descr) == &PyMethodDescr_Type)))
        #endif
#else
        #ifdef __Pyx_CyFunction_USED
        if (likely(PyFunction_Check(descr) || __Pyx_CyFunction_Check(descr)))
        #else
        if (likely(PyFunction_Check(descr)))
        #endif
#endif
        {
            meth_found = 1;
        } else {
            f = Py_TYPE(descr)->tp_descr_get;
            if (f != NULL && PyDescr_IsData(descr)) {
                attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
                Py_DECREF(descr);
                goto try_unpack;
            }
        }
    }
    dictptr = _PyObject_GetDictPtr(obj);
    if (dictptr != NULL && (dict = *dictptr) != NULL) {
        Py_INCREF(dict);
        attr = __Pyx_PyDict_GetItemStr(dict, name);
        if (attr != NULL) {
            Py_INCREF(attr);
            Py_DECREF(dict);
            Py_XDECREF(descr);
            goto try_unpack;
        }
        Py_DECREF(dict);
    }
    if (meth_found) {
        *method = descr;
        return 1;
    }
    if (f != NULL) {
        attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
        Py_DECREF(descr);
        goto try_unpack;
    }
    if (descr != NULL) {
        *method = descr;
        return 0;
    }
    PyErr_Format(PyExc_AttributeError,
#if PY_MAJOR_VERSION >= 3
                 "'%.50s' object has no attribute '%U'",
                 tp->tp_name, name);
#else
                 "'%.50s' object has no attribute '%.400s'",
                 tp->tp_name, PyString_AS_STRING(name));
#endif
    return 0;
#else
    attr = __Pyx_PyObject_GetAttrStr(obj, name);
    goto try_unpack;
#endif
try_unpack:
#if CYTHON_UNPACK_METHODS
    if (likely(attr) && PyMethod_Check(attr) && likely(PyMethod_GET_SELF(attr) == obj)) {
        PyObject *function = PyMethod_GET_FUNCTION(attr);
        Py_INCREF(function);
        Py_DECREF(attr);
        *method = function;
        return 1;
    }
#endif
    *method = attr;
    return 0;
}

/* PyObjectCallMethod1 */
static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) {
    PyObject *result = __Pyx_PyObject_CallOneArg(method, arg);
    Py_DECREF(method);
    return result;
}
static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) {
    PyObject *method = NULL, *result;
    int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
    if (likely(is_method)) {
        result = __Pyx_PyObject_Call2Args(method, obj, arg);
        Py_DECREF(method);
        return result;
    }
    if (unlikely(!method)) return NULL;
    return __Pyx__PyObject_CallMethod1(method, arg);
}

/* append */
static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x) {
    if (likely(PyList_CheckExact(L))) {
        if (unlikely(__Pyx_PyList_Append(L, x) < 0)) return -1;
    } else {
        PyObject* retval = __Pyx_PyObject_CallMethod1(L, __pyx_n_s_append, x);
        if (unlikely(!retval))
            return -1;
        Py_DECREF(retval);
    }
    return 0;
}

/* StringJoin */
#if !CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyBytes_Join(PyObject* sep, PyObject* values) {
    return PyObject_CallMethodObjArgs(sep, __pyx_n_s_join, values, NULL);
}
#endif

/* PyIntCompare */
static CYTHON_INLINE PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED long inplace) {
    if (op1 == op2) {
        Py_RETURN_TRUE;
    }
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op1))) {
        const long b = intval;
        long a = PyInt_AS_LONG(op1);
        if (a == b) Py_RETURN_TRUE; else Py_RETURN_FALSE;
    }
    #endif
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        int unequal;
        unsigned long uintval;
        Py_ssize_t size = Py_SIZE(op1);
        const digit* digits = ((PyLongObject*)op1)->ob_digit;
        if (intval == 0) {
            if (size == 0) Py_RETURN_TRUE; else Py_RETURN_FALSE;
        } else if (intval < 0) {
            if (size >= 0)
                Py_RETURN_FALSE;
            intval = -intval;
            size = -size;
        } else {
            if (size <= 0)
                Py_RETURN_FALSE;
        }
        uintval = (unsigned long) intval;
#if PyLong_SHIFT * 4 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 4)) {
            unequal = (size != 5) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[4] != ((uintval >> (4 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
#if PyLong_SHIFT * 3 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 3)) {
            unequal = (size != 4) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
#if PyLong_SHIFT * 2 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 2)) {
            unequal = (size != 3) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
#if PyLong_SHIFT * 1 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 1)) {
            unequal = (size != 2) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
            unequal = (size != 1) || (((unsigned long) digits[0]) != (uintval & (unsigned long) PyLong_MASK));
        if (unequal == 0) Py_RETURN_TRUE; else Py_RETURN_FALSE;
    }
    #endif
    if (PyFloat_CheckExact(op1)) {
        const long b = intval;
        double a = PyFloat_AS_DOUBLE(op1);
        if ((double)a == (double)b) Py_RETURN_TRUE; else Py_RETURN_FALSE;
    }
    return (
        PyObject_RichCompare(op1, op2, Py_EQ));
}

/* PyErrExceptionMatches */
#if CYTHON_FAST_THREAD_STATE
static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
    Py_ssize_t i, n;
    n = PyTuple_GET_SIZE(tuple);
#if PY_MAJOR_VERSION >= 3
    for (i=0; i<n; i++) {
        if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
    }
#endif
    for (i=0; i<n; i++) {
        if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
    }
    return 0;
}
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;
    if (unlikely(PyTuple_Check(err)))
        return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
    return __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
}
#endif

/* None */
static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname) {
    PyErr_Format(PyExc_NameError, "free variable '%s' referenced before assignment in enclosing scope", varname);
}

/* 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;
}

/* CythonFunctionShared */
#include <structmember.h>
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, CYTHON_UNUSED void *context)
{
    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, CYTHON_UNUSED void *context)
{
    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, CYTHON_UNUSED void *context)
{
    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, CYTHON_UNUSED void *context)
{
    Py_INCREF(op->func_qualname);
    return op->func_qualname;
}
static int
__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
{
    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, CYTHON_UNUSED void *context)
{
    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, CYTHON_UNUSED void *context)
{
    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, CYTHON_UNUSED void *context)
{
    Py_INCREF(op->func_globals);
    return op->func_globals;
}
static PyObject *
__Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
{
    Py_INCREF(Py_None);
    return Py_None;
}
static PyObject *
__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
{
    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, CYTHON_UNUSED void *context) {
    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, CYTHON_UNUSED void *context) {
    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, CYTHON_UNUSED void *context) {
    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, CYTHON_UNUSED void *context) {
    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, CYTHON_UNUSED void *context) {
    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, CYTHON_UNUSED void *context) {
    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(PyCFunctionObject, 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
    Py_INCREF(m->func_qualname);
    return m->func_qualname;
#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_Init(__pyx_CyFunctionObject *op, PyMethodDef *ml, int flags, PyObject* qualname,
                                       PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
    if (unlikely(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_size = 0;
    op->defaults = NULL;
    op->defaults_tuple = NULL;
    op->defaults_kwdict = NULL;
    op->defaults_getter = NULL;
    op->func_annotations = NULL;
    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)
{
    if (__Pyx_CyFunction_weakreflist(m) != NULL)
        PyObject_ClearWeakRefs((PyObject *) m);
    __Pyx_CyFunction_clear(m);
    PyObject_GC_Del(m);
}
static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m)
{
    PyObject_GC_UnTrack(m);
    __Pyx__CyFunction_dealloc(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)
{
#if PY_MAJOR_VERSION < 3
    __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;
#endif
    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)(void*)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;
                #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
                arg0 = PyTuple_GET_ITEM(arg, 0);
                #else
                arg0 = PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL;
                #endif
                result = (*meth)(self, arg0);
                #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
                Py_DECREF(arg0);
                #endif
                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
#if PY_VERSION_HEX >= 0x030800b1
    0,
#endif
#if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
    0,
#endif
#if PY_VERSION_HEX >= 0x030B00A2
    0,
#endif
};
static int __pyx_CyFunction_init(void) {
    __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type);
    if (unlikely(__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 (unlikely(!m->defaults))
        return PyErr_NoMemory();
    memset(m->defaults, 0, size);
    m->defaults_pyobjects = pyobjects;
    m->defaults_size = size;
    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);
}

/* CythonFunction */
static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qualname,
                                      PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
    PyObject *op = __Pyx_CyFunction_Init(
        PyObject_GC_New(__pyx_CyFunctionObject, __pyx_CyFunctionType),
        ml, flags, qualname, closure, module, globals, code
    );
    if (likely(op)) {
        PyObject_GC_Track(op);
    }
    return op;
}

/* PyObject_GenericGetAttrNoDict */
#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) {
    PyErr_Format(PyExc_AttributeError,
#if PY_MAJOR_VERSION >= 3
                 "'%.50s' object has no attribute '%U'",
                 tp->tp_name, attr_name);
#else
                 "'%.50s' object has no attribute '%.400s'",
                 tp->tp_name, PyString_AS_STRING(attr_name));
#endif
    return NULL;
}
static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) {
    PyObject *descr;
    PyTypeObject *tp = Py_TYPE(obj);
    if (unlikely(!PyString_Check(attr_name))) {
        return PyObject_GenericGetAttr(obj, attr_name);
    }
    assert(!tp->tp_dictoffset);
    descr = _PyType_Lookup(tp, attr_name);
    if (unlikely(!descr)) {
        return __Pyx_RaiseGenericGetAttributeError(tp, attr_name);
    }
    Py_INCREF(descr);
    #if PY_MAJOR_VERSION < 3
    if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS)))
    #endif
    {
        descrgetfunc f = Py_TYPE(descr)->tp_descr_get;
        if (unlikely(f)) {
            PyObject *res = f(descr, obj, (PyObject *)tp);
            Py_DECREF(descr);
            return res;
        }
    }
    return descr;
}
#endif

/* PyObject_GenericGetAttr */
#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) {
    if (unlikely(Py_TYPE(obj)->tp_dictoffset)) {
        return PyObject_GenericGetAttr(obj, attr_name);
    }
    return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name);
}
#endif

/* PyObjectGetAttrStrNoError */
static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
        __Pyx_PyErr_Clear();
}
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) {
    PyObject *result;
#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1
    PyTypeObject* tp = Py_TYPE(obj);
    if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) {
        return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1);
    }
#endif
    result = __Pyx_PyObject_GetAttrStr(obj, attr_name);
    if (unlikely(!result)) {
        __Pyx_PyObject_GetAttrStr_ClearAttributeError();
    }
    return result;
}

/* SetupReduce */
static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) {
  int ret;
  PyObject *name_attr;
  name_attr = __Pyx_PyObject_GetAttrStr(meth, __pyx_n_s_name_2);
  if (likely(name_attr)) {
      ret = PyObject_RichCompareBool(name_attr, name, Py_EQ);
  } else {
      ret = -1;
  }
  if (unlikely(ret < 0)) {
      PyErr_Clear();
      ret = 0;
  }
  Py_XDECREF(name_attr);
  return ret;
}
static int __Pyx_setup_reduce(PyObject* type_obj) {
    int ret = 0;
    PyObject *object_reduce = NULL;
    PyObject *object_reduce_ex = NULL;
    PyObject *reduce = NULL;
    PyObject *reduce_ex = NULL;
    PyObject *reduce_cython = NULL;
    PyObject *setstate = NULL;
    PyObject *setstate_cython = NULL;
#if CYTHON_USE_PYTYPE_LOOKUP
    if (_PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate)) goto __PYX_GOOD;
#else
    if (PyObject_HasAttr(type_obj, __pyx_n_s_getstate)) goto __PYX_GOOD;
#endif
#if CYTHON_USE_PYTYPE_LOOKUP
    object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
#else
    object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
#endif
    reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex); if (unlikely(!reduce_ex)) goto __PYX_BAD;
    if (reduce_ex == object_reduce_ex) {
#if CYTHON_USE_PYTYPE_LOOKUP
        object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD;
#else
        object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD;
#endif
        reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce); if (unlikely(!reduce)) goto __PYX_BAD;
        if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) {
            reduce_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_reduce_cython);
            if (likely(reduce_cython)) {
                ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
                ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
            } else if (reduce == object_reduce || PyErr_Occurred()) {
                goto __PYX_BAD;
            }
            setstate = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate);
            if (!setstate) PyErr_Clear();
            if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) {
                setstate_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_setstate_cython);
                if (likely(setstate_cython)) {
                    ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
                    ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
                } else if (!setstate || PyErr_Occurred()) {
                    goto __PYX_BAD;
                }
            }
            PyType_Modified((PyTypeObject*)type_obj);
        }
    }
    goto __PYX_GOOD;
__PYX_BAD:
    if (!PyErr_Occurred())
        PyErr_Format(PyExc_RuntimeError, "Unable to initialize pickling for %s", ((PyTypeObject*)type_obj)->tp_name);
    ret = -1;
__PYX_GOOD:
#if !CYTHON_USE_PYTYPE_LOOKUP
    Py_XDECREF(object_reduce);
    Py_XDECREF(object_reduce_ex);
#endif
    Py_XDECREF(reduce);
    Py_XDECREF(reduce_ex);
    Py_XDECREF(reduce_cython);
    Py_XDECREF(setstate);
    Py_XDECREF(setstate_cython);
    return ret;
}

/* 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_MAJOR_VERSION < 3
    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 ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) {
                module = PyImport_ImportModuleLevelObject(
                    name, global_dict, empty_dict, list, 1);
                if (!module) {
                    if (!PyErr_ExceptionMatches(PyExc_ImportError))
                        goto bad;
                    PyErr_Clear();
                }
            }
            level = 0;
        }
        #endif
        if (!module) {
            #if PY_MAJOR_VERSION < 3
            PyObject *py_level = PyInt_FromLong(level);
            if (!py_level)
                goto bad;
            module = PyObject_CallFunctionObjArgs(py_import,
                name, global_dict, empty_dict, list, py_level, (PyObject *)NULL);
            Py_DECREF(py_level);
            #else
            module = PyImport_ImportModuleLevelObject(
                name, global_dict, empty_dict, list, level);
            #endif
        }
    }
bad:
    #if PY_MAJOR_VERSION < 3
    Py_XDECREF(py_import);
    #endif
    Py_XDECREF(empty_list);
    Py_XDECREF(empty_dict);
    return module;
}

/* 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;
}

/* 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;
}

/* 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();
            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"
            );
        }
        Py_DECREF(package);
        if (unlikely(!patch_module)) goto ignore;
asyncio_done:
        PyErr_Clear();
        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;
}

/* CLineInTraceback */
#ifndef CYTHON_CLINE_IN_TRACEBACK
static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int c_line) {
    PyObject *use_cline;
    PyObject *ptype, *pvalue, *ptraceback;
#if CYTHON_COMPILING_IN_CPYTHON
    PyObject **cython_runtime_dict;
#endif
    if (unlikely(!__pyx_cython_runtime)) {
        return c_line;
    }
    __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
#if CYTHON_COMPILING_IN_CPYTHON
    cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
    if (likely(cython_runtime_dict)) {
        __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
            use_cline, *cython_runtime_dict,
            __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
    } else
#endif
    {
      PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
      if (use_cline_obj) {
        use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
        Py_DECREF(use_cline_obj);
      } else {
        PyErr_Clear();
        use_cline = NULL;
      }
    }
    if (!use_cline) {
        c_line = 0;
        (void) PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
    }
    else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
        c_line = 0;
    }
    __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
    return c_line;
}
#endif

/* 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 = NULL;
    PyObject *py_funcname = NULL;
    #if PY_MAJOR_VERSION < 3
    PyObject *py_srcfile = NULL;
    py_srcfile = PyString_FromString(filename);
    if (!py_srcfile) goto bad;
    #endif
    if (c_line) {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
        if (!py_funcname) goto bad;
        #else
        py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
        if (!py_funcname) goto bad;
        funcname = PyUnicode_AsUTF8(py_funcname);
        if (!funcname) goto bad;
        #endif
    }
    else {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromString(funcname);
        if (!py_funcname) goto bad;
        #endif
    }
    #if PY_MAJOR_VERSION < 3
    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);
    #else
    py_code = PyCode_NewEmpty(filename, funcname, py_line);
    #endif
    Py_XDECREF(py_funcname);  // XDECREF since it's only set on Py3 if cline
    return py_code;
bad:
    Py_XDECREF(py_funcname);
    #if PY_MAJOR_VERSION < 3
    Py_XDECREF(py_srcfile);
    #endif
    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;
    PyThreadState *tstate = __Pyx_PyThreadState_Current;
    if (c_line) {
        c_line = __Pyx_CLineForTraceback(tstate, c_line);
    }
    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(
        tstate,            /*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;\
    }

/* Print */
#if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION < 3
static PyObject *__Pyx_GetStdout(void) {
    PyObject *f = PySys_GetObject((char *)"stdout");
    if (!f) {
        PyErr_SetString(PyExc_RuntimeError, "lost sys.stdout");
    }
    return f;
}
static int __Pyx_Print(PyObject* f, PyObject *arg_tuple, int newline) {
    int i;
    if (!f) {
        if (!(f = __Pyx_GetStdout()))
            return -1;
    }
    Py_INCREF(f);
    for (i=0; i < PyTuple_GET_SIZE(arg_tuple); i++) {
        PyObject* v;
        if (PyFile_SoftSpace(f, 1)) {
            if (PyFile_WriteString(" ", f) < 0)
                goto error;
        }
        v = PyTuple_GET_ITEM(arg_tuple, i);
        if (PyFile_WriteObject(v, f, Py_PRINT_RAW) < 0)
            goto error;
        if (PyString_Check(v)) {
            char *s = PyString_AsString(v);
            Py_ssize_t len = PyString_Size(v);
            if (len > 0) {
                switch (s[len-1]) {
                    case ' ': break;
                    case '\f': case '\r': case '\n': case '\t': case '\v':
                        PyFile_SoftSpace(f, 0);
                        break;
                    default:  break;
                }
            }
        }
    }
    if (newline) {
        if (PyFile_WriteString("\n", f) < 0)
            goto error;
        PyFile_SoftSpace(f, 0);
    }
    Py_DECREF(f);
    return 0;
error:
    Py_DECREF(f);
    return -1;
}
#else
static int __Pyx_Print(PyObject* stream, PyObject *arg_tuple, int newline) {
    PyObject* kwargs = 0;
    PyObject* result = 0;
    PyObject* end_string;
    if (unlikely(!__pyx_print)) {
        __pyx_print = PyObject_GetAttr(__pyx_b, __pyx_n_s_print);
        if (!__pyx_print)
            return -1;
    }
    if (stream) {
        kwargs = PyDict_New();
        if (unlikely(!kwargs))
            return -1;
        if (unlikely(PyDict_SetItem(kwargs, __pyx_n_s_file, stream) < 0))
            goto bad;
        if (!newline) {
            end_string = PyUnicode_FromStringAndSize(" ", 1);
            if (unlikely(!end_string))
                goto bad;
            if (PyDict_SetItem(kwargs, __pyx_n_s_end, end_string) < 0) {
                Py_DECREF(end_string);
                goto bad;
            }
            Py_DECREF(end_string);
        }
    } else if (!newline) {
        if (unlikely(!__pyx_print_kwargs)) {
            __pyx_print_kwargs = PyDict_New();
            if (unlikely(!__pyx_print_kwargs))
                return -1;
            end_string = PyUnicode_FromStringAndSize(" ", 1);
            if (unlikely(!end_string))
                return -1;
            if (PyDict_SetItem(__pyx_print_kwargs, __pyx_n_s_end, end_string) < 0) {
                Py_DECREF(end_string);
                return -1;
            }
            Py_DECREF(end_string);
        }
        kwargs = __pyx_print_kwargs;
    }
    result = PyObject_Call(__pyx_print, arg_tuple, kwargs);
    if (unlikely(kwargs) && (kwargs != __pyx_print_kwargs))
        Py_DECREF(kwargs);
    if (!result)
        return -1;
    Py_DECREF(result);
    return 0;
bad:
    if (kwargs != __pyx_print_kwargs)
        Py_XDECREF(kwargs);
    return -1;
}
#endif

/* CIntToPy */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_nghttp2_error_code(nghttp2_error_code value) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const nghttp2_error_code neg_one = (nghttp2_error_code) -1, const_zero = (nghttp2_error_code) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(nghttp2_error_code) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(nghttp2_error_code) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(nghttp2_error_code) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(nghttp2_error_code) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(nghttp2_error_code) <= 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(nghttp2_error_code),
                                     little, !is_unsigned);
    }
}

/* CIntFromPy */
static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *x) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const size_t neg_one = (size_t) -1, const_zero = (size_t) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    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;
}

/* CIntToPy */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint16_t(uint16_t value) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const uint16_t neg_one = (uint16_t) -1, const_zero = (uint16_t) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(uint16_t) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(uint16_t) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(uint16_t) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(uint16_t) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(uint16_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(uint16_t),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint8_t(uint8_t value) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const uint8_t neg_one = (uint8_t) -1, const_zero = (uint8_t) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(uint8_t) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(uint8_t) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(uint8_t) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(uint8_t) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(uint8_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(uint8_t),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int32_t(int32_t value) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const int32_t neg_one = (int32_t) -1, const_zero = (int32_t) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(int32_t) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(int32_t) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(int32_t) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(int32_t) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(int32_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(int32_t),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const long neg_one = (long) -1, const_zero = (long) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    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);
    }
}

/* PrintOne */
#if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION < 3
static int __Pyx_PrintOne(PyObject* f, PyObject *o) {
    if (!f) {
        if (!(f = __Pyx_GetStdout()))
            return -1;
    }
    Py_INCREF(f);
    if (PyFile_SoftSpace(f, 0)) {
        if (PyFile_WriteString(" ", f) < 0)
            goto error;
    }
    if (PyFile_WriteObject(o, f, Py_PRINT_RAW) < 0)
        goto error;
    if (PyFile_WriteString("\n", f) < 0)
        goto error;
    Py_DECREF(f);
    return 0;
error:
    Py_DECREF(f);
    return -1;
    /* the line below is just to avoid C compiler
     * warnings about unused functions */
    return __Pyx_Print(f, NULL, 0);
}
#else
static int __Pyx_PrintOne(PyObject* stream, PyObject *o) {
    int res;
    PyObject* arg_tuple = PyTuple_Pack(1, o);
    if (unlikely(!arg_tuple))
        return -1;
    res = __Pyx_Print(stream, arg_tuple, 1);
    Py_DECREF(arg_tuple);
    return res;
}
#endif

/* CIntFromPy */
static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const int neg_one = (int) -1, const_zero = (int) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    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;
}

/* CIntToPy */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint32_t(uint32_t value) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const uint32_t neg_one = (uint32_t) -1, const_zero = (uint32_t) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    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);
    }
}

/* CIntFromPy */
static CYTHON_INLINE int32_t __Pyx_PyInt_As_int32_t(PyObject *x) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const int32_t neg_one = (int32_t) -1, const_zero = (int32_t) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(int32_t) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(int32_t, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (int32_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 (int32_t) 0;
                case  1: __PYX_VERIFY_RETURN_INT(int32_t, digit, digits[0])
                case 2:
                    if (8 * sizeof(int32_t) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int32_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int32_t) >= 2 * PyLong_SHIFT) {
                            return (int32_t) (((((int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(int32_t) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int32_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int32_t) >= 3 * PyLong_SHIFT) {
                            return (int32_t) (((((((int32_t)digits[2]) << PyLong_SHIFT) | (int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(int32_t) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int32_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(int32_t) >= 4 * PyLong_SHIFT) {
                            return (int32_t) (((((((((int32_t)digits[3]) << PyLong_SHIFT) | (int32_t)digits[2]) << PyLong_SHIFT) | (int32_t)digits[1]) << PyLong_SHIFT) | (int32_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 (int32_t) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(int32_t) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(int32_t, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(int32_t) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(int32_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 (int32_t) 0;
                case -1: __PYX_VERIFY_RETURN_INT(int32_t, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(int32_t,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(int32_t) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int32_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int32_t) - 1 > 2 * PyLong_SHIFT) {
                            return (int32_t) (((int32_t)-1)*(((((int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(int32_t) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int32_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int32_t) - 1 > 2 * PyLong_SHIFT) {
                            return (int32_t) ((((((int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(int32_t) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int32_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int32_t) - 1 > 3 * PyLong_SHIFT) {
                            return (int32_t) (((int32_t)-1)*(((((((int32_t)digits[2]) << PyLong_SHIFT) | (int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(int32_t) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int32_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int32_t) - 1 > 3 * PyLong_SHIFT) {
                            return (int32_t) ((((((((int32_t)digits[2]) << PyLong_SHIFT) | (int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(int32_t) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int32_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(int32_t) - 1 > 4 * PyLong_SHIFT) {
                            return (int32_t) (((int32_t)-1)*(((((((((int32_t)digits[3]) << PyLong_SHIFT) | (int32_t)digits[2]) << PyLong_SHIFT) | (int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(int32_t) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int32_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(int32_t) - 1 > 4 * PyLong_SHIFT) {
                            return (int32_t) ((((((((((int32_t)digits[3]) << PyLong_SHIFT) | (int32_t)digits[2]) << PyLong_SHIFT) | (int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(int32_t) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(int32_t, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(int32_t) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(int32_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
            int32_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 (int32_t) -1;
        }
    } else {
        int32_t val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (int32_t) -1;
        val = __Pyx_PyInt_As_int32_t(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to int32_t");
    return (int32_t) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to int32_t");
    return (int32_t) -1;
}

/* CIntFromPy */
static CYTHON_INLINE uint32_t __Pyx_PyInt_As_uint32_t(PyObject *x) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const uint32_t neg_one = (uint32_t) -1, const_zero = (uint32_t) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    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;
}

/* CIntToPy */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const int neg_one = (int) -1, const_zero = (int) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    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 long __Pyx_PyInt_As_long(PyObject *x) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const long neg_one = (long) -1, const_zero = (long) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    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;
}

/* FastTypeChecks */
#if CYTHON_COMPILING_IN_CPYTHON
static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
    while (a) {
        a = a->tp_base;
        if (a == b)
            return 1;
    }
    return b == &PyBaseObject_Type;
}
static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
    PyObject *mro;
    if (a == b) return 1;
    mro = a->tp_mro;
    if (likely(mro)) {
        Py_ssize_t i, n;
        n = PyTuple_GET_SIZE(mro);
        for (i = 0; i < n; i++) {
            if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
                return 1;
        }
        return 0;
    }
    return __Pyx_InBases(a, b);
}
#if PY_MAJOR_VERSION == 2
static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
    PyObject *exception, *value, *tb;
    int res;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&exception, &value, &tb);
    res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
    if (unlikely(res == -1)) {
        PyErr_WriteUnraisable(err);
        res = 0;
    }
    if (!res) {
        res = PyObject_IsSubclass(err, exc_type2);
        if (unlikely(res == -1)) {
            PyErr_WriteUnraisable(err);
            res = 0;
        }
    }
    __Pyx_ErrRestore(exception, value, tb);
    return res;
}
#else
static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
    int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
    if (!res) {
        res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
    }
    return res;
}
#endif
static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
    Py_ssize_t i, n;
    assert(PyExceptionClass_Check(exc_type));
    n = PyTuple_GET_SIZE(tuple);
#if PY_MAJOR_VERSION >= 3
    for (i=0; i<n; i++) {
        if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
    }
#endif
    for (i=0; i<n; i++) {
        PyObject *t = PyTuple_GET_ITEM(tuple, i);
        #if PY_MAJOR_VERSION < 3
        if (likely(exc_type == t)) return 1;
        #endif
        if (likely(PyExceptionClass_Check(t))) {
            if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
        } else {
        }
    }
    return 0;
}
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
    if (likely(err == exc_type)) return 1;
    if (likely(PyExceptionClass_Check(err))) {
        if (likely(PyExceptionClass_Check(exc_type))) {
            return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
        } else if (likely(PyTuple_Check(exc_type))) {
            return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
        } else {
        }
    }
    return PyErr_GivenExceptionMatches(err, exc_type);
}
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
    assert(PyExceptionClass_Check(exc_type1));
    assert(PyExceptionClass_Check(exc_type2));
    if (likely(err == exc_type1 || err == exc_type2)) return 1;
    if (likely(PyExceptionClass_Check(err))) {
        return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
    }
    return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
}
#endif

/* 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;
}

/* 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;
        if (PyObject_Hash(*t->p) == -1)
            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 const char* __Pyx_PyObject_AsString(PyObject* o) {
    Py_ssize_t ignore;
    return __Pyx_PyObject_AsStringAndSize(o, &ignore);
}
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
#if !CYTHON_PEP393_ENABLED
static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
    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
static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
    if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
    if (likely(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
#endif
static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
#if __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)) {
        return __Pyx_PyUnicode_AsStringAndSize(o, length);
    } 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 int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
    int retval;
    if (unlikely(!x)) return -1;
    retval = __Pyx_PyObject_IsTrue(x);
    Py_DECREF(x);
    return retval;
}
static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
#if PY_MAJOR_VERSION >= 3
    if (PyLong_Check(result)) {
        if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
                "__int__ returned non-int (type %.200s).  "
                "The ability to return an instance of a strict subclass of int "
                "is deprecated, and may be removed in a future version of Python.",
                Py_TYPE(result)->tp_name)) {
            Py_DECREF(result);
            return NULL;
        }
        return result;
    }
#endif
    PyErr_Format(PyExc_TypeError,
                 "__%.4s__ returned non-%.4s (type %.200s)",
                 type_name, type_name, Py_TYPE(result)->tp_name);
    Py_DECREF(result);
    return NULL;
}
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 (likely(PyInt_Check(x) || PyLong_Check(x)))
#else
  if (likely(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 = m->nb_int(x);
  }
  else if (m && m->nb_long) {
    name = "long";
    res = m->nb_long(x);
  }
  #else
  if (likely(m && m->nb_int)) {
    name = "int";
    res = m->nb_int(x);
  }
  #endif
#else
  if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
    res = PyNumber_Int(x);
  }
#endif
  if (likely(res)) {
#if PY_MAJOR_VERSION < 3
    if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
#else
    if (unlikely(!PyLong_CheckExact(res))) {
#endif
        return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
    }
  }
  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(b);
  }
#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 Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject* o) {
  if (sizeof(Py_hash_t) == sizeof(Py_ssize_t)) {
    return (Py_hash_t) __Pyx_PyIndex_AsSsize_t(o);
#if PY_MAJOR_VERSION < 3
  } else if (likely(PyInt_CheckExact(o))) {
    return PyInt_AS_LONG(o);
#endif
  } else {
    Py_ssize_t ival;
    PyObject *x;
    x = PyNumber_Index(o);
    if (!x) return -1;
    ival = PyInt_AsLong(x);
    Py_DECREF(x);
    return ival;
  }
}
static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
  return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
}
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
    return PyInt_FromSize_t(ival);
}


#endif /* Py_PYTHON_H */
